From 128fc5f4b81f036eeb76cda99704095673efbe8e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 25 Jul 2018 10:49:48 -0700 Subject: 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 --- core/settings/qPrefPrivate.h | 255 +++++++++++++++++++++---------------------- 1 file changed, 127 insertions(+), 128 deletions(-) (limited to 'core/settings/qPrefPrivate.h') 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 implementations to avoid duplicating code +#include "core/qthelper.h" #include "qPref.h" +#include #include #include -#include -#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 -- cgit v1.2.3-70-g09d2