Qt: Save fullscreen setting
Jeffrey Pfau jeffrey@endrift.com
Sat, 28 Mar 2015 23:23:32 -0700
2 files changed,
21 insertions(+),
9 deletions(-)
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -181,6 +181,10 @@ if (opts->width && opts->height) {
resizeFrame(opts->width, opts->height); } + if (opts->fullscreen) { + enterFullScreen(); + } + m_mruFiles = m_config->getMRU(); updateMRU();@@ -345,6 +349,7 @@
void Window::resizeEvent(QResizeEvent*) { m_config->setOption("height", m_screenWidget->height()); m_config->setOption("width", m_screenWidget->width()); + m_config->setOption("fullscreen", isFullScreen()); } void Window::closeEvent(QCloseEvent* event) {@@ -380,6 +385,18 @@ event->accept();
m_controller->loadGame(url.path()); } +void Window::enterFullScreen() { + if (isFullScreen()) { + return; + } + showFullScreen(); +#ifndef Q_OS_MAC + if (m_controller->isLoaded() && !m_controller->isPaused()) { + menuBar()->hide(); + } +#endif +} + void Window::exitFullScreen() { if (!isFullScreen()) { return;@@ -390,15 +407,9 @@ }
void Window::toggleFullScreen() { if (isFullScreen()) { - showNormal(); - menuBar()->show(); + exitFullScreen(); } else { - showFullScreen(); -#ifndef Q_OS_MAC - if (m_controller->isLoaded() && !m_controller->isPaused()) { - menuBar()->hide(); - } -#endif + enterFullScreen(); } }@@ -831,7 +842,7 @@ }, [this]() {
m_controller->setTurbo(false, false); }, QKeySequence(Qt::Key_Tab), tr("Fast Forward (held)"), "holdFastForward"); - addControlledAction(other, other->addAction(tr("Exit fullscreen"), this, SLOT(exitFullScreen()), QKeySequence("Esc")), "exitFullscreen"); + addControlledAction(other, other->addAction(tr("Exit fullscreen"), this, SLOT(exitFullScreen()), QKeySequence("Esc")), "exitFullScreen"); foreach (QAction* action, m_gameActions) { action->setDisabled(true);
M
src/platform/qt/Window.h
→
src/platform/qt/Window.h
@@ -59,6 +59,7 @@ public slots:
void selectROM(); void selectBIOS(); void selectPatch(); + void enterFullScreen(); void exitFullScreen(); void toggleFullScreen(); void loadConfig();