diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/kaiman.cc | 2 | ||||
-rw-r--r-- | src/mainwindow.cc | 30 | ||||
-rw-r--r-- | src/mainwindow.h | 2 |
3 files changed, 33 insertions, 1 deletions
diff --git a/src/kaiman.cc b/src/kaiman.cc index d7a2707..a8dd1d6 100644 --- a/src/kaiman.cc +++ b/src/kaiman.cc @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); MainWindow wnd(argv[1]); - wnd.showMaximized(); + wnd.show(); return app.exec(); } diff --git a/src/mainwindow.cc b/src/mainwindow.cc index e2fe4b4..cfaece1 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -40,6 +40,7 @@ #include <QStatusBar> #include <QFileInfo> #include <QFileDialog> +#include <QSettings> MainWindow::MainWindow(QString p) { @@ -96,6 +97,7 @@ MainWindow::MainWindow(QString p) // Setup toolbar QToolBar *toolbar = new QToolBar(); + toolbar->setObjectName("Execution"); addToolBar(Qt::TopToolBarArea, toolbar); { @@ -113,6 +115,8 @@ MainWindow::MainWindow(QString p) connect(act, SIGNAL(triggered()), this, SLOT(reset())); } + loadSettings(); + statusBar()->showMessage(tr("Ready")); updateWindowTitle(); @@ -134,9 +138,35 @@ void MainWindow::closeEvent(QCloseEvent* event) return; } + saveSettings(); event->accept(); } +void MainWindow::loadSettings() +{ + QByteArray state; + QByteArray geometry; + + QSettings settings; + settings.beginGroup("MainWindow"); + state = settings.value("state").toByteArray(); + geometry = settings.value("geometry").toByteArray(); + settings.endGroup(); + + restoreGeometry(geometry); + restoreState(state); +} + +void MainWindow::saveSettings() +{ + QSettings settings; + + settings.beginGroup("MainWindow"); + settings.setValue("state", saveState()); + settings.setValue("geometry", saveGeometry()); + settings.endGroup(); +} + bool MainWindow::checkDirty() { if(dirty) diff --git a/src/mainwindow.h b/src/mainwindow.h index a2e2271..5943301 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -61,6 +61,8 @@ private slots: void programChanged(); private: + void loadSettings(); + void saveSettings(); bool checkDirty(); void setWindowEnabled(bool enabled); void updateWindowTitle(); |