mirror of https://github.com/mgba-emu/mgba.git
Qt: Add option to pause on minimizing window (closes #1379)
This commit is contained in:
parent
a9e96c7d00
commit
ecc6141c67
1
CHANGES
1
CHANGES
|
@ -55,6 +55,7 @@ Misc:
|
||||||
- Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292)
|
- Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292)
|
||||||
- mGUI: Remember name and position of last loaded game
|
- mGUI: Remember name and position of last loaded game
|
||||||
- Core: Create game-related paths if they don't exist (fixes mgba.io/i/1446)
|
- Core: Create game-related paths if they don't exist (fixes mgba.io/i/1446)
|
||||||
|
- Qt: Add option to pause on minimizing window (closes mgba.io/i/1379)
|
||||||
|
|
||||||
0.7.2: (2019-05-25)
|
0.7.2: (2019-05-25)
|
||||||
Emulation fixes:
|
Emulation fixes:
|
||||||
|
|
|
@ -387,6 +387,7 @@ void SettingsView::updateConfig() {
|
||||||
saveSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
|
saveSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
|
||||||
saveSetting("suspendScreensaver", m_ui.suspendScreensaver);
|
saveSetting("suspendScreensaver", m_ui.suspendScreensaver);
|
||||||
saveSetting("pauseOnFocusLost", m_ui.pauseOnFocusLost);
|
saveSetting("pauseOnFocusLost", m_ui.pauseOnFocusLost);
|
||||||
|
saveSetting("pauseOnMinimize", m_ui.pauseOnMinimize);
|
||||||
saveSetting("savegamePath", m_ui.savegamePath);
|
saveSetting("savegamePath", m_ui.savegamePath);
|
||||||
saveSetting("savestatePath", m_ui.savestatePath);
|
saveSetting("savestatePath", m_ui.savestatePath);
|
||||||
saveSetting("screenshotPath", m_ui.screenshotPath);
|
saveSetting("screenshotPath", m_ui.screenshotPath);
|
||||||
|
@ -550,6 +551,7 @@ void SettingsView::reloadConfig() {
|
||||||
loadSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
|
loadSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
|
||||||
loadSetting("suspendScreensaver", m_ui.suspendScreensaver);
|
loadSetting("suspendScreensaver", m_ui.suspendScreensaver);
|
||||||
loadSetting("pauseOnFocusLost", m_ui.pauseOnFocusLost);
|
loadSetting("pauseOnFocusLost", m_ui.pauseOnFocusLost);
|
||||||
|
loadSetting("pauseOnMinimize", m_ui.pauseOnMinimize);
|
||||||
loadSetting("savegamePath", m_ui.savegamePath);
|
loadSetting("savegamePath", m_ui.savegamePath);
|
||||||
loadSetting("savestatePath", m_ui.savestatePath);
|
loadSetting("savestatePath", m_ui.savestatePath);
|
||||||
loadSetting("screenshotPath", m_ui.screenshotPath);
|
loadSetting("screenshotPath", m_ui.screenshotPath);
|
||||||
|
|
|
@ -562,7 +562,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="10" column="1">
|
||||||
<widget class="QCheckBox" name="showFps">
|
<widget class="QCheckBox" name="showFps">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show FPS in title bar</string>
|
<string>Show FPS in title bar</string>
|
||||||
|
@ -572,21 +572,21 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="0" colspan="2">
|
<item row="12" column="0" colspan="2">
|
||||||
<widget class="Line" name="line_13">
|
<widget class="Line" name="line_13">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="14" column="0" colspan="2">
|
<item row="15" column="0" colspan="2">
|
||||||
<widget class="Line" name="line_16">
|
<widget class="Line" name="line_16">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="15" column="1">
|
<item row="16" column="1">
|
||||||
<widget class="QCheckBox" name="cheatAutosave">
|
<widget class="QCheckBox" name="cheatAutosave">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically save cheats</string>
|
<string>Automatically save cheats</string>
|
||||||
|
@ -596,7 +596,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="16" column="1">
|
<item row="17" column="1">
|
||||||
<widget class="QCheckBox" name="cheatAutoload">
|
<widget class="QCheckBox" name="cheatAutoload">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically load cheats</string>
|
<string>Automatically load cheats</string>
|
||||||
|
@ -606,7 +606,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<item row="13" column="1">
|
||||||
<widget class="QCheckBox" name="autosave">
|
<widget class="QCheckBox" name="autosave">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically save state</string>
|
<string>Automatically save state</string>
|
||||||
|
@ -616,7 +616,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="1">
|
<item row="14" column="1">
|
||||||
<widget class="QCheckBox" name="autoload">
|
<widget class="QCheckBox" name="autoload">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically load state</string>
|
<string>Automatically load state</string>
|
||||||
|
@ -626,13 +626,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="11" column="1">
|
||||||
<widget class="QCheckBox" name="useDiscordPresence">
|
<widget class="QCheckBox" name="useDiscordPresence">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable Discord Rich Presence</string>
|
<string>Enable Discord Rich Presence</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="9" column="1">
|
||||||
|
<widget class="QCheckBox" name="pauseOnMinimize">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pause when minimized</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="emulation">
|
<widget class="QWidget" name="emulation">
|
||||||
|
|
|
@ -602,6 +602,13 @@ void Window::resizeEvent(QResizeEvent* event) {
|
||||||
|
|
||||||
void Window::showEvent(QShowEvent* event) {
|
void Window::showEvent(QShowEvent* event) {
|
||||||
if (m_wasOpened) {
|
if (m_wasOpened) {
|
||||||
|
if (event->spontaneous() && m_config->getOption("pauseOnMinimize").toInt() && m_controller) {
|
||||||
|
focusCheck();
|
||||||
|
if (m_autoresume) {
|
||||||
|
m_controller->setPaused(false);
|
||||||
|
m_autoresume = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_wasOpened = true;
|
m_wasOpened = true;
|
||||||
|
@ -623,6 +630,19 @@ void Window::showEvent(QShowEvent* event) {
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::hideEvent(QHideEvent* event) {
|
||||||
|
if (!event->spontaneous()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!m_config->getOption("pauseOnMinimize").toInt() || !m_controller) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!m_controller->isPaused()) {
|
||||||
|
m_autoresume = true;
|
||||||
|
m_controller->setPaused(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Window::closeEvent(QCloseEvent* event) {
|
void Window::closeEvent(QCloseEvent* event) {
|
||||||
emit shutdown();
|
emit shutdown();
|
||||||
m_config->setQtOption("windowPos", pos());
|
m_config->setQtOption("windowPos", pos());
|
||||||
|
|
|
@ -116,6 +116,7 @@ protected:
|
||||||
virtual void keyReleaseEvent(QKeyEvent* event) override;
|
virtual void keyReleaseEvent(QKeyEvent* event) override;
|
||||||
virtual void resizeEvent(QResizeEvent*) override;
|
virtual void resizeEvent(QResizeEvent*) override;
|
||||||
virtual void showEvent(QShowEvent*) override;
|
virtual void showEvent(QShowEvent*) override;
|
||||||
|
virtual void hideEvent(QHideEvent*) override;
|
||||||
virtual void closeEvent(QCloseEvent*) override;
|
virtual void closeEvent(QCloseEvent*) override;
|
||||||
virtual void focusInEvent(QFocusEvent*) override;
|
virtual void focusInEvent(QFocusEvent*) override;
|
||||||
virtual void focusOutEvent(QFocusEvent*) override;
|
virtual void focusOutEvent(QFocusEvent*) override;
|
||||||
|
|
Loading…
Reference in New Issue