Qt: Fix exiting game in big picture returning to list

This commit is contained in:
Connor McLaughlin 2022-12-20 21:45:01 +10:00
parent fb9608a9cf
commit b530b08bc4
2 changed files with 23 additions and 6 deletions

View file

@ -239,10 +239,10 @@ bool MainWindow::createDisplay(bool fullscreen, bool render_to_main)
m_ui.actionStartFullscreenUI->setEnabled(false); m_ui.actionStartFullscreenUI->setEnabled(false);
m_ui.actionStartFullscreenUI2->setEnabled(false); m_ui.actionStartFullscreenUI2->setEnabled(false);
m_ui.actionViewSystemDisplay->setEnabled(true);
m_ui.actionFullscreen->setEnabled(true);
updateDisplayWidgetCursor(); updateDisplayWidgetCursor();
updateDisplayRelatedActions(true, render_to_main, fullscreen);
m_display_widget->setFocus(); m_display_widget->setFocus();
g_host_display->DoneCurrent(); g_host_display->DoneCurrent();
@ -304,6 +304,7 @@ bool MainWindow::updateDisplay(bool fullscreen, bool render_to_main, bool surfac
if (surfaceless) if (surfaceless)
{ {
updateWindowState(); updateWindowState();
updateDisplayRelatedActions(false, render_to_main, fullscreen);
return true; return true;
} }
@ -328,6 +329,7 @@ bool MainWindow::updateDisplay(bool fullscreen, bool render_to_main, bool surfac
updateWindowTitle(); updateWindowTitle();
updateWindowState(); updateWindowState();
updateDisplayWidgetCursor(); updateDisplayWidgetCursor();
updateDisplayRelatedActions(true, render_to_main, fullscreen);
m_display_widget->setFocus(); m_display_widget->setFocus();
QSignalBlocker blocker(m_ui.actionFullscreen); QSignalBlocker blocker(m_ui.actionFullscreen);
@ -450,8 +452,7 @@ void MainWindow::destroyDisplay()
destroyDisplayWidget(true); destroyDisplayWidget(true);
m_display_created = false; m_display_created = false;
m_ui.actionViewSystemDisplay->setEnabled(false); updateDisplayRelatedActions(false, false, false);
m_ui.actionFullscreen->setEnabled(false);
m_ui.actionStartFullscreenUI->setEnabled(true); m_ui.actionStartFullscreenUI->setEnabled(true);
m_ui.actionStartFullscreenUI2->setEnabled(true); m_ui.actionStartFullscreenUI2->setEnabled(true);
@ -512,6 +513,19 @@ void MainWindow::updateDisplayWidgetCursor()
m_display_widget->updateCursor(s_system_valid && !s_system_paused && shouldHideMouseCursor()); m_display_widget->updateCursor(s_system_valid && !s_system_paused && shouldHideMouseCursor());
} }
void MainWindow::updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen)
{
// rendering to main, or switched to gamelist/grid
m_ui.actionViewSystemDisplay->setEnabled((has_surface && render_to_main) || (!has_surface && g_host_display));
m_ui.menuWindowSize->setEnabled(has_surface && !fullscreen);
m_ui.actionFullscreen->setEnabled(has_surface);
{
QSignalBlocker blocker(m_ui.actionFullscreen);
m_ui.actionFullscreen->setChecked(fullscreen);
}
}
void MainWindow::focusDisplayWidget() void MainWindow::focusDisplayWidget()
{ {
if (!m_display_widget || centralWidget() != m_display_widget) if (!m_display_widget || centralWidget() != m_display_widget)
@ -600,6 +614,9 @@ void MainWindow::onSystemDestroyed()
s_system_valid = false; s_system_valid = false;
s_system_paused = false; s_system_paused = false;
updateEmulationActions(false, false, Achievements::ChallengeModeActive()); updateEmulationActions(false, false, Achievements::ChallengeModeActive());
if (m_display_widget)
updateDisplayWidgetCursor();
else
switchToGameListView(); switchToGameListView();
// reload played time // reload played time
@ -1617,7 +1634,6 @@ void MainWindow::updateEmulationActions(bool starting, bool running, bool cheevo
m_ui.actionChangeDisc->setDisabled(starting || !running); m_ui.actionChangeDisc->setDisabled(starting || !running);
m_ui.actionCheats->setDisabled(starting || !running || cheevos_challenge_mode); m_ui.actionCheats->setDisabled(starting || !running || cheevos_challenge_mode);
m_ui.actionScreenshot->setDisabled(starting || !running); m_ui.actionScreenshot->setDisabled(starting || !running);
m_ui.actionViewSystemDisplay->setEnabled(starting || running);
m_ui.menuChangeDisc->setDisabled(starting || !running); m_ui.menuChangeDisc->setDisabled(starting || !running);
m_ui.menuCheats->setDisabled(starting || !running || cheevos_challenge_mode); m_ui.menuCheats->setDisabled(starting || !running || cheevos_challenge_mode);
m_ui.actionCheatManager->setDisabled(starting || !running || cheevos_challenge_mode); m_ui.actionCheatManager->setDisabled(starting || !running || cheevos_challenge_mode);

View file

@ -211,6 +211,7 @@ private:
void createDisplayWidget(bool fullscreen, bool render_to_main, bool is_exclusive_fullscreen); void createDisplayWidget(bool fullscreen, bool render_to_main, bool is_exclusive_fullscreen);
void destroyDisplayWidget(bool show_game_list); void destroyDisplayWidget(bool show_game_list);
void updateDisplayWidgetCursor(); void updateDisplayWidgetCursor();
void updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen);
void setDisplayFullscreen(const std::string& fullscreen_mode); void setDisplayFullscreen(const std::string& fullscreen_mode);
SettingsDialog* getSettingsDialog(); SettingsDialog* getSettingsDialog();