mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
9d7eb33a33
commit
6a47af2d16
3 changed files with 38 additions and 3 deletions
|
@ -43,7 +43,8 @@ Item {
|
||||||
manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText,
|
manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText,
|
||||||
detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, suitBox.text, buddyBox.text,
|
detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, suitBox.text, buddyBox.text,
|
||||||
divemasterBox.text, detailsEdit.weightText, detailsEdit.notesText, detailsEdit.startpressureText,
|
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
|
// trigger the profile to be redrawn
|
||||||
QMLProfile.diveId = dive_id
|
QMLProfile.diveId = dive_id
|
||||||
|
|
||||||
|
@ -63,6 +64,8 @@ Item {
|
||||||
diveDetailsListView.currentItem.modelData.divemaster = divemasterBox.currentText
|
diveDetailsListView.currentItem.modelData.divemaster = divemasterBox.currentText
|
||||||
diveDetailsListView.currentItem.modelData.cylinder = cylinderBox.currentText
|
diveDetailsListView.currentItem.modelData.cylinder = cylinderBox.currentText
|
||||||
diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText
|
diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText
|
||||||
|
diveDetailsListView.currentItem.modelData.rating = detailsEdit.rating
|
||||||
|
diveDetailsListView.currentItem.modelData.visibility = detailsEdit.visibility
|
||||||
diveDetailsPage.state = "view"
|
diveDetailsPage.state = "view"
|
||||||
Qt.inputMethod.hide()
|
Qt.inputMethod.hide()
|
||||||
// now make sure we directly show the saved dive (this may be a new dive, or it may have moved)
|
// now make sure we directly show the saved dive (this may be a new dive, or it may have moved)
|
||||||
|
@ -244,6 +247,30 @@ Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
Kirigami.Label {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
|
|
|
@ -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
|
// 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,
|
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 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());
|
struct dive *d = get_dive_by_uniq_id(diveId.toInt());
|
||||||
DiveObjectHelper *myDive = new DiveObjectHelper(d);
|
DiveObjectHelper *myDive = new DiveObjectHelper(d);
|
||||||
|
@ -936,6 +936,14 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
|
||||||
free(d->divemaster);
|
free(d->divemaster);
|
||||||
d->divemaster = strdup(qPrintable(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) {
|
if (myDive->notes() != notes) {
|
||||||
diveChanged = true;
|
diveChanged = true;
|
||||||
free(d->notes);
|
free(d->notes);
|
||||||
|
|
|
@ -154,7 +154,7 @@ public slots:
|
||||||
QString duration, QString depth, QString airtemp,
|
QString duration, QString depth, QString airtemp,
|
||||||
QString watertemp, QString suit, QString buddy,
|
QString watertemp, QString suit, QString buddy,
|
||||||
QString diveMaster, QString weight, QString notes, QString startpressure,
|
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 changesNeedSaving();
|
||||||
void saveChangesLocal();
|
void saveChangesLocal();
|
||||||
void saveChangesCloud(bool forceRemoteSync);
|
void saveChangesCloud(bool forceRemoteSync);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue