Qt: Add Resume button

This commit is contained in:
Connor McLaughlin 2020-05-23 15:03:00 +10:00
parent e24e4c20e1
commit e6d52ce6de
4 changed files with 30 additions and 3 deletions

View File

@ -435,7 +435,7 @@ void MainWindow::updateEmulationActions(bool starting, bool running)
{
m_ui.actionStartDisc->setDisabled(starting || running);
m_ui.actionStartBios->setDisabled(starting || running);
m_ui.actionPowerOff->setDisabled(starting || running);
m_ui.actionResumeLastState->setDisabled(starting || running);
m_ui.actionPowerOff->setDisabled(starting || !running);
m_ui.actionReset->setDisabled(starting || !running);
@ -490,6 +490,7 @@ void MainWindow::connectSignals()
connect(m_ui.actionStartDisc, &QAction::triggered, this, &MainWindow::onStartDiscActionTriggered);
connect(m_ui.actionStartBios, &QAction::triggered, this, &MainWindow::onStartBIOSActionTriggered);
connect(m_ui.actionResumeLastState, &QAction::triggered, m_host_interface, &QtHostInterface::resumeSystemFromMostRecentState);
connect(m_ui.actionChangeDisc, &QAction::triggered, [this] { m_ui.menuChangeDisc->exec(QCursor::pos()); });
connect(m_ui.actionChangeDiscFromFile, &QAction::triggered, this, &MainWindow::onChangeDiscFromFileActionTriggered);
connect(m_ui.actionChangeDiscFromGameList, &QAction::triggered, this,

View File

@ -69,6 +69,7 @@
</widget>
<addaction name="actionStartDisc"/>
<addaction name="actionStartBios"/>
<addaction name="actionResumeLastState"/>
<addaction name="separator"/>
<addaction name="actionPowerOff"/>
<addaction name="actionReset"/>
@ -97,6 +98,7 @@
<addaction name="actionAdvancedSettings"/>
<addaction name="separator"/>
<addaction name="actionAddGameDirectory"/>
<addaction name="actionRefreshGameList"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuHelp">
@ -163,7 +165,7 @@
</attribute>
<addaction name="actionStartDisc"/>
<addaction name="actionStartBios"/>
<addaction name="actionRefreshGameList"/>
<addaction name="actionResumeLastState"/>
<addaction name="separator"/>
<addaction name="actionPowerOff"/>
<addaction name="actionReset"/>
@ -202,7 +204,7 @@
<normaloff>:/icons/folder-open.png</normaloff>:/icons/folder-open.png</iconset>
</property>
<property name="text">
<string>Refresh</string>
<string>&amp;Refresh Game List</string>
</property>
</action>
<action name="actionPowerOff">
@ -506,6 +508,18 @@
<string>&amp;Memory Card Settings...</string>
</property>
</action>
<action name="actionResumeLastState">
<property name="icon">
<iconset resource="resources/icons.qrc">
<normaloff>:/icons/media-playback-start.png</normaloff>:/icons/media-playback-start.png</iconset>
</property>
<property name="text">
<string>Resume</string>
</property>
<property name="toolTip">
<string>Resumes the last save state created.</string>
</property>
</action>
</widget>
<resources>
<include location="resources/icons.qrc"/>

View File

@ -227,6 +227,17 @@ void QtHostInterface::resumeSystemFromState(const QString& filename, bool boot_o
HostInterface::ResumeSystemFromState(filename.toStdString().c_str(), boot_on_failure);
}
void QtHostInterface::resumeSystemFromMostRecentState()
{
if (!isOnWorkerThread())
{
QMetaObject::invokeMethod(this, "resumeSystemFromMostRecentState");
return;
}
HostInterface::ResumeSystemFromMostRecentState();
}
void QtHostInterface::onDisplayWindowKeyEvent(int key, bool pressed)
{
DebugAssert(isOnWorkerThread());

View File

@ -118,6 +118,7 @@ public Q_SLOTS:
void onDisplayWindowMouseButtonEvent(int button, bool pressed);
void bootSystem(const SystemBootParameters& params);
void resumeSystemFromState(const QString& filename, bool boot_on_failure);
void resumeSystemFromMostRecentState();
void powerOffSystem();
void synchronousPowerOffSystem();
void resetSystem();