From 492369b3125b2c1c91f134c360110440b03d33b6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 12 Jun 2015 11:48:56 -0700 Subject: [PATCH] Cloud storage: Add preference option whether to sync in the background This defaults to on as that's the most useful setting for the average user. Signed-off-by: Dirk Hohndel --- pref.h | 1 + qt-ui/preferences.cpp | 4 ++++ qt-ui/preferences.ui | 27 +++++++++++++++++---------- subsurfacestartup.c | 3 ++- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/pref.h b/pref.h index e8b9571cd..c7e0ad8ee 100644 --- a/pref.h +++ b/pref.h @@ -95,6 +95,7 @@ struct preferences { char *cloud_storage_email_encoded; bool save_password_local; bool show_cloud_pin; + bool cloud_background_sync; }; enum unit_system_values { METRIC, diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index c6e1e2bd5..426944da0 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -219,6 +219,7 @@ void PreferencesDialog::setUiFromPrefs() ui.save_password_local->setChecked(prefs.save_password_local); ui.cloud_storage_pin->setVisible(prefs.show_cloud_pin); ui.cloud_storage_pin_label->setVisible(prefs.show_cloud_pin); + ui.cloud_background_sync->setChecked(prefs.cloud_background_sync); } void PreferencesDialog::restorePrefs() @@ -404,6 +405,8 @@ void PreferencesDialog::syncSettings() prefs.cloud_storage_password = strdup(qPrintable(password)); } SAVE_OR_REMOVE("show_cloud_pin", default_prefs.show_cloud_pin, prefs.show_cloud_pin); + SAVE_OR_REMOVE("cloud_background_sync", default_prefs.cloud_background_sync, ui.cloud_background_sync->isChecked()); + s.endGroup(); loadSettings(); emit settingsChanged(); @@ -523,6 +526,7 @@ void PreferencesDialog::loadSettings() GET_TXT("password", cloud_storage_password); } GET_BOOL("show_cloud_pin", show_cloud_pin); + GET_BOOL("cloud_background_sync", cloud_background_sync); s.endGroup(); } diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui index 54ffb41d0..0f5e94fe4 100644 --- a/qt-ui/preferences.ui +++ b/qt-ui/preferences.ui @@ -413,7 +413,7 @@ 83 - + QLayout::SetMaximumSize @@ -451,20 +451,27 @@ - + Verification PIN - - + + - + + + + + Sync to cloud in the background? + + + @@ -1747,13 +1754,13 @@ - - - - - + + + + + diff --git a/subsurfacestartup.c b/subsurfacestartup.c index 0254f0a5a..391cbeb60 100644 --- a/subsurfacestartup.c +++ b/subsurfacestartup.c @@ -65,7 +65,8 @@ struct preferences default_prefs = { .album_id = NULL, .access_token = NULL }, - .defaultsetpoint = 1100 + .defaultsetpoint = 1100, + .cloud_background_sync = true }; int run_survey;