+ // Enable zoom-to-fit after acquisition by default
+ if (!contains(Key_View_ZoomToFitAfterAcq))
+ setValue(Key_View_ZoomToFitAfterAcq, 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))
+ setValue(Key_View_ShowSamplingPoints, true);
+
+ // Enable filling logic signal high areas by default
+ if (!contains(Key_View_FillSignalHighAreas))
+ setValue(Key_View_FillSignalHighAreas, true);
+ if (!contains(Key_View_FillSignalHighAreaColor))
+ setValue(Key_View_FillSignalHighAreaColor,
+ QColor(0, 0, 0, 5 * 256 / 100).rgba());
+
+ if (!contains(Key_View_DefaultDivHeight))
+ setValue(Key_View_DefaultDivHeight,
+ 3 * QFontMetrics(QApplication::font()).height());
+
+ if (!contains(Key_View_DefaultLogicHeight))
+ setValue(Key_View_DefaultLogicHeight,
+ 2 * QFontMetrics(QApplication::font()).height());
+
+ if (!contains(Key_View_ShowHoverMarker))
+ setValue(Key_View_ShowHoverMarker, true);
+
+ if (!contains(Key_View_SnapDistance))
+ setValue(Key_View_SnapDistance, 15);
+
+ if (!contains(Key_Dec_ExportFormat))
+ setValue(Key_Dec_ExportFormat, "%s %d: %c: %1");
+
+ // 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)
+{
+ callbacks_.push_back(cb);
+}
+
+void GlobalSettings::remove_change_handler(GlobalSettingsInterface *cb)
+{
+ for (auto cb_it = callbacks_.begin(); cb_it != callbacks_.end(); cb_it++)
+ if (*cb_it == cb) {
+ callbacks_.erase(cb_it);
+ break;
+ }