Update "Options" menu to match Windows version

This commit is contained in:
TotalCaesar659 2020-04-12 18:17:36 +03:00
parent 8d8bc98e97
commit fe5fe82676
2 changed files with 141 additions and 151 deletions

View File

@ -80,14 +80,7 @@ void MainWindow::newFrame()
void MainWindow::updateMenus()
{
foreach(QAction * action, anisotropicGroup->actions()) {
if (g_Config.iAnisotropyLevel == action->data().toInt()) {
action->setChecked(true);
break;
}
}
foreach(QAction * action, screenGroup->actions()) {
foreach(QAction * action, windowGroup->actions()) {
int width = (g_Config.IsPortrait() ? 272 : 480) * action->data().toInt();
int height = (g_Config.IsPortrait() ? 480 : 272) * action->data().toInt();
if (g_Config.iWindowWidth == width && g_Config.iWindowHeight == height) {
@ -96,32 +89,57 @@ void MainWindow::updateMenus()
}
}
foreach(QAction * action, displayLayoutGroup->actions()) {
if (g_Config.iSmallDisplayZoomType == action->data().toInt()) {
foreach(QAction * action, renderingResolutionGroup->actions()) {
if (g_Config.iInternalResolution == action->data().toInt()) {
action->setChecked(true);
break;
}
}
int defaultLevel = LogManager::GetInstance()->GetLogLevel(LogTypes::COMMON);
foreach(QAction * action, defaultLogGroup->actions()) {
if (defaultLevel == action->data().toInt()) {
foreach(QAction * action, renderingModeGroup->actions()) {
if (g_Config.iRenderingMode == action->data().toInt()) {
action->setChecked(true);
break;
}
}
int g3dLevel = LogManager::GetInstance()->GetLogLevel(LogTypes::G3D);
foreach(QAction * action, g3dLogGroup->actions()) {
if (g3dLevel == action->data().toInt()) {
foreach(QAction * action, frameSkippingGroup->actions()) {
if (g_Config.iFrameSkip == action->data().toInt()) {
action->setChecked(true);
break;
}
}
int hleLevel = LogManager::GetInstance()->GetLogLevel(LogTypes::HLE);
foreach(QAction * action, hleLogGroup->actions()) {
if (hleLevel == action->data().toInt()) {
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;
}
@ -493,118 +511,87 @@ void MainWindow::createMenus()
debugMenu->add(new MenuAction(this, SLOT(consoleAct()), QT_TR_NOOP("Log Console")))
->addDisableState(UISTATE_MENU);
// Options
MenuTree* optionsMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Options"));
// - Core
MenuTree* coreMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("&Core"));
coreMenu->add(new MenuAction(this, SLOT(vertexDynarecAct()), QT_TR_NOOP("&Vertex Decoder Dynarec")))
->addEventChecked(&g_Config.bVertexDecoderJit);
coreMenu->add(new MenuAction(this, SLOT(fastmemAct()), QT_TR_NOOP("Fast &Memory (unstable)")))
->addEventChecked(&g_Config.bFastMemory);
coreMenu->add(new MenuAction(this, SLOT(ignoreIllegalAct()), QT_TR_NOOP("&Ignore Illegal reads/writes")))
->addEventChecked(&g_Config.bIgnoreBadMemAccess);
// - Video
MenuTree* videoMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("&Video"));
// - Anisotropic Filtering
MenuTree* anisotropicMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Anisotropic Filtering"));
anisotropicGroup = new MenuActionGroup(this, anisotropicMenu, SLOT(anisotropicGroup_triggered(QAction *)),
QStringList() << "Off" << "2x" << "4x" << "8x" << "16x",
QList<int>() << 0 << 1 << 2 << 3 << 4);
videoMenu->add(new MenuAction(this, SLOT(bufferRenderAct()), QT_TR_NOOP("&Buffered Rendering")))
->addEventChecked(&g_Config.iRenderingMode);
videoMenu->add(new MenuAction(this, SLOT(linearAct()), QT_TR_NOOP("&Linear Filtering")))
->addEventChecked(&g_Config.iTexFiltering);
videoMenu->addSeparator();
// - Screen Size
MenuTree* screenMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Screen Size"));
screenGroup = new MenuActionGroup(this, screenMenu, SLOT(screenGroup_triggered(QAction *)),
QStringList() << "1x" << "2x" << "3x" << "4x" << "5x" << "6x" << "7x" << "8x" << "9x" << "10x",
QList<int>() << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10,
QList<int>() << Qt::CTRL + Qt::Key_1 << Qt::CTRL + Qt::Key_2 << Qt::CTRL + Qt::Key_3 << Qt::CTRL + Qt::Key_4 << Qt::CTRL + Qt::Key_5
<< Qt::CTRL + Qt::Key_6 << Qt::CTRL + Qt::Key_7 << Qt::CTRL + Qt::Key_8 << Qt::CTRL + Qt::Key_9 << Qt::CTRL + Qt::Key_0);
MenuTree* displayLayoutMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Display Layout Options"));
displayLayoutGroup = new MenuActionGroup(this, displayLayoutMenu, SLOT(displayLayoutGroup_triggered(QAction *)),
QStringList() << "Stretched" << "Partialy stretched" << "Auto Scaling" << "Manual Scaling",
QList<int>() << 0 << 1 << 2 << 3);
videoMenu->addSeparator();
videoMenu->add(new MenuAction(this, SLOT(transformAct()), QT_TR_NOOP("&Hardware Transform"), Qt::Key_F6))
->addEventChecked(&g_Config.bHardwareTransform);
videoMenu->add(new MenuAction(this, SLOT(vertexCacheAct()), QT_TR_NOOP("&Vertex Cache")))
->addEventChecked(&g_Config.bVertexCache);
videoMenu->add(new MenuAction(this, SLOT(frameskipAct()), QT_TR_NOOP("&Frameskip")))
->addEventChecked(&g_Config.iFrameSkip);
videoMenu->add(new MenuAction(this, SLOT(frameskipTypeAct()), QT_TR_NOOP("&FrameSkipType")))
->addEventChecked(&g_Config.iFrameSkipType);
optionsMenu->add(new MenuAction(this, SLOT(audioAct()), QT_TR_NOOP("&Audio")))
->addEventChecked(&g_Config.bEnableSound);
optionsMenu->addSeparator();
// Game settings
MenuTree* gameSettingsMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Game settings"));
gameSettingsMenu->add(new MenuAction(this, SLOT(keepOnTopAct()), QT_TR_NOOP("&Keep PPSSPP on top")))
->addEventChecked(&g_Config.bTopMost);
gameSettingsMenu->add(new MenuAction(this, SLOT(pauseWhenNotFocusedAct()), QT_TR_NOOP("&Pause when not focused")))
->addEventChecked(&g_Config.bPauseOnLostFocus);
gameSettingsMenu->add(new MenuAction(this, SLOT(languageAct()), QT_TR_NOOP("La&nguage...")));
gameSettingsMenu->add(new MenuAction(this, SLOT(controlMappingAct()), QT_TR_NOOP("C&ontrol mapping...")));
gameSettingsMenu->add(new MenuAction(this, SLOT(displayLayoutEditorAct()), QT_TR_NOOP("Display layout editor...")));
gameSettingsMenu->add(new MenuAction(this, SLOT(moreSettingsAct()), QT_TR_NOOP("&More settings...")));
gameSettingsMenu->addSeparator();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
optionsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("&Fullscreen"), Qt::Key_F11))
gameSettingsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("&Fullscreen"), Qt::Key_F11))
#else
optionsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("&Fullscreen"), QKeySequence::FullScreen))
gameSettingsMenu->add(new MenuAction(this, SLOT(fullscrAct()), QT_TR_NOOP("Fu&llscreen"), QKeySequence::FullScreen))
#endif
->addEventChecked(&g_Config.bFullScreen);
optionsMenu->add(new MenuAction(this, SLOT(statsAct()), QT_TR_NOOP("&Show debug statistics")))
->addEventChecked(&g_Config.bShowDebugStats);
optionsMenu->add(new MenuAction(this, SLOT(showFPSAct()), QT_TR_NOOP("&Show FPS")))
gameSettingsMenu->add(new MenuAction(this, SLOT(VSyncAct()), QT_TR_NOOP("VS&ync")))
->addEventChecked(&g_Config.bVSync);
MenuTree* postprocessingShaderMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Postprocessin&g shader"));
postprocessingShaderGroup = new MenuActionGroup(this, postprocessingShaderMenu, SLOT(postprocessingShaderGroup_triggered(QAction *)),
QStringList() << "Off" << "FXAA Antialiasing" << "CRT scanlines" << "Natural Colors" << "Natural Colors (no blur)" << "Vignette" << "Grayscale" << "Bloom" << "Sharpen" << "Inverse Colors" << "Scanlines (CRT)" << "Cartoon" << "4xHQ GLSL" << "AA-Color" << "Spline36 Upscaler" << "5xBR" << "5xBR-lv2" << "Video Smoothing AA" << "Super Sampling AA (Gauss)",
QList<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << 18);
MenuTree* renderingResolutionMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Rendering resolution"));
renderingResolutionGroup = new MenuActionGroup(this, renderingResolutionMenu, SLOT(renderingResolutionGroup_triggered(QAction *)),
QStringList() << "&Auto" << "&1x" << "&2x" << "&3x" << "&4x" << "&5x" << "&6x" << "&7x" << "&8x" << "&9x" << "1&0x",
QList<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10);
// - Window Size
MenuTree* windowMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Window size"));
windowGroup = new MenuActionGroup(this, windowMenu, SLOT(windowGroup_triggered(QAction *)),
QStringList() << "&1x" << "&2x" << "&3x" << "&4x" << "&5x" << "&6x" << "&7x" << "&8x" << "&9x" << "1&0x",
QList<int>() << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10);
MenuTree* renderingModeMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Rendering m&ode"));
renderingModeGroup = new MenuActionGroup(this, renderingModeMenu, SLOT(renderingModeGroup_triggered(QAction *)),
QStringList() << "&Skip buffered effects (non-buffered, faster)" << "&Buffered rendering",
QList<int>() << 0 << 1);
MenuTree* frameSkippingMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Frame skipping"));
frameSkippingMenu->add(new MenuAction(this, SLOT(autoframeskipAct()), QT_TR_NOOP("&Auto")))
->addEventChecked(&g_Config.bAutoFrameSkip);
frameSkippingMenu->addSeparator();
frameSkippingGroup = new MenuActionGroup(this, frameSkippingMenu, SLOT(frameSkippinGroup_triggered(QAction *)),
QStringList() << "&Off" << "&1" << "&2" << "&3" << "&4" << "&5" << "&6" << "&7" << "&8",
QList<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8);
MenuTree* frameSkippingTypeMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Frame skipping type"));
frameSkippingTypeGroup = new MenuActionGroup(this, frameSkippingTypeMenu, SLOT(frameSkippingTypeGroup_triggered(QAction *)),
QStringList() << "Skip number of frames" << "Skip percent of FPS",
QList<int>() << 0 << 1);
MenuTree* textureFilteringMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Te&xture filtering"));
textureFilteringGroup = new MenuActionGroup(this, textureFilteringMenu, SLOT(textureFilteringGroup_triggered(QAction *)),
QStringList() << "&Auto" << "&Nearest" << "&Linear" << "Linear on &FMV",
QList<int>() << 1 << 2 << 3 << 4);
MenuTree* screenScalingFilterMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("Scr&een scaling filter"));
screenScalingFilterGroup = new MenuActionGroup(this, screenScalingFilterMenu, SLOT(screenScalingFilterGroup_triggered(QAction *)),
QStringList() << "&Linear" << "&Nearest",
QList<int>() << 0 << 1);
MenuTree* textureScalingMenu = new MenuTree(this, gameSettingsMenu, QT_TR_NOOP("&Texture scaling"));
textureScalingLevelGroup = new MenuActionGroup(this, textureScalingMenu, SLOT(textureScalingLevelGroup_triggered(QAction *)),
QStringList() << "&Off" << "&Auto" << "&2x" << "&3x" << "&4x" << "&5x",
QList<int>() << 1 << 2 << 3 << 4 << 5 << 6);
textureScalingMenu->addSeparator();
textureScalingTypeGroup = new MenuActionGroup(this, textureScalingMenu, SLOT(textureScalingTypeGroup_triggered(QAction *)),
QStringList() << "&xBRZ" << "&Hybrid" << "&Bicubic" << "H&ybrid + bicubic",
QList<int>() << 0 << 1 << 2 << 3);
textureScalingMenu->addSeparator();
textureScalingMenu->add(new MenuAction(this, SLOT(deposterizeAct()), QT_TR_NOOP("&Deposterize")))
->addEventChecked(&g_Config.bTexDeposterize);
gameSettingsMenu->add(new MenuAction(this, SLOT(transformAct()), QT_TR_NOOP("&Hardware transform")))
->addEventChecked(&g_Config.bHardwareTransform);
gameSettingsMenu->add(new MenuAction(this, SLOT(vertexCacheAct()), QT_TR_NOOP("&Vertex cache")))
->addEventChecked(&g_Config.bVertexCache);
gameSettingsMenu->add(new MenuAction(this, SLOT(showFPSAct()), QT_TR_NOOP("&Show FPS counter")))
->addEventChecked(&g_Config.iShowFPSCounter);
optionsMenu->addSeparator();
// - Log Levels
MenuTree* levelsMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("Lo&g levels"));
QMenu* defaultLogMenu = levelsMenu->addMenu("Default");
defaultLogGroup = new MenuActionGroup(this, defaultLogMenu, SLOT(defaultLogGroup_triggered(QAction *)),
QStringList() << "Debug" << "Warning" << "Info" << "Error",
QList<int>() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR);
QMenu* g3dLogMenu = levelsMenu->addMenu("G3D");
g3dLogGroup = new MenuActionGroup(this, g3dLogMenu, SLOT(g3dLogGroup_triggered(QAction *)),
QStringList() << "Debug" << "Warning" << "Info" << "Error",
QList<int>() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR);
QMenu* hleLogMenu = levelsMenu->addMenu("HLE");
hleLogGroup = new MenuActionGroup(this, hleLogMenu, SLOT(hleLogGroup_triggered(QAction *)),
QStringList() << "Debug" << "Warning" << "Info" << "Error",
QList<int>() << LogTypes::LDEBUG << LogTypes::LWARNING << LogTypes::LINFO << LogTypes::LERROR);
optionsMenu->addSeparator();
// - Language
MenuTree* langMenu = new MenuTree(this, optionsMenu, QT_TR_NOOP("&Language"));
QActionGroup* langGroup = new QActionGroup(this);
QStringList fileNames = QDir(":/languages").entryList(QStringList("ppsspp_*.qm"));
if (fileNames.size() == 0)
{
QAction *action = new QAction("No translations", this);
action->setDisabled(true);
langGroup->addAction(action);
} else {
connect(langGroup, SIGNAL(triggered(QAction *)), this, SLOT(langChanged(QAction *)));
bool found = false;
QString currentLocale = g_Config.sLanguageIni.c_str();
QString currentLang = currentLocale.split('_').first();
for (int i = 0; i < fileNames.size(); ++i)
{
QString locale = fileNames[i];
locale.truncate(locale.lastIndexOf('.'));
locale.remove(0, locale.indexOf('_') + 1);
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
QString language = QLocale(locale).nativeLanguageName();
#else
QString language = QLocale::languageToString(QLocale(locale).language());
#endif
QAction *action = new MenuAction(this, langGroup, locale, language);
std::string testLang = g_Config.sLanguageIni;
if (currentLocale == locale || currentLang == locale) {
action->setChecked(true);
loadLanguage(locale, false);
found = true;
}
if (!found && locale == "en") {
action->setChecked(true);
}
}
}
langMenu->addActions(langGroup->actions());
gameSettingsMenu->addSeparator();
gameSettingsMenu->add(new MenuAction(this, SLOT(audioAct()), QT_TR_NOOP("Enable s&ound")))
->addEventChecked(&g_Config.bEnableSound);
gameSettingsMenu->addSeparator();
gameSettingsMenu->add(new MenuAction(this, SLOT(cheatsAct()), QT_TR_NOOP("Enable &cheats"), Qt::CTRL + Qt::Key_T))
->addEventChecked(&g_Config.bEnableCheats);
// Help
MenuTree* helpMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Help"));

