summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qml/DiveDetails.qml5
-rw-r--r--mobile-widgets/qml/DiveDetailsEdit.qml85
-rw-r--r--mobile-widgets/qml/DiveDetailsView.qml88
-rw-r--r--mobile-widgets/qml/HintsTextEdit.qml8
-rw-r--r--mobile-widgets/qml/icons/ic_star_black_24px.svg5
-rw-r--r--mobile-widgets/qml/icons/ic_star_border_black_24px.svg4
-rw-r--r--mobile-widgets/qml/mobile-resources.qrc2
-rw-r--r--mobile-widgets/qmlmanager.cpp10
-rw-r--r--mobile-widgets/qmlmanager.h2
9 files changed, 202 insertions, 7 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml
index bdfda2dc7..ed231486d 100644
--- a/mobile-widgets/qml/DiveDetails.qml
+++ b/mobile-widgets/qml/DiveDetails.qml
@@ -38,6 +38,8 @@ Kirigami.Page {
property alias gasmix: detailsEdit.gasmixText
property alias gpsCheckbox: detailsEdit.gpsCheckbox
property int updateCurrentIdx: manager.updateSelectedDive
+ property alias rating: detailsEdit.rating
+ property alias visibility: detailsEdit.visibility
title: currentItem && currentItem.modelData ? currentItem.modelData.dive.location : qsTr("Dive details")
state: "view"
@@ -134,6 +136,7 @@ Kirigami.Page {
manager.addDiveAborted(dive_id)
// just cancel the edit/add state
state = "view";
+ focus = false;
Qt.inputMethod.hide();
}
@@ -174,6 +177,8 @@ Kirigami.Page {
endpressure = currentItem.modelData.dive.endPressure
gasmix = currentItem.modelData.dive.firstGas
cylinderIndex = currentItem.modelData.dive.cylinderList.indexOf(currentItem.modelData.dive.getCylinder)
+ rating = currentItem.modelData.dive.rating
+ visibility = currentItem.modelData.dive.visibility
diveDetailsPage.state = "edit"
}
diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml
index e9fdeb62c..3d1b31194 100644
--- a/mobile-widgets/qml/DiveDetailsEdit.qml
+++ b/mobile-widgets/qml/DiveDetailsEdit.qml
@@ -35,13 +35,16 @@ Item {
property alias divemasterModel: divemasterBox.model
property alias buddyModel: buddyBox.model
property alias cylinderModel: cylinderBox.model
+ property int rating
+ property int visibility
function saveData() {
// apply the changes to the dive_table
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
@@ -61,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)
@@ -72,7 +77,7 @@ Item {
ColumnLayout {
id: editArea
spacing: Kirigami.Units.smallSpacing
- width: parent.width - 2 * Kirigami.Units.gridUnit
+ width: parent.width
GridLayout {
id: editorDetails
@@ -86,33 +91,46 @@ Item {
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Date:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtDate;
Layout.fillWidth: true
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Location:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtLocation;
Layout.fillWidth: true
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Coordinates:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtGps
Layout.fillWidth: true
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Use current\nGPS location:")
visible: manager.locationServiceAvailable
+ font.pointSize: subsurfaceTheme.smallPointSize
}
SsrfCheckBox {
id: checkboxGPS
@@ -126,43 +144,60 @@ Item {
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Depth:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtDepth
Layout.fillWidth: true
validator: RegExpValidator { regExp: /[^-]*/ }
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Duration:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtDuration
Layout.fillWidth: true
validator: RegExpValidator { regExp: /[^-]*/ }
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Air Temp:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtAirTemp
Layout.fillWidth: true
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Water Temp:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtWaterTemp
Layout.fillWidth: true
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Suit:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
HintsTextEdit {
id: suitBox
@@ -174,6 +209,7 @@ Item {
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Buddy:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
HintsTextEdit {
id: buddyBox
@@ -185,6 +221,7 @@ Item {
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Divemaster:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
HintsTextEdit {
id: divemasterBox
@@ -196,16 +233,21 @@ Item {
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Weight:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtWeight
readOnly: text === "cannot edit multiple weight systems"
Layout.fillWidth: true
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Cylinder:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
HintsTextEdit {
id: cylinderBox
@@ -217,35 +259,74 @@ Item {
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Gas mix:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtGasMix
Layout.fillWidth: true
validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("Start Pressure:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtStartPressure
Layout.fillWidth: true
+ onEditingFinished: {
+ focus = false
+ }
}
Kirigami.Label {
Layout.alignment: Qt.AlignRight
text: qsTr("End Pressure:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextField {
id: txtEndPressure
Layout.fillWidth: true
+ onEditingFinished: {
+ focus = false
+ }
+ }
+
+ Kirigami.Label {
+ Layout.alignment: Qt.AlignRight
+ text: qsTr("Rating:")
+ font.pointSize: subsurfaceTheme.smallPointSize
+ }
+ SpinBox {
+ id: ratingPicker
+ from: 0
+ to: 5
+ value: rating
+ onValueChanged: rating = value
+ }
+
+ Kirigami.Label {
+ Layout.alignment: Qt.AlignRight
+ text: qsTr("Visibility:")
+ font.pointSize: subsurfaceTheme.smallPointSize
+ }
+ SpinBox {
+ id: visibilityPicker
+ from: 0
+ to: 5
+ value: visibility
+ onValueChanged: visibility = value
}
Kirigami.Label {
Layout.columnSpan: 2
Layout.alignment: Qt.AlignLeft
text: qsTr("Notes:")
+ font.pointSize: subsurfaceTheme.smallPointSize
}
TextArea {
Layout.columnSpan: 2
diff --git a/mobile-widgets/qml/DiveDetailsView.qml b/mobile-widgets/qml/DiveDetailsView.qml
index 59670e618..9aa7326d0 100644
--- a/mobile-widgets/qml/DiveDetailsView.qml
+++ b/mobile-widgets/qml/DiveDetailsView.qml
@@ -66,6 +66,7 @@ Item {
}
}
Row {
+ id: dateRow
anchors {
left: locationText.left
top: locationText.bottom
@@ -96,6 +97,91 @@ Item {
top: locationText.bottom
}
}
+ Row {
+ anchors {
+ left: dateRow.left
+ top: numberText.bottom
+ }
+ Kirigami.Label {
+ id: ratingText
+ text: qsTr("Rating:")
+ font.pointSize: subsurfaceTheme.smallPointSize
+ color: subsurfaceTheme.textColor
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: ratingText.verticalCenter
+ source: (dive.rating >= 1) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: ratingText.verticalCenter
+ source: (dive.rating >= 2) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: ratingText.verticalCenter
+ source: (dive.rating >= 3) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: ratingText.verticalCenter
+ source: (dive.rating >= 4) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: ratingText.verticalCenter
+ source: (dive.rating === 5) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ }
+ Row {
+ anchors {
+ right: numberText.right
+ top: numberText.bottom
+ }
+ Kirigami.Label {
+ id: visibilityText
+ text: qsTr("Visibility:")
+ font.pointSize: subsurfaceTheme.smallPointSize
+ color: subsurfaceTheme.textColor
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: visibilityText.verticalCenter
+ source: (dive.visibility >= 1) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: visibilityText.verticalCenter
+ source: (dive.visibility >= 2) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: visibilityText.verticalCenter
+ source: (dive.visibility >= 3) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: visibilityText.verticalCenter
+ source: (dive.visibility >= 4) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ Kirigami.Icon {
+ width: height
+ height: subsurfaceTheme.regularPointSize
+ anchors.verticalCenter: visibilityText.verticalCenter
+ source: (dive.visibility === 5) ? "icons/ic_star.svg" : "icons/ic_star_border.svg"
+ }
+ }
+
}
GridLayout {
id: bottomLayout
@@ -104,7 +190,7 @@ Item {
left: parent.left
right: parent.right
margins: Math.round(Kirigami.Units.gridUnit / 2)
- topMargin: Kirigami.Units.gridUnit * 2
+ topMargin: Kirigami.Units.gridUnit
}
columns: 3
rowSpacing: Kirigami.Units.smallSpacing * 2
diff --git a/mobile-widgets/qml/HintsTextEdit.qml b/mobile-widgets/qml/HintsTextEdit.qml
index 5bf57207f..ff6dc75cb 100644
--- a/mobile-widgets/qml/HintsTextEdit.qml
+++ b/mobile-widgets/qml/HintsTextEdit.qml
@@ -14,7 +14,8 @@ TextField {
onTextChanged: {
textUpdateTimer.restart();
}
- onFocusChanged: frame.shouldShow = focus
+ onFocusChanged: frame.shouldShow = false
+
onVisibleChanged: {
if (visible) {
focus = false
@@ -27,6 +28,9 @@ TextField {
Keys.onDownPressed: {
hintsView.currentIndex++;
}
+ Keys.onReturnPressed: {
+ focus = false
+ }
Timer {
id: textUpdateTimer
interval: 300
@@ -107,7 +111,7 @@ TextField {
onClicked: {
hintsView.currentIndex = index
root.text = modelData
- frame.shouldShow = false;
+ root.focus = false;
}
}
ScrollBar.vertical: ScrollBar { }
diff --git a/mobile-widgets/qml/icons/ic_star_black_24px.svg b/mobile-widgets/qml/icons/ic_star_black_24px.svg
new file mode 100644
index 000000000..742e71af5
--- /dev/null
+++ b/mobile-widgets/qml/icons/ic_star_black_24px.svg
@@ -0,0 +1,5 @@
+<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
+ <path d="M0 0h24v24H0z" fill="none"/>
+ <path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/>
+ <path d="M0 0h24v24H0z" fill="none"/>
+</svg> \ No newline at end of file
diff --git a/mobile-widgets/qml/icons/ic_star_border_black_24px.svg b/mobile-widgets/qml/icons/ic_star_border_black_24px.svg
new file mode 100644
index 000000000..d8196ab02
--- /dev/null
+++ b/mobile-widgets/qml/icons/ic_star_border_black_24px.svg
@@ -0,0 +1,4 @@
+<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
+ <path d="M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"/>
+ <path d="M0 0h24v24H0z" fill="none"/>
+</svg> \ No newline at end of file
diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc
index d3263c7d3..2e5ac00a7 100644
--- a/mobile-widgets/qml/mobile-resources.qrc
+++ b/mobile-widgets/qml/mobile-resources.qrc
@@ -63,5 +63,7 @@
<file alias="icons/Blue_gps.svg">icons/Blue_gps.svg</file>
<file alias="icons/Pink_gps.svg">icons/Pink_gps.svg</file>
<file alias="icons/Dark_gps.svg">icons/Blue_gps.svg</file>
+ <file alias="icons/ic_star.svg">icons/ic_star_black_24px.svg</file>
+ <file alias="icons/ic_star_border.svg">icons/ic_star_border_black_24px.svg</file>
</qresource>
</RCC>
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);