The system was upgraded and everything is back online. If you experience any issues, please send an email to atlas_admin@aei.mpg.de - thanks a lot for your patience!

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 @@ ...@@ -19,6 +19,8 @@
******************************************************************************/ ******************************************************************************/
#include "pulsatingscience.h" #include "pulsatingscience.h"
#include <QSettings>
#ifdef __APPLE__ #ifdef __APPLE__
#include "/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/Carbon.h" #include "/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/Carbon.h"
...@@ -110,6 +112,16 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent) ...@@ -110,6 +112,16 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
connect(m_hiddenShortcut, SIGNAL(activated()), connect(m_hiddenShortcut, SIGNAL(activated()),
this, SLOT(toggleHiddenDemoMode())); 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() PulsatingScience::~PulsatingScience()
...@@ -161,6 +173,12 @@ void PulsatingScience::closeEvent(QCloseEvent *event) ...@@ -161,6 +173,12 @@ void PulsatingScience::closeEvent(QCloseEvent *event)
event->ignore(); event->ignore();
} }
else { else {
// save splitter layout
QSettings settings;
settings.setValue("windowGeometry", saveGeometry());
settings.setValue("windowState", saveState());
settings.setValue("splitterSizes", ui.splitter->saveState());
event->accept(); 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