changeset 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
files framework/MainWindowBase.cpp framework/MainWindowBase.h
diffstat 2 files changed, 6 insertions(+), 13 deletions(-) [+]
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;
--- a/framework/MainWindowBase.h	Tue May 17 17:04:22 2011 +0100
+++ b/framework/MainWindowBase.h	Mon May 23 16:12:29 2011 +0100
@@ -284,7 +284,6 @@
     QString                  m_sessionFile;
     QString                  m_audioFile;
     Document                *m_document;
-    QString                  m_defaultSessionTemplate;
 
     QLabel                  *m_descriptionLabel;
     PaneStack               *m_paneStack;
@@ -399,7 +398,6 @@
     virtual QString getSaveFileName(FileFinder::FileType type);
     virtual void registerLastOpenedFilePath(FileFinder::FileType type, QString path);
 
-    virtual void setDefaultSessionTemplate(QString name);
     virtual QString getDefaultSessionTemplate() const;
 
     virtual void createPlayTarget();