diff framework/MainWindowBase.cpp @ 231:65d75297a37e templating

Pull the default session template directly from settings, instead of storing it
author Chris Cannam
date Mon, 23 May 2011 16:12:29 +0100
parents 976d43d3c67d
children dd14baa45847
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Tue May 17 17:04:22 2011 +0100
+++ b/framework/MainWindowBase.cpp	Mon May 23 16:12:29 2011 +0100
@@ -219,9 +219,6 @@
         settings.value("labellertype", (int)labellerType).toInt();
     int cycle = settings.value("labellercycle", 4).toInt();
 
-    m_defaultSessionTemplate = settings.value("sessiontemplate", "").toString();
-    if (m_defaultSessionTemplate == "") m_defaultSessionTemplate = "default";
-
     settings.endGroup();
 
     m_labeller = new Labeller(labellerType);
@@ -332,16 +329,14 @@
     ff->registerLastOpenedFilePath(type, path);
 }
 
-void
-MainWindowBase::setDefaultSessionTemplate(QString name)
-{
-    m_defaultSessionTemplate = name;
-}
-
 QString
 MainWindowBase::getDefaultSessionTemplate() const
 {
-    return m_defaultSessionTemplate;
+    QSettings settings;
+    settings.beginGroup("MainWindow");
+    QString templateName = settings.value("sessiontemplate", "").toString();
+    if (templateName == "") templateName = "default";
+    return templateName;
 }
 
 void
@@ -1095,7 +1090,7 @@
 //    std::cerr << "MainWindowBase::openAudio(" << source.getLocation().toStdString() << ")" << std::endl;
 
     if (templateName == "") {
-        templateName = m_defaultSessionTemplate;
+        templateName = getDefaultSessionTemplate();
     }
 
     std::cerr << "template is: \"" << templateName.toStdString() << "\"" << std::endl;