diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-07-25 10:49:48 -0700 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-07-26 16:32:51 +0300 |
commit | 128fc5f4b81f036eeb76cda99704095673efbe8e (patch) | |
tree | 26f3b7daef8a4c8881f9129654e6136ea35bae5b /core/settings | |
parent | 68b5fe9ccbbc7255a00d657cf29e6dc2515b8c3c (diff) | |
download | subsurface-128fc5f4b81f036eeb76cda99704095673efbe8e.tar.gz |
Whitespace cleanup core/settings
We can argue about any of the changes here, but they are the result of our
whitespace.pl script - so if any of this is offensive to you, part of the
resolution will be fixing the script...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/settings')
-rw-r--r-- | core/settings/qPref.cpp | 7 | ||||
-rw-r--r-- | core/settings/qPref.h | 2 | ||||
-rw-r--r-- | core/settings/qPrefCloudStorage.cpp | 19 | ||||
-rw-r--r-- | core/settings/qPrefCloudStorage.h | 32 | ||||
-rw-r--r-- | core/settings/qPrefDisplay.cpp | 6 | ||||
-rw-r--r-- | core/settings/qPrefDisplay.h | 18 | ||||
-rw-r--r-- | core/settings/qPrefDiveComputer.h | 32 | ||||
-rw-r--r-- | core/settings/qPrefPrivate.cpp | 3 | ||||
-rw-r--r-- | core/settings/qPrefPrivate.h | 255 |
9 files changed, 187 insertions, 187 deletions
diff --git a/core/settings/qPref.cpp b/core/settings/qPref.cpp index eabd6e7a9..49851c29a 100644 --- a/core/settings/qPref.cpp +++ b/core/settings/qPref.cpp @@ -1,15 +1,14 @@ // SPDX-License-Identifier: GPL-2.0 -#include "qPrefPrivate.h" #include "qPref.h" +#include "qPrefPrivate.h" #include "ssrf-version.h" -qPref::qPref(QObject *parent) : - QObject(parent) +qPref::qPref(QObject *parent) : QObject(parent) { } qPref *qPref::instance() { -static qPref *self = new qPref; + static qPref *self = new qPref; return self; } diff --git a/core/settings/qPref.h b/core/settings/qPref.h index 251913831..a76d92673 100644 --- a/core/settings/qPref.h +++ b/core/settings/qPref.h @@ -2,8 +2,8 @@ #ifndef QPREF_H #define QPREF_H -#include <QObject> #include "core/pref.h" +#include <QObject> #include "qPrefAnimations.h" #include "qPrefCloudStorage.h" diff --git a/core/settings/qPrefCloudStorage.cpp b/core/settings/qPrefCloudStorage.cpp index 3455aaf2d..561554403 100644 --- a/core/settings/qPrefCloudStorage.cpp +++ b/core/settings/qPrefCloudStorage.cpp @@ -7,7 +7,8 @@ static const QString group = QStringLiteral("CloudStorage"); qPrefCloudStorage::qPrefCloudStorage(QObject *parent) : QObject(parent) { } -qPrefCloudStorage*qPrefCloudStorage::instance() + +qPrefCloudStorage *qPrefCloudStorage::instance() { static qPrefCloudStorage *self = new qPrefCloudStorage; return self; @@ -29,7 +30,7 @@ void qPrefCloudStorage::loadSync(bool doSync) disk_userid(doSync); } -void qPrefCloudStorage::set_cloud_base_url(const QString& value) +void qPrefCloudStorage::set_cloud_base_url(const QString &value) { QString valueGit = value + "/git"; if (value != prefs.cloud_base_url) { @@ -45,9 +46,10 @@ void qPrefCloudStorage::set_cloud_base_url(const QString& value) emit cloud_git_url_changed(valueGit); } } -DISK_LOADSYNC_TXT(CloudStorage, "/cloud_base_url", cloud_base_url) -void qPrefCloudStorage::set_cloud_git_url(const QString& value) +DISK_LOADSYNC_TXT(CloudStorage, "/cloud_base_url", cloud_base_url); + +void qPrefCloudStorage::set_cloud_git_url(const QString &value) { if (value != prefs.cloud_git_url) { // only free and set if not default @@ -58,13 +60,14 @@ void qPrefCloudStorage::set_cloud_git_url(const QString& value) emit cloud_git_url_changed(value); } } -DISK_LOADSYNC_TXT(CloudStorage, "/cloud_git_url", cloud_git_url) + +DISK_LOADSYNC_TXT(CloudStorage, "/cloud_git_url", cloud_git_url); HANDLE_PREFERENCE_TXT(CloudStorage, "/email", cloud_storage_email); HANDLE_PREFERENCE_TXT(CloudStorage, "/email_encoded", cloud_storage_email_encoded); -void qPrefCloudStorage::set_cloud_storage_newpassword(const QString& value) +void qPrefCloudStorage::set_cloud_storage_newpassword(const QString &value) { if (value == prefs.cloud_storage_newpassword) return; @@ -75,7 +78,7 @@ void qPrefCloudStorage::set_cloud_storage_newpassword(const QString& value) emit cloud_storage_newpassword_changed(value); } -void qPrefCloudStorage::set_cloud_storage_password(const QString& value) +void qPrefCloudStorage::set_cloud_storage_password(const QString &value) { if (value != prefs.cloud_storage_password) { qPrefPrivate::copy_txt(&prefs.cloud_storage_password, value); @@ -86,7 +89,7 @@ void qPrefCloudStorage::set_cloud_storage_password(const QString& value) void qPrefCloudStorage::disk_cloud_storage_password(bool doSync) { if (doSync) { - if (prefs.save_password_local) + if (prefs.save_password_local) qPrefPrivate::instance()->setting.setValue(group + "/password", prefs.cloud_storage_password); } else { prefs.cloud_storage_password = copy_qstring(qPrefPrivate::instance()->setting.value(group + "/password", default_prefs.cloud_storage_password).toString()); diff --git a/core/settings/qPrefCloudStorage.h b/core/settings/qPrefCloudStorage.h index 30638c4ed..f92e0e1ef 100644 --- a/core/settings/qPrefCloudStorage.h +++ b/core/settings/qPrefCloudStorage.h @@ -46,34 +46,34 @@ public: static inline QString userid() { return prefs.userid; } public slots: - void set_cloud_base_url(const QString& value); - void set_cloud_git_url(const QString& value); - void set_cloud_storage_email(const QString& value); - void set_cloud_storage_email_encoded(const QString& value); - void set_cloud_storage_newpassword(const QString& value); - void set_cloud_storage_password(const QString& value); - void set_cloud_storage_pin(const QString& value); + void set_cloud_base_url(const QString &value); + void set_cloud_git_url(const QString &value); + void set_cloud_storage_email(const QString &value); + void set_cloud_storage_email_encoded(const QString &value); + void set_cloud_storage_newpassword(const QString &value); + void set_cloud_storage_password(const QString &value); + void set_cloud_storage_pin(const QString &value); void set_cloud_timeout(int value); void set_cloud_verification_status(int value); void set_git_local_only(bool value); void set_save_password_local(bool value); void set_save_userid_local(bool value); - void set_userid(const QString& value); + void set_userid(const QString &value); signals: - void cloud_base_url_changed(const QString& value); - void cloud_git_url_changed(const QString& value); - void cloud_storage_email_changed(const QString& value); - void cloud_storage_email_encoded_changed(const QString& value); - void cloud_storage_newpassword_changed(const QString& value); - void cloud_storage_password_changed(const QString& value); - void cloud_storage_pin_changed(const QString& value); + void cloud_base_url_changed(const QString &value); + void cloud_git_url_changed(const QString &value); + void cloud_storage_email_changed(const QString &value); + void cloud_storage_email_encoded_changed(const QString &value); + void cloud_storage_newpassword_changed(const QString &value); + void cloud_storage_password_changed(const QString &value); + void cloud_storage_pin_changed(const QString &value); void cloud_timeout_changed(int value); void cloud_verification_status_changed(int value); void git_local_only_changed(bool value); void save_password_local_changed(bool value); void save_userid_local_changed(bool value); - void userid_changed(const QString& value); + void userid_changed(const QString &value); private: // functions to load/sync variable with disk diff --git a/core/settings/qPrefDisplay.cpp b/core/settings/qPrefDisplay.cpp index cf08af8cd..809a4fe77 100644 --- a/core/settings/qPrefDisplay.cpp +++ b/core/settings/qPrefDisplay.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 +#include "core/subsurface-string.h" #include "qPref.h" #include "qPrefPrivate.h" -#include "core/subsurface-string.h" #include <QApplication> #include <QFont> @@ -26,14 +26,14 @@ void qPrefDisplay::loadSync(bool doSync) disk_theme(doSync); } -void qPrefDisplay::set_divelist_font(const QString& value) +void qPrefDisplay::set_divelist_font(const QString &value) { QString newValue = value; if (value.contains(",")) newValue = value.left(value.indexOf(",")); if (newValue != prefs.divelist_font && - !subsurface_ignore_font(qPrintable(newValue))) { + !subsurface_ignore_font(qPrintable(newValue))) { qPrefPrivate::copy_txt(&prefs.divelist_font, value); disk_divelist_font(true); diff --git a/core/settings/qPrefDisplay.h b/core/settings/qPrefDisplay.h index 57cf15ba0..5d077fc2a 100644 --- a/core/settings/qPrefDisplay.h +++ b/core/settings/qPrefDisplay.h @@ -23,25 +23,25 @@ public: void inline sync() { loadSync(true); } public: - static inline QString divelist_font() {return prefs.divelist_font; }; - static inline double font_size() {return prefs.font_size; }; - static inline bool display_invalid_dives() {return prefs.display_invalid_dives; }; - static inline bool show_developer() {return prefs.show_developer; }; - static inline QString theme() {return prefs.theme; }; + static inline QString divelist_font() { return prefs.divelist_font; }; + static inline double font_size() { return prefs.font_size; }; + static inline bool display_invalid_dives() { return prefs.display_invalid_dives; }; + static inline bool show_developer() { return prefs.show_developer; }; + static inline QString theme() { return prefs.theme; }; public slots: - void set_divelist_font(const QString& value); + void set_divelist_font(const QString &value); void set_font_size(double value); void set_display_invalid_dives(bool value); void set_show_developer(bool value); - void set_theme(const QString& value); + void set_theme(const QString &value); signals: - void divelist_font_changed(const QString& value); + void divelist_font_changed(const QString &value); void font_size_changed(double value); void display_invalid_dives_changed(bool value); void show_developer_changed(bool value); - void theme_changed(const QString& value); + void theme_changed(const QString &value); private: // functions to load/sync variable with disk diff --git a/core/settings/qPrefDiveComputer.h b/core/settings/qPrefDiveComputer.h index c270c8155..30cc5e1e0 100644 --- a/core/settings/qPrefDiveComputer.h +++ b/core/settings/qPrefDiveComputer.h @@ -11,7 +11,7 @@ class qPrefDiveComputer : public QObject { Q_PROPERTY(QString device_name READ device_name WRITE set_device_name NOTIFY device_name_changed); Q_PROPERTY(int download_mode READ download_mode WRITE set_download_mode NOTIFY download_mode_changed); Q_PROPERTY(QString product READ product WRITE set_product NOTIFY product_changed); - Q_PROPERTY(QString vendor READ vendor WRITE set_vendor NOTIFY vendor_changed); + Q_PROPERTY(QString vendor READ vendor WRITE set_vendor NOTIFY vendor_changed); public: qPrefDiveComputer(QObject *parent = NULL); @@ -19,29 +19,29 @@ public: // Load/Sync local settings (disk) and struct preference void loadSync(bool doSync); - void inline load() {loadSync(false); } - void inline sync() {loadSync(true); } + void inline load() { loadSync(false); } + void inline sync() { loadSync(true); } public: - static inline QString device() {return prefs.dive_computer.device; }; - static inline QString device_name() {return prefs.dive_computer.device_name; }; - static inline int download_mode() {return prefs.dive_computer.download_mode; }; - static inline QString product() {return prefs.dive_computer.product; }; - static inline QString vendor() {return prefs.dive_computer.vendor; }; + static inline QString device() { return prefs.dive_computer.device; }; + static inline QString device_name() { return prefs.dive_computer.device_name; }; + static inline int download_mode() { return prefs.dive_computer.download_mode; }; + static inline QString product() { return prefs.dive_computer.product; }; + static inline QString vendor() { return prefs.dive_computer.vendor; }; public slots: - void set_device(const QString& device); - void set_device_name(const QString& device_name); + void set_device(const QString &device); + void set_device_name(const QString &device_name); void set_download_mode(int mode); - void set_product(const QString& product); - void set_vendor(const QString& vendor); + void set_product(const QString &product); + void set_vendor(const QString &vendor); signals: - void device_changed(const QString& device); - void device_name_changed(const QString& device_name); + void device_changed(const QString &device); + void device_name_changed(const QString &device_name); void download_mode_changed(int mode); - void product_changed(const QString& product); - void vendor_changed(const QString& vendor); + void product_changed(const QString &product); + void vendor_changed(const QString &vendor); private: // functions to load/sync variable with disk diff --git a/core/settings/qPrefPrivate.cpp b/core/settings/qPrefPrivate.cpp index 32b00ee79..0275791cf 100644 --- a/core/settings/qPrefPrivate.cpp +++ b/core/settings/qPrefPrivate.cpp @@ -10,9 +10,8 @@ qPrefPrivate *qPrefPrivate::instance() return self; } -void qPrefPrivate::copy_txt(const char **name, const QString& string) +void qPrefPrivate::copy_txt(const char **name, const QString &string) { free((void *)*name); *name = copy_qstring(string); } - diff --git a/core/settings/qPrefPrivate.h b/core/settings/qPrefPrivate.h index da80f6a4b..40b4bb332 100644 --- a/core/settings/qPrefPrivate.h +++ b/core/settings/qPrefPrivate.h @@ -3,15 +3,15 @@ #define QPREFPRIVATE_H // Header used by all qPref<class> implementations to avoid duplicating code +#include "core/qthelper.h" #include "qPref.h" +#include <QObject> #include <QSettings> #include <QVariant> -#include <QObject> -#include "core/qthelper.h" // implementation class of the interface classes class qPrefPrivate : public QObject { - Q_OBJECT + Q_OBJECT public: friend class qPrefAnimations; @@ -20,175 +20,174 @@ public: friend class qPrefDiveComputer; private: - static qPrefPrivate *instance(); + static qPrefPrivate *instance(); QSettings setting; // Helper functions - static void copy_txt(const char **name, const QString& string); + static void copy_txt(const char **name, const QString &string); - qPrefPrivate(QObject *parent = NULL); + qPrefPrivate(QObject *parent = NULL); }; - //******* Macros to generate disk function -#define DISK_LOADSYNC_BOOL_EXT(usegroup, name, field, usestruct) \ -void qPref ## usegroup::disk_ ## field(bool doSync) \ -{ \ - if (doSync) \ - qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ - else \ - prefs.usestruct field = qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toBool(); \ -} +#define DISK_LOADSYNC_BOOL_EXT(usegroup, name, field, usestruct) \ + void qPref##usegroup::disk_##field(bool doSync) \ + { \ + if (doSync) \ + qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ + else \ + prefs.usestruct field = qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toBool(); \ + } #define DISK_LOADSYNC_BOOL(usegroup, name, field) \ -DISK_LOADSYNC_BOOL_EXT(usegroup, name, field, ) - -#define DISK_LOADSYNC_DOUBLE_EXT(usegroup, name, field, usestruct) \ -void qPref ## usegroup::disk_ ## field(bool doSync) \ -{ \ - if (doSync) \ - qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ - else \ - prefs.usestruct field = qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toDouble(); \ -} + DISK_LOADSYNC_BOOL_EXT(usegroup, name, field, ) + +#define DISK_LOADSYNC_DOUBLE_EXT(usegroup, name, field, usestruct) \ + void qPref##usegroup::disk_##field(bool doSync) \ + { \ + if (doSync) \ + qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ + else \ + prefs.usestruct field = qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toDouble(); \ + } #define DISK_LOADSYNC_DOUBLE(usegroup, name, field) \ -DISK_LOADSYNC_DOUBLE_EXT(usegroup, name, field, ) - -#define DISK_LOADSYNC_ENUM_EXT(usegroup, name, type, field, usestruct) \ -void qPref ## usegroup::disk_ ## field(bool doSync) \ -{ \ - if (doSync) \ - qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ - else \ - prefs.usestruct field = (enum type)qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toInt(); \ -} + DISK_LOADSYNC_DOUBLE_EXT(usegroup, name, field, ) + +#define DISK_LOADSYNC_ENUM_EXT(usegroup, name, type, field, usestruct) \ + void qPref##usegroup::disk_##field(bool doSync) \ + { \ + if (doSync) \ + qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ + else \ + prefs.usestruct field = (enum type)qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toInt(); \ + } #define DISK_LOADSYNC_ENUM(usegroup, name, type, field) \ -DISK_LOADSYNC_ENUM_EXT(usegroup, name, type, field, ) - -#define DISK_LOADSYNC_INT_EXT(usegroup, name, field, usestruct) \ -void qPref ## usegroup::disk_ ## field(bool doSync) \ -{ \ - if (doSync) \ - qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ - else \ - prefs.usestruct field = qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toInt(); \ -} + DISK_LOADSYNC_ENUM_EXT(usegroup, name, type, field, ) + +#define DISK_LOADSYNC_INT_EXT(usegroup, name, field, usestruct) \ + void qPref##usegroup::disk_##field(bool doSync) \ + { \ + if (doSync) \ + qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ + else \ + prefs.usestruct field = qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toInt(); \ + } #define DISK_LOADSYNC_INT(usegroup, name, field) \ -DISK_LOADSYNC_INT(usegroup, name, field, ) - -#define DISK_LOADSYNC_INT_DEF_EXT(usegroup, name, field, defval, usestruct) \ -void qPref ## usegroup::disk_ ## field(bool doSync) \ -{ \ - if (doSync) \ - qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ - else \ - prefs.usestruct field = qPrefPrivate::instance()->setting.value(group + name, defval).toInt(); \ -} + DISK_LOADSYNC_INT(usegroup, name, field, ) + +#define DISK_LOADSYNC_INT_DEF_EXT(usegroup, name, field, defval, usestruct) \ + void qPref##usegroup::disk_##field(bool doSync) \ + { \ + if (doSync) \ + qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ + else \ + prefs.usestruct field = qPrefPrivate::instance()->setting.value(group + name, defval).toInt(); \ + } #define DISK_LOADSYNC_INT_DEF(usegroup, name, field, defval) \ -DISK_LOADSYNC_INT_DEF_EXT(usegroup, name, field, defval, ) - -#define DISK_LOADSYNC_TXT_EXT(usegroup, name, field, usestruct) \ -void qPref ## usegroup::disk_ ## field(bool doSync) \ -{ \ - if (doSync) \ - qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ - else \ - prefs.usestruct field = copy_qstring(qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toString()); \ -} + DISK_LOADSYNC_INT_DEF_EXT(usegroup, name, field, defval, ) + +#define DISK_LOADSYNC_TXT_EXT(usegroup, name, field, usestruct) \ + void qPref##usegroup::disk_##field(bool doSync) \ + { \ + if (doSync) \ + qPrefPrivate::instance()->setting.setValue(group + name, prefs.usestruct field); \ + else \ + prefs.usestruct field = copy_qstring(qPrefPrivate::instance()->setting.value(group + name, default_prefs.usestruct field).toString()); \ + } #define DISK_LOADSYNC_TXT(usegroup, name, field) \ -DISK_LOADSYNC_TXT_EXT(usegroup, name, field, ) + DISK_LOADSYNC_TXT_EXT(usegroup, name, field, ) //******* Macros to generate set function #define SET_PREFERENCE_BOOL_EXT(usegroup, field, usestruct) \ -void qPref ## usegroup::set_ ## field (bool value) \ -{ \ - if (value != prefs.usestruct field) { \ - prefs.usestruct field = value; \ - disk_ ## field(true); \ - emit field ## _changed(value); \ - } \ -} + void qPref##usegroup::set_##field(bool value) \ + { \ + if (value != prefs.usestruct field) { \ + prefs.usestruct field = value; \ + disk_##field(true); \ + emit field##_changed(value); \ + } \ + } #define SET_PREFERENCE_BOOL(usegroup, field) \ -SET_PREFERENCE_BOOL_EXT(usegroup, field, ) \ + SET_PREFERENCE_BOOL_EXT(usegroup, field, ) #define SET_PREFERENCE_DOUBLE_EXT(usegroup, field, usestruct) \ -void qPref ## usegroup::set_ ## field (double value) \ -{ \ - if (value != prefs.usestruct field) { \ - prefs.usestruct field = value; \ - disk_ ## field(true); \ - emit field ## _changed(value); \ - } \ -} + void qPref##usegroup::set_##field(double value) \ + { \ + if (value != prefs.usestruct field) { \ + prefs.usestruct field = value; \ + disk_##field(true); \ + emit field##_changed(value); \ + } \ + } #define SET_PREFERENCE_DOUBLE(usegroup, field) \ -SET_PREFERENCE_DOUBLE_EXT(usegroup, field, ) \ + SET_PREFERENCE_DOUBLE_EXT(usegroup, field, ) #define SET_PREFERENCE_ENUM_EXT(usegroup, type, field, usestruct) \ -void qPref ## usegroup::set_ ## field (type value) \ -{ \ - if (value != prefs.usestruct field) { \ - prefs.usestruct field = value; \ - disk_ ## field(true); \ - emit field ## _changed(value); \ - } \ -} + void qPref##usegroup::set_##field(type value) \ + { \ + if (value != prefs.usestruct field) { \ + prefs.usestruct field = value; \ + disk_##field(true); \ + emit field##_changed(value); \ + } \ + } #define SET_PREFERENCE_ENUM(usegroup, type, field) \ -SET_PREFERENCE_ENUM_EXT(usegroup, type, field, ) + SET_PREFERENCE_ENUM_EXT(usegroup, type, field, ) #define SET_PREFERENCE_INT_EXT(usegroup, field, usestruct) \ -void qPref ## usegroup::set_ ## field (int value) \ -{ \ - if (value != prefs.usestruct field) { \ - prefs.usestruct field = value; \ - disk_ ## field(true); \ - emit field ## _changed(value); \ - } \ -} + void qPref##usegroup::set_##field(int value) \ + { \ + if (value != prefs.usestruct field) { \ + prefs.usestruct field = value; \ + disk_##field(true); \ + emit field##_changed(value); \ + } \ + } #define SET_PREFERENCE_INT(usegroup, field) \ -SET_PREFERENCE_INT_EXT(usegroup, field, ) \ - -#define SET_PREFERENCE_TXT_EXT(usegroup, field, usestruct) \ -void qPref ## usegroup::set_ ## field (const QString& value) \ -{ \ - if (value != prefs.usestruct field) { \ - qPrefPrivate::instance()->copy_txt(&prefs.usestruct field, value); \ - disk_ ## field(true); \ - emit field ## _changed(value); \ - } \ -} + SET_PREFERENCE_INT_EXT(usegroup, field, ) + +#define SET_PREFERENCE_TXT_EXT(usegroup, field, usestruct) \ + void qPref##usegroup::set_##field(const QString &value) \ + { \ + if (value != prefs.usestruct field) { \ + qPrefPrivate::instance()->copy_txt(&prefs.usestruct field, value); \ + disk_##field(true); \ + emit field##_changed(value); \ + } \ + } #define SET_PREFERENCE_TXT(usegroup, field) \ -SET_PREFERENCE_TXT_EXT(usegroup, field, ) \ + SET_PREFERENCE_TXT_EXT(usegroup, field, ) //******* Macros to generate set/set/loadsync combined #define HANDLE_PREFERENCE_BOOL_EXT(usegroup, name, field, usestruct) \ -SET_PREFERENCE_BOOL_EXT(usegroup, field, usestruct); \ -DISK_LOADSYNC_BOOL_EXT(usegroup, name, field, usestruct); + SET_PREFERENCE_BOOL_EXT(usegroup, field, usestruct); \ + DISK_LOADSYNC_BOOL_EXT(usegroup, name, field, usestruct); #define HANDLE_PREFERENCE_BOOL(usegroup, name, field) \ -HANDLE_PREFERENCE_BOOL_EXT(usegroup, name, field, ) + HANDLE_PREFERENCE_BOOL_EXT(usegroup, name, field, ) #define HANDLE_PREFERENCE_DOUBLE_EXT(usegroup, name, field, usestruct) \ -SET_PREFERENCE_DOUBLE_EXT(usegroup, field, usestruct); \ -DISK_LOADSYNC_DOUBLE_EXT(usegroup, name, field, usestruct); + SET_PREFERENCE_DOUBLE_EXT(usegroup, field, usestruct); \ + DISK_LOADSYNC_DOUBLE_EXT(usegroup, name, field, usestruct); #define HANDLE_PREFERENCE_DOUBLE(usegroup, name, field) \ -HANDLE_PREFERENCE_DOUBLE_EXT(usegroup, name, field, ) + HANDLE_PREFERENCE_DOUBLE_EXT(usegroup, name, field, ) #define HANDLE_PREFERENCE_ENUM_EXT(usegroup, type, name, field, usestruct) \ -SET_PREFERENCE_ENUM_EXT(usegroup, type, field, usestruct); \ -DISK_LOADSYNC_ENUM_EXT(usegroup, name, type, field, usestruct); + SET_PREFERENCE_ENUM_EXT(usegroup, type, field, usestruct); \ + DISK_LOADSYNC_ENUM_EXT(usegroup, name, type, field, usestruct); #define HANDLE_PREFERENCE_ENUM(usegroup, type, name, field) \ -HANDLE_PREFERENCE_ENUM_EXT(usegroup, type, name, field, ) + HANDLE_PREFERENCE_ENUM_EXT(usegroup, type, name, field, ) #define HANDLE_PREFERENCE_INT_EXT(usegroup, name, field, usestruct) \ -SET_PREFERENCE_INT_EXT(usegroup, field, usestruct); \ -DISK_LOADSYNC_INT_EXT(usegroup, name, field, usestruct); + SET_PREFERENCE_INT_EXT(usegroup, field, usestruct); \ + DISK_LOADSYNC_INT_EXT(usegroup, name, field, usestruct); #define HANDLE_PREFERENCE_INT(usegroup, name, field) \ -HANDLE_PREFERENCE_INT_EXT(usegroup, name, field, ) + HANDLE_PREFERENCE_INT_EXT(usegroup, name, field, ) #define HANDLE_PREFERENCE_TXT_EXT(usegroup, name, field, usestruct) \ -SET_PREFERENCE_TXT_EXT(usegroup, field, usestruct); \ -DISK_LOADSYNC_TXT_EXT(usegroup, name, field, usestruct); + SET_PREFERENCE_TXT_EXT(usegroup, field, usestruct); \ + DISK_LOADSYNC_TXT_EXT(usegroup, name, field, usestruct); #define HANDLE_PREFERENCE_TXT(usegroup, name, field) \ -HANDLE_PREFERENCE_TXT_EXT(usegroup, name, field, ) + HANDLE_PREFERENCE_TXT_EXT(usegroup, name, field, ) #endif |