diff options
author | jan Iversen <jani@apache.org> | 2018-08-14 10:30:07 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-08-15 16:11:39 -0700 |
commit | 9b8a6fa8552647c1c1e7b78000e93a1bbc508365 (patch) | |
tree | 4196fe4371cab7e02c5168256e2d6ce380aadbce /core/settings | |
parent | 0825f644e0b98190d68e0b63c4204fa8282e84b4 (diff) | |
download | subsurface-9b8a6fa8552647c1c1e7b78000e93a1bbc508365.tar.gz |
core: make methods in qPref* static
Make methods static to allow fast and esay access
use qPrefXYZ::foo() instead of qPrefXYZ::instance()->foo()
Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'core/settings')
-rw-r--r-- | core/settings/qPrefAnimations.cpp | 2 | ||||
-rw-r--r-- | core/settings/qPrefAnimations.h | 10 | ||||
-rw-r--r-- | core/settings/qPrefCloudStorage.cpp | 6 | ||||
-rw-r--r-- | core/settings/qPrefCloudStorage.h | 54 | ||||
-rw-r--r-- | core/settings/qPrefDisplay.cpp | 4 | ||||
-rw-r--r-- | core/settings/qPrefDisplay.h | 28 | ||||
-rw-r--r-- | core/settings/qPrefDiveComputer.h | 26 | ||||
-rw-r--r-- | core/settings/qPrefDivePlanner.h | 108 | ||||
-rw-r--r-- | core/settings/qPrefFacebook.cpp | 6 | ||||
-rw-r--r-- | core/settings/qPrefFacebook.h | 18 | ||||
-rw-r--r-- | core/settings/qPrefGeneral.h | 72 | ||||
-rw-r--r-- | core/settings/qPrefGeocoding.cpp | 6 | ||||
-rw-r--r-- | core/settings/qPrefGeocoding.h | 12 | ||||
-rw-r--r-- | core/settings/qPrefLanguage.h | 54 | ||||
-rw-r--r-- | core/settings/qPrefLocationService.h | 18 | ||||
-rw-r--r-- | core/settings/qPrefPartialPressureGas.h | 48 | ||||
-rw-r--r-- | core/settings/qPrefProxy.h | 30 | ||||
-rw-r--r-- | core/settings/qPrefTechnicalDetails.h | 115 | ||||
-rw-r--r-- | core/settings/qPrefUnit.cpp | 2 | ||||
-rw-r--r-- | core/settings/qPrefUnit.h | 46 | ||||
-rw-r--r-- | core/settings/qPrefUpdateManager.cpp | 4 | ||||
-rw-r--r-- | core/settings/qPrefUpdateManager.h | 28 |
22 files changed, 349 insertions, 348 deletions
diff --git a/core/settings/qPrefAnimations.cpp b/core/settings/qPrefAnimations.cpp index 9be8900c5..ca1980210 100644 --- a/core/settings/qPrefAnimations.cpp +++ b/core/settings/qPrefAnimations.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#include "qPref.h" +#include "qPrefAnimations.h" #include "qPrefPrivate.h" static const QString group = QStringLiteral("Animations"); diff --git a/core/settings/qPrefAnimations.h b/core/settings/qPrefAnimations.h index c24a6590e..450e854f9 100644 --- a/core/settings/qPrefAnimations.h +++ b/core/settings/qPrefAnimations.h @@ -14,22 +14,22 @@ public: static qPrefAnimations *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: static int animation_speed() { return prefs.animation_speed; } public slots: - void set_animation_speed(int value); + static void set_animation_speed(int value); signals: void animation_speed_changed(int value); private: // functions to load/sync variable with disk - void disk_animation_speed(bool doSync); + static void disk_animation_speed(bool doSync); }; #endif diff --git a/core/settings/qPrefCloudStorage.cpp b/core/settings/qPrefCloudStorage.cpp index c3e9c60a7..421893135 100644 --- a/core/settings/qPrefCloudStorage.cpp +++ b/core/settings/qPrefCloudStorage.cpp @@ -40,7 +40,7 @@ void qPrefCloudStorage::set_cloud_base_url(const QString &value) } disk_cloud_base_url(true); - emit cloud_base_url_changed(value); + emit instance()->cloud_base_url_changed(value); } } void qPrefCloudStorage::disk_cloud_base_url(bool doSync) @@ -65,7 +65,7 @@ void qPrefCloudStorage::set_cloud_storage_newpassword(const QString &value) qPrefPrivate::copy_txt(&prefs.cloud_storage_newpassword, value); // NOT saved on disk, because it is only temporary - emit cloud_storage_newpassword_changed(value); + emit instance()->cloud_storage_newpassword_changed(value); } void qPrefCloudStorage::set_cloud_storage_password(const QString &value) @@ -73,7 +73,7 @@ void qPrefCloudStorage::set_cloud_storage_password(const QString &value) if (value != prefs.cloud_storage_password) { qPrefPrivate::copy_txt(&prefs.cloud_storage_password, value); disk_cloud_storage_password(true); - emit cloud_storage_password_changed(value); + emit instance()->cloud_storage_password_changed(value); } } void qPrefCloudStorage::disk_cloud_storage_password(bool doSync) diff --git a/core/settings/qPrefCloudStorage.h b/core/settings/qPrefCloudStorage.h index 6f32aef95..91864afbc 100644 --- a/core/settings/qPrefCloudStorage.h +++ b/core/settings/qPrefCloudStorage.h @@ -26,9 +26,9 @@ public: static qPrefCloudStorage *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: static QString cloud_base_url() { return prefs.cloud_base_url; } @@ -46,18 +46,18 @@ public: static QString userid() { return prefs.userid; } public slots: - void set_cloud_base_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); + static void set_cloud_base_url(const QString &value); + static void set_cloud_storage_email(const QString &value); + static void set_cloud_storage_email_encoded(const QString &value); + static void set_cloud_storage_newpassword(const QString &value); + static void set_cloud_storage_password(const QString &value); + static void set_cloud_storage_pin(const QString &value); + static void set_cloud_timeout(int value); + static void set_cloud_verification_status(int value); + static void set_git_local_only(bool value); + static void set_save_password_local(bool value); + static void set_save_userid_local(bool value); + static void set_userid(const QString &value); signals: void cloud_base_url_changed(const QString &value); @@ -75,18 +75,18 @@ signals: private: // functions to load/sync variable with disk - void disk_cloud_base_url(bool doSync); - void disk_cloud_storage_email(bool doSync); - void disk_cloud_storage_email_encoded(bool doSync); - void disk_cloud_storage_newpassword(bool doSync); - void disk_cloud_storage_password(bool doSync); - void disk_cloud_storage_pin(bool doSync); - void disk_cloud_timeout(bool doSync); - void disk_cloud_verification_status(bool doSync); - void disk_git_local_only(bool doSync); - void disk_save_password_local(bool doSync); - void disk_save_userid_local(bool doSync); - void disk_userid(bool doSync); + static void disk_cloud_base_url(bool doSync); + static void disk_cloud_storage_email(bool doSync); + static void disk_cloud_storage_email_encoded(bool doSync); + static void disk_cloud_storage_newpassword(bool doSync); + static void disk_cloud_storage_password(bool doSync); + static void disk_cloud_storage_pin(bool doSync); + static void disk_cloud_timeout(bool doSync); + static void disk_cloud_verification_status(bool doSync); + static void disk_git_local_only(bool doSync); + static void disk_save_password_local(bool doSync); + static void disk_save_userid_local(bool doSync); + static void disk_userid(bool doSync); }; #endif diff --git a/core/settings/qPrefDisplay.cpp b/core/settings/qPrefDisplay.cpp index 809a4fe77..5eb0b1eb6 100644 --- a/core/settings/qPrefDisplay.cpp +++ b/core/settings/qPrefDisplay.cpp @@ -38,7 +38,7 @@ void qPrefDisplay::set_divelist_font(const QString &value) disk_divelist_font(true); qApp->setFont(QFont(newValue)); - emit divelist_font_changed(value); + emit instance()->divelist_font_changed(value); } } void qPrefDisplay::disk_divelist_font(bool doSync) @@ -58,7 +58,7 @@ void qPrefDisplay::set_font_size(double value) QFont defaultFont = qApp->font(); defaultFont.setPointSizeF(prefs.font_size); qApp->setFont(defaultFont); - emit font_size_changed(value); + emit instance()->font_size_changed(value); } } void qPrefDisplay::disk_font_size(bool doSync) diff --git a/core/settings/qPrefDisplay.h b/core/settings/qPrefDisplay.h index 804f4a258..ba7be7200 100644 --- a/core/settings/qPrefDisplay.h +++ b/core/settings/qPrefDisplay.h @@ -18,9 +18,9 @@ public: static qPrefDisplay *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: static QString divelist_font() { return prefs.divelist_font; } @@ -30,11 +30,11 @@ public: static QString theme() { return prefs.theme; } public slots: - 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); + static void set_divelist_font(const QString &value); + static void set_font_size(double value); + static void set_display_invalid_dives(bool value); + static void set_show_developer(bool value); + static void set_theme(const QString &value); signals: void divelist_font_changed(const QString &value); @@ -45,13 +45,13 @@ signals: private: // functions to load/sync variable with disk - void disk_divelist_font(bool doSync); - void disk_font_size(bool doSync); - void disk_display_invalid_dives(bool doSync); - void disk_show_developer(bool doSync); - void disk_theme(bool doSync); + static void disk_divelist_font(bool doSync); + static void disk_font_size(bool doSync); + static void disk_display_invalid_dives(bool doSync); + static void disk_show_developer(bool doSync); + static void disk_theme(bool doSync); // font helper function - void setCorrectFont(); + static void setCorrectFont(); }; #endif diff --git a/core/settings/qPrefDiveComputer.h b/core/settings/qPrefDiveComputer.h index dda0b9500..99ff6575b 100644 --- a/core/settings/qPrefDiveComputer.h +++ b/core/settings/qPrefDiveComputer.h @@ -18,9 +18,9 @@ public: static qPrefDiveComputer *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: static QString device() { return prefs.dive_computer.device; } @@ -30,11 +30,11 @@ public: static 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_download_mode(int mode); - void set_product(const QString &product); - void set_vendor(const QString &vendor); + static void set_device(const QString &device); + static void set_device_name(const QString &device_name); + static void set_download_mode(int mode); + static void set_product(const QString &product); + static void set_vendor(const QString &vendor); signals: void device_changed(const QString &device); @@ -45,11 +45,11 @@ signals: private: // functions to load/sync variable with disk - void disk_device(bool doSync); - void disk_device_name(bool doSync); - void disk_download_mode(bool doSync); - void disk_product(bool doSync); - void disk_vendor(bool doSync); + static void disk_device(bool doSync); + static void disk_device_name(bool doSync); + static void disk_download_mode(bool doSync); + static void disk_product(bool doSync); + static void disk_vendor(bool doSync); }; #endif diff --git a/core/settings/qPrefDivePlanner.h b/core/settings/qPrefDivePlanner.h index 77af1b8b9..fa6ecb80c 100644 --- a/core/settings/qPrefDivePlanner.h +++ b/core/settings/qPrefDivePlanner.h @@ -38,9 +38,9 @@ public: static qPrefDivePlanner *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: static int ascratelast6m() { return prefs.ascratelast6m; } @@ -70,31 +70,31 @@ public: static bool verbatim_plan() { return prefs.verbatim_plan; } public slots: - void set_ascratelast6m(int value); - void set_ascratestops(int value); - void set_ascrate50(int value); - void set_ascrate75(int value); - void set_bestmixend(depth_t value); - void set_bottompo2(int value); - void set_bottomsac(int value); - void set_decopo2(int value); - void set_decosac(int value); - void set_descrate(int value); - void set_display_duration(bool value); - void set_display_runtime(bool value); - void set_display_transitions(bool value); - void set_display_variations(bool value); - void set_doo2breaks(bool value); - void set_drop_stone_mode(bool value); - void set_last_stop(bool value); - void set_min_switch_duration(int value); - void set_planner_deco_mode(deco_mode value); - void set_problemsolvingtime(int value); - void set_reserve_gas(int value); - void set_sacfactor(int value); - void set_safetystop(bool value); - void set_switch_at_req_stop(bool value); - void set_verbatim_plan(bool value); + static void set_ascratelast6m(int value); + static void set_ascratestops(int value); + static void set_ascrate50(int value); + static void set_ascrate75(int value); + static void set_bestmixend(depth_t value); + static void set_bottompo2(int value); + static void set_bottomsac(int value); + static void set_decopo2(int value); + static void set_decosac(int value); + static void set_descrate(int value); + static void set_display_duration(bool value); + static void set_display_runtime(bool value); + static void set_display_transitions(bool value); + static void set_display_variations(bool value); + static void set_doo2breaks(bool value); + static void set_drop_stone_mode(bool value); + static void set_last_stop(bool value); + static void set_min_switch_duration(int value); + static void set_planner_deco_mode(deco_mode value); + static void set_problemsolvingtime(int value); + static void set_reserve_gas(int value); + static void set_sacfactor(int value); + static void set_safetystop(bool value); + static void set_switch_at_req_stop(bool value); + static void set_verbatim_plan(bool value); signals: void ascratelast6m_changed(int value); @@ -124,32 +124,32 @@ signals: void verbatim_plan_changed(bool value); private: - void disk_ascratelast6m(bool doSync); - void disk_ascratestops(bool doSync); - void disk_ascrate50(bool doSync); - void disk_ascrate75(bool doSync); - void disk_bestmixend(bool doSync); - void disk_bottompo2(bool doSync); - void disk_bottomsac(bool doSync); - void disk_decopo2(bool doSync); - void disk_decosac(bool doSync); - void disk_descrate(bool doSync); - void disk_display_deco_mode(bool doSync); - void disk_display_duration(bool doSync); - void disk_display_runtime(bool doSync); - void disk_display_transitions(bool doSync); - void disk_display_variations(bool doSync); - void disk_doo2breaks(bool doSync); - void disk_drop_stone_mode(bool doSync); - void disk_last_stop(bool doSync); - void disk_min_switch_duration(bool doSync); - void disk_planner_deco_mode(bool doSync); - void disk_problemsolvingtime(bool doSync); - void disk_reserve_gas(bool doSync); - void disk_sacfactor(bool doSync); - void disk_safetystop(bool doSync); - void disk_switch_at_req_stop(bool doSync); - void disk_verbatim_plan(bool doSync); + static void disk_ascratelast6m(bool doSync); + static void disk_ascratestops(bool doSync); + static void disk_ascrate50(bool doSync); + static void disk_ascrate75(bool doSync); + static void disk_bestmixend(bool doSync); + static void disk_bottompo2(bool doSync); + static void disk_bottomsac(bool doSync); + static void disk_decopo2(bool doSync); + static void disk_decosac(bool doSync); + static void disk_descrate(bool doSync); + static void disk_display_deco_mode(bool doSync); + static void disk_display_duration(bool doSync); + static void disk_display_runtime(bool doSync); + static void disk_display_transitions(bool doSync); + static void disk_display_variations(bool doSync); + static void disk_doo2breaks(bool doSync); + static void disk_drop_stone_mode(bool doSync); + static void disk_last_stop(bool doSync); + static void disk_min_switch_duration(bool doSync); + static void disk_planner_deco_mode(bool doSync); + static void disk_problemsolvingtime(bool doSync); + static void disk_reserve_gas(bool doSync); + static void disk_sacfactor(bool doSync); + static void disk_safetystop(bool doSync); + static void disk_switch_at_req_stop(bool doSync); + static void disk_verbatim_plan(bool doSync); }; #endif diff --git a/core/settings/qPrefFacebook.cpp b/core/settings/qPrefFacebook.cpp index b96008920..29e62d38f 100644 --- a/core/settings/qPrefFacebook.cpp +++ b/core/settings/qPrefFacebook.cpp @@ -22,7 +22,7 @@ void qPrefFacebook::set_access_token(const QString &value) { if (value != prefs.facebook.access_token) { qPrefPrivate::instance()->copy_txt(&prefs.facebook.access_token, value); - emit access_token_changed(value); + emit instance()->access_token_changed(value); } } @@ -30,7 +30,7 @@ void qPrefFacebook::set_album_id(const QString &value) { if (value != prefs.facebook.album_id) { qPrefPrivate::instance()->copy_txt(&prefs.facebook.album_id, value); - emit album_id_changed(value); + emit instance()->album_id_changed(value); } } @@ -38,6 +38,6 @@ void qPrefFacebook::set_user_id(const QString &value) { if (value != prefs.facebook.user_id) { qPrefPrivate::instance()->copy_txt(&prefs.facebook.user_id, value); - emit access_token_changed(value); + emit instance()->access_token_changed(value); } } diff --git a/core/settings/qPrefFacebook.h b/core/settings/qPrefFacebook.h index 60c037583..0493b8ca9 100644 --- a/core/settings/qPrefFacebook.h +++ b/core/settings/qPrefFacebook.h @@ -17,9 +17,9 @@ public: static qPrefFacebook *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() {loadSync(false); } - void sync() {loadSync(true); } + static void loadSync(bool doSync); + static void load() {loadSync(false); } + static void sync() {loadSync(true); } public: static QString access_token() { return prefs.facebook.access_token; } @@ -27,9 +27,9 @@ public: static QString user_id() { return prefs.facebook.user_id; } public slots: - void set_access_token(const QString& value); - void set_album_id(const QString& value); - void set_user_id(const QString& value); + static void set_access_token(const QString& value); + static void set_album_id(const QString& value); + static void set_user_id(const QString& value); signals: void access_token_changed(const QString& value); @@ -37,9 +37,9 @@ signals: void user_id_changed(const QString& value); private: - void disk_access_token(bool doSync); - void disk_album_id(bool doSync); - void disk_user_id(bool doSync); + static void disk_access_token(bool doSync); + static void disk_album_id(bool doSync); + static void disk_user_id(bool doSync); }; #endif diff --git a/core/settings/qPrefGeneral.h b/core/settings/qPrefGeneral.h index 3263bb718..983e4eca0 100644 --- a/core/settings/qPrefGeneral.h +++ b/core/settings/qPrefGeneral.h @@ -24,35 +24,35 @@ public: static qPrefGeneral *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { return loadSync(false); } - void sync() { return loadSync(true); } + static void loadSync(bool doSync); + static void load() { return loadSync(false); } + static void sync() { return loadSync(true); } public: - bool auto_recalculate_thumbnails() { return prefs.auto_recalculate_thumbnails; } - QString default_cylinder() { return prefs.default_cylinder; } - QString default_filename() { return prefs.default_filename; } - enum def_file_behavior default_file_behavior() { return prefs.default_file_behavior; } - int defaultsetpoint() { return prefs.defaultsetpoint; } - bool extract_video_thumbnails() { return prefs.extract_video_thumbnails; } - int extract_video_thumbnails_position() { return prefs.extract_video_thumbnails_position; } - QString ffmpeg_executable() { return prefs.ffmpeg_executable; } - int o2consumption() { return prefs.o2consumption; } - int pscr_ratio() { return prefs.pscr_ratio; } - bool use_default_file() { return prefs.use_default_file; } + static bool auto_recalculate_thumbnails() { return prefs.auto_recalculate_thumbnails; } + static QString default_cylinder() { return prefs.default_cylinder; } + static QString default_filename() { return prefs.default_filename; } + static enum def_file_behavior default_file_behavior() { return prefs.default_file_behavior; } + static int defaultsetpoint() { return prefs.defaultsetpoint; } + static bool extract_video_thumbnails() { return prefs.extract_video_thumbnails; } + static int extract_video_thumbnails_position() { return prefs.extract_video_thumbnails_position; } + static QString ffmpeg_executable() { return prefs.ffmpeg_executable; } + static int o2consumption() { return prefs.o2consumption; } + static int pscr_ratio() { return prefs.pscr_ratio; } + static bool use_default_file() { return prefs.use_default_file; } public slots: - void set_auto_recalculate_thumbnails(bool value); - void set_default_cylinder(const QString& value); - void set_default_filename(const QString& value); - void set_default_file_behavior(enum def_file_behavior value); - void set_defaultsetpoint(int value); - void set_extract_video_thumbnails(bool value); - void set_extract_video_thumbnails_position(int value); - void set_ffmpeg_executable(const QString& value); - void set_o2consumption(int value); - void set_pscr_ratio(int value); - void set_use_default_file(bool value); + static void set_auto_recalculate_thumbnails(bool value); + static void set_default_cylinder(const QString& value); + static void set_default_filename(const QString& value); + static void set_default_file_behavior(enum def_file_behavior value); + static void set_defaultsetpoint(int value); + static void set_extract_video_thumbnails(bool value); + static void set_extract_video_thumbnails_position(int value); + static void set_ffmpeg_executable(const QString& value); + static void set_o2consumption(int value); + static void set_pscr_ratio(int value); + static void set_use_default_file(bool value); signals: void auto_recalculate_thumbnails_changed(bool value); @@ -68,17 +68,17 @@ signals: void use_default_file_changed(bool value); private: - void disk_auto_recalculate_thumbnails(bool doSync); - void disk_default_cylinder(bool doSync); - void disk_default_filename(bool doSync); - void disk_default_file_behavior(bool doSync); - void disk_defaultsetpoint(bool doSync); - void disk_extract_video_thumbnails(bool doSync); - void disk_extract_video_thumbnails_position(bool doSync); - void disk_ffmpeg_executable(bool doSync); - void disk_o2consumption(bool doSync); - void disk_pscr_ratio(bool doSync); - void disk_use_default_file(bool doSync); + static void disk_auto_recalculate_thumbnails(bool doSync); + static void disk_default_cylinder(bool doSync); + static void disk_default_filename(bool doSync); + static void disk_default_file_behavior(bool doSync); + static void disk_defaultsetpoint(bool doSync); + static void disk_extract_video_thumbnails(bool doSync); + static void disk_extract_video_thumbnails_position(bool doSync); + static void disk_ffmpeg_executable(bool doSync); + static void disk_o2consumption(bool doSync); + static void disk_pscr_ratio(bool doSync); + static void disk_use_default_file(bool doSync); }; #endif diff --git a/core/settings/qPrefGeocoding.cpp b/core/settings/qPrefGeocoding.cpp index 8d7553e53..a726e721f 100644 --- a/core/settings/qPrefGeocoding.cpp +++ b/core/settings/qPrefGeocoding.cpp @@ -26,7 +26,7 @@ void qPrefGeocoding::set_first_taxonomy_category(taxonomy_category value) if (value != prefs.geocoding.category[0]) { prefs.geocoding.category[0] = value; disk_first_taxonomy_category(true); - emit first_taxonomy_category_changed(value); + emit instance()->first_taxonomy_category_changed(value); } } void qPrefGeocoding::disk_first_taxonomy_category(bool doSync) @@ -43,7 +43,7 @@ void qPrefGeocoding::set_second_taxonomy_category(taxonomy_category value) if (value != prefs.geocoding.category[1]) { prefs.geocoding.category[1] = value; disk_second_taxonomy_category(true); - emit second_taxonomy_category_changed(value); + emit instance()->second_taxonomy_category_changed(value); } } void qPrefGeocoding::disk_second_taxonomy_category(bool doSync) @@ -60,7 +60,7 @@ void qPrefGeocoding::set_third_taxonomy_category(taxonomy_category value) if (value != prefs.geocoding.category[2]) { prefs.geocoding.category[2] = value; disk_third_taxonomy_category(true); - emit third_taxonomy_category_changed(value); + emit instance()->third_taxonomy_category_changed(value); } } void qPrefGeocoding::disk_third_taxonomy_category(bool doSync) diff --git a/core/settings/qPrefGeocoding.h b/core/settings/qPrefGeocoding.h index ce3eba2e5..03c9f59c8 100644 --- a/core/settings/qPrefGeocoding.h +++ b/core/settings/qPrefGeocoding.h @@ -27,9 +27,9 @@ public: taxonomy_category third_taxonomy_category() { return prefs.geocoding.category[2]; } public slots: - void set_first_taxonomy_category(taxonomy_category value); - void set_second_taxonomy_category(taxonomy_category value); - void set_third_taxonomy_category(taxonomy_category value); + static void set_first_taxonomy_category(taxonomy_category value); + static void set_second_taxonomy_category(taxonomy_category value); + static void set_third_taxonomy_category(taxonomy_category value); signals: void first_taxonomy_category_changed(taxonomy_category value); @@ -37,9 +37,9 @@ signals: void third_taxonomy_category_changed(taxonomy_category value); private: - void disk_first_taxonomy_category(bool doSync); - void disk_second_taxonomy_category(bool doSync); - void disk_third_taxonomy_category(bool doSync); + static void disk_first_taxonomy_category(bool doSync); + static void disk_second_taxonomy_category(bool doSync); + static void disk_third_taxonomy_category(bool doSync); }; #endif diff --git a/core/settings/qPrefLanguage.h b/core/settings/qPrefLanguage.h index d1d8b2b79..e004f79d3 100644 --- a/core/settings/qPrefLanguage.h +++ b/core/settings/qPrefLanguage.h @@ -21,29 +21,29 @@ public: static qPrefLanguage *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: - const QString date_format() { return prefs.date_format; } - bool date_format_override() { return prefs.date_format_override; } - const QString date_format_short() { return prefs.date_format_short; } - const QString language() { return prefs.locale.language; } - const QString lang_locale() { return prefs.locale.lang_locale; } - const QString time_format() { return prefs.time_format; } - bool time_format_override() { return prefs.time_format_override; } - bool use_system_language() { return prefs.locale.use_system_language; } + static const QString date_format() { return prefs.date_format; } + static bool date_format_override() { return prefs.date_format_override; } + static const QString date_format_short() { return prefs.date_format_short; } + static const QString language() { return prefs.locale.language; } + static const QString lang_locale() { return prefs.locale.lang_locale; } + static const QString time_format() { return prefs.time_format; } + static bool time_format_override() { return prefs.time_format_override; } + static bool use_system_language() { return prefs.locale.use_system_language; } public slots: - void set_date_format(const QString& value); - void set_date_format_override(bool value); - void set_date_format_short(const QString& value); - void set_language(const QString& value); - void set_lang_locale(const QString& value); - void set_time_format(const QString& value); - void set_time_format_override(bool value); - void set_use_system_language(bool value); + static void set_date_format(const QString& value); + static void set_date_format_override(bool value); + static void set_date_format_short(const QString& value); + static void set_language(const QString& value); + static void set_lang_locale(const QString& value); + static void set_time_format(const QString& value); + static void set_time_format_override(bool value); + static void set_use_system_language(bool value); signals: void date_format_changed(const QString& value); @@ -56,14 +56,14 @@ signals: void use_system_language_changed(bool value); private: - void disk_date_format(bool doSync); - void disk_date_format_override(bool doSync); - void disk_date_format_short(bool doSync); - void disk_language(bool doSync); - void disk_lang_locale(bool doSync); - void disk_time_format(bool doSync); - void disk_time_format_override(bool doSync); - void disk_use_system_language(bool doSync); + static void disk_date_format(bool doSync); + static void disk_date_format_override(bool doSync); + static void disk_date_format_short(bool doSync); + static void disk_language(bool doSync); + static void disk_lang_locale(bool doSync); + static void disk_time_format(bool doSync); + static void disk_time_format_override(bool doSync); + static void disk_use_system_language(bool doSync); }; #endif diff --git a/core/settings/qPrefLocationService.h b/core/settings/qPrefLocationService.h index e3aa43c29..676f2bbf8 100644 --- a/core/settings/qPrefLocationService.h +++ b/core/settings/qPrefLocationService.h @@ -16,17 +16,17 @@ public: static qPrefLocationService *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: - int distance_threshold() { return prefs.distance_threshold; } - int time_threshold() { return prefs.time_threshold; } + static int distance_threshold() { return prefs.distance_threshold; } + static int time_threshold() { return prefs.time_threshold; } public slots: - void set_distance_threshold(int value); - void set_time_threshold(int value); + static void set_distance_threshold(int value); + static void set_time_threshold(int value); signals: void distance_threshold_changed(int value); @@ -34,8 +34,8 @@ signals: private: - void disk_distance_threshold(bool doSync); - void disk_time_threshold(bool doSync); + static void disk_distance_threshold(bool doSync); + static void disk_time_threshold(bool doSync); }; #endif diff --git a/core/settings/qPrefPartialPressureGas.h b/core/settings/qPrefPartialPressureGas.h index 0777c9303..c87711658 100644 --- a/core/settings/qPrefPartialPressureGas.h +++ b/core/settings/qPrefPartialPressureGas.h @@ -20,27 +20,27 @@ public: static qPrefPartialPressureGas *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: - bool phe() { return prefs.pp_graphs.phe; } - double phe_threshold() { return prefs.pp_graphs.phe_threshold; } - bool pn2() { return prefs.pp_graphs.pn2; } - double pn2_threshold() { return prefs.pp_graphs.pn2_threshold; } - bool po2() { return prefs.pp_graphs.po2; } - double po2_threshold_max() { return prefs.pp_graphs.po2_threshold_max; } - double po2_threshold_min() { return prefs.pp_graphs.po2_threshold_min; } + static bool phe() { return prefs.pp_graphs.phe; } + static double phe_threshold() { return prefs.pp_graphs.phe_threshold; } + static bool pn2() { return prefs.pp_graphs.pn2; } + static double pn2_threshold() { return prefs.pp_graphs.pn2_threshold; } + static bool po2() { return prefs.pp_graphs.po2; } + static double po2_threshold_max() { return prefs.pp_graphs.po2_threshold_max; } + static double po2_threshold_min() { return prefs.pp_graphs.po2_threshold_min; } public slots: - void set_phe(bool value); - void set_phe_threshold(double value); - void set_pn2(bool value); - void set_pn2_threshold(double value); - void set_po2(bool value); - void set_po2_threshold_min(double value); - void set_po2_threshold_max(double value); + static void set_phe(bool value); + static void set_phe_threshold(double value); + static void set_pn2(bool value); + static void set_pn2_threshold(double value); + static void set_po2(bool value); + static void set_po2_threshold_min(double value); + static void set_po2_threshold_max(double value); signals: void phe_changed(bool value); @@ -52,13 +52,13 @@ signals: void po2_threshold_min_changed(double value); private: - void disk_phe(bool doSync); - void disk_phe_threshold(bool doSync); - void disk_pn2(bool doSync); - void disk_pn2_threshold(bool doSync); - void disk_po2(bool doSync); - void disk_po2_threshold_min(bool doSync); - void disk_po2_threshold_max(bool doSync); + static void disk_phe(bool doSync); + static void disk_phe_threshold(bool doSync); + static void disk_pn2(bool doSync); + static void disk_pn2_threshold(bool doSync); + static void disk_po2(bool doSync); + static void disk_po2_threshold_min(bool doSync); + static void disk_po2_threshold_max(bool doSync); }; #endif diff --git a/core/settings/qPrefProxy.h b/core/settings/qPrefProxy.h index abca19c06..e1ead178e 100644 --- a/core/settings/qPrefProxy.h +++ b/core/settings/qPrefProxy.h @@ -20,9 +20,9 @@ public: static qPrefProxy *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: static bool proxy_auth() { return prefs.proxy_auth; } @@ -33,12 +33,12 @@ public: static QString proxy_user() { return prefs.proxy_user; } public slots: - void set_proxy_auth(bool value); - void set_proxy_host(const QString &value); - void set_proxy_pass(const QString &value); - void set_proxy_port(int value); - void set_proxy_type(int value); - void set_proxy_user(const QString &value); + static void set_proxy_auth(bool value); + static void set_proxy_host(const QString &value); + static void set_proxy_pass(const QString &value); + static void set_proxy_port(int value); + static void set_proxy_type(int value); + static void set_proxy_user(const QString &value); signals: void proxy_auth_changed(bool value); @@ -49,12 +49,12 @@ signals: void proxy_user_changed(const QString &value); private: - void disk_proxy_auth(bool doSync); - void disk_proxy_host(bool doSync); - void disk_proxy_pass(bool doSync); - void disk_proxy_port(bool doSync); - void disk_proxy_type(bool doSync); - void disk_proxy_user(bool doSync); + static void disk_proxy_auth(bool doSync); + static void disk_proxy_host(bool doSync); + static void disk_proxy_pass(bool doSync); + static void disk_proxy_port(bool doSync); + static void disk_proxy_type(bool doSync); + static void disk_proxy_user(bool doSync); }; #endif diff --git a/core/settings/qPrefTechnicalDetails.h b/core/settings/qPrefTechnicalDetails.h index 44981c2dc..b9a58c3c9 100644 --- a/core/settings/qPrefTechnicalDetails.h +++ b/core/settings/qPrefTechnicalDetails.h @@ -41,10 +41,11 @@ public: static qPrefTechnicalDetails *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } +public: static bool calcalltissues() { return prefs.calcalltissues; } static bool calcceiling() { return prefs.calcceiling; } static bool calcceiling3m() { return prefs.calcceiling3m; } @@ -74,33 +75,33 @@ public: static bool zoomed_plot() { return prefs.zoomed_plot; } public slots: - void set_calcalltissues(bool value); - void set_calcceiling(bool value); - void set_calcceiling3m(bool value); - void set_calcndltts(bool value); - void set_dcceiling(bool value); - void set_display_deco_mode(deco_mode value); - void set_display_unused_tanks(bool value); - void set_ead(bool value); - void set_gfhigh(int value); - void set_gflow(int value); - void set_gf_low_at_maxdepth(bool value); - void set_hrgraph(bool value); - void set_mod(bool value); - void set_modpO2(double value); - void set_percentagegraph(bool value); - void set_redceiling(bool value); - void set_rulergraph(bool value); - void set_show_average_depth(bool value); - void set_show_ccr_sensors(bool value); - void set_show_ccr_setpoint(bool value); - void set_show_icd(bool value); - void set_show_pictures_in_profile(bool value); - void set_show_sac(bool value); - void set_show_scr_ocpo2(bool value); - void set_tankbar(bool value); - void set_vpmb_conservatism(int value); - void set_zoomed_plot(bool value); + static void set_calcalltissues(bool value); + static void set_calcceiling(bool value); + static void set_calcceiling3m(bool value); + static void set_calcndltts(bool value); + static void set_dcceiling(bool value); + static void set_display_deco_mode(deco_mode value); + static void set_display_unused_tanks(bool value); + static void set_ead(bool value); + static void set_gfhigh(int value); + static void set_gflow(int value); + static void set_gf_low_at_maxdepth(bool value); + static void set_hrgraph(bool value); + static void set_mod(bool value); + static void set_modpO2(double value); + static void set_percentagegraph(bool value); + static void set_redceiling(bool value); + static void set_rulergraph(bool value); + static void set_show_average_depth(bool value); + static void set_show_ccr_sensors(bool value); + static void set_show_ccr_setpoint(bool value); + static void set_show_icd(bool value); + static void set_show_pictures_in_profile(bool value); + static void set_show_sac(bool value); + static void set_show_scr_ocpo2(bool value); + static void set_tankbar(bool value); + static void set_vpmb_conservatism(int value); + static void set_zoomed_plot(bool value); signals: void calcalltissues_changed(bool value); @@ -132,33 +133,33 @@ signals: void zoomed_plot_changed(bool value); private: - void disk_calcalltissues(bool doSync); - void disk_calcceiling(bool doSync); - void disk_calcceiling3m(bool doSync); - void disk_calcndltts(bool doSync); - void disk_dcceiling(bool doSync); - void disk_display_deco_mode(bool doSync); - void disk_display_unused_tanks(bool doSync); - void disk_ead(bool doSync); - void disk_gfhigh(bool doSync); - void disk_gflow(bool doSync); - void disk_gf_low_at_maxdepth(bool doSync); - void disk_hrgraph(bool doSync); - void disk_mod(bool doSync); - void disk_modpO2(bool doSync); - void disk_percentagegraph(bool doSync); - void disk_redceiling(bool doSync); - void disk_rulergraph(bool doSync); - void disk_show_average_depth(bool doSync); - void disk_show_ccr_sensors(bool doSync); - void disk_show_ccr_setpoint(bool doSync); - void disk_show_icd(bool doSync); - void disk_show_pictures_in_profile(bool doSync); - void disk_show_sac(bool doSync); - void disk_show_scr_ocpo2(bool doSync); - void disk_tankbar(bool doSync); - void disk_vpmb_conservatism(bool doSync); - void disk_zoomed_plot(bool doSync); + static void disk_calcalltissues(bool doSync); + static void disk_calcceiling(bool doSync); + static void disk_calcceiling3m(bool doSync); + static void disk_calcndltts(bool doSync); + static void disk_dcceiling(bool doSync); + static void disk_display_deco_mode(bool doSync); + static void disk_display_unused_tanks(bool doSync); + static void disk_ead(bool doSync); + static void disk_gfhigh(bool doSync); + static void disk_gflow(bool doSync); + static void disk_gf_low_at_maxdepth(bool doSync); + static void disk_hrgraph(bool doSync); + static void disk_mod(bool doSync); + static void disk_modpO2(bool doSync); + static void disk_percentagegraph(bool doSync); + static void disk_redceiling(bool doSync); + static void disk_rulergraph(bool doSync); + static void disk_show_average_depth(bool doSync); + static void disk_show_ccr_sensors(bool doSync); + static void disk_show_ccr_setpoint(bool doSync); + static void disk_show_icd(bool doSync); + static void disk_show_pictures_in_profile(bool doSync); + static void disk_show_sac(bool doSync); + static void disk_show_scr_ocpo2(bool doSync); + static void disk_tankbar(bool doSync); + static void disk_vpmb_conservatism(bool doSync); + static void disk_zoomed_plot(bool doSync); }; #endif diff --git a/core/settings/qPrefUnit.cpp b/core/settings/qPrefUnit.cpp index b0b45a881..a762940da 100644 --- a/core/settings/qPrefUnit.cpp +++ b/core/settings/qPrefUnit.cpp @@ -63,7 +63,7 @@ void qPrefUnits::set_unit_system(const QString& value) prefs.unit_system = PERSONALIZE; } disk_unit_system(true); - emit unit_system_changed(value); + emit instance()->unit_system_changed(value); } } DISK_LOADSYNC_ENUM(Units, "/unit_system", unit_system_values, unit_system); diff --git a/core/settings/qPrefUnit.h b/core/settings/qPrefUnit.h index 70ccadadd..bc4273546 100644 --- a/core/settings/qPrefUnit.h +++ b/core/settings/qPrefUnit.h @@ -24,9 +24,9 @@ public: static qPrefUnits *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: static bool coordinates_traditional() { return prefs.coordinates_traditional; } @@ -41,16 +41,16 @@ public: static units::WEIGHT weight() { return prefs.units.weight; } public slots: - void set_coordinates_traditional(bool value); - void set_duration_units(units::DURATION value); - void set_length(units::LENGTH value); - void set_pressure(units::PRESSURE value); - void set_show_units_table(bool value); - void set_temperature(units::TEMPERATURE value); - void set_unit_system(const QString& value); - void set_vertical_speed_time(units::TIME value); - void set_volume(units::VOLUME value); - void set_weight(units::WEIGHT value); + static void set_coordinates_traditional(bool value); + static void set_duration_units(units::DURATION value); + static void set_length(units::LENGTH value); + static void set_pressure(units::PRESSURE value); + static void set_show_units_table(bool value); + static void set_temperature(units::TEMPERATURE value); + static void set_unit_system(const QString& value); + static void set_vertical_speed_time(units::TIME value); + static void set_volume(units::VOLUME value); + static void set_weight(units::WEIGHT value); signals: void coordinates_traditional_changed(bool value); @@ -65,16 +65,16 @@ signals: void weight_changed(int value); private: - void disk_coordinates_traditional(bool doSync); - void disk_duration_units(bool doSync); - void disk_length(bool doSync); - void disk_pressure(bool doSync); - void disk_show_units_table(bool doSync); - void disk_temperature(bool doSync); - void disk_unit_system(bool doSync); - void disk_vertical_speed_time(bool doSync); - void disk_volume(bool doSync); - void disk_weight(bool doSync); + static void disk_coordinates_traditional(bool doSync); + static void disk_duration_units(bool doSync); + static void disk_length(bool doSync); + static void disk_pressure(bool doSync); + static void disk_show_units_table(bool doSync); + static void disk_temperature(bool doSync); + static void disk_unit_system(bool doSync); + static void disk_vertical_speed_time(bool doSync); + static void disk_volume(bool doSync); + static void disk_weight(bool doSync); }; #endif diff --git a/core/settings/qPrefUpdateManager.cpp b/core/settings/qPrefUpdateManager.cpp index 2c8b8d70e..e6eac1e6a 100644 --- a/core/settings/qPrefUpdateManager.cpp +++ b/core/settings/qPrefUpdateManager.cpp @@ -30,7 +30,7 @@ void qPrefUpdateManager::set_dont_check_exists(bool value) { if (value != prefs.update_manager.dont_check_exists) { prefs.update_manager.dont_check_exists = value; - emit dont_check_exists_changed(value); + emit instance()->dont_check_exists_changed(value); } // DO NOT STORE ON DISK } @@ -45,7 +45,7 @@ void qPrefUpdateManager::set_next_check(const QDate& value) if (valueString != prefs.update_manager.next_check) { qPrefPrivate::copy_txt(&prefs.update_manager.next_check, valueString); disk_next_check(true); - emit next_check_changed(value); + emit instance()->next_check_changed(value); } } DISK_LOADSYNC_TXT_EXT(UpdateManager, "/NextCheck", next_check, update_manager.); diff --git a/core/settings/qPrefUpdateManager.h b/core/settings/qPrefUpdateManager.h index 19943d2b7..773ca3b4b 100644 --- a/core/settings/qPrefUpdateManager.h +++ b/core/settings/qPrefUpdateManager.h @@ -18,21 +18,21 @@ public: static qPrefUpdateManager *instance(); // Load/Sync local settings (disk) and struct preference - void loadSync(bool doSync); - void load() { loadSync(false); } - void sync() { loadSync(true); } + static void loadSync(bool doSync); + static void load() { loadSync(false); } + static void sync() { loadSync(true); } public: - bool dont_check_for_updates() { return prefs.update_manager.dont_check_for_updates; } - bool dont_check_exists() { return prefs.update_manager.dont_check_exists; } - const QString last_version_used() { return prefs.update_manager.last_version_used; } - const QDate next_check() { return QDate::fromString(QString(prefs.update_manager.next_check), "dd/MM/yyyy"); } + static bool dont_check_for_updates() { return prefs.update_manager.dont_check_for_updates; } + static bool dont_check_exists() { return prefs.update_manager.dont_check_exists; } + static const QString last_version_used() { return prefs.update_manager.last_version_used; } + static const QDate next_check() { return QDate::fromString(QString(prefs.update_manager.next_check), "dd/MM/yyyy"); } public slots: - void set_dont_check_for_updates(bool value); - void set_dont_check_exists(bool value); - void set_last_version_used(const QString& value); - void set_next_check(const QDate& value); + static void set_dont_check_for_updates(bool value); + static void set_dont_check_exists(bool value); + static void set_last_version_used(const QString& value); + static void set_next_check(const QDate& value); signals: void dont_check_for_updates_changed(bool value); @@ -41,9 +41,9 @@ signals: void next_check_changed(const QDate& value); private: - void disk_dont_check_for_updates(bool doSync); - void disk_last_version_used(bool doSync); - void disk_next_check(bool doSync); + static void disk_dont_check_for_updates(bool doSync); + static void disk_last_version_used(bool doSync); + static void disk_next_check(bool doSync); }; #endif |