Skip to content

Unification of the menu of Linux and Windows versions #12817

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

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
35 changes: 28 additions & 7 deletions Qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ void MainWindow::newFrame()

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);
Expand Down Expand Up @@ -165,7 +172,7 @@ void MainWindow::bootDone()
}

/* SIGNALS */
void MainWindow::openAct()
void MainWindow::loadAct()
{
QString filename = QFileDialog::getOpenFileName(NULL, "Load File", g_Config.currentDirectory.c_str(), "PSP ROMs (*.pbp *.elf *.iso *.cso *.prx)");
if (QFile::exists(filename))
Expand All @@ -184,6 +191,13 @@ void MainWindow::closeAct()
SetGameTitle("");
}

void MainWindow::openmsAct()
{
QString confighome = getenv("XDG_CONFIG_HOME");
QString memorystick = confighome + "/ppsspp/PSP";
QDesktopServices::openUrl(QUrl(memorystick));
}

void SaveStateActionFinished(SaveState::Status status, const std::string &message, void *userdata)
{
// TODO: Improve messaging?
Expand Down Expand Up @@ -508,21 +522,28 @@ void MainWindow::createMenus()
{
// File
MenuTree* fileMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&File"));
fileMenu->add(new MenuAction(this, SLOT(openAct()), QT_TR_NOOP("&Open..."), QKeySequence::Open))
fileMenu->add(new MenuAction(this, SLOT(loadAct()), QT_TR_NOOP("&Load...")))
->addEnableState(UISTATE_MENU);
fileMenu->add(new MenuAction(this, SLOT(closeAct()), QT_TR_NOOP("&Close"), QKeySequence::Close))
->addDisableState(UISTATE_MENU);
fileMenu->addSeparator();
fileMenu->add(new MenuAction(this, SLOT(qlstateAct()), QT_TR_NOOP("Quickload State"), Qt::Key_F4))
fileMenu->add(new MenuAction(this, SLOT(openmsAct()), QT_TR_NOOP("Open &Memory stick")))
->addEnableState(UISTATE_MENU);
fileMenu->addSeparator();
MenuTree* savestateMenu = new MenuTree(this, fileMenu, QT_TR_NOOP("Saves&tate slot"));
saveStateGroup = new MenuActionGroup(this, savestateMenu, SLOT(saveStateGroup_triggered(QAction *)),
QStringList() << "1" << "2" << "3" << "4" << "5",
QList<int>() << 0 << 1 << 2 << 3 << 4);
fileMenu->add(new MenuAction(this, SLOT(qlstateAct()), QT_TR_NOOP("L&oad state"), Qt::Key_F4))
->addDisableState(UISTATE_MENU);
fileMenu->add(new MenuAction(this, SLOT(qsstateAct()), QT_TR_NOOP("Quicksave State"), Qt::Key_F2))
fileMenu->add(new MenuAction(this, SLOT(qsstateAct()), QT_TR_NOOP("S&ave state"), Qt::Key_F2))
->addDisableState(UISTATE_MENU);
fileMenu->add(new MenuAction(this, SLOT(lstateAct()), QT_TR_NOOP("&Load State File...")))
fileMenu->add(new MenuAction(this, SLOT(lstateAct()), QT_TR_NOOP("&Load state file...")))
->addDisableState(UISTATE_MENU);
fileMenu->add(new MenuAction(this, SLOT(sstateAct()), QT_TR_NOOP("&Save State File...")))
fileMenu->add(new MenuAction(this, SLOT(sstateAct()), QT_TR_NOOP("&Save state file...")))
->addDisableState(UISTATE_MENU);
fileMenu->addSeparator();
fileMenu->add(new MenuAction(this, SLOT(exitAct()), QT_TR_NOOP("E&xit"), QKeySequence::Quit));
fileMenu->add(new MenuAction(this, SLOT(exitAct()), QT_TR_NOOP("E&xit"), Qt::ALT + Qt::Key_F4));

// Emulation
MenuTree* emuMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Emulation"));
Expand Down
6 changes: 4 additions & 2 deletions Qt/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ public slots:

private slots:
// File
void openAct();
void loadAct();
void closeAct();
void openmsAct();
void saveStateGroup_triggered(QAction *action) { g_Config.iCurrentStateSlot = action->data().toInt(); }
void qlstateAct();
void qsstateAct();
void lstateAct();
Expand Down Expand Up @@ -178,7 +180,7 @@ private slots:
*screenScalingFilterGroup, *textureFilteringGroup,
*frameSkippingTypeGroup, *frameSkippingGroup,
*renderingModeGroup, *renderingResolutionGroup,
*displayRotationGroup;
*displayRotationGroup, *saveStateGroup;

std::queue<MainWindowMsg> msgQueue_;
std::mutex msgMutex_;
Expand Down