Commit b5c71b20 authored by Oliver Bock's avatar Oliver Bock

Save/restore window state and layout (on quit/startup)

parent 5d8927f0
......@@ -19,6 +19,8 @@
******************************************************************************/
#include "pulsatingscience.h"
#include <QSettings>
#ifdef __APPLE__
#include "/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/Carbon.h"
......@@ -110,6 +112,16 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
connect(m_hiddenShortcut, SIGNAL(activated()),
this, SLOT(toggleHiddenDemoMode()));
// restore previously saved window and splitter layout
QCoreApplication::setOrganizationName("Max-Planck-Insitut für Gravitationsphysik");
QCoreApplication::setOrganizationDomain("aei.mpg.de");
QCoreApplication::setApplicationName("Pulsating Science");
QSettings settings;
restoreGeometry(settings.value("windowGeometry").toByteArray());
restoreState(settings.value("windowState").toByteArray());
ui.splitter->restoreState(settings.value("splitterSizes").toByteArray());
}
PulsatingScience::~PulsatingScience()
......@@ -161,6 +173,12 @@ void PulsatingScience::closeEvent(QCloseEvent *event)
event->ignore();
}
else {
// save splitter layout
QSettings settings;
settings.setValue("windowGeometry", saveGeometry());
settings.setValue("windowState", saveState());
settings.setValue("splitterSizes", ui.splitter->saveState());
event->accept();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment