Mercurial > hg > octave-nkf
diff gui/src/ResourceManager.cpp @ 13668:421afeae929b
Added a settings wizard that appears at first startup of Octave GUI.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sat, 10 Sep 2011 18:33:58 +0200 |
parents | ddc3c20d0e2f |
children | c0e66d6e3dc8 |
line wrap: on
line diff
--- a/gui/src/ResourceManager.cpp +++ b/gui/src/ResourceManager.cpp @@ -25,9 +25,7 @@ ResourceManager::ResourceManager () { m_settings = 0; - QDesktopServices desktopServices; - m_homePath = desktopServices.storageLocation (QDesktopServices::HomeLocation); - setSettings(m_homePath + "/.octave-gui"); + reloadSettings (); } ResourceManager::~ResourceManager () @@ -48,13 +46,25 @@ } void +ResourceManager::reloadSettings () +{ + QDesktopServices desktopServices; + m_homePath = desktopServices.storageLocation (QDesktopServices::HomeLocation); + setSettings(m_homePath + "/.octave-gui"); +} + +void ResourceManager::setSettings (QString file) { delete m_settings; + + m_firstRun = false; if (!QFile::exists (file)) - { - QFile::copy("../default-settings/.octave-gui", file); - } + m_firstRun = true; + + // If the settings file does not exist, QSettings automatically creates it. + // Therefore we have to check if it exists before instantiating the settings object. + // That way we can detect if the user ran this application before. m_settings = new QSettings (file, QSettings::IniFormat); } @@ -75,6 +85,12 @@ return QIcon (); } +bool +ResourceManager::isFirstRun () +{ + return m_firstRun; +} + void ResourceManager::updateNetworkSettings () {