aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml
diff options
context:
space:
mode:
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r--mobile-widgets/qml/DiveDetails.qml4
-rw-r--r--mobile-widgets/qml/DiveDetailsEdit.qml1095
-rw-r--r--mobile-widgets/qml/Settings.qml128
-rw-r--r--mobile-widgets/qml/SsrfTextField.qml25
-rw-r--r--mobile-widgets/qml/StatisticsPage.qml19
-rw-r--r--mobile-widgets/qml/TemplateButton.qml3
-rw-r--r--mobile-widgets/qml/TemplateComboBox.qml6
-rw-r--r--mobile-widgets/qml/TemplateSlimComboBox.qml2
-rw-r--r--mobile-widgets/qml/ThemeTest.qml85
-rw-r--r--mobile-widgets/qml/main.qml62
10 files changed, 848 insertions, 581 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml
index e505d7bc1..1215e86ad 100644
--- a/mobile-widgets/qml/DiveDetails.qml
+++ b/mobile-widgets/qml/DiveDetails.qml
@@ -115,7 +115,7 @@ Kirigami.Page {
enabled: manager.redoText !== ""
onTriggered: manager.redo()
}
- property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, undoAction, redoAction ]
+ property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, deleteAction, undoAction, redoAction ]
states: [
State {
@@ -123,7 +123,7 @@ Kirigami.Page {
PropertyChanges {
target: diveDetailsPage;
actions {
- right: deleteAction
+ right: null
left: currentItem ? (currentItem.modelData && currentItem.modelData.gps !== "" ? mapAction : null) : null
}
contextualActions: contextactions
diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml
index 703d573b9..6f5690bae 100644
--- a/mobile-widgets/qml/DiveDetailsEdit.qml
+++ b/mobile-widgets/qml/DiveDetailsEdit.qml
@@ -84,31 +84,31 @@ Item {
var state = diveDetailsPage.state
diveDetailsPage.state = "view" // run the transition
// join cylinder info from separate string into a list.
- if (usedCyl[0] != null) {
+ if (usedCyl[0] !== undefined) {
usedCyl[0] = cylinderBox0.currentText
usedGas[0] = txtGasMix0.text
startpressure[0] = txtStartPressure0.text
endpressure[0] = txtEndPressure0.text
}
- if (usedCyl[1] != null) {
+ if (usedCyl[1] !== undefined) {
usedCyl[1] = cylinderBox1.currentText
usedGas[1] = txtGasMix1.text
startpressure[1] = txtStartPressure1.text
endpressure[1] = txtEndPressure1.text
}
- if (usedCyl[2] != null) {
+ if (usedCyl[2] !== undefined) {
usedCyl[2] = cylinderBox2.currentText
usedGas[2] = txtGasMix2.text
startpressure[2] = txtStartPressure2.text
endpressure[2] = txtEndPressure2.text
}
- if (usedCyl[3] != null) {
+ if (usedCyl[3] !== undefined) {
usedCyl[3] = cylinderBox3.currentText
usedGas[3] = txtGasMix3.text
startpressure[3] = txtStartPressure3.text
endpressure[3] = txtEndPressure3.text
}
- if (usedCyl[4] != null) {
+ if (usedCyl[4] !== undefined) {
usedCyl[4] = cylinderBox4.currentText
usedGas[4] = txtGasMix4.text
startpressure[4] = txtStartPressure4.text
@@ -128,78 +128,160 @@ Item {
clearDetailsEdit()
}
- height: editArea.height
+ height: editArea.height + Kirigami.Units.gridUnit * 3
width: diveDetailsPage.width - diveDetailsPage.leftPadding - diveDetailsPage.rightPadding - Kirigami.Units.smallSpacing * 2
- ColumnLayout {
- id: editArea
- spacing: Kirigami.Units.smallSpacing
- width: parent.width
-
- GridLayout {
- id: editorDetails
+ Item {
+ // there is a maximum width above which this becomes less pleasant to use. 42 gridUnits
+ // allows for two of the large drop downs or four of the text fields or all of a cylinder
+ // to be in one row. More just doesn't look good
+ width: Math.min(parent.width - Kirigami.Units.smallSpacing, Kirigami.Units.gridUnit * 42)
+ // weird way to create a little space from the left edge - but I can't do a margin here
+ x: Kirigami.Units.smallSpacing
+ Flow {
+ id: editArea
+ // with larger fonts we need more space, or things look too crowded
+ spacing: subsurfaceTheme.currentScale > 1.0 ? 1.5 * Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing
width: parent.width
- columns: 2
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Dive number:")
- }
- SsrfTextField {
- id: txtNumber;
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Date:")
+ flow: GridLayout.LeftToRight
+ RowLayout {
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Date/Time:")
+ }
+ SsrfTextField {
+ id: txtDate;
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 10
+ flickable: detailsEditFlickable
+ }
}
- SsrfTextField {
- id: txtDate;
- Layout.fillWidth: true
- flickable: detailsEditFlickable
+ RowLayout {
+ TemplateLabelSmall {
+ horizontalAlignment: Text.AlignRight
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ text: qsTr("Dive number:")
+ }
+ SsrfTextField {
+ id: txtNumber;
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 3
+ flickable: detailsEditFlickable
+ }
+ Item {
+ // if date and dive number are on the same line, don't have the Depth behind them
+ // to ensure that we add an element that fills enough of the line that the flow
+ // will not pull the next element up
+ visible: editArea.width > Kirigami.Units.gridUnit * 27
+ Layout.preferredWidth: editArea.width - Kirigami.Units.gridUnit * 26
+ }
}
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Location:")
+ RowLayout {
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Depth:")
+ }
+ SsrfTextField {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 3
+ id: txtDepth
+ validator: RegExpValidator { regExp: /[^-]*/ }
+ flickable: detailsEditFlickable
+ }
}
- TemplateEditComboBox {
- id: locationBox
- flickable: detailsEditFlickable
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- manager.locationList : null
- onAccepted: {
- focus = false
- gpsText = manager.getGpsFromSiteName(editText)
- }
- onActivated: {
- focus = false
- gpsText = manager.getGpsFromSiteName(editText)
+ RowLayout {
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Duration:")
+ }
+ SsrfTextField {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 3
+ id: txtDuration
+ validator: RegExpValidator { regExp: /[^-]*/ }
+ flickable: detailsEditFlickable
}
+
}
+ RowLayout {
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Air Temp:")
+ }
+ SsrfTextField {
+ id: txtAirTemp
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 3
+ flickable: detailsEditFlickable
+ }
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Coordinates:")
}
- SsrfTextField {
- id: txtGps
- Layout.fillWidth: true
- flickable: detailsEditFlickable
+ RowLayout {
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Water Temp:")
+ }
+ SsrfTextField {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 3
+ id: txtWaterTemp
+ flickable: detailsEditFlickable
+ }
}
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Use current\nGPS location:")
- visible: manager.locationServiceAvailable
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 20
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Location:")
+ }
+ TemplateEditComboBox {
+ // this one needs more space
+ id: locationBox
+ flickable: detailsEditFlickable
+ model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
+ manager.locationList : null
+ onAccepted: {
+ focus = false
+ gpsText = manager.getGpsFromSiteName(editText)
+ }
+ onActivated: {
+ focus = false
+ gpsText = manager.getGpsFromSiteName(editText)
+ }
+ }
}
- TemplateCheckBox {
- id: checkboxGPS
- visible: manager.locationServiceAvailable
- onCheckedChanged: {
- if (checked)
- gpsText = manager.getCurrentPosition()
+ RowLayout {
+ spacing: Kirigami.Units.smallSpacing
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 20
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Coordinates:")
+ }
+ SsrfTextField {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 16
+ id: txtGps
+ flickable: detailsEditFlickable
}
}
+ RowLayout {
+ width: manager.locationServiceAvailable ? Kirigami.Units.gridUnit * 12 : 0
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Use current\nGPS location:")
+ visible: manager.locationServiceAvailable
+ }
+ TemplateCheckBox {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ id: checkboxGPS
+ visible: manager.locationServiceAvailable
+ onCheckedChanged: {
+ if (checked)
+ gpsText = manager.getCurrentPosition()
+ }
+ }
+ }
+
Connections {
target: manager
onWaitingForPositionChanged: {
@@ -207,443 +289,514 @@ Item {
manager.appendTextToLog("received updated position info " + gpsText)
}
}
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Depth:")
- }
- SsrfTextField {
- id: txtDepth
- Layout.fillWidth: true
- validator: RegExpValidator { regExp: /[^-]*/ }
- flickable: detailsEditFlickable
- }
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Duration:")
- }
- SsrfTextField {
- id: txtDuration
- Layout.fillWidth: true
- validator: RegExpValidator { regExp: /[^-]*/ }
- flickable: detailsEditFlickable
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Air Temp:")
- }
- SsrfTextField {
- id: txtAirTemp
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Water Temp:")
- }
- SsrfTextField {
- id: txtWaterTemp
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Suit:")
- }
- TemplateEditComboBox {
- id: suitBox
- flickable: detailsEditFlickable
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- manager.suitList : null
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Buddy:")
- }
- TemplateEditComboBox {
- id: buddyBox
- flickable: detailsEditFlickable
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- manager.buddyList : null
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Divemaster:")
- }
- TemplateEditComboBox {
- id: divemasterBox
- flickable: detailsEditFlickable
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- manager.divemasterList : null
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Weight:")
- }
- SsrfTextField {
- id: txtWeight
- readOnly: text === "cannot edit multiple weight systems"
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
-// all cylinder info should be able to become dynamic instead of this blob of code.
-// first cylinder
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Cylinder1:")
- }
- TemplateComboBox {
- id: cylinderBox0
- flickable: detailsEditFlickable
- flat: true
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- diveDetailsListView.currentItem.modelData.cylinderList : null
- inputMethodHints: Qt.ImhNoPredictiveText
- Layout.fillWidth: true
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Gas mix:")
- }
- SsrfTextField {
- id: txtGasMix0
- text: usedGas[0] != null ? usedGas[0] : null
- Layout.fillWidth: true
- validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
- flickable: detailsEditFlickable
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Start Pressure:")
- }
- SsrfTextField {
- id: txtStartPressure0
- text: startpressure[0] != null ? startpressure[0] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
-
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("End Pressure:")
- }
- SsrfTextField {
- id: txtEndPressure0
- text: endpressure[0] != null ? endpressure[0] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
-//second cylinder
- TemplateLabelSmall {
- visible: usedCyl[1] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Cylinder2:")
- }
- TemplateComboBox {
- visible: usedCyl[1] != null ? true : false
- id: cylinderBox1
- flickable: detailsEditFlickable
- flat: true
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- diveDetailsListView.currentItem.modelData.cylinderList : null
- inputMethodHints: Qt.ImhNoPredictiveText
- Layout.fillWidth: true
- }
-
- TemplateLabelSmall {
- visible: usedCyl[1] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Gas mix:")
- }
- SsrfTextField {
- visible: usedCyl[1] != null ? true : false
- id: txtGasMix1
- text: usedGas[1] != null ? usedGas[1] : null
- Layout.fillWidth: true
- validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
- flickable: detailsEditFlickable
- }
-
- TemplateLabelSmall {
- visible: usedCyl[1] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Start Pressure:")
- }
- SsrfTextField {
- visible: usedCyl[1] != null ? true : false
- id: txtStartPressure1
- text: startpressure[1] != null ? startpressure[1] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
-
- TemplateLabelSmall {
- visible: usedCyl[1] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("End Pressure:")
- }
- SsrfTextField {
- visible: usedCyl[1] != null ? true : false
- id: txtEndPressure1
- text: endpressure[1] != null ? endpressure[1] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 20
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Suit:")
+ }
+ TemplateEditComboBox {
+ id: suitBox
+ flickable: detailsEditFlickable
+ model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
+ manager.suitList : null
+ }
}
-// third cylinder
- TemplateLabelSmall {
- visible: usedCyl[2] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Cylinder3:")
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 20
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Buddy:")
+ }
+ TemplateEditComboBox {
+ id: buddyBox
+ flickable: detailsEditFlickable
+ model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
+ manager.buddyList : null
+ }
}
- TemplateComboBox {
- visible: usedCyl[2] != null ? true : false
- id: cylinderBox2
- flickable: detailsEditFlickable
- currentIndex: find(usedCyl[2])
- flat: true
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- diveDetailsListView.currentItem.modelData.cylinderList : null
- inputMethodHints: Qt.ImhNoPredictiveText
- Layout.fillWidth: true
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 20
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Divemaster:")
+ }
+ TemplateEditComboBox {
+ id: divemasterBox
+ flickable: detailsEditFlickable
+ model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
+ manager.divemasterList : null
+ }
}
- TemplateLabelSmall {
- visible: usedCyl[2] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Gas mix:")
- }
- SsrfTextField {
- visible: usedCyl[2] != null ? true : false
- id: txtGasMix2
- text: usedGas[2] != null ? usedGas[2] : null
- Layout.fillWidth: true
- validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
- }
- TemplateLabelSmall {
- visible: usedCyl[2] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Start Pressure:")
- }
- SsrfTextField {
- visible: usedCyl[2] != null ? true : false
- id: txtStartPressure2
- text: startpressure[2] != null ? startpressure[2] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 16
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Weight:")
+ }
+ SsrfTextField {
+ id: txtWeight
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 12
+ readOnly: text === "cannot edit multiple weight systems"
+ flickable: detailsEditFlickable
+ }
}
- TemplateLabelSmall {
- visible: usedCyl[2] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("End Pressure:")
- }
- SsrfTextField {
- visible: usedCyl[2] != null ? true : false
- id: txtEndPressure2
- text: endpressure[2] != null ? endpressure[2] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
-// fourth cylinder
- TemplateLabelSmall {
- visible: usedCyl[3] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Cylinder4:")
- }
- TemplateComboBox {
- visible: usedCyl[3] != null ? true : false
- id: cylinderBox3
- flickable: detailsEditFlickable
- currentIndex: find(usedCyl[3])
- flat: true
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- diveDetailsListView.currentItem.modelData.cylinderList : null
- inputMethodHints: Qt.ImhNoPredictiveText
- Layout.fillWidth: true
+ // all cylinder info should be able to become dynamic instead of this blob of code.
+ // first cylinder
+ Flow {
+ width: parent.width
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 12
+ id: cb1
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Cylinder1:")
+ }
+ TemplateComboBox {
+ id: cylinderBox0
+ flickable: detailsEditFlickable
+ flat: true
+ model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
+ diveDetailsListView.currentItem.modelData.cylinderList : null
+ inputMethodHints: Qt.ImhNoPredictiveText
+ }
+ }
+ RowLayout {
+ height: cb1.height
+ width: Kirigami.Units.gridUnit * 8
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Gas mix:")
+ }
+ SsrfTextField {
+ id: txtGasMix0
+ text: usedGas[0] !== undefined ? usedGas[0] : null
+ Layout.fillWidth: true
+ validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
+ flickable: detailsEditFlickable
+ }
+ }
+ RowLayout {
+ height: cb1.height
+ width: Kirigami.Units.gridUnit * 10
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Start Pressure:")
+ }
+ SsrfTextField {
+ id: txtStartPressure0
+ text: startpressure[0] !== undefined ? startpressure[0] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
+ }
+ RowLayout {
+ height: cb1.height
+ width: Kirigami.Units.gridUnit * 10
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("End Pressure:")
+ }
+ SsrfTextField {
+ id: txtEndPressure0
+ text: endpressure[0] !== undefined ? endpressure[0] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
+ }
}
-
- TemplateLabelSmall {
- visible: usedCyl[3] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Gas mix:")
+ //second cylinder
+ Flow {
+ width: parent.width
+ visible: usedCyl[1] !== undefined ? true : false
+ RowLayout {
+ id: cb2
+ width: Kirigami.Units.gridUnit * 12
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Cylinder2:")
+ }
+ TemplateComboBox {
+ id: cylinderBox1
+ flickable: detailsEditFlickable
+ flat: true
+ model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
+ diveDetailsListView.currentItem.modelData.cylinderList : null
+ inputMethodHints: Qt.ImhNoPredictiveText
+ }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 8
+ height: cb2.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Gas mix:")
+ }
+ SsrfTextField {
+ id: txtGasMix1
+ text: usedGas[1] !== undefined ? usedGas[1] : null
+ Layout.fillWidth: true
+ validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
+ flickable: detailsEditFlickable
+ }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ height: cb2.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Start Pressure:")
+ }
+ SsrfTextField {
+ id: txtStartPressure1
+ text: startpressure[1] !== undefined ? startpressure[1] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ height: cb2.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("End Pressure:")
+ }
+ SsrfTextField {
+ id: txtEndPressure1
+ text: endpressure[1] !== undefined ? endpressure[1] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
+ }
}
- SsrfTextField {
- visible: usedCyl[3] != null ? true : false
- id: txtGasMix3
- text: usedGas[3] != null ? usedGas[3] : null
- Layout.fillWidth: true
- validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
- flickable: detailsEditFlickable
+ // third cylinder
+ Flow {
+ width: parent.width
+ visible: usedCyl[2] !== undefined ? true : false
+ RowLayout {
+ id: cb3
+ width: Kirigami.Units.gridUnit * 12
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Cylinder3:")
+ }
+ TemplateComboBox {
+ id: cylinderBox2
+ flickable: detailsEditFlickable
+ currentIndex: find(usedCyl[2])
+ flat: true
+ model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
+ diveDetailsListView.currentItem.modelData.cylinderList : null
+ inputMethodHints: Qt.ImhNoPredictiveText
+ }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 8
+ height: cb3.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Gas mix:")
+ }
+ SsrfTextField {
+ id: txtGasMix2
+ text: usedGas[2] !== undefined ? usedGas[2] : null
+ Layout.fillWidth: true
+ validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
+ flickable: detailsEditFlickable
+ }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ height: cb3.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Start Pressure:")
+ }
+ SsrfTextField {
+ id: txtStartPressure2
+ text: startpressure[2] !== undefined ? startpressure[2] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ height: cb3.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("End Pressure:")
+ }
+ SsrfTextField {
+ id: txtEndPressure2
+ text: endpressure[2] !== undefined ? endpressure[2] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
+ }
}
+ // fourth cylinder
+ Flow {
+ width: parent.width
+ visible: usedCyl[3] !== undefined ? true : false
+ RowLayout {
+ id: cb4
+ width: Kirigami.Units.gridUnit * 12
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Cylinder4:")
+ }
+ TemplateComboBox {
+ id: cylinderBox3
+ flickable: detailsEditFlickable
+ currentIndex: find(usedCyl[3])
+ flat: true
+ model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
+ diveDetailsListView.currentItem.modelData.cylinderList : null
+ inputMethodHints: Qt.ImhNoPredictiveText
+ }
- TemplateLabelSmall {
- visible: usedCyl[3] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Start Pressure:")
- }
- SsrfTextField {
- visible: usedCyl[3] != null ? true : false
- id: txtStartPressure3
- text: startpressure[3] != null ? startpressure[3] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 8
+ height: cb4.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Gas mix:")
+ }
+ SsrfTextField {
+ id: txtGasMix3
+ text: usedGas[3] !== undefined ? usedGas[3] : null
+ Layout.fillWidth: true
+ validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
+ flickable: detailsEditFlickable
+ }
- TemplateLabelSmall {
- visible: usedCyl[3] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("End Pressure:")
- }
- SsrfTextField {
- visible: usedCyl[3] != null ? true : false
- id: txtEndPressure3
- text: endpressure[3] != null ? endpressure[3] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
-// fifth cylinder
- TemplateLabelSmall {
- visible: usedCyl[4] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Cylinder5:")
- }
- TemplateComboBox {
- visible: usedCyl[4] != null ? true : false
- id: cylinderBox4
- flickable: detailsEditFlickable
- currentIndex: find(usedCyl[4])
- flat: true
- model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
- diveDetailsListView.currentItem.modelData.cylinderList : null
- inputMethodHints: Qt.ImhNoPredictiveText
- Layout.fillWidth: true
- }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ height: cb4.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Start Pressure:")
+ }
+ SsrfTextField {
+ id: txtStartPressure3
+ text: startpressure[3] !== undefined ? startpressure[3] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
- TemplateLabelSmall {
- visible: usedCyl[4] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Gas mix:")
- }
- SsrfTextField {
- visible: usedCyl[4] != null ? true : false
- id: txtGasMix4
- text: usedGas[4] != null ? usedGas[4] : null
- Layout.fillWidth: true
- validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
- flickable: detailsEditFlickable
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ height: cb4.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("End Pressure:")
+ }
+ SsrfTextField {
+ id: txtEndPressure3
+ text: endpressure[3] !== undefined ? endpressure[3] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
+ }
}
+ // fifth cylinder
+ Flow {
+ width: parent.width
+ visible: usedCyl[4] !== undefined ? true : false
+ RowLayout {
+ id: cb5
+ width: Kirigami.Units.gridUnit * 12
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Cylinder5:")
+ }
+ TemplateComboBox {
+ id: cylinderBox4
+ flickable: detailsEditFlickable
+ currentIndex: find(usedCyl[4])
+ flat: true
+ model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
+ diveDetailsListView.currentItem.modelData.cylinderList : null
+ inputMethodHints: Qt.ImhNoPredictiveText
+ Layout.fillWidth: true
+ }
- TemplateLabelSmall {
- visible: usedCyl[4] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("Start Pressure:")
- }
- SsrfTextField {
- visible: usedCyl[4] != null ? true : false
- id: txtStartPressure4
- text: startpressure[4] != null ? startpressure[4] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 8
+ height: cb5.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Gas mix:")
+ }
+ SsrfTextField {
+ id: txtGasMix4
+ text: usedGas[4] !== undefined ? usedGas[4] : null
+ Layout.fillWidth: true
+ validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i }
+ flickable: detailsEditFlickable
+ }
- TemplateLabelSmall {
- visible: usedCyl[4] != null ? true : false
- Layout.alignment: Qt.AlignRight
- text: qsTr("End Pressure:")
- }
- SsrfTextField {
- visible: usedCyl[4] != null ? true : false
- id: txtEndPressure4
- text: endpressure[4] != null ? endpressure[4] : null
- Layout.fillWidth: true
- flickable: detailsEditFlickable
- }
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ height: cb5.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Start Pressure:")
+ }
+ SsrfTextField {
+ id: txtStartPressure4
+ text: startpressure[4] !== undefined ? startpressure[4] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Rating:")
- }
- TemplateSpinBox {
- id: ratingPicker
- from: 0
- to: 5
- value: rating
- onValueChanged: rating = value
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ height: cb5.height
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("End Pressure:")
+ }
+ SsrfTextField {
+ id: txtEndPressure4
+ text: endpressure[4] !== undefined ? endpressure[4] : null
+ Layout.fillWidth: true
+ flickable: detailsEditFlickable
+ }
+ }
}
+ // rating / visibility
+ RowLayout {
+ width: parent.width
- TemplateLabelSmall {
- Layout.alignment: Qt.AlignRight
- text: qsTr("Visibility:")
- }
- TemplateSpinBox {
- id: visibilityPicker
- from: 0
- to: 5
- value: visibility
- onValueChanged: visibility = value
- }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Rating:")
+ }
+ TemplateSpinBox {
+ id: ratingPicker
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ from: 0
+ to: 5
+ value: rating
+ onValueChanged: rating = value
+ }
- TemplateLabelSmall {
- Layout.columnSpan: 2
- Layout.alignment: Qt.AlignLeft
- text: qsTr("Notes:")
+ }
+ RowLayout {
+ width: Kirigami.Units.gridUnit * 10
+ TemplateLabelSmall {
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 4
+ horizontalAlignment: Text.AlignRight
+ text: qsTr("Visibility:")
+ }
+ TemplateSpinBox {
+ id: visibilityPicker
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 6
+ from: 0
+ to: 5
+ value: visibility
+ onValueChanged: visibility = value
+ }
+ Item { Layout.fillWidth: true }
+ }
}
- Controls.TextArea {
- Layout.columnSpan: 2
+ ColumnLayout {
width: parent.width
- id: txtNotes
- textFormat: TextEdit.RichText
- focus: true
- color: subsurfaceTheme.textColor
- Layout.fillWidth: true
- Layout.fillHeight: true
- Layout.minimumHeight: Kirigami.Units.gridUnit * 6
- selectByMouse: true
- wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
- property bool firstTime: true
- property int visibleTop: detailsEditFlickable.contentY
- property int visibleBottom: visibleTop + detailsEditFlickable.height - 4 * Kirigami.Units.gridUnit
- onPressed: waitForKeyboard.start()
- onCursorRectangleChanged: {
- ensureVisible(y + cursorRectangle.y)
+ TemplateLabelSmall {
+ Layout.preferredWidth: parent.width
+ text: qsTr("Notes:")
}
-
- // ensure that the y coordinate is inside the visible part of the detailsEditFlickable (our flickable)
- function ensureVisible(yDest) {
- if (yDest > visibleBottom)
- detailsEditFlickable.contentY += yDest - visibleBottom
- if (yDest < visibleTop)
- detailsEditFlickable.contentY -= visibleTop - yDest
- }
-
- // give the OS enough time to actually resize the flickable
- Timer {
- id: waitForKeyboard
- interval: 300 // 300ms seems like FOREVER
- onTriggered: {
- if (!Qt.inputMethod.visible) {
- if (txtNotes.firstTime) {
- txtNotes.firstTime = false
- restart()
+ Controls.TextArea {
+ Layout.preferredWidth: parent.width
+ width: parent.width
+ id: txtNotes
+ textFormat: TextEdit.RichText
+ focus: true
+ color: subsurfaceTheme.textColor
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.minimumHeight: Kirigami.Units.gridUnit * 6
+ selectByMouse: true
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ property bool firstTime: true
+ onPressed: waitForKeyboard.start()
+ onCursorRectangleChanged: {
+ ensureVisible()
+ }
+ // ensure that the y coordinate is inside the visible part of the detailsEditFlickable (our flickable)
+ function ensureVisible() {
+ // make sure there's enough space for the TextArea above the keyboard and action button
+ // and that it's not too far up, either
+ var flickable = detailsEditFlickable
+ var positionInFlickable = txtNotes.mapToItem(flickable.contentItem, 0, 0)
+ var taY = positionInFlickable.y + cursorRectangle.y
+ if (manager.verboseEnabled)
+ manager.appendTextToLog("position check: lower edge of view is " +
+ (0 + flickable.contentY + flickable.height) +
+ " and text area is at " + taY)
+ if (taY > flickable.contentY + flickable.height - 4 * Kirigami.Units.gridUnit)
+ flickable.contentY = Math.max(0, 4 * Kirigami.Units.gridUnit + taY - flickable.height)
+ while (taY < flickable.contentY)
+ flickable.contentY -= 2 * Kirigami.Units.gridUnit
+ }
+ // give the OS enough time to actually resize the flickable
+ Timer {
+ id: waitForKeyboard
+ interval: 300 // 300ms seems like FOREVER
+ onTriggered: {
+ if (!Qt.inputMethod.visible) {
+ if (txtNotes.firstTime) {
+ txtNotes.firstTime = false
+ restart()
+ }
+ return
}
- return
+ // make sure at least half the Notes field is visible
+ txtNotes.ensureVisible()
}
- // make sure at least half the Notes field is visible
- txtNotes.ensureVisible(txtNotes.y + txtNotes.cursorRectangle.y)
}
}
}
}
Item {
+ anchors.top: editArea.bottom
height: Kirigami.Units.gridUnit * 3
width: height // just to make sure the spacer doesn't produce scrollbars, but also isn't null
}
diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml
index 3d28bec2a..e0497d36c 100644
--- a/mobile-widgets/qml/Settings.qml
+++ b/mobile-widgets/qml/Settings.qml
@@ -309,35 +309,58 @@ TemplatePage {
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
Layout.columnSpan: 2
}
- RowLayout {
+ Flow {
Layout.columnSpan: 2
spacing: Kirigami.Units.largeSpacing
TemplateButton {
- text: qsTr("smaller")
+ text: qsTr("very small")
+ fontSize: subsurfaceTheme.regularPointSize / subsurfaceTheme.currentScale * 0.75
+ enabled: subsurfaceTheme.currentScale !== 0.75
+ onClicked: {
+ subsurfaceTheme.currentScale = 0.75
+ rootItem.setupUnits()
+ }
+ }
+ TemplateButton {
+ text: qsTr("small")
Layout.fillWidth: true
+ fontSize: subsurfaceTheme.regularPointSize / subsurfaceTheme.currentScale * 0.85
enabled: subsurfaceTheme.currentScale !== 0.85
onClicked: {
subsurfaceTheme.currentScale = 0.85
+ rootItem.setupUnits()
}
}
TemplateButton {
text: qsTr("regular")
Layout.fillWidth: true
+ fontSize: subsurfaceTheme.regularPointSize / subsurfaceTheme.currentScale * 0.85
enabled: subsurfaceTheme.currentScale !== 1.0
onClicked: {
subsurfaceTheme.currentScale = 1.0
+ rootItem.setupUnits()
}
}
TemplateButton {
- text: qsTr("larger")
+ text: qsTr("large")
Layout.fillWidth: true
+ fontSize: subsurfaceTheme.regularPointSize / subsurfaceTheme.currentScale * 1.15
enabled: subsurfaceTheme.currentScale !== 1.15
onClicked: {
subsurfaceTheme.currentScale = 1.15
+ rootItem.setupUnits()
+ }
+ }
+ TemplateButton {
+ text: qsTr("very large")
+ Layout.fillWidth: true
+ fontSize: subsurfaceTheme.regularPointSize / subsurfaceTheme.currentScale * 1.3
+ enabled: subsurfaceTheme.currentScale !== 1.3
+ onClicked: {
+ subsurfaceTheme.currentScale = 1.3
+ rootItem.setupUnits()
}
}
- }
- Rectangle {
}
}
}
@@ -516,37 +539,31 @@ TemplatePage {
}
TemplateLabel {
text: qsTr("Distance threshold (meters)")
- //Layout.preferredWidth: gridWidth * 0.75
}
TemplateTextField {
id: distanceThreshold
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 2
text: PrefLocationService.distance_threshold
- //Layout.preferredWidth: gridWidth * 0.25
onEditingFinished: {
PrefLocationService.distance_threshold = distanceThreshold.text
}
}
TemplateLabel {
text: qsTr("Time threshold (minutes)")
- //Layout.preferredWidth: gridWidth * 0.75
}
TemplateTextField {
id: timeThreshold
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 2
text: PrefLocationService.time_threshold / 60
- //Layout.preferredWidth: gridWidth * 0.25
onEditingFinished: {
PrefLocationService.time_threshold = timeThreshold.text * 60
}
}
- }
- TemplateLine {
- visible: sectionAdvanced.isExpanded
- }
- GridLayout {
- id: whichBluetoothDevices
- visible: sectionAdvanced.isExpanded
- width: parent.width
- columns: 2
+
+ TemplateLine {
+ visible: sectionAdvanced.isExpanded
+ Layout.columnSpan: 2
+ }
TemplateLabel {
text: qsTr("Bluetooth")
font.pointSize: subsurfaceTheme.headingPointSize
@@ -558,25 +575,19 @@ TemplatePage {
TemplateLabel {
text: qsTr("Temporarily show all bluetooth devices \neven if not recognized as dive computers.\nPlease report DCs that need this setting")
Layout.fillWidth: true
- //Layout.preferredWidth: gridWidth * 0.75
}
SsrfSwitch {
id: nonDCButton
checked: manager.showNonDiveComputers
- //Layout.preferredWidth: gridWidth * 0.25
onClicked: {
manager.showNonDiveComputers = checked
}
}
- }
- TemplateLine {
- visible: sectionAdvanced.isExpanded
- }
- GridLayout {
- id: display
- visible: sectionAdvanced.isExpanded
- width: parent.width
- columns: 2
+
+ TemplateLine {
+ visible: sectionAdvanced.isExpanded
+ Layout.columnSpan: 2
+ }
TemplateLabel {
text: qsTr("Display")
font.pointSize: subsurfaceTheme.headingPointSize
@@ -588,25 +599,18 @@ TemplatePage {
TemplateLabel {
text: qsTr("Show only one column in Portrait mode")
Layout.fillWidth: true
- //Layout.preferredWidth: gridWidth * 0.75
}
SsrfSwitch {
id: singleColumnButton
checked: PrefDisplay.singleColumnPortrait
- //Layout.preferredWidth: gridWidth * 0.25
onClicked: {
PrefDisplay.singleColumnPortrait = checked
}
}
- }
- TemplateLine {
- visible: sectionAdvanced.isExpanded
- }
- GridLayout {
- id: profilePrefs
- visible: sectionAdvanced.isExpanded
- width: parent.width
- columns: 2
+ TemplateLine {
+ visible: sectionAdvanced.isExpanded
+ Layout.columnSpan: 2
+ }
TemplateLabel {
text: qsTr("Profile deco ceiling")
font.pointSize: subsurfaceTheme.headingPointSize
@@ -622,7 +626,7 @@ TemplatePage {
checked: PrefTechnicalDetails.dcceiling
onClicked: {
PrefTechnicalDetails.dcceiling = checked
- rootItem.settingChanged()
+ rootItem.settingsChanged()
}
}
TemplateLabel {
@@ -635,16 +639,36 @@ TemplatePage {
rootItem.settingsChanged()
}
}
- }
- TemplateLine {
- visible: sectionAdvanced.isExpanded
- }
-
- GridLayout {
- id: developer
- visible: sectionAdvanced.isExpanded
- width: parent.width
- columns: 2
+ TemplateLabel {
+ text: qsTr("GFLow")
+ }
+ TemplateTextField {
+ id: gfLow
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 2
+ text: PrefTechnicalDetails.gflow
+ inputMask: "99"
+ onEditingFinished: {
+ PrefTechnicalDetails.gflow = gfLow.text
+ rootItem.settingsChanged()
+ }
+ }
+ TemplateLabel {
+ text: qsTr("GFHigh")
+ }
+ TemplateTextField {
+ id: gfHigh
+ Layout.preferredWidth: Kirigami.Units.gridUnit * 2
+ text: PrefTechnicalDetails.gfhigh
+ inputMask: "99"
+ onEditingFinished: {
+ PrefTechnicalDetails.gfhigh = gfHigh.text
+ rootItem.settingsChanged()
+ }
+ }
+ TemplateLine {
+ visible: sectionAdvanced.isExpanded
+ Layout.columnSpan: 2
+ }
TemplateLabel {
text: qsTr("Developer")
font.pointSize: subsurfaceTheme.headingPointSize
@@ -656,12 +680,10 @@ TemplatePage {
TemplateLabel {
text: qsTr("Display Developer menu")
Layout.fillWidth: true
- //Layout.preferredWidth: gridWidth * 0.75
}
SsrfSwitch {
id: developerButton
checked: PrefDisplay.show_developer
- //sLayout.preferredWidth: gridWidth * 0.25
onClicked: {
PrefDisplay.show_developer = checked
}
diff --git a/mobile-widgets/qml/SsrfTextField.qml b/mobile-widgets/qml/SsrfTextField.qml
index d91e13c2d..8f07f5ee1 100644
--- a/mobile-widgets/qml/SsrfTextField.qml
+++ b/mobile-widgets/qml/SsrfTextField.qml
@@ -11,9 +11,30 @@ Controls.TextField {
property var flickable
property bool firstTime: true
+ /**
+ * set inComboBox if the TextField is used in an editable ComboBox
+ * this ensures that the baseline that is used to visually indicate that the user can
+ * edit the text as well as use the drop down is placed much closer to the actual text
+ */
+ property bool inComboBox: false
+
id: stf
+ background: Item {
+ Rectangle {
+ width: parent.width - Kirigami.Units.smallSpacing
+ x: inComboBox ? Kirigami.Units.smallSpacing : -1
+ height: 1
+ color: stf.focus ? subsurfaceTheme.primaryColor : Qt.darker(subsurfaceTheme.backgroundColor, 1.2)
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: inComboBox ? Kirigami.Units.largeSpacing : 1
+ visible: !stf.readOnly
+ }
+ }
// while we are at it, let's put some common settings here into the shared element
+ font.pointSize: subsurfaceTheme.regularPointSize
+ topPadding: 0
+ bottomPadding: 0
color: subsurfaceTheme.textColor
onEditingFinished: {
focus = false
@@ -44,8 +65,8 @@ Controls.TextField {
// make sure there's enough space for the input field above the keyboard and action button (and that it's not too far up, either)
var positionInFlickable = stf.mapToItem(flickable.contentItem, 0, 0)
var stfY = positionInFlickable.y
- if (verbose)
- manager.appendTextToLogFile("position check: lower edge of view is " + (0 + flickable.contentY + flickable.height) + " and text field is at " + stfY)
+ if (manager.verboseEnabebled)
+ manager.appendTextToLog("position check: lower edge of view is " + (0 + flickable.contentY + flickable.height) + " and text field is at " + stfY)
if (stfY + stf.height > flickable.contentY + flickable.height - 3 * Kirigami.Units.gridUnit || stfY < flickable.contentY)
flickable.contentY = Math.max(0, 3 * Kirigami.Units.gridUnit + stfY + stf.height - flickable.height)
}
diff --git a/mobile-widgets/qml/StatisticsPage.qml b/mobile-widgets/qml/StatisticsPage.qml
index 72a50602f..0a9a7bdea 100644
--- a/mobile-widgets/qml/StatisticsPage.qml
+++ b/mobile-widgets/qml/StatisticsPage.qml
@@ -15,6 +15,7 @@ Kirigami.Page {
bottomPadding: 0
width: rootItem.width
implicitWidth: rootItem.width
+ background: Rectangle { color: subsurfaceTheme.backgroundColor }
property bool wide: width > rootItem.height
StatsManager {
id: statsManager
@@ -31,6 +32,18 @@ Kirigami.Page {
statsManager.doit()
}
}
+ onWideChanged: {
+ // so this means we rotated the device - and sometimes after rotation
+ // the stats widget is empty.
+ rotationRedrawTrigger.start()
+ }
+ Timer {
+ // wait .5 seconds (so the OS rotation animation has a chance to run) and then set var1 again
+ // to its current value, which appears to be enough to ensure that the chart is drawn again
+ id: rotationRedrawTrigger
+ interval: 500
+ onTriggered: statsManager.var1Changed(i1.var1currentIndex)
+ }
Component {
id: chartListDelegate
@@ -56,6 +69,7 @@ Kirigami.Page {
Label {
text: chartName
font.bold: isHeader
+ color: subsurfaceTheme.textColor
}
}
}
@@ -87,6 +101,7 @@ Kirigami.Page {
Layout.row: 0
Layout.leftMargin: Kirigami.Units.smallSpacing
Layout.topMargin: Kirigami.Units.smallSpacing
+ property alias var1currentIndex: var1.currentIndex
TemplateLabelSmall {
text: qsTr("Base variable")
}
@@ -193,10 +208,10 @@ Kirigami.Page {
onClicked: chartTypePopup.open()
}
Item {
- Layout.column: wide ? 0 : 1
+ Layout.column: wide ? 0 : 2
Layout.row: wide ? 6 : 2
Layout.preferredHeight: wide ? parent.height - Kirigami.Units.gridUnit * 16 : Kirigami.Units.gridUnit
- Layout.preferredWidth: wide ? parent.width - i1.implicitWidt - i2.implicitWidt - i3.implicitWidt - i4.implicitWidth : Kirigami.Units.gridUnit
+ Layout.fillWidth: wide ? false : true
// just used for spacing
}
StatsView {
diff --git a/mobile-widgets/qml/TemplateButton.qml b/mobile-widgets/qml/TemplateButton.qml
index 49ca8c0dd..5586214a1 100644
--- a/mobile-widgets/qml/TemplateButton.qml
+++ b/mobile-widgets/qml/TemplateButton.qml
@@ -5,6 +5,7 @@ import org.kde.kirigami 2.4 as Kirigami
Button {
id: root
+ property double fontSize: subsurfaceTheme.regularPointSize
background: Rectangle {
id: buttonBackground
color: root.enabled? (root.pressed ? subsurfaceTheme.darkerPrimaryColor : subsurfaceTheme.primaryColor) : "gray"
@@ -15,7 +16,7 @@ Button {
contentItem: Text {
id: buttonText
text: root.text
- font.pointSize: subsurfaceTheme.regularPointSize
+ font.pointSize: root.fontSize
anchors.centerIn: buttonBackground
color: root.pressed ? subsurfaceTheme.darkerPrimaryTextColor :subsurfaceTheme.primaryTextColor
}
diff --git a/mobile-widgets/qml/TemplateComboBox.qml b/mobile-widgets/qml/TemplateComboBox.qml
index 82b5fbf9f..10ffdb93e 100644
--- a/mobile-widgets/qml/TemplateComboBox.qml
+++ b/mobile-widgets/qml/TemplateComboBox.qml
@@ -6,10 +6,12 @@ import org.kde.kirigami 2.4 as Kirigami
ComboBox {
id: cb
+ editable: false
Layout.fillWidth: true
- Layout.preferredHeight: Kirigami.Units.gridUnit * 2.5
+ Layout.preferredHeight: Kirigami.Units.gridUnit * 2.0
inputMethodHints: Qt.ImhNoPredictiveText
font.pointSize: subsurfaceTheme.regularPointSize
+ rightPadding: Kirigami.Units.smallSpacing
property var flickable // used to ensure the combobox is visible on screen
delegate: ItemDelegate {
width: cb.width
@@ -49,6 +51,7 @@ ComboBox {
}
contentItem: SsrfTextField {
+ inComboBox: cb.editable
readOnly: !cb.editable
anchors.right: indicator.left
anchors.left: cb.left
@@ -59,6 +62,7 @@ ComboBox {
font: cb.font
color: subsurfaceTheme.textColor
verticalAlignment: Text.AlignVCenter
+
onPressed: {
if (readOnly) {
if (cb.popup.opened) {
diff --git a/mobile-widgets/qml/TemplateSlimComboBox.qml b/mobile-widgets/qml/TemplateSlimComboBox.qml
index 36137770a..896871be1 100644
--- a/mobile-widgets/qml/TemplateSlimComboBox.qml
+++ b/mobile-widgets/qml/TemplateSlimComboBox.qml
@@ -8,7 +8,7 @@ TemplateComboBox {
id: cb
Layout.fillWidth: false
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
- Layout.preferredWidth: Kirigami.Units.gridUnit * 8
+ Layout.minimumWidth: Kirigami.Units.gridUnit * 8
contentItem: Text {
text: cb.displayText
font.pointSize: subsurfaceTheme.regularPointSize
diff --git a/mobile-widgets/qml/ThemeTest.qml b/mobile-widgets/qml/ThemeTest.qml
index 49f8d6192..a15d33c90 100644
--- a/mobile-widgets/qml/ThemeTest.qml
+++ b/mobile-widgets/qml/ThemeTest.qml
@@ -23,114 +23,143 @@ Kirigami.Page {
Kirigami.Heading {
Layout.columnSpan: 2
text: "Theme Information"
+ color: subsurfaceTheme.textColor
}
Kirigami.Heading {
text: "Screen"
+ color: subsurfaceTheme.textColor
Layout.columnSpan: 2
level: 3
}
- Controls.Label {
+ TemplateLabel {
text: "Geometry (pixels):"
}
- Controls.Label {
+ TemplateLabel {
text: rootItem.width + "x" + rootItem.height
}
- Controls.Label {
+ TemplateLabel {
text: "Geometry (gridUnits):"
}
- Controls.Label {
+ TemplateLabel {
text: Math.round(rootItem.width / Kirigami.Units.gridUnit) + "x" + Math.round(rootItem.height / Kirigami.Units.gridUnit)
}
- Controls.Label {
+ TemplateLabel {
text: "Units.gridUnit:"
}
- Controls.Label {
+ TemplateLabel {
text: Kirigami.Units.gridUnit
}
- Controls.Label {
+ TemplateLabel {
text: "Units.devicePixelRatio:"
}
- Controls.Label {
+ TemplateLabel {
text: Screen.devicePixelRatio
}
Kirigami.Heading {
text: "Font Metrics"
+ color: subsurfaceTheme.textColor
level: 3
Layout.columnSpan: 2
}
- Controls.Label {
+ TemplateLabel {
text: "basePointSize:"
}
- Controls.Label {
+ TemplateLabel {
text: subsurfaceTheme.basePointSize
}
- Controls.Label {
+ TemplateLabel {
text: "FontMetrics pointSize:"
}
- Controls.Label {
+ TemplateLabel {
text: fontMetrics.font.pointSize
}
- Controls.Label {
+ TemplateLabel {
text: "FontMetrics pixelSize:"
}
- Controls.Label {
+ TemplateLabel {
text: Number(fontMetrics.height).toFixed(2)
}
- Controls.Label {
+ TemplateLabel {
text: "FontMetrics devicePixelRatio:"
}
- Controls.Label {
+ TemplateLabel {
text: Number(fontMetrics.height / fontMetrics.font.pointSize).toFixed(2)
}
- Controls.Label {
+ TemplateLabel {
text: "Text item pixelSize:"
}
- Text {
+ TemplateLabel {
text: fontMetrics.font.pixelSize
}
- Controls.Label {
+ TemplateLabel {
text: "Text item pointSize:"
}
- Text {
+ TemplateLabel {
text: fontMetrics.font.pointSize
}
- Controls.Label {
+ TemplateLabel {
text: "Pixel density:"
}
- Text {
+ TemplateLabel {
text: Number(Screen.pixelDensity).toFixed(2)
}
- Controls.Label {
+ TemplateLabel {
text: "Height of default font:"
}
- Text {
+ TemplateLabel {
text: Number(fontMetrics.font.pixelSize / Screen.pixelDensity).toFixed(2) + "mm"
}
- Controls.Label {
+ TemplateLabel {
text: "2cm x 2cm square:"
}
Rectangle {
width: Math.round(Screen.pixelDensity * 20)
height: Math.round(Screen.pixelDensity * 20)
- color: "black"
+ color: subsurfaceTheme.textColor
}
-
- Controls.Label {
+ TemplateLabel {
+ text: "text in 4 gridUnit square"
+ }
+ Rectangle {
+ id: backSquare
+ width: Kirigami.Units.gridUnit * 4
+ height: width
+ color: subsurfaceTheme.primaryColor
+ border.color: subsurfaceTheme.primaryColor
+ border.width: 1
+
+ Controls.Label {
+ anchors.top: backSquare.top
+ anchors.left: backSquare.left
+ color: subsurfaceTheme.primaryTextColor
+ font.pointSize: subsurfaceTheme.regularPointSize
+ text: "Simply 27 random characters"
+ }
+ Controls.Label {
+ anchors.bottom: backSquare.bottom
+ anchors.left: backSquare.left
+ color: subsurfaceTheme.primaryTextColor
+ font.pointSize: subsurfaceTheme.smallPointSize
+ text: "Simply 27 random characters"
+ }
+ }
+
+ TemplateLabel {
Layout.columnSpan: 2
Layout.fillHeight: true
}
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 1e5e1bdba..2ef9a4332 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -53,17 +53,19 @@ Kirigami.ApplicationWindow {
onNotificationTextChanged: {
// once the app is fully initialized and the UI is running, we use passive
// notifications to show the notification text, but during initialization
- // we instead dump the information into the textBlock below - and to make
- // this visually more useful we interpret a "\r" at the beginning of a notification
- // to mean that we want to simply over-write the last line, not create a new one
+ // we instead dump the information into the textBlock below
if (initialized) {
- // make sure any old notification is hidden
- // hiding notifications is no longer supported????
- // hidePassiveNotification()
if (notificationText !== "") {
- // there's a risk that we have a >5 second gap in update events;
- // still, keep the timeout at 5s to avoid odd unchanging notifications
- showPassiveNotification(notificationText, 5000)
+ var actionEnd = notificationText.indexOf("]")
+ if (notificationText.startsWith("[") && actionEnd !== -1) {
+ // we have a notification text that starts with our special syntax to indication
+ // an action that the user can take (the actual action is always opening the context drawer
+ // so the action text should always be something that can then be found in the context drawer)
+ showPassiveNotification(notificationText.substring(actionEnd + 1), 5000, notificationText.substring(1,actionEnd),
+ function() { contextDrawer.open() })
+ } else {
+ showPassiveNotification(notificationText, 5000)
+ }
}
} else {
textBlock.text = textBlock.text + "\n" + notificationText
@@ -663,32 +665,50 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
}
+ property double regularFontsize: subsurfaceTheme.regularPointSize
+
+ FontMetrics {
+ id: fontMetrics
+ font.pointSize: regularFontsize
+ }
+
+ onRegularFontsizeChanged: {
+ manager.appendTextToLog("regular font size changed to " + regularFontsize)
+ rootItem.font.pointSize = regularFontsize
+ }
+
function setupUnits() {
+ // since Kirigami was initially instantiated, the font size may have
+ // changed, so recalculate the gridUnit
+ var kirigamiGridUnit = fontMetrics.height
+
// some screens are too narrow for Subsurface-mobile to render well
- // try to hack around that by making sure that we can fit at least 21 gridUnits in a row
- var numColumns = Math.max(Math.floor(rootItem.width / (21 * Kirigami.Units.gridUnit)), 1)
+ // things don't look greate with fewer than 21 gridUnits in a row
+ var numColumns = Math.max(Math.floor(rootItem.width / (21 * kirigamiGridUnit)), 1)
if (Screen.primaryOrientation === Qt.PortraitOrientation && PrefDisplay.singleColumnPortrait) {
manager.appendTextToLog("show only one column in portrait mode");
numColumns = 1;
}
-
rootItem.colWidth = numColumns > 1 ? Math.floor(rootItem.width / numColumns) : rootItem.width;
- var kirigamiGridUnit = Kirigami.Units.gridUnit
+
+ // If we can't fit 21 gridUnits into a line, let the user know and suggest using a smaller font
var widthInGridUnits = Math.floor(rootItem.colWidth / kirigamiGridUnit)
if (widthInGridUnits < 21) {
- kirigamiGridUnit = Math.floor(rootItem.colWidth / 21)
- widthInGridUnits = Math.floor(rootItem.colWidth / kirigamiGridUnit)
+ showPassiveNotification(qsTr("Font size likely too big for the display, switching to smaller font suggested"), 3000)
}
- var factor = 1.0
manager.appendTextToLog(numColumns + " columns with column width of " + rootItem.colWidth)
manager.appendTextToLog("width in Grid Units " + widthInGridUnits + " original gridUnit " + Kirigami.Units.gridUnit + " now " + kirigamiGridUnit)
if (Kirigami.Units.gridUnit !== kirigamiGridUnit) {
- factor = kirigamiGridUnit / Kirigami.Units.gridUnit
- // change our glabal grid unit
- Kirigami.Units.gridUnit = kirigamiGridUnit
+ // change our global grid unit and prevent Kirigami from resizing our rootItem
+ var fixWidth = rootItem.width
+ var fixHeight = rootItem.height
+ Kirigami.Units.gridUnit = kirigamiGridUnit * 1.0
+ rootItem.width = fixWidth
+ rootItem.height = fixHeight
}
+
pageStack.defaultColumnWidth = rootItem.colWidth
- manager.appendTextToLog("Done setting up sizes")
+ manager.appendTextToLog("Done setting up sizes width " + rootItem.width + " gridUnit " + kirigamiGridUnit)
}
QtObject {
@@ -709,6 +729,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
onWidthChanged: {
manager.appendTextToLog("[screensetup] width changed now " + width + " x " + height + " vs screen " + Screen.width + " x " + Screen.height)
+
if (screenSizeObject.lastOrientation === undefined) {
manager.appendTextToLog("[screensetup] found initial orientation " + Screen.orientation)
screenSizeObject.lastOrientation = Screen.orientation
@@ -741,6 +762,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
manager.appendTextToLog("[screensetup] remembering better height")
screenSizeObject.initialWidth = width
}
+ setupUnits()
}
}
} else {