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;
pull/3568/head
ANK-dev 1 month ago committed by Connor McLaughlin
parent ee9f32185e
commit 456d341ec2

@ -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()

@ -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);

@ -37,6 +37,9 @@
<property name="title">
<string>&amp;System</string>
</property>
<property name="toolTipsVisible">
<bool>true</bool>
</property>
<widget class="QMenu" name="menuChangeDisc">
<property name="title">
<string>Change Disc</string>
@ -93,6 +96,9 @@
<property name="title">
<string>S&amp;ettings</string>
</property>
<property name="toolTipsVisible">
<bool>true</bool>
</property>
<addaction name="actionViewGameProperties"/>
<addaction name="separator"/>
<addaction name="actionInterfaceSettings"/>
@ -120,6 +126,9 @@
<property name="title">
<string>&amp;Help</string>
</property>
<property name="toolTipsVisible">
<bool>true</bool>
</property>
<addaction name="actionGitHubRepository"/>
<addaction name="actionDiscordServer"/>
<addaction name="separator"/>
@ -133,6 +142,9 @@
<property name="title">
<string>&amp;Debug</string>
</property>
<property name="toolTipsVisible">
<bool>true</bool>
</property>
<widget class="QMenu" name="menuRenderer">
<property name="title">
<string>Switch GPU Renderer</string>
@ -192,6 +204,9 @@
<property name="title">
<string>&amp;View</string>
</property>
<property name="toolTipsVisible">
<bool>true</bool>
</property>
<widget class="QMenu" name="menuWindowSize">
<property name="title">
<string>&amp;Window Size</string>
@ -227,6 +242,9 @@
<property name="title">
<string>&amp;Tools</string>
</property>
<property name="toolTipsVisible">
<bool>true</bool>
</property>
<addaction name="actionOpenDataDirectory"/>
<addaction name="separator"/>
<addaction name="actionMemoryCardEditor"/>

Loading…
Cancel
Save