Mercurial > hg > svapp
comparison 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 |
comparison
equal
deleted
inserted
replaced
230:976d43d3c67d | 231:65d75297a37e |
---|---|
217 | 217 |
218 labellerType = (Labeller::ValueType) | 218 labellerType = (Labeller::ValueType) |
219 settings.value("labellertype", (int)labellerType).toInt(); | 219 settings.value("labellertype", (int)labellerType).toInt(); |
220 int cycle = settings.value("labellercycle", 4).toInt(); | 220 int cycle = settings.value("labellercycle", 4).toInt(); |
221 | 221 |
222 m_defaultSessionTemplate = settings.value("sessiontemplate", "").toString(); | |
223 if (m_defaultSessionTemplate == "") m_defaultSessionTemplate = "default"; | |
224 | |
225 settings.endGroup(); | 222 settings.endGroup(); |
226 | 223 |
227 m_labeller = new Labeller(labellerType); | 224 m_labeller = new Labeller(labellerType); |
228 m_labeller->setCounterCycleSize(cycle); | 225 m_labeller->setCounterCycleSize(cycle); |
229 | 226 |
330 { | 327 { |
331 FileFinder *ff = FileFinder::getInstance(); | 328 FileFinder *ff = FileFinder::getInstance(); |
332 ff->registerLastOpenedFilePath(type, path); | 329 ff->registerLastOpenedFilePath(type, path); |
333 } | 330 } |
334 | 331 |
335 void | |
336 MainWindowBase::setDefaultSessionTemplate(QString name) | |
337 { | |
338 m_defaultSessionTemplate = name; | |
339 } | |
340 | |
341 QString | 332 QString |
342 MainWindowBase::getDefaultSessionTemplate() const | 333 MainWindowBase::getDefaultSessionTemplate() const |
343 { | 334 { |
344 return m_defaultSessionTemplate; | 335 QSettings settings; |
336 settings.beginGroup("MainWindow"); | |
337 QString templateName = settings.value("sessiontemplate", "").toString(); | |
338 if (templateName == "") templateName = "default"; | |
339 return templateName; | |
345 } | 340 } |
346 | 341 |
347 void | 342 void |
348 MainWindowBase::updateMenuStates() | 343 MainWindowBase::updateMenuStates() |
349 { | 344 { |
1093 QString templateName) | 1088 QString templateName) |
1094 { | 1089 { |
1095 // std::cerr << "MainWindowBase::openAudio(" << source.getLocation().toStdString() << ")" << std::endl; | 1090 // std::cerr << "MainWindowBase::openAudio(" << source.getLocation().toStdString() << ")" << std::endl; |
1096 | 1091 |
1097 if (templateName == "") { | 1092 if (templateName == "") { |
1098 templateName = m_defaultSessionTemplate; | 1093 templateName = getDefaultSessionTemplate(); |
1099 } | 1094 } |
1100 | 1095 |
1101 std::cerr << "template is: \"" << templateName.toStdString() << "\"" << std::endl; | 1096 std::cerr << "template is: \"" << templateName.toStdString() << "\"" << std::endl; |
1102 | 1097 |
1103 if (!source.isAvailable()) return FileOpenFailed; | 1098 if (!source.isAvailable()) return FileOpenFailed; |