Qt: Add Game Properties to view menu (for running game)

This commit is contained in:
Connor McLaughlin 2020-10-13 23:20:50 +10:00
parent eb89bbd909
commit 56c511b45c
4 changed files with 33 additions and 1 deletions

View File

@ -41,6 +41,8 @@ public:
bool getShowGridCoverTitles() const; bool getShowGridCoverTitles() const;
const GameListEntry* getSelectedEntry() const;
Q_SIGNALS: Q_SIGNALS:
void entrySelected(const GameListEntry* entry); void entrySelected(const GameListEntry* entry);
void entryDoubleClicked(const GameListEntry* entry); void entryDoubleClicked(const GameListEntry* entry);
@ -68,7 +70,6 @@ protected:
void resizeEvent(QResizeEvent* event); void resizeEvent(QResizeEvent* event);
private: private:
const GameListEntry* getSelectedEntry() const;
void resizeTableViewColumnsToFit(); void resizeTableViewColumnsToFit();
void loadTableViewColumnVisibilitySettings(); void loadTableViewColumnVisibilitySettings();
void saveTableViewColumnVisibilitySettings(); void saveTableViewColumnVisibilitySettings();

View File

@ -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() void MainWindow::onGitHubRepositoryActionTriggered()
{ {
QtUtils::OpenURL(this, "https://github.com/stenzek/duckstation/"); 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.actionViewGameList, &QAction::triggered, this, &MainWindow::onViewGameListActionTriggered);
connect(m_ui.actionViewGameGrid, &QAction::triggered, this, &MainWindow::onViewGameGridActionTriggered); connect(m_ui.actionViewGameGrid, &QAction::triggered, this, &MainWindow::onViewGameGridActionTriggered);
connect(m_ui.actionViewSystemDisplay, &QAction::triggered, this, &MainWindow::onViewSystemDisplayTriggered); 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.actionGitHubRepository, &QAction::triggered, this, &MainWindow::onGitHubRepositoryActionTriggered);
connect(m_ui.actionIssueTracker, &QAction::triggered, this, &MainWindow::onIssueTrackerActionTriggered); connect(m_ui.actionIssueTracker, &QAction::triggered, this, &MainWindow::onIssueTrackerActionTriggered);
connect(m_ui.actionDiscordServer, &QAction::triggered, this, &MainWindow::onDiscordServerActionTriggered); connect(m_ui.actionDiscordServer, &QAction::triggered, this, &MainWindow::onDiscordServerActionTriggered);

View File

@ -69,6 +69,7 @@ private Q_SLOTS:
void onViewGameListActionTriggered(); void onViewGameListActionTriggered();
void onViewGameGridActionTriggered(); void onViewGameGridActionTriggered();
void onViewSystemDisplayTriggered(); void onViewSystemDisplayTriggered();
void onViewGamePropertiesActionTriggered();
void onGitHubRepositoryActionTriggered(); void onGitHubRepositoryActionTriggered();
void onIssueTrackerActionTriggered(); void onIssueTrackerActionTriggered();
void onDiscordServerActionTriggered(); void onDiscordServerActionTriggered();

View File

@ -193,6 +193,7 @@
<addaction name="actionViewGameList"/> <addaction name="actionViewGameList"/>
<addaction name="actionViewGameGrid"/> <addaction name="actionViewGameGrid"/>
<addaction name="actionViewSystemDisplay"/> <addaction name="actionViewSystemDisplay"/>
<addaction name="actionViewGameProperties"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionGridViewShowTitles"/> <addaction name="actionGridViewShowTitles"/>
<addaction name="actionGridViewZoomIn"/> <addaction name="actionGridViewZoomIn"/>
@ -701,6 +702,11 @@
<string>System &amp;Display</string> <string>System &amp;Display</string>
</property> </property>
</action> </action>
<action name="actionViewGameProperties">
<property name="text">
<string>Game &amp;Properties</string>
</property>
</action>
<action name="actionMemory_Card_Editor"> <action name="actionMemory_Card_Editor">
<property name="text"> <property name="text">
<string>Memory &amp;Card Editor</string> <string>Memory &amp;Card Editor</string>