From c3dbd2b2629b2c53df85dbca92984f910e1eada7 Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Sun, 12 Apr 2020 19:26:44 +0300 Subject: [PATCH] Update "Emulation" menu to match Windows version --- Qt/mainwindow.cpp | 19 +++++++++++-------- Qt/mainwindow.h | 5 +++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 62d4c1a12b..7103290f1d 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -80,6 +80,13 @@ void MainWindow::newFrame() void MainWindow::updateMenus() { + foreach(QAction * action, displayRotationGroup->actions()) { + if (g_Config.iInternalScreenRotation == action->data().toInt()) { + action->setChecked(true); + break; + } + } + foreach(QAction * action, windowGroup->actions()) { int width = (g_Config.IsPortrait() ? 272 : 480) * action->data().toInt(); int height = (g_Config.IsPortrait() ? 480 : 272) * action->data().toInt(); @@ -255,11 +262,6 @@ void MainWindow::resetAct() NativeMessageReceived("reset", ""); } -void MainWindow::runonloadAct() -{ - g_Config.bAutoRun = !g_Config.bAutoRun; -} - void MainWindow::breakonloadAct() { g_Config.bAutoRun = !g_Config.bAutoRun; @@ -530,9 +532,10 @@ void MainWindow::createMenus() ->addEnableState(UISTATE_INGAME); emuMenu->add(new MenuAction(this, SLOT(resetAct()), QT_TR_NOOP("Re&set"))) ->addEnableState(UISTATE_INGAME); - emuMenu->addSeparator(); - emuMenu->add(new MenuAction(this, SLOT(runonloadAct()), QT_TR_NOOP("Run on &load"))) - ->addEventChecked(&g_Config.bAutoRun); + MenuTree* displayRotationMenu = new MenuTree(this, emuMenu, QT_TR_NOOP("Display rotation")); + displayRotationGroup = new MenuActionGroup(this, displayRotationMenu, SLOT(displayRotationGroup_triggered(QAction *)), + QStringList() << "Landscape" << "Portrait" << "Landscape reversed" << "Portrait reversed", + QList() << 1 << 2 << 3 << 4); // Debug MenuTree* debugMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Debug")); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 0d4700fc5f..95df4e9b11 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -80,7 +80,7 @@ private slots: void runAct(); void pauseAct(); void resetAct(); - void runonloadAct(); + void displayRotationGroup_triggered(QAction *action) { g_Config.iInternalScreenRotation = action->data().toInt(); } // Debug void breakonloadAct(); @@ -177,7 +177,8 @@ private: *textureScalingLevelGroup, *textureScalingTypeGroup, *screenScalingFilterGroup, *textureFilteringGroup, *frameSkippingTypeGroup, *frameSkippingGroup, - *renderingModeGroup, *renderingResolutionGroup; + *renderingModeGroup, *renderingResolutionGroup, + *displayRotationGroup; std::queue msgQueue_; std::mutex msgMutex_;