From 456d341ec2e1b0bff12b8834102843abe43cc515 Mon Sep 17 00:00:00 2001 From: ANK-dev Date: Fri, 12 Sep 2025 16:24:06 -0300 Subject: [PATCH] Enable/Disable View menu items according to state - Disable all Game List/Grid related options while System Display is active. Reenable when switching back to List/Grid. - Disable Game List/Grid exclusive options when switching to the opposite view; - Disable "Clear List Background" when a background is not set; - Enable tooltips for menu items; --- src/duckstation-qt/mainwindow.cpp | 24 ++++++++++++++++++++++++ src/duckstation-qt/mainwindow.h | 1 + src/duckstation-qt/mainwindow.ui | 18 ++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 662da4ffb..e9866907e 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -528,6 +528,26 @@ void MainWindow::updateDisplayRelatedActions(bool has_surface, bool fullscreen) m_ui.menuWindowSize->setEnabled(s_system_valid && !s_system_starting && has_surface && !fullscreen); m_ui.actionFullscreen->setEnabled(has_surface && !s_system_starting); m_ui.actionFullscreen->setChecked(fullscreen); + + updateGameListRelatedActions(has_surface); +} + +void MainWindow::updateGameListRelatedActions(bool running) +{ + bool game_grid = m_game_list_widget->isShowingGameGrid(); + bool game_list = m_game_list_widget->isShowingGameList(); + bool has_background = Host::GetBaseStringSettingValue("UI", "GameListBackgroundPath") != ""; + bool starting_or_running = (s_system_starting || running); + + m_ui.actionMergeDiscSets->setDisabled(starting_or_running); + m_ui.actionShowLocalizedTitles->setDisabled(starting_or_running); + m_ui.actionShowGameIcons->setDisabled(starting_or_running || !game_list); + m_ui.actionGridViewShowTitles->setDisabled(starting_or_running || !game_grid); + m_ui.actionViewZoomIn->setDisabled(starting_or_running); + m_ui.actionViewZoomOut->setDisabled(starting_or_running); + m_ui.actionGridViewRefreshCovers->setDisabled(starting_or_running || !game_grid); + m_ui.actionChangeGameListBackground->setDisabled(starting_or_running); + m_ui.actionClearGameListBackground->setDisabled(starting_or_running || !has_background); } void MainWindow::focusDisplayWidget() @@ -1441,12 +1461,14 @@ void MainWindow::onViewStatusBarActionToggled(bool checked) void MainWindow::onViewGameListActionTriggered() { m_game_list_widget->showGameList(); + updateGameListRelatedActions(false); switchToGameListView(); } void MainWindow::onViewGameGridActionTriggered() { m_game_list_widget->showGameGrid(); + updateGameListRelatedActions(false); switchToGameListView(); } @@ -2659,6 +2681,7 @@ void MainWindow::onViewChangeGameListBackgroundTriggered() Host::SetBaseStringSettingValue("UI", "GameListBackgroundPath", relative_path.c_str()); Host::CommitBaseSettingChanges(); m_game_list_widget->updateBackground(true); + m_ui.actionClearGameListBackground->setEnabled(true); } void MainWindow::onViewClearGameListBackgroundTriggered() @@ -2666,6 +2689,7 @@ void MainWindow::onViewClearGameListBackgroundTriggered() Host::DeleteBaseSettingValue("UI", "GameListBackgroundPath"); Host::CommitBaseSettingChanges(); m_game_list_widget->updateBackground(true); + m_ui.actionClearGameListBackground->setEnabled(false); } void MainWindow::onSettingsTriggeredFromToolbar() diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index 6a27dbbd4..e732d1f8c 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -274,6 +274,7 @@ private: void destroyDisplayWidget(bool show_game_list); void updateDisplayWidgetCursor(); void updateDisplayRelatedActions(bool has_surface, bool fullscreen); + void updateGameListRelatedActions(bool running); void exitFullscreen(bool wait_for_completion); void doSettings(const char* category = nullptr); diff --git a/src/duckstation-qt/mainwindow.ui b/src/duckstation-qt/mainwindow.ui index c4f0dc55a..ef46724ab 100644 --- a/src/duckstation-qt/mainwindow.ui +++ b/src/duckstation-qt/mainwindow.ui @@ -37,6 +37,9 @@ &System + + true + Change Disc @@ -93,6 +96,9 @@ S&ettings + + true + @@ -120,6 +126,9 @@ &Help + + true + @@ -133,6 +142,9 @@ &Debug + + true + Switch GPU Renderer @@ -192,6 +204,9 @@ &View + + true + &Window Size @@ -227,6 +242,9 @@ &Tools + + true +