diff options
author | Joakim Bygdell <j.bygdell@gmail.com> | 2017-07-28 19:28:52 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-08-02 18:49:47 -0700 |
commit | 6a47af2d16c522575c79828f6a3e71e59de76d78 (patch) | |
tree | a187215959b518aa7d602ea4c8ddb286dee826d0 | |
parent | 9d7eb33a33d6e7c21806057e700f0a00a43cbba5 (diff) | |
download | subsurface-6a47af2d16c522575c79828f6a3e71e59de76d78.tar.gz |
QML UI: enable modification of ratings
This enables editing of visibility and ratings for a dive.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
-rw-r--r-- | mobile-widgets/qml/DiveDetailsEdit.qml | 29 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 10 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 2 |
3 files changed, 38 insertions, 3 deletions
diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml index 3ad2cd500..57f18dfb8 100644 --- a/mobile-widgets/qml/DiveDetailsEdit.qml +++ b/mobile-widgets/qml/DiveDetailsEdit.qml @@ -43,7 +43,8 @@ Item { manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText, detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, suitBox.text, buddyBox.text, divemasterBox.text, detailsEdit.weightText, detailsEdit.notesText, detailsEdit.startpressureText, - detailsEdit.endpressureText, detailsEdit.gasmixText, cylinderBox.text) + detailsEdit.endpressureText, detailsEdit.gasmixText, cylinderBox.text, detailsEdit.rating, + detailsEdit.visibility) // trigger the profile to be redrawn QMLProfile.diveId = dive_id @@ -63,6 +64,8 @@ Item { diveDetailsListView.currentItem.modelData.divemaster = divemasterBox.currentText diveDetailsListView.currentItem.modelData.cylinder = cylinderBox.currentText diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText + diveDetailsListView.currentItem.modelData.rating = detailsEdit.rating + diveDetailsListView.currentItem.modelData.visibility = detailsEdit.visibility diveDetailsPage.state = "view" Qt.inputMethod.hide() // now make sure we directly show the saved dive (this may be a new dive, or it may have moved) @@ -245,6 +248,30 @@ Item { } Kirigami.Label { + Layout.alignment: Qt.AlignRight + text: qsTr("Rating:") + } + SpinBox { + id: ratingPicker + from: 0 + to: 5 + value: rating + onValueChanged: rating = value + } + + Kirigami.Label { + Layout.alignment: Qt.AlignRight + text: qsTr("Visibility:") + } + SpinBox { + id: visibilityPicker + from: 0 + to: 5 + value: visibility + onValueChanged: visibility = value + } + + Kirigami.Label { Layout.columnSpan: 2 Layout.alignment: Qt.AlignLeft text: qsTr("Notes:") diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index ed58fffb5..260f92649 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -832,7 +832,7 @@ bool QMLManager::checkDepth(DiveObjectHelper *myDive, dive *d, QString depth) // update the dive and return the notes field, stripped of the HTML junk void QMLManager::commitChanges(QString diveId, QString date, QString location, QString gps, QString duration, QString depth, QString airtemp, QString watertemp, QString suit, QString buddy, QString diveMaster, QString weight, QString notes, - QString startpressure, QString endpressure, QString gasmix, QString cylinder) + QString startpressure, QString endpressure, QString gasmix, QString cylinder, int rating, int visibility) { struct dive *d = get_dive_by_uniq_id(diveId.toInt()); DiveObjectHelper *myDive = new DiveObjectHelper(d); @@ -936,6 +936,14 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q free(d->divemaster); d->divemaster = strdup(qPrintable(diveMaster)); } + if (myDive->rating() != rating) { + diveChanged = true; + d->rating = rating; + } + if (myDive->visibility() != visibility) { + diveChanged = true; + d->visibility = visibility; + } if (myDive->notes() != notes) { diveChanged = true; free(d->notes); diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index 8f3db3266..71f6b8cf9 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -154,7 +154,7 @@ public slots: QString duration, QString depth, QString airtemp, QString watertemp, QString suit, QString buddy, QString diveMaster, QString weight, QString notes, QString startpressure, - QString endpressure, QString gasmix, QString cylinder); + QString endpressure, QString gasmix, QString cylinder, int rating, int visibility); void changesNeedSaving(); void saveChangesLocal(); void saveChangesCloud(bool forceRemoteSync); |