summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2018-01-28 15:21:28 +0100
committerGravatar Jan Mulder <jlmulder@xs4all.nl>2018-01-31 14:48:14 +0100
commit494ad2654082d85846cb902556921ab62a6dbb14 (patch)
treefc130087b7c90cf38b8bbf6513f1ed08cf05755f /mobile-widgets
parent83259008e763d3cc120c826f58f91a0ff62b6b92 (diff)
downloadsubsurface-494ad2654082d85846cb902556921ab62a6dbb14.tar.gz
mobile cleanup: restyle construction of locationlist
See also e6e1473e6. The construction of the locationlist was not the same as the 3 previous lists, and it needs the inclusion of a new model file (divelocationmodel.cpp) in the mobile app. In addition, as the mobile app is mainly interested in a simple stringList (model) to populate a HintsText field (or maybe later a combobox), this stringlist is added to the model, to easy interfacing with QML. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/DiveDetailsEdit.qml3
-rw-r--r--mobile-widgets/qmlmanager.cpp6
-rw-r--r--mobile-widgets/qmlmanager.h5
3 files changed, 12 insertions, 2 deletions
diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml
index c623a856f..4895ef9d1 100644
--- a/mobile-widgets/qml/DiveDetailsEdit.qml
+++ b/mobile-widgets/qml/DiveDetailsEdit.qml
@@ -129,8 +129,7 @@ Item {
}
HintsTextEdit {
id: txtLocation
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- diveDetailsListView.currentItem.modelData.dive.locationList : null
+ model: manager.locationList
inputMethodHints: Qt.ImhNoPredictiveText
Layout.fillWidth: true
onEditingFinished: {
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 57cacba74..d28fa11ae 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -276,6 +276,7 @@ void QMLManager::openLocalThenRemote(QString url)
buddyModel.updateModel(); emit buddyListChanged();
suitModel.updateModel(); emit suitListChanged();
divemasterModel.updateModel(); emit divemasterListChanged();
+ locationModel.update(); emit locationListChanged();
}
void QMLManager::mergeLocalRepo()
@@ -1567,6 +1568,11 @@ QStringList QMLManager::divemasterList() const
return divemasterModel.stringList();
}
+QStringList QMLManager::locationList() const
+{
+ return locationModel.allSiteNames();
+}
+
QStringList QMLManager::cylinderInit() const
{
QStringList cylinders;
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index 4f188ac7d..17762e0a2 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -14,6 +14,7 @@
#include "core/downloadfromdcthread.h"
#include "qt-models/divelistmodel.h"
#include "qt-models/completionmodels.h"
+#include "qt-models/divelocationmodel.h"
class QMLManager : public QObject {
Q_OBJECT
@@ -39,6 +40,7 @@ class QMLManager : public QObject {
Q_PROPERTY(QStringList suitList READ suitList NOTIFY suitListChanged)
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(bool showPin MEMBER m_showPin WRITE setShowPin NOTIFY showPinChanged)
Q_PROPERTY(QString progressMessage MEMBER m_progressMessage WRITE setProgressMessage NOTIFY progressMessageChanged)
@@ -134,6 +136,7 @@ public:
QStringList suitList() const;
QStringList buddyList() const;
QStringList divemasterList() const;
+ QStringList locationList() const;
QStringList cylinderInit() const;
bool showPin() const;
void setShowPin(bool enable);
@@ -200,6 +203,7 @@ private:
BuddyCompletionModel buddyModel;
SuitCompletionModel suitModel;
DiveMasterCompletionModel divemasterModel;
+ LocationInformationModel locationModel;
QString m_cloudUserName;
QString m_cloudPassword;
QString m_cloudPin;
@@ -274,6 +278,7 @@ signals:
void suitListChanged();
void buddyListChanged();
void divemasterListChanged();
+ void locationListChanged();
};
#endif