From 2c5fad73e8939409639548571dcb942e6b2cb792 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 25 Jan 2016 15:54:23 -0200 Subject: Start to use the QSettings ObjectWrapper start of the QSettinsg Object Wrapper usage on the code this first patch removes two macros that generated around 200 lines in runtime for something like a quarter of it Basically, whenever we changed anything we called the PreferencesDialog::settingsChanged and connected everythign to that signal, now each setting has it's own changed signal and we can call it directly. The best thing about this approach is that we don't trigger repaints for things that are not directly profile related. ( actually we still do, but the plan is to remove them in due time) this commit breaks correct atualization of the profile (because everything was connected to PreferencesDialog::settingsChanged) and now I need to hunt a bit for the correct connections Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp | 6 ++++++ subsurface-core/subsurface-qt/SettingsObjectWrapper.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'subsurface-core') diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp index e7975971d..6c455e1c1 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp @@ -1604,3 +1604,9 @@ short int SettingsObjectWrapper::saveUserIdLocal() const { return prefs.save_userid_local; } + +SettingsObjectWrapper* SettingsObjectWrapper::instance() +{ + static SettingsObjectWrapper settings; + return &settings; +} diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h index 6a8aa73b8..924ca95d6 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h @@ -614,7 +614,7 @@ class SettingsObjectWrapper : public QObject { Q_PROPERTY(AnimationsSettingsObjectWrapper* animation MEMBER animation_settings CONSTANT) Q_PROPERTY(LocationServiceSettingsObjectWrapper* Location MEMBER location_settings CONSTANT) public: - SettingsObjectWrapper(QObject *parent = NULL); + static SettingsObjectWrapper *instance(); short saveUserIdLocal() const; TechnicalDetailsSettings *techDetails; @@ -633,6 +633,8 @@ public: public slots: void setSaveUserIdLocal(short value); +private: + SettingsObjectWrapper(QObject *parent = NULL); signals: void saveUserIdLocalChanged(short value); }; -- cgit v1.2.3-70-g09d2