Main window geometry and state saving/reloading
This commit is contained in:
parent
8c7f15cefb
commit
09dc356883
@ -336,6 +336,10 @@ void MultiMC::initGlobalSettings()
|
|||||||
QUuid uuid = QUuid::createUuid();
|
QUuid uuid = QUuid::createUuid();
|
||||||
m_settings->set("YggdrasilClientToken", uuid.toString());
|
m_settings->set("YggdrasilClientToken", uuid.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Window state and geometry
|
||||||
|
m_settings->registerSetting(new Setting("MainWindowState", ""));
|
||||||
|
m_settings->registerSetting(new Setting("MainWindowGeometry", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiMC::initHttpMetaCache()
|
void MultiMC::initHttpMetaCache()
|
||||||
@ -398,6 +402,8 @@ int main_gui(MultiMC &app)
|
|||||||
{
|
{
|
||||||
// show main window
|
// show main window
|
||||||
MainWindow mainWin;
|
MainWindow mainWin;
|
||||||
|
mainWin.restoreState(QByteArray::fromBase64(MMC->settings()->get("MainWindowState").toByteArray()));
|
||||||
|
mainWin.restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("MainWindowGeometry").toByteArray()));
|
||||||
mainWin.show();
|
mainWin.show();
|
||||||
mainWin.checkSetDefaultJava();
|
mainWin.checkSetDefaultJava();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
@ -449,9 +449,10 @@ void MainWindow::on_actionEditInstMods_triggered()
|
|||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
// Save the window state and geometry.
|
// Save the window state and geometry.
|
||||||
// TODO: Make this work with the new settings system.
|
|
||||||
// settings->getConfig().setValue("MainWindowGeometry", saveGeometry());
|
MMC->settings()->set("MainWindowState", saveState().toBase64());
|
||||||
// settings->getConfig().setValue("MainWindowState", saveState());
|
MMC->settings()->set("MainWindowGeometry", saveGeometry().toBase64());
|
||||||
|
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
QApplication::exit();
|
QApplication::exit();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user