diff options
author | RSDuck <RSDuck@users.noreply.github.com> | 2022-02-25 16:06:22 +0100 |
---|---|---|
committer | RSDuck <RSDuck@users.noreply.github.com> | 2022-02-25 16:35:21 +0100 |
commit | 550db94a87bd4a0d0692ca3625623857827f14e4 (patch) | |
tree | 17085f0af8377fe447d4f965f0d59a6af8973b06 /src/frontend/qt_sdl | |
parent | e3ad78e84f3ca56da12360756c736a5b69bacf42 (diff) |
Use enum for screen sizing
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r-- | src/frontend/qt_sdl/Config.h | 11 | ||||
-rw-r--r-- | src/frontend/qt_sdl/main.cpp | 24 |
2 files changed, 23 insertions, 12 deletions
diff --git a/src/frontend/qt_sdl/Config.h b/src/frontend/qt_sdl/Config.h index 0ad589f..bce6ea2 100644 --- a/src/frontend/qt_sdl/Config.h +++ b/src/frontend/qt_sdl/Config.h @@ -38,6 +38,17 @@ enum HK_MAX }; +enum +{ + screenSizing_Even, + screenSizing_EmphTop, + screenSizing_EmphBop, + screenSizing_Auto, + screenSizing_TopOnly, + screenSizing_BotOnly, + screenSizing_MAX, +}; + namespace Config { diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index c31e78a..d970514 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -503,7 +503,7 @@ void EmuThread::run() micProcess(); // auto screen layout - if (Config::ScreenSizing == 3) + if (Config::ScreenSizing == screenSizing_Auto) { mainScreenPos[2] = mainScreenPos[1]; mainScreenPos[1] = mainScreenPos[0]; @@ -515,14 +515,14 @@ void EmuThread::run() { // constant flickering, likely displaying 3D on both screens // TODO: when both screens are used for 2D only...??? - guess = 0; + guess = screenSizing_Even; } else { if (mainScreenPos[0] == 1) - guess = 1; + guess = screenSizing_EmphTop; else - guess = 2; + guess = screenSizing_EmphBop; } if (guess != autoScreenSizing) @@ -1557,7 +1557,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) const char* screensizing[] = {"Even", "Emphasize top", "Emphasize bottom", "Auto", "Top only", "Bottom only"}; - for (int i = 0; i < 6; i++) + for (int i = 0; i < screenSizing_MAX; i++) { actScreenSizing[i] = submenu->addAction(QString(screensizing[i])); actScreenSizing[i]->setActionGroup(grpScreenSizing); @@ -2778,18 +2778,18 @@ void MainWindow::onChangeScreenSwap(bool checked) Config::ScreenSwap = checked?1:0; // Swap between top and bottom screen when displaying one screen. - if (Config::ScreenSizing == 4) + if (Config::ScreenSizing == screenSizing_TopOnly) { // Bottom Screen. - Config::ScreenSizing = 5; - actScreenSizing[4]->setChecked(false); + Config::ScreenSizing = screenSizing_BotOnly; + actScreenSizing[screenSizing_TopOnly]->setChecked(false); actScreenSizing[Config::ScreenSizing]->setChecked(true); } - else if (Config::ScreenSizing == 5) + else if (Config::ScreenSizing == screenSizing_BotOnly) { // Top Screen. - Config::ScreenSizing = 4; - actScreenSizing[5]->setChecked(false); + Config::ScreenSizing = screenSizing_TopOnly; + actScreenSizing[screenSizing_BotOnly]->setChecked(false); actScreenSizing[Config::ScreenSizing]->setChecked(true); } @@ -3016,7 +3016,7 @@ int main(int argc, char** argv) SANITIZE(Config::ScreenRotation, 0, 3); SANITIZE(Config::ScreenGap, 0, 500); SANITIZE(Config::ScreenLayout, 0, 3); - SANITIZE(Config::ScreenSizing, 0, 5); + SANITIZE(Config::ScreenSizing, 0, (int)screenSizing_MAX); SANITIZE(Config::ScreenAspectTop, 0, 4); SANITIZE(Config::ScreenAspectBot, 0, 4); #undef SANITIZE |