Mobile: consolidate settings to one page and menu entry

Addresses: #492

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>

Had a bit of rebase issue with this one.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
Joakim Bygdell 2017-07-20 19:39:55 +02:00 committed by Dirk Hohndel
parent e80132cdef
commit 6655b37add
5 changed files with 43 additions and 51 deletions

View file

@ -9,7 +9,7 @@ import org.subsurfacedivelog.mobile 1.0
Item { Item {
id: loginWindow id: loginWindow
height: outerLayout.height + 2 * Kirigami.Units.gridUnit height: outerLayout.height
property string username: login.text; property string username: login.text;
property string password: password.text; property string password: password.text;
@ -82,7 +82,7 @@ Item {
GridLayout { GridLayout {
columns: 2 columns: 2
CheckBox { Switch {
checked: false checked: false
id: showPassword id: showPassword
onCheckedChanged: { onCheckedChanged: {
@ -104,7 +104,5 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
visible: rootItem.showPin visible: rootItem.showPin
} }
Item { width: Kirigami.Units.gridUnit; height: width }
} }
} }

View file

@ -8,8 +8,8 @@ import org.kde.kirigami 2.0 as Kirigami
import org.subsurfacedivelog.mobile 1.0 import org.subsurfacedivelog.mobile 1.0
Kirigami.ScrollablePage { Kirigami.ScrollablePage {
objectName: "Preferences" objectName: "Settings"
title: qsTr("Preferences") title: qsTr("Settings")
anchors.margins: Kirigami.Units.gridUnit / 2 anchors.margins: Kirigami.Units.gridUnit / 2
actions { actions {
@ -27,9 +27,24 @@ Kirigami.ScrollablePage {
} }
ColumnLayout { ColumnLayout {
width: parent.width - Kirigami.Units.gridUnit width: parent.width - Kirigami.Units.gridUnit
CloudCredentials {
id: cloudCredentials
Layout.fillWidth: true
Layout.margins: Kirigami.Units.gridUnit
Layout.topMargin: 0
property int headingLevel: 4
}
Rectangle {
color: subsurfaceTheme.darkerPrimaryColor
height: 1
opacity: 0.5
Layout.columnSpan: 3
Layout.fillWidth: true
}
GridLayout { GridLayout {
id: themePrefs id: themeSettings
columns: 2 columns: 2
Layout.bottomMargin: Kirigami.Units.gridUnit
Kirigami.Heading { Kirigami.Heading {
text: qsTr("Theme") text: qsTr("Theme")
@ -39,7 +54,6 @@ Kirigami.ScrollablePage {
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2 Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
Layout.columnSpan: 2 Layout.columnSpan: 2
} }
RadioButton { RadioButton {
id: bluebutton id: bluebutton
checked: subsurfaceTheme.currentTheme === "Blue" checked: subsurfaceTheme.currentTheme === "Blue"
@ -238,6 +252,13 @@ Kirigami.ScrollablePage {
} }
} }
} }
Rectangle {
color: subsurfaceTheme.darkerPrimaryColor
height: 1
opacity: 0.5
Layout.columnSpan: 3
Layout.fillWidth: true
}
GridLayout { GridLayout {
id: gpsPrefs id: gpsPrefs
columns: 2 columns: 2
@ -278,6 +299,13 @@ Kirigami.ScrollablePage {
Layout.fillHeight: true Layout.fillHeight: true
} }
} }
Rectangle {
color: subsurfaceTheme.darkerPrimaryColor
height: 1
opacity: 0.5
Layout.columnSpan: 3
Layout.fillWidth: true
}
GridLayout { GridLayout {
id: locationService id: locationService
columns: 2 columns: 2
@ -318,7 +346,7 @@ Kirigami.ScrollablePage {
columns: 2 columns: 2
width: parent.width width: parent.width
Kirigami.Heading { Kirigami.Heading {
text: qsTr("Debug log for download from divecomputer") text: qsTr("Dive computer")
color: subsurfaceTheme.textColor color: subsurfaceTheme.textColor
level: 4 level: 4
Layout.topMargin: Kirigami.Units.largeSpacing Layout.topMargin: Kirigami.Units.largeSpacing
@ -326,31 +354,12 @@ Kirigami.ScrollablePage {
Layout.columnSpan: 2 Layout.columnSpan: 2
} }
CheckBox { Switch {
id: libdclogButton id: libdclogButton
checked: manager.libdcLog checked: manager.libdcLog
onClicked: { onClicked: {
manager.libdcLog = checked manager.libdcLog = checked
} }
indicator: Rectangle {
implicitWidth: 20
implicitHeight: 20
x: libdclogButton.leftPadding
y: parent.height / 2 - height / 2
radius: 4
border.color: libdclogButton.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
color: subsurfaceTheme.backgroundColor
Rectangle {
width: 12
height: 12
x: 4
y: 4
radius: 3
color: libdclogButton.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
visible: libdclogButton.checked
}
}
} }
Kirigami.Label { Kirigami.Label {
text: qsTr("Save detailed log of interaction with the dive computer") text: qsTr("Save detailed log of interaction with the dive computer")

View file

@ -39,5 +39,6 @@ Kirigami.ScrollablePage {
Layout.topMargin: 0 Layout.topMargin: 0
property int headingLevel: 3 property int headingLevel: 3
} }
Item { width: Kirigami.Units.gridUnit; height: 3 * Kirigami.Units.gridUnit}
} }
} }

View file

@ -242,25 +242,9 @@ if you have network connectivity and want to sync your data to cloud storage."),
Kirigami.Action { Kirigami.Action {
iconName: "icons/ic_settings.svg" iconName: "icons/ic_settings.svg"
text: qsTr("Settings") text: qsTr("Settings")
Kirigami.Action { onTriggered: {
text: qsTr("Cloud credentials") stackView.push(settingsWindow)
onTriggered: { detailsWindow.endEditMode()
returnTopPage()
oldStatus = manager.credentialStatus
if (diveList.numDives > 0) {
manager.startPageText = "Enter different credentials or return to dive list"
} else {
manager.startPageText = "Enter valid cloud storage credentials"
}
manager.credentialStatus = QMLManager.UNKNOWN
}
}
Kirigami.Action {
text: qsTr("Preferences")
onTriggered: {
stackView.push(prefsWindow)
detailsWindow.endEditMode()
}
} }
}, },
Kirigami.Action { Kirigami.Action {
@ -438,8 +422,8 @@ if you have network connectivity and want to sync your data to cloud storage."),
id: manager id: manager
} }
Preferences { Settings {
id: prefsWindow id: settingsWindow
visible: false visible: false
} }

View file

@ -1,7 +1,6 @@
<RCC> <RCC>
<qresource prefix="/qml"> <qresource prefix="/qml">
<file>main.qml</file> <file>main.qml</file>
<file>Preferences.qml</file>
<file>About.qml</file> <file>About.qml</file>
<file>CloudCredentials.qml</file> <file>CloudCredentials.qml</file>
<file>DiveList.qml</file> <file>DiveList.qml</file>
@ -13,6 +12,7 @@
<file>GpsList.qml</file> <file>GpsList.qml</file>
<file>HintsTextEdit.qml</file> <file>HintsTextEdit.qml</file>
<file>Log.qml</file> <file>Log.qml</file>
<file>Settings.qml</file>
<file>ThemeTest.qml</file> <file>ThemeTest.qml</file>
<file>StartPage.qml</file> <file>StartPage.qml</file>
<file>dive.jpg</file> <file>dive.jpg</file>