# HG changeset patch # User Chris Cannam # Date 1379691480 -3600 # Node ID c0a20cd1a9ff1591bd9c521a1d327ae81af1b160 # Parent 2093255c82034033a5d931b605904d59c4f7de86 If maximised on exit, don't save (maximised) geometry but instead mark as maximised and maximise on restart diff -r 2093255c8203 -r c0a20cd1a9ff main/MainWindow.cpp --- a/main/MainWindow.cpp Mon Sep 16 15:47:42 2013 +0100 +++ b/main/MainWindow.cpp Fri Sep 20 16:38:00 2013 +0100 @@ -3094,8 +3094,11 @@ QSettings settings; settings.beginGroup("MainWindow"); - settings.setValue("size", size()); - settings.setValue("position", pos()); + settings.setValue("maximised", isMaximized()); + if (!isMaximized()) { + settings.setValue("size", size()); + settings.setValue("position", pos()); + } settings.endGroup(); if (m_preferencesDialog && diff -r 2093255c8203 -r c0a20cd1a9ff main/main.cpp --- a/main/main.cpp Mon Sep 16 15:47:42 2013 +0100 +++ b/main/main.cpp Fri Sep 20 16:38:00 2013 +0100 @@ -363,14 +363,21 @@ if (width > height * 2) width = height * 2; settings.beginGroup("MainWindow"); + QSize size = settings.value("size", QSize(width, height)).toSize(); gui->resizeConstrained(size); + if (settings.contains("position")) { QRect prevrect(settings.value("position").toPoint(), size); if (!(available & prevrect).isEmpty()) { gui->move(prevrect.topLeft()); } } + + if (settings.value("maximised", false).toBool()) { + gui->setWindowState(Qt::WindowMaximized); + } + settings.endGroup(); gui->show();