X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fglobalsettings.hpp;h=6e027d782c97dd3e4a449e72282fa8c2ad55e646;hp=c6b4cfc5891e617a4d44985f240268bf2a2fa1a0;hb=4521022bf4ea07aff38bfa09fe0f7d5702b26475;hpb=ffc00fdd5946593ad2a587078fd4ee9ba0a507ec diff --git a/pv/globalsettings.hpp b/pv/globalsettings.hpp index c6b4cfc5..6e027d78 100644 --- a/pv/globalsettings.hpp +++ b/pv/globalsettings.hpp @@ -20,21 +20,27 @@ #ifndef PULSEVIEW_GLOBALSETTINGS_HPP #define PULSEVIEW_GLOBALSETTINGS_HPP -#include #include #include +#include #include #include #include -using std::function; using std::map; -using std::multimap; +using std::vector; namespace pv { +class GlobalSettingsInterface +{ +public: + virtual void on_setting_changed(const QString &key, const QVariant &value) = 0; +}; + + class GlobalSettings : public QSettings { Q_OBJECT @@ -43,14 +49,21 @@ public: static const QString Key_View_ZoomToFitDuringAcq; static const QString Key_View_ZoomToFitAfterAcq; static const QString Key_View_TriggerIsZeroTime; - static const QString Key_View_ColouredBG; + static const QString Key_View_ColoredBG; static const QString Key_View_StickyScrolling; static const QString Key_View_ShowSamplingPoints; + static const QString Key_View_FillSignalHighAreas; + static const QString Key_View_FillSignalHighAreaColor; static const QString Key_View_ShowAnalogMinorGrid; static const QString Key_View_ConversionThresholdDispMode; static const QString Key_View_DefaultDivHeight; static const QString Key_View_DefaultLogicHeight; + static const QString Key_View_ShowHoverMarker; + static const QString Key_View_SnapDistance; static const QString Key_Dec_InitialStateConfigurable; + static const QString Key_Dec_ExportFormat; + static const QString Key_Log_BufferSize; + static const QString Key_Log_NotifyOfStacktrace; enum ConvThrDispMode { ConvThrDispMode_None = 0, @@ -63,8 +76,8 @@ public: void set_defaults_where_needed(); - static void register_change_handler(const QString key, - function cb); + static void add_change_handler(GlobalSettingsInterface *cb); + static void remove_change_handler(GlobalSettingsInterface *cb); void setValue(const QString& key, const QVariant& value); @@ -90,8 +103,12 @@ public: static GVariant* restore_gvariant(QSettings &settings); + static void store_variantbase(QSettings &settings, Glib::VariantBase v); + + static Glib::VariantBase restore_variantbase(QSettings &settings); + private: - static multimap< QString, function > callbacks_; + static vector callbacks_; static bool tracking_; static map tracked_changes_;