diff options
-rw-r--r-- | qt-ui/mainwindow.cpp | 23 | ||||
-rw-r--r-- | qt-ui/mainwindow.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 550c15d97..f1a27a11a 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -170,6 +170,7 @@ MainWindow::MainWindow() : QMainWindow(), updateManager = new UpdateManager(this); undoBuffer = new UndoBuffer(this); + setApplicationState("Default"); } MainWindow::~MainWindow() @@ -1505,3 +1506,25 @@ void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topL { applicationState[state] = WidgetForBorder(topLeft, bottomLeft, topRight, bottomRight); } + +void MainWindow::setApplicationState(const QByteArray& state) { + if (!applicationState.keys().contains(state)) + return; + + // yes, index is zero both times. please don't change it. + if (ui.topSplitter->count()) { + ui.topSplitter->widget(0)->setParent(NULL); + ui.topSplitter->widget(0)->setParent(NULL); + } + if (ui.bottomSplitter->count()) { + ui.bottomSplitter->widget(0)->setParent(NULL); + ui.bottomSplitter->widget(0)->setParent(NULL); + } + + + WidgetForBorder curr = applicationState[state]; + ui.topSplitter->addWidget(curr.topLeft); + ui.topSplitter->addWidget(curr.topRight); + ui.bottomSplitter->addWidget(curr.bottomLeft); + ui.bottomSplitter->addWidget(curr.bottomRight); +} diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index bf75bf9d9..6179a9732 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -83,6 +83,7 @@ public: void setPlanNotes(const char *notes); void printPlan(); void checkSurvey(QSettings *s); + void setApplicationState(const QByteArray& state); UndoBuffer *undoBuffer; private slots: |