From 56c511b45c220b9a8c57c3b9f05aad1fdb3b3d76 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 13 Oct 2020 23:20:50 +1000 Subject: [PATCH] Qt: Add Game Properties to view menu (for running game) --- src/duckstation-qt/gamelistwidget.h | 3 ++- src/duckstation-qt/mainwindow.cpp | 24 ++++++++++++++++++++++++ src/duckstation-qt/mainwindow.h | 1 + src/duckstation-qt/mainwindow.ui | 6 ++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/gamelistwidget.h b/src/duckstation-qt/gamelistwidget.h index a719a5b25..5d397f39f 100644 --- a/src/duckstation-qt/gamelistwidget.h +++ b/src/duckstation-qt/gamelistwidget.h @@ -41,6 +41,8 @@ public: bool getShowGridCoverTitles() const; + const GameListEntry* getSelectedEntry() const; + Q_SIGNALS: void entrySelected(const GameListEntry* entry); void entryDoubleClicked(const GameListEntry* entry); @@ -68,7 +70,6 @@ protected: void resizeEvent(QResizeEvent* event); private: - const GameListEntry* getSelectedEntry() const; void resizeTableViewColumnsToFit(); void loadTableViewColumnVisibilitySettings(); void saveTableViewColumnVisibilitySettings(); diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index eb1a97b0f..571419ba5 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -361,6 +361,29 @@ void MainWindow::onViewSystemDisplayTriggered() } } +void MainWindow::onViewGamePropertiesActionTriggered() +{ + const GameListEntry* entry; + + if (m_emulation_running) + { + const std::string& path = System::GetRunningPath(); + if (path.empty()) + return; + + entry = m_host_interface->getGameList()->GetEntryForPath(path.c_str()); + } + else + { + entry = m_game_list_widget->getSelectedEntry(); + } + + if (!entry) + return; + + GamePropertiesDialog::showForEntry(m_host_interface, entry, this); +} + void MainWindow::onGitHubRepositoryActionTriggered() { QtUtils::OpenURL(this, "https://github.com/stenzek/duckstation/"); @@ -748,6 +771,7 @@ void MainWindow::connectSignals() connect(m_ui.actionViewGameList, &QAction::triggered, this, &MainWindow::onViewGameListActionTriggered); connect(m_ui.actionViewGameGrid, &QAction::triggered, this, &MainWindow::onViewGameGridActionTriggered); connect(m_ui.actionViewSystemDisplay, &QAction::triggered, this, &MainWindow::onViewSystemDisplayTriggered); + connect(m_ui.actionViewGameProperties, &QAction::triggered, this, &MainWindow::onViewGamePropertiesActionTriggered); connect(m_ui.actionGitHubRepository, &QAction::triggered, this, &MainWindow::onGitHubRepositoryActionTriggered); connect(m_ui.actionIssueTracker, &QAction::triggered, this, &MainWindow::onIssueTrackerActionTriggered); connect(m_ui.actionDiscordServer, &QAction::triggered, this, &MainWindow::onDiscordServerActionTriggered); diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index 10f187296..d4607abff 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -69,6 +69,7 @@ private Q_SLOTS: void onViewGameListActionTriggered(); void onViewGameGridActionTriggered(); void onViewSystemDisplayTriggered(); + void onViewGamePropertiesActionTriggered(); void onGitHubRepositoryActionTriggered(); void onIssueTrackerActionTriggered(); void onDiscordServerActionTriggered(); diff --git a/src/duckstation-qt/mainwindow.ui b/src/duckstation-qt/mainwindow.ui index afc93399d..2fbe9eb8d 100644 --- a/src/duckstation-qt/mainwindow.ui +++ b/src/duckstation-qt/mainwindow.ui @@ -193,6 +193,7 @@ + @@ -701,6 +702,11 @@ System &Display + + + Game &Properties + + Memory &Card Editor