aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qml/main.qml12
-rw-r--r--mobile-widgets/qmlmanager.cpp30
-rw-r--r--mobile-widgets/qmlmanager.h6
3 files changed, 20 insertions, 28 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index f16e85808..ea26e3afd 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -168,11 +168,11 @@ Kirigami.ApplicationWindow {
detailsWindow.suitModel = manager.suitList
detailsWindow.suitIndex = -1
detailsWindow.suitText = ""
- detailsWindow.cylinderModel0 = manager.cylinderInit
- detailsWindow.cylinderModel1 = manager.cylinderInit
- detailsWindow.cylinderModel2 = manager.cylinderInit
- detailsWindow.cylinderModel3 = manager.cylinderInit
- detailsWindow.cylinderModel4 = manager.cylinderInit
+ detailsWindow.cylinderModel0 = manager.cylinderListInit
+ detailsWindow.cylinderModel1 = manager.cylinderListInit
+ detailsWindow.cylinderModel2 = manager.cylinderListInit
+ detailsWindow.cylinderModel3 = manager.cylinderListInit
+ detailsWindow.cylinderModel4 = manager.cylinderListInit
detailsWindow.cylinderIndex0 = PrefEquipment.default_cylinder == "" ? -1 : detailsWindow.cylinderModel0.indexOf(PrefEquipment.default_cylinder)
detailsWindow.usedCyl = ["",]
detailsWindow.weight = ""
@@ -482,7 +482,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
text: qsTr("Settings")
onTriggered: {
globalDrawer.close()
- settingsWindow.defaultCylinderModel = manager.cylinderInit
+ settingsWindow.defaultCylinderModel = manager.defaultCylinderListInit
PrefEquipment.default_cylinder === "" ? defaultCylinderIndex = "-1" : defaultCylinderIndex = settingsWindow.defaultCylinderModel.indexOf(PrefEquipment.default_cylinder)
showPage(settingsWindow)
detailsWindow.endEditMode()
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 4f8cdbd52..ee70679d5 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -1867,27 +1867,17 @@ QStringList QMLManager::locationList() const
return locationModel.allSiteNames();
}
-QStringList QMLManager::cylinderInit() const
-{
- QStringList cylinders;
- struct dive *d;
- int i = 0;
- for_each_dive (i, d) {
- for (int j = 0; j < d->cylinders.nr; j++) {
- if (!empty_string(get_cylinder(d, j)->type.description))
- cylinders << get_cylinder(d, j)->type.description;
- }
- }
-
- for (int ti = 0; ti < tank_info_table.nr; ti++) {
- QString cyl = tank_info_table.infos[ti].name;
- if (cyl == "")
- continue;
- cylinders << cyl;
- }
+// this is the cylinder list used when editing a dive
+QStringList QMLManager::cylinderListInit() const
+{
+ return formatFullCylinderList();
+}
- cylinders.removeDuplicates();
- cylinders.sort();
+// this is the cylinder list used to pick your default cylinder
+// it starts with the (translated) "no default cylinder" in order to special-case this
+QStringList QMLManager::defaultCylinderListInit() const
+{
+ QStringList cylinders = cylinderListInit();
// now add fist one that indicates that the user wants no default cylinder
cylinders.prepend(tr("no default cylinder"));
return cylinders;
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index cc2633676..f20856a8e 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -38,7 +38,8 @@ class QMLManager : public QObject {
Q_PROPERTY(QStringList buddyList READ buddyList NOTIFY buddyListChanged)
Q_PROPERTY(QStringList divemasterList READ divemasterList NOTIFY divemasterListChanged)
Q_PROPERTY(QStringList locationList READ locationList NOTIFY locationListChanged)
- Q_PROPERTY(QStringList cylinderInit READ cylinderInit CONSTANT)
+ Q_PROPERTY(QStringList cylinderListInit READ cylinderListInit CONSTANT)
+ Q_PROPERTY(QStringList defaultCylinderListInit READ defaultCylinderListInit CONSTANT)
Q_PROPERTY(QStringList cloudCacheList READ cloudCacheList NOTIFY cloudCacheListChanged)
Q_PROPERTY(QString progressMessage MEMBER m_progressMessage WRITE setProgressMessage NOTIFY progressMessageChanged)
Q_PROPERTY(bool btEnabled MEMBER m_btEnabled WRITE setBtEnabled NOTIFY btEnabledChanged)
@@ -162,7 +163,8 @@ public:
QStringList buddyList() const;
QStringList divemasterList() const;
QStringList locationList() const;
- QStringList cylinderInit() const;
+ QStringList cylinderListInit() const;
+ QStringList defaultCylinderListInit() const;
QStringList cloudCacheList() const;
Q_INVOKABLE void setStatusbarColor(QColor color);
void btHostModeChange(QBluetoothLocalDevice::HostMode state);