Skip to content

Commit

Permalink
Use enum for screen sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
RSDuck committed Feb 25, 2022
1 parent e3ad78e commit 550db94
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/frontend/qt_sdl/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ enum
HK_MAX
};

enum
{
screenSizing_Even,
screenSizing_EmphTop,
screenSizing_EmphBop,
screenSizing_Auto,
screenSizing_TopOnly,
screenSizing_BotOnly,
screenSizing_MAX,
};

namespace Config
{

Expand Down
24 changes: 12 additions & 12 deletions src/frontend/qt_sdl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 550db94

Please sign in to comment.