mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Import: Add option to sync time on dive computer download
Add an option for users to sync the dive computer time with the PC time every time dives are downloaded. Obviously this will only work on dive computers that have time synchronisation support in libdivecomputer, for other computers a notice is logged. The selection for this option is persisted as a preference. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
cb410fe1ba
commit
a38ea971a0
18 changed files with 130 additions and 1 deletions
|
@ -397,7 +397,7 @@ Kirigami.Page {
|
|||
}
|
||||
|
||||
RowLayout {
|
||||
id: downloadOptions
|
||||
id: forceDownloadOption
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 0
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
|
@ -421,6 +421,31 @@ Kirigami.Page {
|
|||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: syncTimeOption
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 0
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
TemplateCheckBox {
|
||||
id: syncTimeWithDiveComputer
|
||||
checked: Backend.sync_dc_time
|
||||
enabled: syncTimeLabel.visible
|
||||
visible: enabled
|
||||
height: syncTimeLabel.height - Kirigami.Units.smallSpacing;
|
||||
width: height
|
||||
onClicked: {
|
||||
Backend.sync_dc_time = checked
|
||||
}
|
||||
}
|
||||
TemplateLabel {
|
||||
id: syncTimeLabel
|
||||
text: qsTr("Sync dive computer time")
|
||||
visible: comboVendor.currentIndex != -1 && comboProduct.currentIndex != -1 &&
|
||||
comboConnection.currentIndex != -1
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: dlList
|
||||
Layout.topMargin: Kirigami.Units.smallSpacing * 4
|
||||
|
|
|
@ -79,6 +79,9 @@ QMLInterface::QMLInterface()
|
|||
this, &QMLInterface::verbatim_planChanged);
|
||||
connect(qPrefDivePlanner::instance(), &qPrefDivePlanner::display_variationsChanged,
|
||||
this, &QMLInterface::display_variationsChanged);
|
||||
|
||||
connect(qPrefDiveComputer::instance(), &qPrefDiveComputer::sync_dc_timeChanged,
|
||||
this, &QMLInterface::sync_dc_timeChanged);
|
||||
}
|
||||
|
||||
void QMLInterface::setup(QQmlContext *ct)
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
#ifndef QMLINTERFACE_H
|
||||
#define QMLINTERFACE_H
|
||||
#include "core/qthelper.h"
|
||||
#include "core/downloadfromdcthread.h"
|
||||
#include "core/settings/qPrefCloudStorage.h"
|
||||
#include "core/settings/qPrefUnit.h"
|
||||
#include "core/settings/qPrefDivePlanner.h"
|
||||
#include "core/settings/qPrefTechnicalDetails.h"
|
||||
#include "core/settings/qPrefDiveComputer.h"
|
||||
#include "qt-models/diveplannermodel.h"
|
||||
#include "backend-shared/plannershared.h"
|
||||
|
||||
|
@ -78,6 +80,8 @@ class QMLInterface : public QObject {
|
|||
Q_PROPERTY(bool verbatim_plan READ verbatim_plan WRITE set_verbatim_plan NOTIFY verbatim_planChanged);
|
||||
Q_PROPERTY(bool display_variations READ display_variations WRITE set_display_variations NOTIFY display_variationsChanged);
|
||||
|
||||
Q_PROPERTY(bool sync_dc_time READ sync_dc_time WRITE set_sync_dc_time NOTIFY sync_dc_timeChanged);
|
||||
|
||||
public:
|
||||
// function to do the needed setup
|
||||
static void setup(QQmlContext *ct);
|
||||
|
@ -212,6 +216,8 @@ public:
|
|||
bool verbatim_plan() { return prefs.verbatim_plan; }
|
||||
bool display_variations() { return prefs.display_variations; }
|
||||
|
||||
bool sync_dc_time() { return prefs.sync_dc_time; }
|
||||
|
||||
public slots:
|
||||
void set_cloud_verification_status(CLOUD_STATUS value) { qPrefCloudStorage::set_cloud_verification_status(value); }
|
||||
void set_duration_units(DURATION value) { qPrefUnits::set_duration_units((units::DURATION)value); }
|
||||
|
@ -258,6 +264,10 @@ public slots:
|
|||
void set_display_transitions(bool value) { DivePlannerPointsModel::instance()->setDisplayTransitions(value); }
|
||||
void set_verbatim_plan(bool value) { DivePlannerPointsModel::instance()->setVerbatim(value); }
|
||||
void set_display_variations(bool value) { DivePlannerPointsModel::instance()->setDisplayVariations(value); }
|
||||
void set_sync_dc_time(bool value) {
|
||||
qPrefDiveComputer::set_sync_dc_time(value);
|
||||
DCDeviceData::instance()->setSyncTime(value);
|
||||
}
|
||||
QString firstDiveDate() { return get_first_dive_date_string(); }
|
||||
QString lastDiveDate() { return get_last_dive_date_string(); }
|
||||
|
||||
|
@ -307,6 +317,8 @@ signals:
|
|||
void display_transitionsChanged(bool value);
|
||||
void verbatim_planChanged(bool value);
|
||||
void display_variationsChanged(bool value);
|
||||
|
||||
void sync_dc_timeChanged(bool value);
|
||||
private:
|
||||
QMLInterface();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue