diff options
author | jan Iversen <jani@apache.org> | 2018-08-03 20:25:02 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-08-09 08:45:02 -0700 |
commit | e33545afd04dc059c0df4bc47b5aacec3487c60d (patch) | |
tree | cce643642383ef23fa51abad21f9b4b9a72dbda0 /core/subsurface-qt/SettingsObjectWrapper.cpp | |
parent | e673a3558eaff6ebc617e6e97e5c81cd819e7985 (diff) | |
download | subsurface-e33545afd04dc059c0df4bc47b5aacec3487c60d.tar.gz |
core: activate qPrefUpdateManager
remove UpdateManager from SettingsObjectWrapper and reference qPrefUpdateManager
update files using SettingsObjectWrapper/UpdateManager to use qPrefUpdateManager
this activated qPrefUpdateManager and removed the similar class from
SettingsObjectWrapper.
Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'core/subsurface-qt/SettingsObjectWrapper.cpp')
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 75 |
1 files changed, 2 insertions, 73 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index c31d3831b..16a354dda 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -8,71 +8,6 @@ #include "core/qthelper.h" #include "core/prefs-macros.h" -UpdateManagerSettings::UpdateManagerSettings(QObject *parent) : QObject(parent) -{ - -} - -bool UpdateManagerSettings::dontCheckForUpdates() const -{ - return prefs.update_manager.dont_check_for_updates; -} - -bool UpdateManagerSettings::dontCheckExists() const -{ - return prefs.update_manager.dont_check_exists; -} - -QString UpdateManagerSettings::lastVersionUsed() const -{ - return prefs.update_manager.last_version_used; -} - -QDate UpdateManagerSettings::nextCheck() const -{ - return QDate::fromString(QString(prefs.update_manager.next_check), "dd/MM/yyyy"); -} - -void UpdateManagerSettings::setDontCheckForUpdates(bool value) -{ - if (value == prefs.update_manager.dont_check_for_updates) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("DontCheckForUpdates", value); - prefs.update_manager.dont_check_for_updates = value; - prefs.update_manager.dont_check_exists = true; - emit dontCheckForUpdatesChanged(value); -} - -void UpdateManagerSettings::setLastVersionUsed(const QString& value) -{ - if (value == prefs.update_manager.last_version_used) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("LastVersionUsed", value); - free((void *)prefs.update_manager.last_version_used); - prefs.update_manager.last_version_used = copy_qstring(value); - emit lastVersionUsedChanged(value); -} - -void UpdateManagerSettings::setNextCheck(const QDate& date) -{ - if (date.toString() == prefs.update_manager.next_check) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("NextCheck", date); - free((void *)prefs.update_manager.next_check); - prefs.update_manager.next_check = copy_qstring(date.toString("dd/MM/yyyy")); - emit nextCheckChanged(date); -} - - PartialPressureGasSettings::PartialPressureGasSettings(QObject* parent): QObject(parent) { @@ -1112,7 +1047,7 @@ QObject(parent), language_settings(new LanguageSettingsObjectWrapper(this)), animation_settings(new qPrefAnimations(this)), location_settings(new LocationServiceSettingsObjectWrapper(this)), - update_manager_settings(new UpdateManagerSettings(this)), + update_manager_settings(new qPrefUpdateManager(this)), dive_computer_settings(new qPrefDiveComputer(this)) { } @@ -1205,13 +1140,7 @@ void SettingsObjectWrapper::load() qPrefDivePlanner::instance()->load(); qPrefDiveComputer::instance()->load(); - - s.beginGroup("UpdateManager"); - prefs.update_manager.dont_check_exists = s.contains("DontCheckForUpdates"); - GET_BOOL("DontCheckForUpdates", update_manager.dont_check_for_updates); - GET_TXT("LastVersionUsed", update_manager.last_version_used); - prefs.update_manager.next_check = copy_qstring(s.value("NextCheck").toDate().toString("dd/MM/yyyy")); - s.endGroup(); + qPrefUpdateManager::instance()->load(); s.beginGroup("Language"); GET_BOOL("UseSystemLanguage", locale.use_system_language); |