]> sigrok.org Git - pulseview.git/blobdiff - pv/globalsettings.cpp
DecodeSignal: Re-set decoder metadata after stack termination
[pulseview.git] / pv / globalsettings.cpp
index 1a589fe9cf0459b986d88f2b5dfaa3398a1ba710..c77327c3d1b6b18bd1c1255139b0a6b19323a7d9 100644 (file)
@@ -20,6 +20,7 @@
 #include "globalsettings.hpp"
 
 #include <QApplication>
+#include <QDebug>
 #include <QFontMetrics>
 #include <QString>
 
@@ -31,7 +32,7 @@ namespace pv {
 const QString GlobalSettings::Key_View_ZoomToFitDuringAcq = "View_ZoomToFitDuringAcq";
 const QString GlobalSettings::Key_View_ZoomToFitAfterAcq = "View_ZoomToFitAfterAcq";
 const QString GlobalSettings::Key_View_TriggerIsZeroTime = "View_TriggerIsZeroTime";
-const QString GlobalSettings::Key_View_ColouredBG = "View_ColouredBG";
+const QString GlobalSettings::Key_View_ColoredBG = "View_ColoredBG";
 const QString GlobalSettings::Key_View_StickyScrolling = "View_StickyScrolling";
 const QString GlobalSettings::Key_View_ShowSamplingPoints = "View_ShowSamplingPoints";
 const QString GlobalSettings::Key_View_ShowAnalogMinorGrid = "View_ShowAnalogMinorGrid";
@@ -39,6 +40,8 @@ const QString GlobalSettings::Key_View_ConversionThresholdDispMode = "View_Conve
 const QString GlobalSettings::Key_View_DefaultDivHeight = "View_DefaultDivHeight";
 const QString GlobalSettings::Key_View_DefaultLogicHeight = "View_DefaultLogicHeight";
 const QString GlobalSettings::Key_Dec_InitialStateConfigurable = "Dec_InitialStateConfigurable";
+const QString GlobalSettings::Key_Log_BufferSize = "Log_BufferSize";
+const QString GlobalSettings::Key_Log_NotifyOfStacktrace = "Log_NotifyOfStacktrace";
 
 vector<GlobalSettingsInterface*> GlobalSettings::callbacks_;
 bool GlobalSettings::tracking_ = false;
@@ -56,9 +59,9 @@ void GlobalSettings::set_defaults_where_needed()
        if (!contains(Key_View_ZoomToFitAfterAcq))
                setValue(Key_View_ZoomToFitAfterAcq, true);
 
-       // Enable coloured trace backgrounds by default
-       if (!contains(Key_View_ColouredBG))
-               setValue(Key_View_ColouredBG, true);
+       // Enable colored trace backgrounds by default
+       if (!contains(Key_View_ColoredBG))
+               setValue(Key_View_ColoredBG, true);
 
        // Enable showing sampling points by default
        if (!contains(Key_View_ShowSamplingPoints))
@@ -71,6 +74,14 @@ void GlobalSettings::set_defaults_where_needed()
        if (!contains(Key_View_DefaultLogicHeight))
                setValue(Key_View_DefaultLogicHeight,
                2 * QFontMetrics(QApplication::font()).height());
+
+       // Default to 500 lines of backlog
+       if (!contains(Key_Log_BufferSize))
+               setValue(Key_Log_BufferSize, 500);
+
+       // Notify user of existing stack trace by default
+       if (!contains(Key_Log_NotifyOfStacktrace))
+               setValue(Key_Log_NotifyOfStacktrace, true);
 }
 
 void GlobalSettings::add_change_handler(GlobalSettingsInterface *cb)
@@ -96,6 +107,9 @@ void GlobalSettings::setValue(const QString &key, const QVariant &value)
 
        QSettings::setValue(key, value);
 
+       // TODO Emulate noquote()
+       qDebug() << "Setting" << key << "changed to" << value;
+
        // Call all registered callbacks
        for (GlobalSettingsInterface *cb : callbacks_)
                cb->on_setting_changed(key, value);