[PATCH 3/3] QML UI: enable edit of cylinder pressures

2016-02-09 Thread Joakim Bygdell
First cylinder only, show warning if there are more than one cylinder defined.

Signed-off-by: Joakim Bygdell 
---
 qt-mobile/qml/DiveDetails.qml | 10 ++
 qt-mobile/qml/DiveDetailsEdit.qml | 26 +-
 qt-mobile/qml/main.qml|  2 ++
 qt-mobile/qmlmanager.cpp  | 15 ++-
 qt-mobile/qmlmanager.h|  3 ++-
 5 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml
index 162e31b..f0e2ff3 100644
--- a/qt-mobile/qml/DiveDetails.qml
+++ b/qt-mobile/qml/DiveDetails.qml
@@ -22,6 +22,8 @@ MobileComponents.Page {
property alias notes: detailsEdit.notesText
property alias suit: detailsEdit.suitText
property alias weight: detailsEdit.weightText
+   property alias startpressure: detailsEdit.startpressureText
+   property alias endpressure: detailsEdit.endpressureText
 
state: "view"
 
@@ -99,6 +101,14 @@ MobileComponents.Page {
// careful when translating, this text is "magic" in 
DiveDetailsEdit.qml
weight = "cannot edit multiple weight systems"
}
+   if (diveDetailsListView.currentItem.modelData.dive.getCylinder 
!= "Multiple" ) {
+   startpressure = 
diveDetailsListView.currentItem.modelData.dive.startPressure
+   endpressure = 
diveDetailsListView.currentItem.modelData.dive.endPressure
+   } else {
+   // careful when translating, this text is "magic" in 
DiveDetailsEdit.qml
+   startpressure = "cannot edit multiple cylinders"
+   endpressure = "cannot edit multiple cylinders"
+   }
 
diveDetailsPage.state = "edit"
}
diff --git a/qt-mobile/qml/DiveDetailsEdit.qml 
b/qt-mobile/qml/DiveDetailsEdit.qml
index 90ca304..f6a197d 100644
--- a/qt-mobile/qml/DiveDetailsEdit.qml
+++ b/qt-mobile/qml/DiveDetailsEdit.qml
@@ -22,6 +22,8 @@ Item {
property alias durationText: txtDuration.text
property alias depthText: txtDepth.text
property alias weightText: txtWeight.text
+   property alias startpressureText: txtStartPressure.text
+   property alias endpressureText: txtEndPressure.text
 
height: editArea.height
ColumnLayout {
@@ -144,6 +146,27 @@ Item {
}
 
MobileComponents.Label {
+   Layout.alignment: Qt.AlignRight
+   text: "Start pressure:"
+   }
+   TextField {
+   id: txtStartPressure
+   readOnly: (text == "cannot edit multiple 
cylinders" ? true : false)
+   Layout.fillWidth: true
+   }
+
+   MobileComponents.Label {
+   Layout.alignment: Qt.AlignRight
+   text: "End Pressure:"
+   }
+   TextField {
+   id: txtEndPressure
+   readOnly: (text == "cannot edit multiple 
cylinders" ? true : false)
+   Layout.fillWidth: true
+   }
+
+
+   MobileComponents.Label {
Layout.columnSpan: 2
Layout.alignment: Qt.AlignLeft
text: "Notes:"
@@ -168,7 +191,8 @@ Item {
// 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, detailsEdit.suitText,
- detailsEdit.buddyText, 
detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText)
+ detailsEdit.buddyText, 
detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText,
+ 
detailsEdit.startpressureText, detailsEdit.endpressureText)
// apply the changes to the dive detail view - 
since the edit could have changed the order
// first make sure that we are looking at the 
correct dive - our model allows us to look
// up the index based on the unique dive_id
diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml
index ee18242..6054b2f 100644
--- a/qt-mobile/qml/main.qml
+++ b/qt-mobile/qml/main.qml
@@ -71,6 +71,8 @@ MobileComponents.ApplicationWindow {
 

Re: [PATCH 3/3] QML UI: enable edit of cylinder pressures

2016-02-09 Thread Joakim Bygdell


0003-QML-UI-enable-edit-of-cylinder-pressures.patch
Description: Binary data

> On 09 Feb 2016, at 19:52, Joakim Bygdell  wrote:
> 
> First cylinder only, show warning if there are more than one cylinder defined.
> 
> Signed-off-by: Joakim Bygdell 
> ---
> qt-mobile/qml/DiveDetails.qml | 10 ++
> qt-mobile/qml/DiveDetailsEdit.qml | 26 +-
> qt-mobile/qml/main.qml|  2 ++
> qt-mobile/qmlmanager.cpp  | 15 ++-
> qt-mobile/qmlmanager.h|  3 ++-
> 5 files changed, 53 insertions(+), 3 deletions(-)
> 
> diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml
> index 162e31b..f0e2ff3 100644
> --- a/qt-mobile/qml/DiveDetails.qml
> +++ b/qt-mobile/qml/DiveDetails.qml
> @@ -22,6 +22,8 @@ MobileComponents.Page {
>   property alias notes: detailsEdit.notesText
>   property alias suit: detailsEdit.suitText
>   property alias weight: detailsEdit.weightText
> + property alias startpressure: detailsEdit.startpressureText
> + property alias endpressure: detailsEdit.endpressureText
> 
>   state: "view"
> 
> @@ -99,6 +101,14 @@ MobileComponents.Page {
>   // careful when translating, this text is "magic" in 
> DiveDetailsEdit.qml
>   weight = "cannot edit multiple weight systems"
>   }
> + if (diveDetailsListView.currentItem.modelData.dive.getCylinder 
> != "Multiple" ) {
> + startpressure = 
> diveDetailsListView.currentItem.modelData.dive.startPressure
> + endpressure = 
> diveDetailsListView.currentItem.modelData.dive.endPressure
> + } else {
> + // careful when translating, this text is "magic" in 
> DiveDetailsEdit.qml
> + startpressure = "cannot edit multiple cylinders"
> + endpressure = "cannot edit multiple cylinders"
> + }
> 
>   diveDetailsPage.state = "edit"
>   }
> diff --git a/qt-mobile/qml/DiveDetailsEdit.qml 
> b/qt-mobile/qml/DiveDetailsEdit.qml
> index 90ca304..f6a197d 100644
> --- a/qt-mobile/qml/DiveDetailsEdit.qml
> +++ b/qt-mobile/qml/DiveDetailsEdit.qml
> @@ -22,6 +22,8 @@ Item {
>   property alias durationText: txtDuration.text
>   property alias depthText: txtDepth.text
>   property alias weightText: txtWeight.text
> + property alias startpressureText: txtStartPressure.text
> + property alias endpressureText: txtEndPressure.text
> 
>   height: editArea.height
>   ColumnLayout {
> @@ -144,6 +146,27 @@ Item {
>   }
> 
>   MobileComponents.Label {
> + Layout.alignment: Qt.AlignRight
> + text: "Start Pressure:"
> + }
> + TextField {
> + id: txtStartPressure
> + readOnly: (text == "cannot edit multiple 
> cylinders" ? true : false)
> + Layout.fillWidth: true
> + }
> +
> + MobileComponents.Label {
> + Layout.alignment: Qt.AlignRight
> + text: "End Pressure:"
> + }
> + TextField {
> + id: txtEndPressure
> + readOnly: (text == "cannot edit multiple 
> cylinders" ? true : false)
> + Layout.fillWidth: true
> + }
> +
> +
> + MobileComponents.Label {
>   Layout.columnSpan: 2
>   Layout.alignment: Qt.AlignLeft
>   text: "Notes:"
> @@ -168,7 +191,8 @@ Item {
>   // 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, detailsEdit.suitText,
> -   detailsEdit.buddyText, 
> detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText)
> +   detailsEdit.buddyText, 
> detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText,
> +   
> detailsEdit.startpressureText, detailsEdit.endpressureText)
>   // apply the changes to the dive detail view - 
> since the edit could have changed the order
>   // first make sure that we are looking at the 
> correct dive - our model allows us to look
>   // up the index based on the unique 

[PATCH 3/3] QML UI: enable edit of cylinder pressures

2016-02-09 Thread Joakim Bygdell
First cylinder only, show warning if there are more than one cylinder defined.

Signed-off-by: Joakim Bygdell 
---
 qt-mobile/qml/DiveDetails.qml | 10 ++
 qt-mobile/qml/DiveDetailsEdit.qml | 26 +-
 qt-mobile/qml/main.qml|  2 ++
 qt-mobile/qmlmanager.cpp  | 15 ++-
 qt-mobile/qmlmanager.h|  3 ++-
 5 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml
index 162e31b..f0e2ff3 100644
--- a/qt-mobile/qml/DiveDetails.qml
+++ b/qt-mobile/qml/DiveDetails.qml
@@ -22,6 +22,8 @@ MobileComponents.Page {
property alias notes: detailsEdit.notesText
property alias suit: detailsEdit.suitText
property alias weight: detailsEdit.weightText
+   property alias startpressure: detailsEdit.startpressureText
+   property alias endpressure: detailsEdit.endpressureText
 
state: "view"
 
@@ -99,6 +101,14 @@ MobileComponents.Page {
// careful when translating, this text is "magic" in 
DiveDetailsEdit.qml
weight = "cannot edit multiple weight systems"
}
+   if (diveDetailsListView.currentItem.modelData.dive.getCylinder 
!= "Multiple" ) {
+   startpressure = 
diveDetailsListView.currentItem.modelData.dive.startPressure
+   endpressure = 
diveDetailsListView.currentItem.modelData.dive.endPressure
+   } else {
+   // careful when translating, this text is "magic" in 
DiveDetailsEdit.qml
+   startpressure = "cannot edit multiple cylinders"
+   endpressure = "cannot edit multiple cylinders"
+   }
 
diveDetailsPage.state = "edit"
}
diff --git a/qt-mobile/qml/DiveDetailsEdit.qml 
b/qt-mobile/qml/DiveDetailsEdit.qml
index 90ca304..f6a197d 100644
--- a/qt-mobile/qml/DiveDetailsEdit.qml
+++ b/qt-mobile/qml/DiveDetailsEdit.qml
@@ -22,6 +22,8 @@ Item {
property alias durationText: txtDuration.text
property alias depthText: txtDepth.text
property alias weightText: txtWeight.text
+   property alias startpressureText: txtStartPressure.text
+   property alias endpressureText: txtEndPressure.text
 
height: editArea.height
ColumnLayout {
@@ -144,6 +146,27 @@ Item {
}
 
MobileComponents.Label {
+   Layout.alignment: Qt.AlignRight
+   text: "Start pressure:"
+   }
+   TextField {
+   id: txtStartPressure
+   readOnly: (text == "cannot edit multiple 
cylinders" ? true : false)
+   Layout.fillWidth: true
+   }
+
+   MobileComponents.Label {
+   Layout.alignment: Qt.AlignRight
+   text: "End Pressure:"
+   }
+   TextField {
+   id: txtEndPressure
+   readOnly: (text == "cannot edit multiple 
cylinders" ? true : false)
+   Layout.fillWidth: true
+   }
+
+
+   MobileComponents.Label {
Layout.columnSpan: 2
Layout.alignment: Qt.AlignLeft
text: "Notes:"
@@ -168,7 +191,8 @@ Item {
// 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, detailsEdit.suitText,
- detailsEdit.buddyText, 
detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText)
+ detailsEdit.buddyText, 
detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText,
+ 
detailsEdit.startpressureText, detailsEdit.endpressureText)
// apply the changes to the dive detail view - 
since the edit could have changed the order
// first make sure that we are looking at the 
correct dive - our model allows us to look
// up the index based on the unique dive_id
diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml
index ee18242..6054b2f 100644
--- a/qt-mobile/qml/main.qml
+++ b/qt-mobile/qml/main.qml
@@ -71,6 +71,8 @@ MobileComponents.ApplicationWindow {