diff main/MainWindow.cpp @ 427:ba07505d20e2 templating

Ensure last used template is remembered in settings
author Chris Cannam
date Tue, 10 May 2011 17:56:28 +0100
parents 72a2b4210e50
children 45bfc5962c33
line wrap: on
line diff
--- a/main/MainWindow.cpp	Tue May 10 13:58:59 2011 +0100
+++ b/main/MainWindow.cpp	Tue May 10 17:56:28 2011 +0100
@@ -1654,7 +1654,7 @@
     QSettings settings;
     settings.beginGroup("MainWindow");
     QString deflt = settings.value("sessiontemplate", "").toString();
-    setDefaultSessionTemplate(deflt == "" ? "default" : "");
+    setDefaultSessionTemplate(deflt == "" ? "default" : deflt);
     settings.endGroup();
 
     QActionGroup *templatesGroup = new QActionGroup(this);
@@ -2859,6 +2859,11 @@
     }
 
     setDefaultSessionTemplate(n);
+
+    QSettings settings;
+    settings.beginGroup("MainWindow");
+    settings.setValue("sessiontemplate", n);
+    settings.endGroup();
 }
 
 void
@@ -2881,7 +2886,6 @@
 void
 MainWindow::manageSavedTemplates()
 {
-    //!!! really we should watch this directory and recreate the menu when it changes
     ResourceFinder rf;
     QDesktopServices::openUrl("file:" + rf.getResourceSaveDir("templates"));
 }