View File

@ -90,14 +90,13 @@ private slots:
void takeScreen() { g_TakeScreenshot = true; }
void consoleAct();
// Options
// Core
void vertexDynarecAct() { g_Config.bVertexDecoderJit = !g_Config.bVertexDecoderJit; }
void fastmemAct() { g_Config.bFastMemory = !g_Config.bFastMemory; }
void ignoreIllegalAct() { g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess; }
// Video
void anisotropicGroup_triggered(QAction *action) { g_Config.iAnisotropyLevel = action->data().toInt(); }
// Game settings
void keepOnTopAct() { g_Config.bTopMost = !g_Config.bTopMost; }
void pauseWhenNotFocusedAct() { g_Config.bPauseOnLostFocus = !g_Config.bPauseOnLostFocus; }
void languageAct() { NativeMessageReceived("language screen", ""); }
void controlMappingAct() { NativeMessageReceived("control mapping", ""); }
void displayLayoutEditorAct() { NativeMessageReceived("display layout editor", ""); }
void moreSettingsAct() { NativeMessageReceived("settings", ""); }
void bufferRenderAct() {
g_Config.iRenderingMode = !g_Config.iRenderingMode;
@ -105,12 +104,23 @@ private slots:
}
void linearAct() { g_Config.iTexFiltering = (g_Config.iTexFiltering != 0) ? 0 : 3; }
void screenGroup_triggered(QAction *action) { SetWindowScale(action->data().toInt()); }
void postprocessingShaderGroup_triggered(QAction *action) { g_Config.sPostShaderName = action->data().toInt(); }
void renderingResolutionGroup_triggered(QAction *action) { g_Config.iInternalResolution = action->data().toInt(); }
void windowGroup_triggered(QAction *action) { SetWindowScale(action->data().toInt()); }
void displayLayoutGroup_triggered(QAction *action) {
g_Config.iSmallDisplayZoomType = action->data().toInt();
NativeMessageReceived("gpu_resized", "");
}
void renderingModeGroup_triggered(QAction *action) { g_Config.iRenderingMode = action->data().toInt(); }
void autoframeskipAct() { g_Config.bAutoFrameSkip = !g_Config.bAutoFrameSkip; }
void frameSkippingGroup_triggered(QAction *action) { g_Config.iFrameSkip = action->data().toInt(); }
void frameSkippingTypeGroup_triggered(QAction *action) { g_Config.iFrameSkipType = action->data().toInt(); }
void textureFilteringGroup_triggered(QAction *action) { g_Config.iTexFiltering = action->data().toInt(); }
void screenScalingFilterGroup_triggered(QAction *action) { g_Config.iBufFilter = action->data().toInt(); }
void textureScalingLevelGroup_triggered(QAction *action) { g_Config.iTexScalingLevel = action->data().toInt(); }
void textureScalingTypeGroup_triggered(QAction *action) { g_Config.iTexScalingType = action->data().toInt(); }
void deposterizeAct() { g_Config.bTexDeposterize = !g_Config.bTexDeposterize; }
void transformAct() {
g_Config.bHardwareTransform = !g_Config.bHardwareTransform;
NativeMessageReceived("gpu_resized", "");
@ -122,28 +132,18 @@ private slots:
// Sound
void audioAct() { g_Config.bEnableSound = !g_Config.bEnableSound; }
// Cheats
void cheatsAct() { g_Config.bEnableCheats = !g_Config.bEnableCheats; }
void fullscrAct();
void raiseTopMost();
void statsAct() {
g_Config.bShowDebugStats = !g_Config.bShowDebugStats;
NativeMessageReceived("clear jit", "");
}
void VSyncAct() { g_Config.bVSync = !g_Config.bVSync; }
void showFPSAct() { g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter; }
// Logs
void defaultLogGroup_triggered(QAction * action) {
LogTypes::LOG_LEVELS level = (LogTypes::LOG_LEVELS)action->data().toInt();
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
if(type == LogTypes::G3D || type == LogTypes::HLE)
continue;
LogManager::GetInstance()->SetLogLevel(type, level);
}
}
void g3dLogGroup_triggered(QAction * action) { LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, (LogTypes::LOG_LEVELS)action->data().toInt()); }
void hleLogGroup_triggered(QAction * action) { LogManager::GetInstance()->SetLogLevel(LogTypes::HLE, (LogTypes::LOG_LEVELS)action->data().toInt()); }
// Help
void websiteAct();
void forumAct();
@ -169,8 +169,11 @@ private:
CoreState nextState;
GlobalUIState lastUIState;
QActionGroup *anisotropicGroup, *screenGroup, *displayLayoutGroup,
*defaultLogGroup, *g3dLogGroup, *hleLogGroup;
QActionGroup *windowGroup, *postprocessingShaderGroup,
*textureScalingLevelGroup, *textureScalingTypeGroup,
*screenScalingFilterGroup, *textureFilteringGroup,
*frameSkippingTypeGroup, *frameSkippingGroup,
*renderingModeGroup, *renderingResolutionGroup;
std::queue<MainWindowMsg> msgQueue_;
std::mutex msgMutex_;