#include <QString>
#include <QVariant>
+using std::function;
+using std::map;
+using std::multimap;
+
namespace pv {
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;
public:
GlobalSettings();
static void register_change_handler(const QString key,
- std::function<void(QVariant)> cb);
+ function<void(QVariant)> 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<void(QVariant)> > callbacks_;
+ static multimap< QString, function<void(QVariant)> > callbacks_;
+
+ static bool tracking_;
+ static map<QString, QVariant> tracked_changes_;
};
} // namespace pv