mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-30 09:35:40 +00:00
Qt: Fix display window geometry not saving
This commit is contained in:
parent
e2a4129c30
commit
f7de39f3d0
|
@ -97,6 +97,7 @@ QtDisplayWidget* MainWindow::createDisplay(QThread* worker_thread, const QString
|
||||||
}
|
}
|
||||||
else if (!render_to_main)
|
else if (!render_to_main)
|
||||||
{
|
{
|
||||||
|
restoreDisplayWindowGeometryFromConfig();
|
||||||
m_display_widget->showNormal();
|
m_display_widget->showNormal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -149,6 +150,7 @@ QtDisplayWidget* MainWindow::updateDisplay(QThread* worker_thread, bool fullscre
|
||||||
}
|
}
|
||||||
else if (!render_to_main)
|
else if (!render_to_main)
|
||||||
{
|
{
|
||||||
|
restoreDisplayWindowGeometryFromConfig();
|
||||||
m_display_widget->showNormal();
|
m_display_widget->showNormal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -195,6 +197,10 @@ void MainWindow::destroyDisplayWidget()
|
||||||
switchToGameListView();
|
switchToGameListView();
|
||||||
m_ui.mainContainer->removeWidget(m_display_widget);
|
m_ui.mainContainer->removeWidget(m_display_widget);
|
||||||
}
|
}
|
||||||
|
else if (!m_display_widget->isFullScreen())
|
||||||
|
{
|
||||||
|
saveDisplayWindowGeometryToConfig();
|
||||||
|
}
|
||||||
|
|
||||||
delete m_display_widget;
|
delete m_display_widget;
|
||||||
m_display_widget = nullptr;
|
m_display_widget = nullptr;
|
||||||
|
@ -943,6 +949,23 @@ void MainWindow::restoreStateFromConfig()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::saveDisplayWindowGeometryToConfig()
|
||||||
|
{
|
||||||
|
const QByteArray geometry = m_display_widget->saveGeometry();
|
||||||
|
const QByteArray geometry_b64 = geometry.toBase64();
|
||||||
|
const std::string old_geometry_b64 = m_host_interface->GetStringSettingValue("UI", "DisplayWindowGeometry");
|
||||||
|
if (old_geometry_b64 != geometry_b64.constData())
|
||||||
|
m_host_interface->SetStringSettingValue("UI", "DisplayWindowGeometry", geometry_b64.constData());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::restoreDisplayWindowGeometryFromConfig()
|
||||||
|
{
|
||||||
|
const std::string geometry_b64 = m_host_interface->GetStringSettingValue("UI", "DisplayWindowGeometry");
|
||||||
|
const QByteArray geometry = QByteArray::fromBase64(QByteArray::fromStdString(geometry_b64));
|
||||||
|
if (!geometry.isEmpty())
|
||||||
|
m_display_widget->restoreGeometry(geometry);
|
||||||
|
}
|
||||||
|
|
||||||
SettingsDialog* MainWindow::getSettingsDialog()
|
SettingsDialog* MainWindow::getSettingsDialog()
|
||||||
{
|
{
|
||||||
if (!m_settings_dialog)
|
if (!m_settings_dialog)
|
||||||
|
|
|
@ -98,6 +98,8 @@ private:
|
||||||
void switchToEmulationView();
|
void switchToEmulationView();
|
||||||
void saveStateToConfig();
|
void saveStateToConfig();
|
||||||
void restoreStateFromConfig();
|
void restoreStateFromConfig();
|
||||||
|
void saveDisplayWindowGeometryToConfig();
|
||||||
|
void restoreDisplayWindowGeometryFromConfig();
|
||||||
void destroyDisplayWidget();
|
void destroyDisplayWidget();
|
||||||
SettingsDialog* getSettingsDialog();
|
SettingsDialog* getSettingsDialog();
|
||||||
void doSettings(SettingsDialog::Category category = SettingsDialog::Category::Count);
|
void doSettings(SettingsDialog::Category category = SettingsDialog::Category::Count);
|
||||||
|
|
Loading…
Reference in a new issue