mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <dirk@hohndel.org>
This commit is contained in:
parent
3a0ffb70a0
commit
492369b312
4 changed files with 24 additions and 11 deletions
1
pref.h
1
pref.h
|
@ -95,6 +95,7 @@ struct preferences {
|
||||||
char *cloud_storage_email_encoded;
|
char *cloud_storage_email_encoded;
|
||||||
bool save_password_local;
|
bool save_password_local;
|
||||||
bool show_cloud_pin;
|
bool show_cloud_pin;
|
||||||
|
bool cloud_background_sync;
|
||||||
};
|
};
|
||||||
enum unit_system_values {
|
enum unit_system_values {
|
||||||
METRIC,
|
METRIC,
|
||||||
|
|
|
@ -219,6 +219,7 @@ void PreferencesDialog::setUiFromPrefs()
|
||||||
ui.save_password_local->setChecked(prefs.save_password_local);
|
ui.save_password_local->setChecked(prefs.save_password_local);
|
||||||
ui.cloud_storage_pin->setVisible(prefs.show_cloud_pin);
|
ui.cloud_storage_pin->setVisible(prefs.show_cloud_pin);
|
||||||
ui.cloud_storage_pin_label->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()
|
void PreferencesDialog::restorePrefs()
|
||||||
|
@ -404,6 +405,8 @@ void PreferencesDialog::syncSettings()
|
||||||
prefs.cloud_storage_password = strdup(qPrintable(password));
|
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("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();
|
s.endGroup();
|
||||||
loadSettings();
|
loadSettings();
|
||||||
emit settingsChanged();
|
emit settingsChanged();
|
||||||
|
@ -523,6 +526,7 @@ void PreferencesDialog::loadSettings()
|
||||||
GET_TXT("password", cloud_storage_password);
|
GET_TXT("password", cloud_storage_password);
|
||||||
}
|
}
|
||||||
GET_BOOL("show_cloud_pin", show_cloud_pin);
|
GET_BOOL("show_cloud_pin", show_cloud_pin);
|
||||||
|
GET_BOOL("cloud_background_sync", cloud_background_sync);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -413,7 +413,7 @@
|
||||||
<height>83</height>
|
<height>83</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3" rowstretch="1,1,1" columnstretch="1,1">
|
<layout class="QGridLayout" name="gridLayout_3" rowstretch="1,1,1" columnstretch="1,1,0">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetMaximumSize</enum>
|
<enum>QLayout::SetMaximumSize</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -451,20 +451,27 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="cloud_storage_pin_label">
|
<widget class="QLabel" name="cloud_storage_pin_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Verification PIN</string>
|
<string>Verification PIN</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
<widget class="QLineEdit" name="cloud_storage_pin">
|
<widget class="QLineEdit" name="cloud_storage_pin">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string extracomment="One time verification PIN for Subsurface cloud storage infrastructure"/>
|
<string extracomment="One time verification PIN for Subsurface cloud storage infrastructure"/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCheckBox" name="cloud_background_sync">
|
||||||
|
<property name="text">
|
||||||
|
<string>Sync to cloud in the background?</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1747,13 +1754,13 @@
|
||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="buttonGroup_2"/>
|
|
||||||
<buttongroup name="buttonGroup_4"/>
|
|
||||||
<buttongroup name="buttonGroup_3"/>
|
|
||||||
<buttongroup name="buttonGroup_5"/>
|
|
||||||
<buttongroup name="buttonGroup"/>
|
|
||||||
<buttongroup name="buttonGroup_6"/>
|
<buttongroup name="buttonGroup_6"/>
|
||||||
|
<buttongroup name="buttonGroup_3"/>
|
||||||
<buttongroup name="buttonGroup_7"/>
|
<buttongroup name="buttonGroup_7"/>
|
||||||
|
<buttongroup name="buttonGroup_4"/>
|
||||||
|
<buttongroup name="buttonGroup"/>
|
||||||
|
<buttongroup name="buttonGroup_5"/>
|
||||||
|
<buttongroup name="buttonGroup_2"/>
|
||||||
<buttongroup name="verticalSpeed"/>
|
<buttongroup name="verticalSpeed"/>
|
||||||
</buttongroups>
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -65,7 +65,8 @@ struct preferences default_prefs = {
|
||||||
.album_id = NULL,
|
.album_id = NULL,
|
||||||
.access_token = NULL
|
.access_token = NULL
|
||||||
},
|
},
|
||||||
.defaultsetpoint = 1100
|
.defaultsetpoint = 1100,
|
||||||
|
.cloud_background_sync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
int run_survey;
|
int run_survey;
|
||||||
|
|
Loading…
Add table
Reference in a new issue