]> sigrok.org Git - pulseview.git/commitdiff
Settings: Add method to set settings defaults
authorSoeren Apel <redacted>
Fri, 9 Jun 2017 20:06:02 +0000 (22:06 +0200)
committerSoeren Apel <redacted>
Fri, 9 Jun 2017 20:06:02 +0000 (22:06 +0200)
pv/globalsettings.cpp
pv/globalsettings.hpp
pv/mainwindow.cpp

index 0eff1915d15ed5d151b4d1eb364d40247231c532..ee9741030c1098ee8d6c5352dfef6feccfa5fbdf 100644 (file)
@@ -42,6 +42,13 @@ GlobalSettings::GlobalSettings() :
        beginGroup("Settings");
 }
 
+void GlobalSettings::set_defaults_where_needed()
+{
+       // Enable coloured trace backgrounds by default
+       if (!contains(Key_View_ColouredBG))
+               setValue(Key_View_ColouredBG, true);
+}
+
 void GlobalSettings::register_change_handler(const QString key,
        function<void(QVariant)> cb)
 {
index 930bb5bbfcceee55f7fdea1cf9cab54831208901..f6a6141fca7ad18ccd1e9276e4eea0789a2dead1 100644 (file)
@@ -48,6 +48,8 @@ public:
 public:
        GlobalSettings();
 
+       void set_defaults_where_needed();
+
        static void register_change_handler(const QString key,
                function<void(QVariant)> cb);
 
index 786d07e28987d1fe7af3943447eb4ddd492687fa..e6686fed08def913cbb3b40d301838198a531d8f 100644 (file)
@@ -89,6 +89,9 @@ MainWindow::MainWindow(DeviceManager &device_manager, QWidget *parent) :
        GlobalSettings::register_change_handler(GlobalSettings::Key_View_ShowAnalogMinorGrid,
                bind(&MainWindow::on_settingViewShowAnalogMinorGrid_changed, this, _1));
 
+       GlobalSettings settings;
+       settings.set_defaults_where_needed();
+
        setup_ui();
        restore_ui_settings();
 }