Cloud storage: create preference entry for base URL

This just deals with the mechanics. There is no UI to enter / change this
URL (and that's intentional), neither is it used, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-15 05:52:12 -07:00
parent b144518a85
commit 617b105458
3 changed files with 11 additions and 0 deletions

2
pref.h
View file

@ -28,6 +28,8 @@ struct preferences {
const char *divelist_font;
const char *default_filename;
const char *default_cylinder;
const char *cloud_base_url;
const char *cloud_git_url;
double font_size;
partial_pressure_graphs_t pp_graphs;
short mod;

View file

@ -431,6 +431,9 @@ void PreferencesDialog::syncSettings()
SAVE_OR_REMOVE("cloud_verification_status", default_prefs.cloud_verification_status, prefs.cloud_verification_status);
SAVE_OR_REMOVE("cloud_background_sync", default_prefs.cloud_background_sync, ui.cloud_background_sync->isChecked());
// at this point we intentionally do not have a UI for changing this
// it could go into some sort of "advanced setup" or something
SAVE_OR_REMOVE("cloud_base_url", default_prefs.cloud_base_url, prefs.cloud_base_url);
s.endGroup();
loadSettings();
emit settingsChanged();
@ -563,6 +566,11 @@ void PreferencesDialog::loadSettings()
}
GET_INT("cloud_verification_status", cloud_verification_status);
GET_BOOL("cloud_background_sync", cloud_background_sync);
// creating the git url here is simply a convenience when C code wants
// to compare against that git URL - it's always derived from the base URL
GET_TXT("cloud_base_url", cloud_base_url);
prefs.cloud_git_url = strdup(qPrintable(QString(prefs.cloud_base_url) + "/git"));
s.endGroup();
}

View file

@ -5,6 +5,7 @@
#include "gettext.h"
struct preferences prefs;
struct preferences default_prefs = {
.cloud_base_url = "https://cloud.subsurface-divelog.org/",
.units = SI_UNITS,
.unit_system = METRIC,
.coordinates_traditional = true,