Qt: Add Create RPCS3 shortcuts to Wecome Dialog

This commit is contained in:
Eladash 2023-06-23 20:14:38 +03:00 committed by Ivan
parent 83e22fa9f0
commit 6aa598b029
2 changed files with 53 additions and 1 deletions

View File

@ -2,8 +2,11 @@
#include "ui_welcome_dialog.h"
#include "gui_settings.h"
#include "shortcut_utils.h"
#include "qt_utils.h"
#include "Utilities/File.h"
#include <QPushButton>
#include <QCheckBox>
#include <QSvgWidget>
@ -21,6 +24,7 @@ welcome_dialog::welcome_dialog(std::shared_ptr<gui_settings> gui_settings, bool
ui->okay->setEnabled(is_manual_show);
ui->i_have_read->setChecked(is_manual_show);
ui->i_have_read->setEnabled(!is_manual_show);
ui->do_not_show->setEnabled(!is_manual_show);
ui->do_not_show->setChecked(!m_gui_settings->GetValue(gui::ib_show_welcome).toBool());
ui->icon_label->load(QStringLiteral(":/rpcs3.svg"));
ui->label_3->setText(tr(
@ -63,7 +67,28 @@ welcome_dialog::welcome_dialog(std::shared_ptr<gui_settings> gui_settings, bool
connect(ui->okay, &QPushButton::clicked, this, &QDialog::accept);
#ifdef _WIN32
ui->create_applications_menu_shortcut->setText(tr("&Create Start Menu shortcut"));
#elif defined(__APPLE__)
ui->create_applications_menu_shortcut->setText(tr("&Create Launchpad shortcut"));
#else
ui->create_applications_menu_shortcut->setText(tr("&Create Application Menu shortcut"));
#endif
layout()->setSizeConstraint(QLayout::SetFixedSize);
connect(this, &QDialog::finished, this, [this]()
{
if (ui->create_desktop_shortcut->isChecked())
{
gui::utils::create_shortcut("RPCS3", "", "RPCS3", ":/rpcs3.svg", fs::get_temp_dir(), gui::utils::shortcut_location::desktop);
}
if (ui->create_applications_menu_shortcut->isChecked())
{
gui::utils::create_shortcut("RPCS3", "", "RPCS3", ":/rpcs3.svg", fs::get_temp_dir(), gui::utils::shortcut_location::applications);
}
});
}
welcome_dialog::~welcome_dialog()

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>611</width>
<height>272</height>
<height>319</height>
</rect>
</property>
<property name="sizePolicy">
@ -184,6 +184,33 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="create_desktop_shortcut">
<property name="text">
<string>Create desktop shortcut</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="create_applications_menu_shortcut">
<property name="text">
<string>Create Start Menu shortcut</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="button_layout">
<property name="leftMargin">