Skip to content

Commit

Permalink
save view mode over restart
Browse files Browse the repository at this point in the history
Fixes: 2890122

Read the viewMode from the application config file (KScope.conf) at
startup and save it to the config on close.
  • Loading branch information
cpackham committed Nov 19, 2009
1 parent f50ed9f commit f393007
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions trunk/app/mainwindow.cpp
Expand Up @@ -70,14 +70,14 @@ MainWindow::MainWindow() : QMainWindow(), actions_(this)
// Create a status bar.
statusBar();

// Apply saved window settings.
readSettings();

// Initialise actions.
// The order is important: make sure the child widgets are created BEFORE
// calling setup().
actions_.setup();

// Apply saved window settings.
readSettings();

// Perform actions when a project is opened or closed.
connect(ProjectManager::signalProxy(), SIGNAL(hasProject(bool)), this,
SLOT(projectOpenedClosed(bool)));
Expand Down Expand Up @@ -461,6 +461,7 @@ void MainWindow::writeSettings()
settings.setValue("size", size());
settings.setValue("pos", pos());
settings.setValue("state", saveState());
settings.setValue("viewMode", editCont_->viewMode());
settings.endGroup();
}

Expand All @@ -469,12 +470,17 @@ void MainWindow::writeSettings()
*/
void MainWindow::readSettings()
{
QMdiArea::ViewMode viewMode;

// Restore main window position and size.
Settings& settings = Application::settings();
settings.beginGroup("MainWindow");
resize(settings.value("size", QSize(1000, 600)).toSize());
move(settings.value("pos", QPoint(200, 200)).toPoint());
restoreState(settings.value("state").toByteArray());
viewMode = static_cast<QMdiArea::ViewMode>(settings.value("viewMode", 0).toUInt());
editCont_->setViewMode(viewMode);

settings.endGroup();
}

Expand Down

0 comments on commit f393007

Please sign in to comment.