parent
8a3a8b7c68
commit
faf7cf752d
|
@ -34,6 +34,8 @@ InterfaceSettingsDialog::InterfaceSettingsDialog(QWidget* parent) : QDialog(pare
|
||||||
ui->cbMouseHide->setChecked(Config::MouseHide != 0);
|
ui->cbMouseHide->setChecked(Config::MouseHide != 0);
|
||||||
ui->spinMouseHideSeconds->setEnabled(Config::MouseHide != 0);
|
ui->spinMouseHideSeconds->setEnabled(Config::MouseHide != 0);
|
||||||
ui->spinMouseHideSeconds->setValue(Config::MouseHideSeconds);
|
ui->spinMouseHideSeconds->setValue(Config::MouseHideSeconds);
|
||||||
|
ui->cbPauseLostFocus->setChecked(Config::PauseLostFocus != 0);
|
||||||
|
oldPauseLostFocusVal = ui->cbPauseLostFocus->isChecked() ? 1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
InterfaceSettingsDialog::~InterfaceSettingsDialog()
|
InterfaceSettingsDialog::~InterfaceSettingsDialog()
|
||||||
|
@ -59,6 +61,7 @@ void InterfaceSettingsDialog::done(int r)
|
||||||
{
|
{
|
||||||
Config::MouseHide = ui->cbMouseHide->isChecked() ? 1:0;
|
Config::MouseHide = ui->cbMouseHide->isChecked() ? 1:0;
|
||||||
Config::MouseHideSeconds = ui->spinMouseHideSeconds->value();
|
Config::MouseHideSeconds = ui->spinMouseHideSeconds->value();
|
||||||
|
Config::PauseLostFocus = ui->cbPauseLostFocus->isChecked() ? 1:0;
|
||||||
|
|
||||||
Config::Save();
|
Config::Save();
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>209</width>
|
<width>262</width>
|
||||||
<height>110</height>
|
<height>113</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -20,31 +20,31 @@
|
||||||
<string>Interface settings - melonDS</string>
|
<string>Interface settings - melonDS</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="3">
|
<item row="1" column="0" alignment="Qt::AlignLeft">
|
||||||
<widget class="QCheckBox" name="cbMouseHide">
|
|
||||||
<property name="text">
|
|
||||||
<string>Hide mouse after inactivity</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Hide after</string>
|
<string>Hide after</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="0" colspan="4">
|
||||||
<widget class="QSpinBox" name="spinMouseHideSeconds"/>
|
<widget class="QCheckBox" name="cbPauseLostFocus">
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>seconds of inactivity</string>
|
<string>Pause emulation when window is not in focus</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="3">
|
<item row="0" column="0" colspan="5">
|
||||||
|
<widget class="QCheckBox" name="cbMouseHide">
|
||||||
|
<property name="text">
|
||||||
|
<string>Hide mouse after inactivity</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" alignment="Qt::AlignLeft">
|
||||||
|
<widget class="QSpinBox" name="spinMouseHideSeconds"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="5">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -54,6 +54,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>seconds of inactivity</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
@ -80,6 +80,8 @@ int EnableCheats;
|
||||||
int MouseHide;
|
int MouseHide;
|
||||||
int MouseHideSeconds;
|
int MouseHideSeconds;
|
||||||
|
|
||||||
|
int PauseLostFocus;
|
||||||
|
|
||||||
bool EnableJIT;
|
bool EnableJIT;
|
||||||
|
|
||||||
ConfigEntry PlatformConfigFile[] =
|
ConfigEntry PlatformConfigFile[] =
|
||||||
|
@ -190,6 +192,7 @@ ConfigEntry PlatformConfigFile[] =
|
||||||
|
|
||||||
{"MouseHide", 0, &MouseHide, 0, NULL, 0},
|
{"MouseHide", 0, &MouseHide, 0, NULL, 0},
|
||||||
{"MouseHideSeconds", 0, &MouseHideSeconds, 5, NULL, 0},
|
{"MouseHideSeconds", 0, &MouseHideSeconds, 5, NULL, 0},
|
||||||
|
{"PauseLostFocus", 0, &PauseLostFocus, 0, NULL, 0},
|
||||||
|
|
||||||
{"", -1, NULL, 0, NULL, 0}
|
{"", -1, NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
|
@ -94,6 +94,7 @@ extern int EnableCheats;
|
||||||
|
|
||||||
extern int MouseHide;
|
extern int MouseHide;
|
||||||
extern int MouseHideSeconds;
|
extern int MouseHideSeconds;
|
||||||
|
extern int PauseLostFocus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1534,6 +1534,19 @@ void MainWindow::dropEvent(QDropEvent* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onAppStateChanged(Qt::ApplicationState state)
|
||||||
|
{
|
||||||
|
if (state == Qt::ApplicationInactive)
|
||||||
|
{
|
||||||
|
if (Config::PauseLostFocus && emuThread->emuIsRunning())
|
||||||
|
emuThread->emuPause();
|
||||||
|
}
|
||||||
|
else if (state == Qt::ApplicationActive)
|
||||||
|
{
|
||||||
|
if (Config::PauseLostFocus && !pausedManually)
|
||||||
|
emuThread->emuUnpause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString MainWindow::loadErrorStr(int error)
|
QString MainWindow::loadErrorStr(int error)
|
||||||
{
|
{
|
||||||
|
@ -2002,11 +2015,13 @@ void MainWindow::onPause(bool checked)
|
||||||
{
|
{
|
||||||
emuThread->emuPause();
|
emuThread->emuPause();
|
||||||
OSD::AddMessage(0, "Paused");
|
OSD::AddMessage(0, "Paused");
|
||||||
|
pausedManually = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emuThread->emuUnpause();
|
emuThread->emuUnpause();
|
||||||
OSD::AddMessage(0, "Resumed");
|
OSD::AddMessage(0, "Resumed");
|
||||||
|
pausedManually = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2152,6 +2167,7 @@ void MainWindow::onOpenInterfaceSettings()
|
||||||
InterfaceSettingsDialog* dlg = InterfaceSettingsDialog::openDlg(this);
|
InterfaceSettingsDialog* dlg = InterfaceSettingsDialog::openDlg(this);
|
||||||
connect(dlg, &InterfaceSettingsDialog::finished, this, &MainWindow::onInterfaceSettingsFinished);
|
connect(dlg, &InterfaceSettingsDialog::finished, this, &MainWindow::onInterfaceSettingsFinished);
|
||||||
connect(dlg, &InterfaceSettingsDialog::updateMouseTimer, this, &MainWindow::onUpdateMouseTimer);
|
connect(dlg, &InterfaceSettingsDialog::updateMouseTimer, this, &MainWindow::onUpdateMouseTimer);
|
||||||
|
connect(dlg, &InterfaceSettingsDialog::focusUnpauseEmu, emuThread, &EmuThread::emuUnpause);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onUpdateMouseTimer()
|
void MainWindow::onUpdateMouseTimer()
|
||||||
|
@ -2505,6 +2521,8 @@ int main(int argc, char** argv)
|
||||||
emuThread->start();
|
emuThread->start();
|
||||||
emuThread->emuPause();
|
emuThread->emuPause();
|
||||||
|
|
||||||
|
QObject::connect(&melon, &QApplication::applicationStateChanged, mainWindow, &MainWindow::onAppStateChanged);
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
char* file = argv[1];
|
char* file = argv[1];
|
||||||
|
|
|
@ -185,6 +185,8 @@ public:
|
||||||
bool hasOGL;
|
bool hasOGL;
|
||||||
QOpenGLContext* getOGLContext();
|
QOpenGLContext* getOGLContext();
|
||||||
|
|
||||||
|
void onAppStateChanged(Qt::ApplicationState state);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* event) override;
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
|
|
||||||
|
@ -263,6 +265,8 @@ private:
|
||||||
|
|
||||||
QString loadErrorStr(int error);
|
QString loadErrorStr(int error);
|
||||||
|
|
||||||
|
bool pausedManually;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QWidget* panel;
|
QWidget* panel;
|
||||||
ScreenPanelGL* panelGL;
|
ScreenPanelGL* panelGL;
|
||||||
|
|
Loading…
Reference in New Issue