mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-11-17 19:24:05 +01:00
RMG: store & load maximized state
This commit is contained in:
1 parent
0050646ad7
commit
3e8578f2fd
2 files changed
+20
-2
No files matched your search
@@ -169,8 +169,15 @@ void MainWindow::configureUI(QApplication* app)
|
||||
this->setCentralWidget(this->ui_Widgets);
|
||||
|
||||
QString geometry;
|
||||
bool maximized;
|
||||
|
||||
geometry = QString::fromStdString(CoreSettingsGetStringValue(SettingsID::RomBrowser_Geometry));
|
||||
if (!geometry.isEmpty())
|
||||
maximized = CoreSettingsGetBoolValue(SettingsID::RomBrowser_Maximized);
|
||||
if (maximized)
|
||||
{
|
||||
this->showMaximized();
|
||||
}
|
||||
else if (!geometry.isEmpty())
|
||||
{
|
||||
this->restoreGeometry(QByteArray::fromBase64(geometry.toLocal8Bit()));
|
||||
}
|
||||
@@ -294,10 +301,12 @@ void MainWindow::storeGeometry(void)
|
||||
}
|
||||
|
||||
this->ui_Geometry = this->saveGeometry();
|
||||
this->ui_Geometry_Maximized = this->isMaximized();
|
||||
this->ui_Geometry_Saved = true;
|
||||
|
||||
std::string geometryStr = this->ui_Geometry.toBase64().toStdString();
|
||||
CoreSettingsSetValue(SettingsID::RomBrowser_Geometry, geometryStr);
|
||||
CoreSettingsSetValue(SettingsID::RomBrowser_Maximized, this->ui_Geometry_Maximized);
|
||||
}
|
||||
|
||||
void MainWindow::loadGeometry(void)
|
||||
@@ -309,7 +318,15 @@ void MainWindow::loadGeometry(void)
|
||||
|
||||
this->setMinimumSize(0, 0);
|
||||
this->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
this->restoreGeometry(this->ui_Geometry);
|
||||
|
||||
if (this->ui_Geometry_Maximized)
|
||||
{
|
||||
this->showMaximized();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->restoreGeometry(this->ui_Geometry);
|
||||
}
|
||||
|
||||
if (this->isFullScreen())
|
||||
{
|
||||
|
||||
@@ -62,6 +62,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
QLabel *ui_StatusBar_Label;
|
||||
|
||||
QByteArray ui_Geometry;
|
||||
bool ui_Geometry_Maximized = false;
|
||||
bool ui_Geometry_Saved = false;
|
||||
|
||||
bool ui_AllowManualResizing = false;
|
||||
|
||||
Reference in new issue
Block a user