X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fglobalsettings.hpp;h=ea43491c35b1a2b63d3656cbf375a8940113df5b;hp=c6b4cfc5891e617a4d44985f240268bf2a2fa1a0;hb=d0c0573b3ee694827a747727f862c5f91736ca05;hpb=451dc5f33fbc4f559881acdf338c476a976fcbf2 diff --git a/pv/globalsettings.hpp b/pv/globalsettings.hpp index c6b4cfc5..ea43491c 100644 --- a/pv/globalsettings.hpp +++ b/pv/globalsettings.hpp @@ -20,7 +20,6 @@ #ifndef PULSEVIEW_GLOBALSETTINGS_HPP #define PULSEVIEW_GLOBALSETTINGS_HPP -#include #include #include @@ -31,10 +30,17 @@ 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 @@ -63,8 +69,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); @@ -91,7 +97,7 @@ public: static GVariant* restore_gvariant(QSettings &settings); private: - static multimap< QString, function > callbacks_; + static vector callbacks_; static bool tracking_; static map tracked_changes_;