From 4d2c1a82c9e975307fc07027309a8a4fd7720a29 Mon Sep 17 00:00:00 2001 From: KamFretoZ <14798312+kamfretoz@users.noreply.github.com> Date: Sun, 7 Dec 2025 11:21:11 +0700 Subject: [PATCH] Qt: Misc Shortcut Cleanups --- common/FileSystem.cpp | 2 +- pcsx2-qt/MainWindow.cpp | 4 ++-- pcsx2-qt/ShortcutCreationDialog.cpp | 26 +++++++------------- pcsx2-qt/ShortcutCreationDialog.h | 7 +++--- pcsx2-qt/ShortcutCreationDialog.ui | 37 +++++++++++++++++++++++++---- 5 files changed, 47 insertions(+), 29 deletions(-) diff --git a/common/FileSystem.cpp b/common/FileSystem.cpp index 05fd4cd820..6705d37f49 100644 --- a/common/FileSystem.cpp +++ b/common/FileSystem.cpp @@ -28,7 +28,7 @@ #endif #if defined(_WIN32) -#include "RedtapeWindows.h" +#include "common/RedtapeWindows.h" #include #include #include diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index bc917337ad..c4c122591b 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -1734,8 +1734,8 @@ void MainWindow::onCreateGameShortcutTriggered() const QString title = QString::fromStdString(entry->GetTitle()); const QString path = QString::fromStdString(entry->path); - VMLock lock(pauseAndLockVM()); - ShortcutCreationDialog dlg(lock.getDialogParent(), title, path); + + ShortcutCreationDialog dlg(this, title, path); dlg.exec(); } #endif diff --git a/pcsx2-qt/ShortcutCreationDialog.cpp b/pcsx2-qt/ShortcutCreationDialog.cpp index d53c2bb351..ce083339a3 100644 --- a/pcsx2-qt/ShortcutCreationDialog.cpp +++ b/pcsx2-qt/ShortcutCreationDialog.cpp @@ -13,7 +13,7 @@ #include "VMManager.h" #if defined(_WIN32) -#include +#include "common/RedtapeWindows.h" #include #include #include @@ -61,16 +61,6 @@ ShortcutCreationDialog::ShortcutCreationDialog(QWidget* parent, const QString& t connect(m_ui.bootOptionToggle, &QCheckBox::toggled, m_ui.bootOptionDropdown, &QPushButton::setEnabled); connect(m_ui.fullscreenMode, &QCheckBox::toggled, m_ui.fullscreenModeDropdown, &QPushButton::setEnabled); - m_ui.shortcutDesktop->setChecked(true); - m_ui.overrideBootELFPath->setEnabled(false); - m_ui.overrideBootELFButton->setEnabled(false); - m_ui.gameArgs->setEnabled(false); - m_ui.bootOptionDropdown->setEnabled(false); - m_ui.fullscreenModeDropdown->setEnabled(false); - m_ui.loadStateIndex->setEnabled(false); - m_ui.loadStateFileBrowse->setEnabled(false); - m_ui.loadStateFilePath->setEnabled(false); - m_ui.loadStateIndex->setMaximum(VMManager::NUM_SAVE_STATE_SLOTS); if (std::getenv("container")) @@ -80,6 +70,7 @@ ShortcutCreationDialog::ShortcutCreationDialog(QWidget* parent, const QString& t m_ui.shortcutStartMenu->setEnabled(false); } + connect(m_ui.dialogButtons, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(m_ui.dialogButtons, &QDialogButtonBox::accepted, this, [&]() { std::vector args; @@ -111,7 +102,6 @@ ShortcutCreationDialog::ShortcutCreationDialog(QWidget* parent, const QString& t } } - if (m_ui.loadStateFileToggle->isChecked()) if (m_ui.loadStateFileToggle->isChecked() && !m_ui.loadStateFilePath->text().isEmpty()) { args.push_back("-statefile"); @@ -124,15 +114,12 @@ ShortcutCreationDialog::ShortcutCreationDialog(QWidget* parent, const QString& t if (m_ui.bigPictureModeToggle->isChecked()) args.push_back("-bigpicture"); - m_desktop = m_ui.shortcutDesktop->isChecked(); - std::string custom_args = m_ui.customArgsInput->text().toStdString(); - ShortcutCreationDialog::CreateShortcut(title.toStdString(), path.toStdString(), args, custom_args, m_desktop); + ShortcutCreationDialog::CreateShortcut(title.toStdString(), path.toStdString(), args, custom_args, m_ui.shortcutDesktop->isChecked()); accept(); }); - connect(m_ui.dialogButtons, &QDialogButtonBox::rejected, this, &QDialog::reject); } void ShortcutCreationDialog::CreateShortcut(const std::string name, const std::string game_path, std::vector passed_cli_args, std::string custom_args, bool is_desktop) @@ -190,7 +177,10 @@ void ShortcutCreationDialog::CreateShortcut(const std::string name, const std::s lossless &= ShortcutCreationDialog::EscapeShortcutCommandLine(&arg); if (!lossless) - QMessageBox::warning(this, tr("Failed to create shortcut"), tr("File path contains invalid character(s). The resulting shortcut may not work."), QMessageBox::StandardButton::Ok, QMessageBox::StandardButton::Ok); + { + QMessageBox::warning(this, tr("Failed to create shortcut"), tr("File path contains invalid character(s)."), QMessageBox::StandardButton::Ok, QMessageBox::StandardButton::Ok); + return; + } ShortcutCreationDialog::EscapeShortcutCommandLine(&clean_path); std::string combined_args = StringUtil::JoinString(passed_cli_args.begin(), passed_cli_args.end(), " "); @@ -344,7 +334,7 @@ void ShortcutCreationDialog::CreateShortcut(const std::string name, const std::s } else { - QMessageBox::critical(this, tr("Failed to create shortcut"), tr("Home path is empty."), QMessageBox::StandardButton::Ok, QMessageBox::StandardButton::Ok); + QMessageBox::critical(this, tr("Failed to create shortcut"), tr("Path to the Home directory is empty."), QMessageBox::StandardButton::Ok, QMessageBox::StandardButton::Ok); return; } diff --git a/pcsx2-qt/ShortcutCreationDialog.h b/pcsx2-qt/ShortcutCreationDialog.h index 51d8e386f2..b8c0a7d17c 100644 --- a/pcsx2-qt/ShortcutCreationDialog.h +++ b/pcsx2-qt/ShortcutCreationDialog.h @@ -22,8 +22,9 @@ public: bool EscapeShortcutCommandLine(std::string* cmdline); protected: - QString m_title; - QString m_path; - bool m_desktop; + const QString m_title; + const QString m_path; + +private: Ui::ShortcutCreationDialog m_ui; }; diff --git a/pcsx2-qt/ShortcutCreationDialog.ui b/pcsx2-qt/ShortcutCreationDialog.ui index a08db1af19..4ad84869ba 100644 --- a/pcsx2-qt/ShortcutCreationDialog.ui +++ b/pcsx2-qt/ShortcutCreationDialog.ui @@ -10,7 +10,7 @@ 0 0 500 - 685 + 700 @@ -59,6 +59,9 @@ + + false + Force Enable @@ -82,10 +85,17 @@ - + + + false + + + + false + Fast Boot @@ -107,13 +117,20 @@ + + false + Browse... - + + + false + + @@ -123,6 +140,9 @@ + + false + false @@ -132,7 +152,11 @@ - + + + false + + @@ -160,6 +184,9 @@ + + false + Browse... @@ -194,7 +221,7 @@ - You may add additional (space-separated) <a href="https://pcsx2.net/docs/post/cli/">custom arguments</a> that are not listed above here: + You may add additional (space-separated) <a href="https://pcsx2.net/docs/advanced/cli/">custom arguments</a> that are not listed above here: Qt::TextFormat::RichText