Qt: Fix fullscreen/window size being enabled in game list

This commit is contained in:
Connor McLaughlin 2022-09-15 19:43:21 +10:00 committed by refractionpcsx2
parent f2d86f2782
commit c96f1d28e6
2 changed files with 19 additions and 5 deletions

View File

@ -236,6 +236,7 @@ void MainWindow::setupAdditionalUi()
}
updateEmulationActions(false, false);
updateDisplayRelatedActions(false, false, false);
}
void MainWindow::connectSignals()
@ -840,7 +841,6 @@ void MainWindow::updateEmulationActions(bool starting, bool running)
m_ui.actionSaveState->setEnabled(running);
m_ui.menuSaveState->setEnabled(running);
m_ui.menuWindowSize->setEnabled(starting_or_running);
m_ui.actionViewGameProperties->setEnabled(running);
@ -854,6 +854,19 @@ void MainWindow::updateEmulationActions(bool starting, bool running)
m_ui.actionRescanAllGames->setDisabled(starting_or_running);
}
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::updateStatusBarWidgetVisibility()
{
auto Update = [this](QWidget* widget, bool visible, int stretch) {
@ -1791,8 +1804,6 @@ DisplayWidget* MainWindow::createDisplay(bool fullscreen, bool render_to_main)
updateWindowTitle();
updateWindowState();
m_ui.actionViewSystemDisplay->setEnabled(true);
m_ui.actionFullscreen->setEnabled(true);
m_ui.actionStartFullscreenUI->setEnabled(false);
m_ui.actionStartFullscreenUI2->setEnabled(false);
@ -1886,8 +1897,6 @@ DisplayWidget* MainWindow::updateDisplay(bool fullscreen, bool render_to_main, b
m_display_widget->updateRelativeMode(s_vm_valid && !s_vm_paused);
m_display_widget->updateCursor(s_vm_valid && !s_vm_paused);
QSignalBlocker blocker(m_ui.actionFullscreen);
m_ui.actionFullscreen->setChecked(fullscreen);
return m_display_widget;
}
@ -1954,6 +1963,8 @@ void MainWindow::createDisplayWidget(bool fullscreen, bool render_to_main, bool
m_ui.mainContainer->setCurrentIndex(1);
}
updateDisplayRelatedActions(true, render_to_main, fullscreen);
// We need the surface visible.
QGuiApplication::sync();
}
@ -2039,6 +2050,8 @@ void MainWindow::destroyDisplayWidget(bool show_game_list)
m_display_container->deleteLater();
m_display_container = nullptr;
}
updateDisplayRelatedActions(false, false, false);
}
void MainWindow::focusDisplayWidget()

View File

@ -192,6 +192,7 @@ private:
void restoreStateFromConfig();
void updateEmulationActions(bool starting, bool running);
void updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen);
void updateStatusBarWidgetVisibility();
void updateWindowTitle();
void updateWindowState(bool force_visible = false);