Added logic to make Qt GUI main menu access pause emulation functionality a configurable parameter.
This commit is contained in:
parent
9e92e28419
commit
27bb85f282
|
@ -103,8 +103,6 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
||||||
|
|
||||||
createMainMenu();
|
createMainMenu();
|
||||||
|
|
||||||
g_config->getOption( "SDL.VideoDriver", &use_SDL_video );
|
|
||||||
|
|
||||||
firstResize = true;
|
firstResize = true;
|
||||||
closeRequested = false;
|
closeRequested = false;
|
||||||
errorMsgValid = false;
|
errorMsgValid = false;
|
||||||
|
@ -115,6 +113,8 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
||||||
mainMenuEmuWasPaused = false;
|
mainMenuEmuWasPaused = false;
|
||||||
mainMenuPauseWhenActv = false;
|
mainMenuPauseWhenActv = false;
|
||||||
|
|
||||||
|
g_config->getOption( "SDL.PauseOnMainMenuAccess", &mainMenuPauseWhenActv );
|
||||||
|
|
||||||
if ( use_SDL_video )
|
if ( use_SDL_video )
|
||||||
{
|
{
|
||||||
viewport_SDL = new ConsoleViewSDL_t(this);
|
viewport_SDL = new ConsoleViewSDL_t(this);
|
||||||
|
@ -396,6 +396,11 @@ void consoleWin_t::setViewportAspect(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::setMenuAccessPauseEnable( bool enable )
|
||||||
|
{
|
||||||
|
mainMenuPauseWhenActv = enable;
|
||||||
|
}
|
||||||
|
|
||||||
void consoleWin_t::loadCursor(void)
|
void consoleWin_t::loadCursor(void)
|
||||||
{
|
{
|
||||||
int cursorVis;
|
int cursorVis;
|
||||||
|
|
|
@ -127,6 +127,8 @@ class consoleWin_t : public QMainWindow
|
||||||
void setViewerCursor( QCursor s );
|
void setViewerCursor( QCursor s );
|
||||||
void setViewerCursor( Qt::CursorShape s );
|
void setViewerCursor( Qt::CursorShape s );
|
||||||
Qt::CursorShape getViewerCursor(void);
|
Qt::CursorShape getViewerCursor(void);
|
||||||
|
|
||||||
|
void setMenuAccessPauseEnable(bool enable);
|
||||||
protected:
|
protected:
|
||||||
consoleMenuBar *menubar;
|
consoleMenuBar *menubar;
|
||||||
|
|
||||||
|
|
|
@ -49,10 +49,10 @@ GuiConfDialog_t::GuiConfDialog_t(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
int useNativeFileDialogVal;
|
int useNativeFileDialogVal;
|
||||||
int useNativeMenuBarVal;
|
int useNativeMenuBarVal, pauseOnMenuAccessVal;
|
||||||
int useCustomQssVal, useCustomQPalVal;
|
int useCustomQssVal, useCustomQPalVal;
|
||||||
QVBoxLayout *mainLayout, *vbox1, *vbox2;
|
QVBoxLayout *mainLayout, *vbox1, *vbox2;
|
||||||
QHBoxLayout *hbox;
|
QHBoxLayout *hbox, *hbox1;
|
||||||
QPushButton *closeButton, *button;
|
QPushButton *closeButton, *button;
|
||||||
QMenuBar *menuBar;
|
QMenuBar *menuBar;
|
||||||
QMenu *fileMenu, *colorMenu;
|
QMenu *fileMenu, *colorMenu;
|
||||||
|
@ -74,6 +74,7 @@ GuiConfDialog_t::GuiConfDialog_t(QWidget *parent)
|
||||||
g_config->getOption("SDL.UseNativeMenuBar", &useNativeMenuBarVal);
|
g_config->getOption("SDL.UseNativeMenuBar", &useNativeMenuBarVal);
|
||||||
g_config->getOption("SDL.UseCustomQss", &useCustomQssVal);
|
g_config->getOption("SDL.UseCustomQss", &useCustomQssVal);
|
||||||
g_config->getOption("SDL.UseCustomQPal", &useCustomQPalVal);
|
g_config->getOption("SDL.UseCustomQPal", &useCustomQPalVal);
|
||||||
|
g_config->getOption("SDL.PauseOnMainMenuAccess", &pauseOnMenuAccessVal);
|
||||||
|
|
||||||
setWindowTitle(tr("GUI Config"));
|
setWindowTitle(tr("GUI Config"));
|
||||||
|
|
||||||
|
@ -124,12 +125,15 @@ GuiConfDialog_t::GuiConfDialog_t(QWidget *parent)
|
||||||
|
|
||||||
useNativeFileDialog = new QCheckBox(tr("Use Native OS File Dialog"));
|
useNativeFileDialog = new QCheckBox(tr("Use Native OS File Dialog"));
|
||||||
useNativeMenuBar = new QCheckBox(tr("Use Native OS Menu Bar"));
|
useNativeMenuBar = new QCheckBox(tr("Use Native OS Menu Bar"));
|
||||||
|
pauseOnMenuAccess = new QCheckBox(tr("Pause On Main Menu Access"));
|
||||||
|
|
||||||
useNativeFileDialog->setChecked(useNativeFileDialogVal);
|
useNativeFileDialog->setChecked(useNativeFileDialogVal);
|
||||||
useNativeMenuBar->setChecked(useNativeMenuBarVal);
|
useNativeMenuBar->setChecked(useNativeMenuBarVal);
|
||||||
|
pauseOnMenuAccess->setChecked(pauseOnMenuAccessVal);
|
||||||
|
|
||||||
connect(useNativeFileDialog, SIGNAL(stateChanged(int)), this, SLOT(useNativeFileDialogChanged(int)));
|
connect(useNativeFileDialog, SIGNAL(stateChanged(int)), this, SLOT(useNativeFileDialogChanged(int)));
|
||||||
connect(useNativeMenuBar, SIGNAL(stateChanged(int)), this, SLOT(useNativeMenuBarChanged(int)));
|
connect(useNativeMenuBar, SIGNAL(stateChanged(int)), this, SLOT(useNativeMenuBarChanged(int)));
|
||||||
|
connect(pauseOnMenuAccess, SIGNAL(stateChanged(int)), this, SLOT(pauseOnMenuAccessChanged(int)));
|
||||||
|
|
||||||
styleComboBox = new QComboBox();
|
styleComboBox = new QComboBox();
|
||||||
|
|
||||||
|
@ -220,9 +224,17 @@ GuiConfDialog_t::GuiConfDialog_t(QWidget *parent)
|
||||||
custom_qss_path->setText(qssFile.c_str());
|
custom_qss_path->setText(qssFile.c_str());
|
||||||
vbox2->addWidget( custom_qss_path );
|
vbox2->addWidget( custom_qss_path );
|
||||||
|
|
||||||
mainLayout->addWidget(useNativeFileDialog);
|
hbox1 = new QHBoxLayout();
|
||||||
mainLayout->addWidget(useNativeMenuBar);
|
vbox1 = new QVBoxLayout();
|
||||||
mainLayout->addWidget(frame);
|
|
||||||
|
mainLayout->addLayout(hbox1);
|
||||||
|
hbox1->addLayout(vbox1);
|
||||||
|
hbox1->addWidget(frame);
|
||||||
|
|
||||||
|
vbox1->addWidget(useNativeFileDialog, 1);
|
||||||
|
vbox1->addWidget(useNativeMenuBar, 1);
|
||||||
|
vbox1->addWidget(pauseOnMenuAccess, 1);
|
||||||
|
vbox1->addStretch(10);
|
||||||
|
|
||||||
closeButton = new QPushButton( tr("Close") );
|
closeButton = new QPushButton( tr("Close") );
|
||||||
closeButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
|
closeButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
|
||||||
|
@ -275,6 +287,15 @@ void GuiConfDialog_t::useNativeMenuBarChanged(int state)
|
||||||
consoleWindow->menuBar()->setNativeMenuBar(value);
|
consoleWindow->menuBar()->setNativeMenuBar(value);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
void GuiConfDialog_t::pauseOnMenuAccessChanged(int state)
|
||||||
|
{
|
||||||
|
int value = (state == Qt::Unchecked) ? 0 : 1;
|
||||||
|
|
||||||
|
g_config->setOption("SDL.PauseOnMainMenuAccess", value);
|
||||||
|
|
||||||
|
consoleWindow->setMenuAccessPauseEnable( value );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
void GuiConfDialog_t::useCustomStyleChanged(int state)
|
void GuiConfDialog_t::useCustomStyleChanged(int state)
|
||||||
{
|
{
|
||||||
int value = (state == Qt::Unchecked) ? 0 : 1;
|
int value = (state == Qt::Unchecked) ? 0 : 1;
|
||||||
|
|
|
@ -142,6 +142,7 @@ protected:
|
||||||
|
|
||||||
QCheckBox *useNativeFileDialog;
|
QCheckBox *useNativeFileDialog;
|
||||||
QCheckBox *useNativeMenuBar;
|
QCheckBox *useNativeMenuBar;
|
||||||
|
QCheckBox *pauseOnMenuAccess;
|
||||||
QCheckBox *useCustomStyle;
|
QCheckBox *useCustomStyle;
|
||||||
QCheckBox *useCustomPalette;
|
QCheckBox *useCustomPalette;
|
||||||
QComboBox *styleComboBox;
|
QComboBox *styleComboBox;
|
||||||
|
@ -154,6 +155,7 @@ public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void useNativeFileDialogChanged(int v);
|
void useNativeFileDialogChanged(int v);
|
||||||
void useNativeMenuBarChanged(int v);
|
void useNativeMenuBarChanged(int v);
|
||||||
|
void pauseOnMenuAccessChanged(int v);
|
||||||
void useCustomQPaletteChanged(int v);
|
void useCustomQPaletteChanged(int v);
|
||||||
void useCustomStyleChanged(int v);
|
void useCustomStyleChanged(int v);
|
||||||
void styleChanged(int index);
|
void styleChanged(int index);
|
||||||
|
|
|
@ -52,47 +52,6 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//static const char* HotkeyStrings[HK_MAX] = {
|
|
||||||
// "OpenROM",
|
|
||||||
// "CloseROM",
|
|
||||||
// "CheatMenu",
|
|
||||||
// "BindState",
|
|
||||||
// "LoadLua",
|
|
||||||
// "ToggleBG",
|
|
||||||
// "SaveState",
|
|
||||||
// "FDSSelect",
|
|
||||||
// "LoadState",
|
|
||||||
// "FDSEject",
|
|
||||||
// "VSInsertCoin",
|
|
||||||
// "VSToggleDip",
|
|
||||||
// "MovieToggleFrameDisplay",
|
|
||||||
// "SubtitleDisplay",
|
|
||||||
// "Reset",
|
|
||||||
// "Screenshot",
|
|
||||||
// "Pause",
|
|
||||||
// "DecreaseSpeed",
|
|
||||||
// "IncreaseSpeed",
|
|
||||||
// "FrameAdvance",
|
|
||||||
// "Turbo",
|
|
||||||
// "ToggleInputDisplay",
|
|
||||||
// "ToggleMovieRW",
|
|
||||||
// "MuteCapture",
|
|
||||||
// "Quit",
|
|
||||||
// "FrameAdvanceLagSkip",
|
|
||||||
// "LagCounterDisplay",
|
|
||||||
// "SelectState0", "SelectState1", "SelectState2", "SelectState3",
|
|
||||||
// "SelectState4", "SelectState5", "SelectState6", "SelectState7",
|
|
||||||
// "SelectState8", "SelectState9", "SelectStateNext", "SelectStatePrev",
|
|
||||||
// "VolumeDown", "VolumeUp", "FKB_Enable" };
|
|
||||||
|
|
||||||
//const char *getHotkeyString( int i )
|
|
||||||
//{
|
|
||||||
// if ( (i>=0) && (i<HK_MAX) )
|
|
||||||
// {
|
|
||||||
// return HotkeyStrings[i];
|
|
||||||
// }
|
|
||||||
// return NULL;
|
|
||||||
//}
|
|
||||||
|
|
||||||
int getHotKeyConfig( int i, const char **nameOut, const char **keySeqOut, const char **titleOut )
|
int getHotKeyConfig( int i, const char **nameOut, const char **keySeqOut, const char **titleOut )
|
||||||
{
|
{
|
||||||
|
@ -626,6 +585,7 @@ InitConfig()
|
||||||
|
|
||||||
config->addOption("_useNativeFileDialog", "SDL.UseNativeFileDialog", false);
|
config->addOption("_useNativeFileDialog", "SDL.UseNativeFileDialog", false);
|
||||||
config->addOption("_useNativeMenuBar" , "SDL.UseNativeMenuBar", false);
|
config->addOption("_useNativeMenuBar" , "SDL.UseNativeMenuBar", false);
|
||||||
|
config->addOption("SDL.PauseOnMainMenuAccess", true);
|
||||||
config->addOption("SDL.GuiStyle", "");
|
config->addOption("SDL.GuiStyle", "");
|
||||||
config->addOption("SDL.QtStyleSheet", "");
|
config->addOption("SDL.QtStyleSheet", "");
|
||||||
config->addOption("SDL.QPaletteFile", "");
|
config->addOption("SDL.QPaletteFile", "");
|
||||||
|
@ -776,7 +736,6 @@ InitConfig()
|
||||||
|
|
||||||
for(int i=0; i < HK_MAX; i++)
|
for(int i=0; i < HK_MAX; i++)
|
||||||
{
|
{
|
||||||
char buf[256];
|
|
||||||
const char *hotKeyName, *hotKeySeq;
|
const char *hotKeyName, *hotKeySeq;
|
||||||
std::string nameText, keyText;
|
std::string nameText, keyText;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue