X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fglobalsettings.hpp;h=1c07c308d71a5170e9c227a251fa14238aafde01;hp=b7457963da88e462cdaa1a2e8202f5ae2a919fb0;hb=489953884c0d7692fa20748314751e114ae54cf2;hpb=bf9f12687c8d43422455cbdc27ec1cc5d4305149 diff --git a/pv/globalsettings.hpp b/pv/globalsettings.hpp index b7457963..1c07c308 100644 --- a/pv/globalsettings.hpp +++ b/pv/globalsettings.hpp @@ -27,6 +27,10 @@ #include #include +using std::function; +using std::map; +using std::multimap; + namespace pv { class GlobalSettings : public QSettings @@ -36,17 +40,41 @@ class GlobalSettings : public QSettings public: static const QString Key_View_AlwaysZoomToFit; static const QString Key_View_ColouredBG; + static const QString Key_View_StickyScrolling; + static const QString Key_View_ShowSamplingPoints; + static const QString Key_View_ShowAnalogMinorGrid; public: GlobalSettings(); static void register_change_handler(const QString key, - std::function cb); + function cb); void setValue(const QString& key, const QVariant& value); + /** + * Begins the tracking of changes. All changes will + * be recorded until stop_tracking() is called. + * The change tracking is global and doesn't support nesting. + */ + void start_tracking(); + + /** + * Ends the tracking of changes without any changes to the settings. + */ + void stop_tracking(); + + /** + * Ends the tracking of changes, undoing the changes since the + * change tracking began. + */ + void undo_tracked_changes(); + private: - static std::multimap< QString, std::function > callbacks_; + static multimap< QString, function > callbacks_; + + static bool tracking_; + static map tracked_changes_; }; } // namespace pv