Skip to content

Commit

Permalink
Update "File" menu to match Windows version
Browse files Browse the repository at this point in the history
  • Loading branch information
TotalCaesar659 committed Apr 12, 2020
1 parent c3dbd2b commit b0dabc6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
35 changes: 28 additions & 7 deletions Qt/mainwindow.cpp
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
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

0 comments on commit b0dabc6

Please sign in to comment.