mirror of https://github.com/PCSX2/pcsx2.git
Qt: Fix window geometry not saving on exit
This commit is contained in:
parent
0284c35f4c
commit
724aa657f3
|
@ -983,27 +983,28 @@ void MainWindow::saveStateToConfig()
|
||||||
if (!isVisible())
|
if (!isVisible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
|
const QByteArray geometry(saveGeometry());
|
||||||
|
const QByteArray geometry_b64(geometry.toBase64());
|
||||||
|
const std::string old_geometry_b64(Host::GetBaseStringSettingValue("UI", "MainWindowGeometry"));
|
||||||
|
if (old_geometry_b64 != geometry_b64.constData())
|
||||||
{
|
{
|
||||||
const QByteArray geometry = saveGeometry();
|
Host::SetBaseStringSettingValue("UI", "MainWindowGeometry", geometry_b64.constData());
|
||||||
const QByteArray geometry_b64 = geometry.toBase64();
|
changed = true;
|
||||||
const std::string old_geometry_b64 = Host::GetBaseStringSettingValue("UI", "MainWindowGeometry");
|
|
||||||
if (old_geometry_b64 != geometry_b64.constData())
|
|
||||||
{
|
|
||||||
Host::SetBaseStringSettingValue("UI", "MainWindowGeometry", geometry_b64.constData());
|
|
||||||
Host::CommitBaseSettingChanges();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QByteArray state(saveState());
|
||||||
|
const QByteArray state_b64(state.toBase64());
|
||||||
|
const std::string old_state_b64(Host::GetBaseStringSettingValue("UI", "MainWindowState"));
|
||||||
|
if (old_state_b64 != state_b64.constData())
|
||||||
{
|
{
|
||||||
const QByteArray state = saveState();
|
Host::SetBaseStringSettingValue("UI", "MainWindowState", state_b64.constData());
|
||||||
const QByteArray state_b64 = state.toBase64();
|
changed = true;
|
||||||
const std::string old_state_b64 = Host::GetBaseStringSettingValue("UI", "MainWindowState");
|
|
||||||
if (old_state_b64 != state_b64.constData())
|
|
||||||
{
|
|
||||||
Host::SetBaseStringSettingValue("UI", "MainWindowState", state_b64.constData());
|
|
||||||
Host::CommitBaseSettingChanges();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
Host::CommitBaseSettingChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::restoreStateFromConfig()
|
void MainWindow::restoreStateFromConfig()
|
||||||
|
@ -1979,6 +1980,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||||
// If there's no VM, we can just exit as normal.
|
// If there's no VM, we can just exit as normal.
|
||||||
if (!s_vm_valid)
|
if (!s_vm_valid)
|
||||||
{
|
{
|
||||||
|
saveStateToConfig();
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1992,7 +1994,6 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Application will be exited in VM stopped handler.
|
// Application will be exited in VM stopped handler.
|
||||||
saveStateToConfig();
|
|
||||||
m_is_closing = true;
|
m_is_closing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue