comparison 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
comparison
equal deleted inserted replaced
426:72a2b4210e50 427:ba07505d20e2
1652 m_templatesMenu->clear(); 1652 m_templatesMenu->clear();
1653 1653
1654 QSettings settings; 1654 QSettings settings;
1655 settings.beginGroup("MainWindow"); 1655 settings.beginGroup("MainWindow");
1656 QString deflt = settings.value("sessiontemplate", "").toString(); 1656 QString deflt = settings.value("sessiontemplate", "").toString();
1657 setDefaultSessionTemplate(deflt == "" ? "default" : ""); 1657 setDefaultSessionTemplate(deflt == "" ? "default" : deflt);
1658 settings.endGroup(); 1658 settings.endGroup();
1659 1659
1660 QActionGroup *templatesGroup = new QActionGroup(this); 1660 QActionGroup *templatesGroup = new QActionGroup(this);
1661 1661
1662 QAction *action = new QAction(tr("Default"), this); 1662 QAction *action = new QAction(tr("Default"), this);
2857 << std::endl; 2857 << std::endl;
2858 return; 2858 return;
2859 } 2859 }
2860 2860
2861 setDefaultSessionTemplate(n); 2861 setDefaultSessionTemplate(n);
2862
2863 QSettings settings;
2864 settings.beginGroup("MainWindow");
2865 settings.setValue("sessiontemplate", n);
2866 settings.endGroup();
2862 } 2867 }
2863 2868
2864 void 2869 void
2865 MainWindow::saveSessionAsTemplate() 2870 MainWindow::saveSessionAsTemplate()
2866 { 2871 {
2879 } 2884 }
2880 2885
2881 void 2886 void
2882 MainWindow::manageSavedTemplates() 2887 MainWindow::manageSavedTemplates()
2883 { 2888 {
2884 //!!! really we should watch this directory and recreate the menu when it changes
2885 ResourceFinder rf; 2889 ResourceFinder rf;
2886 QDesktopServices::openUrl("file:" + rf.getResourceSaveDir("templates")); 2890 QDesktopServices::openUrl("file:" + rf.getResourceSaveDir("templates"));
2887 } 2891 }
2888 2892
2889 void 2893 void