Improve code readability

This commit is contained in:
TotalCaesar659 2020-04-18 02:46:11 +03:00
parent cc916180b5
commit 00684a4bb9
2 changed files with 18 additions and 69 deletions

View File

@ -78,21 +78,24 @@ void MainWindow::newFrame()
}
}
void MainWindow::updateMenuGroupInt(QActionGroup *group, int value) {
foreach (QAction *action, group->actions()) {
action->setChecked(action->data().toInt() == value);
}
}
void MainWindow::updateMenus()
{
foreach(QAction * action, saveStateGroup->actions()) {
if (g_Config.iCurrentStateSlot == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, displayRotationGroup->actions()) {
if (g_Config.iInternalScreenRotation == action->data().toInt()) {
action->setChecked(true);
break;
}
}
updateMenuGroupInt(saveStateGroup, g_Config.iCurrentStateSlot);
updateMenuGroupInt(displayRotationGroup, g_Config.iInternalScreenRotation);
updateMenuGroupInt(renderingResolutionGroup, g_Config.iInternalResolution);
updateMenuGroupInt(renderingModeGroup, g_Config.iRenderingMode);
updateMenuGroupInt(frameSkippingGroup, g_Config.iFrameSkip);
updateMenuGroupInt(frameSkippingTypeGroup, g_Config.iFrameSkipType);
updateMenuGroupInt(textureFilteringGroup, g_Config.iTexFiltering);
updateMenuGroupInt(screenScalingFilterGroup, g_Config.iBufFilter);
updateMenuGroupInt(textureScalingLevelGroup, g_Config.iTexScalingLevel);
updateMenuGroupInt(textureScalingTypeGroup, g_Config.iTexScalingType);
foreach(QAction * action, windowGroup->actions()) {
int width = (g_Config.IsPortrait() ? 272 : 480) * action->data().toInt();
@ -102,62 +105,6 @@ void MainWindow::updateMenus()
break;
}
}
foreach(QAction * action, renderingResolutionGroup->actions()) {
if (g_Config.iInternalResolution == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, renderingModeGroup->actions()) {
if (g_Config.iRenderingMode == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, frameSkippingGroup->actions()) {
if (g_Config.iFrameSkip == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, frameSkippingTypeGroup->actions()) {
if (g_Config.iFrameSkipType == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, textureFilteringGroup->actions()) {
if (g_Config.iTexFiltering == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, screenScalingFilterGroup->actions()) {
if (g_Config.iBufFilter == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, textureScalingLevelGroup->actions()) {
if (g_Config.iTexScalingLevel == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, textureScalingTypeGroup->actions()) {
if (g_Config.iTexScalingType == action->data().toInt()) {
action->setChecked(true);
break;
}
}
emit updateMenu();
}

View File

@ -41,6 +41,8 @@ public:
CoreState GetNextState() { return nextState; }
void updateMenuGroupInt(QActionGroup *group, int value);
void updateMenus();
void Notify(MainWindowMsg msg) {