Qt: Stub saving resume state when powering off

This commit is contained in:
Connor McLaughlin 2020-01-24 14:50:54 +10:00
parent 0200b9ffc1
commit 069bdd471c
3 changed files with 10 additions and 8 deletions

View File

@ -271,7 +271,7 @@ void MainWindow::connectSignals()
&MainWindow::onChangeDiscFromGameListActionTriggered);
connect(m_ui.actionAddGameDirectory, &QAction::triggered,
[this]() { getSettingsDialog()->getGameListSettingsWidget()->addSearchDirectory(this); });
connect(m_ui.actionPowerOff, &QAction::triggered, m_host_interface, &QtHostInterface::powerOffSystem);
connect(m_ui.actionPowerOff, &QAction::triggered, [this]() { m_host_interface->powerOffSystem(true, false); });
connect(m_ui.actionReset, &QAction::triggered, m_host_interface, &QtHostInterface::resetSystem);
connect(m_ui.actionPause, &QAction::toggled, m_host_interface, &QtHostInterface::pauseSystem);
connect(m_ui.actionLoadState, &QAction::triggered, this, [this]() { m_ui.menuLoadState->exec(QCursor::pos()); });

View File

@ -383,21 +383,23 @@ void QtHostInterface::addButtonToInputMap(const QString& binding, InputButtonHan
}
}
void QtHostInterface::powerOffSystem()
void QtHostInterface::powerOffSystem(bool save_resume_state /* = false */, bool block_until_done /* = false */)
{
if (!isOnWorkerThread())
{
QMetaObject::invokeMethod(this, "powerOffSystem", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "powerOffSystem",
block_until_done ? Qt::BlockingQueuedConnection : Qt::QueuedConnection,
Q_ARG(bool, save_resume_state), Q_ARG(bool, block_until_done));
return;
}
if (!m_system)
{
Log_ErrorPrintf("powerOffSystem() called without system");
return;
}
m_system.reset();
if (save_resume_state)
Log_InfoPrintf("TODO: Save resume state");
DestroySystem();
m_audio_stream->PauseOutput(true);
m_display_window->destroyDeviceContext();

View File

@ -74,7 +74,7 @@ Q_SIGNALS:
public Q_SLOTS:
void applySettings();
void powerOffSystem();
void powerOffSystem(bool save_resume_state = false, bool block_until_done = false);
void resetSystem();
void pauseSystem(bool paused);
void changeDisc(QString new_disc_filename);