Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unification of the menu of Linux and Windows versions #12817

Merged
merged 8 commits into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ static ConfigSetting generalSettings[] = {
ConfigSetting("FirstRun", &g_Config.bFirstRun, true),
ConfigSetting("RunCount", &g_Config.iRunCount, 0),
ConfigSetting("Enable Logging", &g_Config.bEnableLogging, true),
ConfigSetting("AutoRun", &g_Config.bAutoRun, false),
ConfigSetting("AutoRun", &g_Config.bAutoRun, true),
ConfigSetting("Browse", &g_Config.bBrowse, false),
ConfigSetting("IgnoreBadMemAccess", &g_Config.bIgnoreBadMemAccess, true, true),
ConfigSetting("CurrentDirectory", &g_Config.currentDirectory, ""),
Expand Down
2 changes: 1 addition & 1 deletion Qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ void MainWindow::createMenus()
// Debug
MenuTree* debugMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Debug"));
debugMenu->add(new MenuAction(this, SLOT(breakonloadAct()), QT_TR_NOOP("Break on load")))
->addEventChecked(&g_Config.bAutoRun);
->addEventUnchecked(&g_Config.bAutoRun);
debugMenu->add(new MenuAction(this, SLOT(ignoreIllegalAct()), QT_TR_NOOP("&Ignore illegal reads/writes")))
->addEventChecked(&g_Config.bIgnoreBadMemAccess);
debugMenu->addSeparator();
Expand Down
14 changes: 11 additions & 3 deletions Qt/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private slots:
NativeMessageReceived("gpu_resized", "");
if (g_Config.iTexScalingLevel == TEXSCALING_AUTO) {
NativeMessageReceived("gpu_clearCache", "");
}
}
}
void windowGroup_triggered(QAction *action) { SetWindowScale(action->data().toInt()); }

Expand All @@ -131,7 +131,7 @@ private slots:
if (g_Config.iRenderingMode == FB_NON_BUFFERED_MODE) {
g_Config.iRenderingMode = FB_BUFFERED_MODE;
NativeMessageReceived("gpu_resized", "");
}
}
}
void frameSkippingGroup_triggered(QAction *action) { g_Config.iFrameSkip = action->data().toInt(); }
void frameSkippingTypeGroup_triggered(QAction *action) { g_Config.iFrameSkipType = action->data().toInt(); }
Expand Down Expand Up @@ -233,7 +233,7 @@ class MenuAction : public QAction
}
// Add to QActionGroup
MenuAction(QWidget* parent, QActionGroup* group, QVariant data, QString text, QKeySequence key = 0) :
QAction(parent), _eventCheck(0), _stateEnable(-1), _stateDisable(-1), _enableStepping(false)
QAction(parent), _eventCheck(0), _eventUncheck(0), _stateEnable(-1), _stateDisable(-1), _enableStepping(false)
{
this->setCheckable(true);
this->setData(data);
Expand All @@ -254,6 +254,11 @@ class MenuAction : public QAction
this->setCheckable(true);
_eventCheck = (bool*)event;
}
// Event which causes it to be unchecked
void addEventUnchecked(bool* event) {
this->setCheckable(true);
_eventUncheck = event;
}
// UI State which causes it to be enabled
void addEnableState(int state) {
_stateEnable = state;
Expand All @@ -272,6 +277,8 @@ public slots:
void update() {
if (_eventCheck)
setChecked(*_eventCheck);
if (_eventUncheck)
setChecked(false);
unknownbrackets marked this conversation as resolved.
Show resolved Hide resolved
if (_stateEnable >= 0)
setEnabled(GetUIState() == _stateEnable);
if (_stateDisable >= 0)
Expand All @@ -282,6 +289,7 @@ public slots:
private:
const char *_text;
bool *_eventCheck;
bool *_eventUncheck;
int _stateEnable, _stateDisable;
bool _enableStepping;
};
Expand Down