mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-27 08:05:41 +00:00
Qt: Add shutdown without saving menu option
This commit is contained in:
parent
6a04803502
commit
b0398f5aa7
|
@ -374,6 +374,10 @@ void AndroidHostInterface::EmulationThreadEntryPoint(jobject emulation_activity,
|
||||||
EmulationThreadLoop();
|
EmulationThreadLoop();
|
||||||
|
|
||||||
thread_env->CallVoidMethod(m_emulation_activity_object, s_EmulationActivity_method_onEmulationStopped);
|
thread_env->CallVoidMethod(m_emulation_activity_object, s_EmulationActivity_method_onEmulationStopped);
|
||||||
|
|
||||||
|
if (g_settings.save_state_on_exit)
|
||||||
|
SaveResumeSaveState();
|
||||||
|
|
||||||
PowerOffSystem();
|
PowerOffSystem();
|
||||||
DestroyImGuiContext();
|
DestroyImGuiContext();
|
||||||
thread_env->DeleteGlobalRef(m_emulation_activity_object);
|
thread_env->DeleteGlobalRef(m_emulation_activity_object);
|
||||||
|
|
|
@ -810,6 +810,7 @@ void MainWindow::updateEmulationActions(bool starting, bool running)
|
||||||
m_ui.actionResumeLastState->setDisabled(starting || running);
|
m_ui.actionResumeLastState->setDisabled(starting || running);
|
||||||
|
|
||||||
m_ui.actionPowerOff->setDisabled(starting || !running);
|
m_ui.actionPowerOff->setDisabled(starting || !running);
|
||||||
|
m_ui.actionPowerOffWithoutSaving->setDisabled(starting || !running);
|
||||||
m_ui.actionReset->setDisabled(starting || !running);
|
m_ui.actionReset->setDisabled(starting || !running);
|
||||||
m_ui.actionPause->setDisabled(starting || !running);
|
m_ui.actionPause->setDisabled(starting || !running);
|
||||||
m_ui.actionChangeDisc->setDisabled(starting || !running);
|
m_ui.actionChangeDisc->setDisabled(starting || !running);
|
||||||
|
@ -926,6 +927,8 @@ void MainWindow::connectSignals()
|
||||||
connect(m_ui.actionAddGameDirectory, &QAction::triggered,
|
connect(m_ui.actionAddGameDirectory, &QAction::triggered,
|
||||||
[this]() { getSettingsDialog()->getGameListSettingsWidget()->addSearchDirectory(this); });
|
[this]() { getSettingsDialog()->getGameListSettingsWidget()->addSearchDirectory(this); });
|
||||||
connect(m_ui.actionPowerOff, &QAction::triggered, m_host_interface, &QtHostInterface::powerOffSystem);
|
connect(m_ui.actionPowerOff, &QAction::triggered, m_host_interface, &QtHostInterface::powerOffSystem);
|
||||||
|
connect(m_ui.actionPowerOffWithoutSaving, &QAction::triggered, m_host_interface,
|
||||||
|
&QtHostInterface::powerOffSystemWithoutSaving);
|
||||||
connect(m_ui.actionReset, &QAction::triggered, m_host_interface, &QtHostInterface::resetSystem);
|
connect(m_ui.actionReset, &QAction::triggered, m_host_interface, &QtHostInterface::resetSystem);
|
||||||
connect(m_ui.actionPause, &QAction::toggled, [this](bool active) { m_host_interface->pauseSystem(active); });
|
connect(m_ui.actionPause, &QAction::toggled, [this](bool active) { m_host_interface->pauseSystem(active); });
|
||||||
connect(m_ui.actionScreenshot, &QAction::triggered, m_host_interface, &QtHostInterface::saveScreenshot);
|
connect(m_ui.actionScreenshot, &QAction::triggered, m_host_interface, &QtHostInterface::saveScreenshot);
|
||||||
|
|
|
@ -87,6 +87,7 @@
|
||||||
<addaction name="actionResumeLastState"/>
|
<addaction name="actionResumeLastState"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionPowerOff"/>
|
<addaction name="actionPowerOff"/>
|
||||||
|
<addaction name="actionPowerOffWithoutSaving"/>
|
||||||
<addaction name="actionReset"/>
|
<addaction name="actionReset"/>
|
||||||
<addaction name="actionPause"/>
|
<addaction name="actionPause"/>
|
||||||
<addaction name="menuChangeDisc"/>
|
<addaction name="menuChangeDisc"/>
|
||||||
|
@ -177,7 +178,7 @@
|
||||||
<addaction name="actionDebugDumpVRAMtoCPUCopies"/>
|
<addaction name="actionDebugDumpVRAMtoCPUCopies"/>
|
||||||
<addaction name="actionDumpAudio"/>
|
<addaction name="actionDumpAudio"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionCPUDebugger" />
|
<addaction name="actionCPUDebugger"/>
|
||||||
<addaction name="actionDumpRAM"/>
|
<addaction name="actionDumpRAM"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionDebugShowVRAM"/>
|
<addaction name="actionDebugShowVRAM"/>
|
||||||
|
@ -790,6 +791,15 @@
|
||||||
<string>Open Data Directory...</string>
|
<string>Open Data Directory...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionPowerOffWithoutSaving">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources/resources.qrc">
|
||||||
|
<normaloff>:/icons/process-stop.png</normaloff>:/icons/process-stop.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Power Off &Without Saving</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resources/resources.qrc"/>
|
<include location="resources/resources.qrc"/>
|
||||||
|
|
|
@ -808,6 +808,20 @@ void QtHostInterface::powerOffSystem()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_settings.save_state_on_exit)
|
||||||
|
SaveResumeSaveState();
|
||||||
|
|
||||||
|
PowerOffSystem();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtHostInterface::powerOffSystemWithoutSaving()
|
||||||
|
{
|
||||||
|
if (!isOnWorkerThread())
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod(this, "powerOffSystemWithoutSaving", Qt::QueuedConnection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PowerOffSystem();
|
PowerOffSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,7 @@ public Q_SLOTS:
|
||||||
void resumeSystemFromState(const QString& filename, bool boot_on_failure);
|
void resumeSystemFromState(const QString& filename, bool boot_on_failure);
|
||||||
void resumeSystemFromMostRecentState();
|
void resumeSystemFromMostRecentState();
|
||||||
void powerOffSystem();
|
void powerOffSystem();
|
||||||
|
void powerOffSystemWithoutSaving();
|
||||||
void synchronousPowerOffSystem();
|
void synchronousPowerOffSystem();
|
||||||
void resetSystem();
|
void resetSystem();
|
||||||
void pauseSystem(bool paused, bool wait_until_paused = false);
|
void pauseSystem(bool paused, bool wait_until_paused = false);
|
||||||
|
|
BIN
src/duckstation-qt/resources/icons/process-stop.png
Normal file
BIN
src/duckstation-qt/resources/icons/process-stop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
BIN
src/duckstation-qt/resources/icons/process-stop@2x.png
Normal file
BIN
src/duckstation-qt/resources/icons/process-stop@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
|
@ -92,6 +92,8 @@
|
||||||
<file>icons/preferences-desktop-keyboard-shortcuts@2x.png</file>
|
<file>icons/preferences-desktop-keyboard-shortcuts@2x.png</file>
|
||||||
<file>icons/preferences-system.png</file>
|
<file>icons/preferences-system.png</file>
|
||||||
<file>icons/preferences-system@2x.png</file>
|
<file>icons/preferences-system@2x.png</file>
|
||||||
|
<file>icons/process-stop.png</file>
|
||||||
|
<file>icons/process-stop@2x.png</file>
|
||||||
<file>icons/software-update-available.png</file>
|
<file>icons/software-update-available.png</file>
|
||||||
<file>icons/software-update-available@2x.png</file>
|
<file>icons/software-update-available@2x.png</file>
|
||||||
<file>icons/star-0.png</file>
|
<file>icons/star-0.png</file>
|
||||||
|
|
|
@ -673,7 +673,11 @@ void SDLHostInterface::DrawMainMenuBar()
|
||||||
|
|
||||||
if (ImGui::MenuItem("Power Off", nullptr, false, system_enabled))
|
if (ImGui::MenuItem("Power Off", nullptr, false, system_enabled))
|
||||||
{
|
{
|
||||||
RunLater([this]() { DestroySystem(); });
|
RunLater([this]() {
|
||||||
|
if (g_settings.save_state_on_exit)
|
||||||
|
SaveResumeSaveState();
|
||||||
|
PowerOffSystem();
|
||||||
|
});
|
||||||
ClearImGuiFocus();
|
ClearImGuiFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,9 +174,6 @@ void CommonHostInterface::PowerOffSystem()
|
||||||
if (System::IsShutdown())
|
if (System::IsShutdown())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g_settings.save_state_on_exit)
|
|
||||||
SaveResumeSaveState();
|
|
||||||
|
|
||||||
HostInterface::PowerOffSystem();
|
HostInterface::PowerOffSystem();
|
||||||
|
|
||||||
if (InBatchMode())
|
if (InBatchMode())
|
||||||
|
@ -1489,6 +1486,9 @@ void CommonHostInterface::RegisterGeneralHotkeys()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_settings.save_state_on_exit)
|
||||||
|
SaveResumeSaveState();
|
||||||
|
|
||||||
PowerOffSystem();
|
PowerOffSystem();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue