diff base/Preferences.cpp @ 694:2c4aca969c24 toggle

Option added in the preference menu to be able to start the application in minimal mode
author mathieub <mathieu.barthet@eecs.qmul.ac.uk>
date Wed, 20 Jul 2011 16:30:07 +0100
parents 75f154085a4d
children
line wrap: on
line diff
--- a/base/Preferences.cpp	Sun Jun 26 19:33:54 2011 +0100
+++ b/base/Preferences.cpp	Wed Jul 20 16:30:07 2011 +0100
@@ -47,7 +47,8 @@
     m_viewFontSize(10),
     m_backgroundMode(BackgroundFromTheme),
     m_timeToTextMode(TimeToTextMs),
-    m_showSplash(true)
+    m_showSplash(true),
+    m_startInMiniMode(false)
 {
     QSettings settings;
     settings.beginGroup("Preferences");
@@ -68,6 +69,7 @@
         (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt());
     m_viewFontSize = settings.value("view-font-size", 10).toInt();
     m_showSplash = settings.value("show-splash", true).toBool();
+    m_startInMiniMode = settings.value("start-in-mini-mode", false).toBool();
     settings.endGroup();
 
     settings.beginGroup("TempDirectory");
@@ -96,6 +98,7 @@
     props.push_back("Time To Text Mode");
     props.push_back("View Font Size");
     props.push_back("Show Splash Screen");
+    props.push_back("Start In Minimal Mode");
     return props;
 }
 
@@ -141,6 +144,9 @@
     if (name == "Show Splash Screen") {
         return tr("Show splash screen on startup");
     }
+    if (name == "Start In Minimal Mode") {
+        return tr("Start Sonic Visualiser in minimal mode");
+    }
     return name;
 }
 
@@ -187,6 +193,9 @@
     if (name == "Show Splash Screen") {
         return ToggleProperty;
     }
+    if (name == "Start In Minimal Mode") {
+        return ToggleProperty;
+    }
     return InvalidProperty;
 }
 
@@ -259,6 +268,10 @@
         if (deflt) *deflt = 1;
     }
 
+    if (name == "Start In Minimal Mode") {
+        if (deflt) *deflt = 0;
+    }
+
     return 0;
 }
 
@@ -363,6 +376,8 @@
         setViewFontSize(value);
     } else if (name == "Show Splash Screen") {
         setShowSplash(value ? true : false);
+    } else if (name == "Start In Minimal Mode") {
+        setStartInMiniMode(value ? true : false);
     }
 }
 
@@ -553,4 +568,19 @@
         emit propertyChanged("Show Splash Screen");
     }
 }
+
+void
+Preferences::setStartInMiniMode(bool show)
+{
+    if (m_startInMiniMode != show) {
+
+        m_startInMiniMode = show;
+
+        QSettings settings;
+        settings.beginGroup("Preferences");
+        settings.setValue("start-in-mini-mode", show);
+        settings.endGroup();
+        emit propertyChanged("Start Sonic Visualiser in minimal mode");
+    }
+}