diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-12-03 14:06:52 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-12-03 14:11:30 -0800 |
commit | 7a94360a6da6665ea42de29c39246a5ebc67dada (patch) | |
tree | ecd27cddb5f054476387d34f85d2065442249e4a | |
parent | 9ef475844dbe55540ca4f53932c27ab1ce59c09d (diff) | |
download | subsurface-7a94360a6da6665ea42de29c39246a5ebc67dada.tar.gz |
QML-UI: Split cloud credentials and other preferences
This makes the cloud credential entry page much simpler, separate page. It also
removes the two colums and uses the label of the check box instead of having a
separate label item.
The preferences page of course also gets simpler by doing this. Here I kept the
two columns, though.
Finally the code for the old context menu was removed - not sure why this was
still here.
Next I need to fix the savePreferences() call to do the right thing in each
case.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-mobile/qml/CloudCredentials.qml | 85 | ||||
-rw-r--r-- | qt-mobile/qml/Preferences.qml | 57 | ||||
-rw-r--r-- | qt-mobile/qml/StartPage.qml | 4 | ||||
-rw-r--r-- | qt-mobile/qml/main.qml | 97 | ||||
-rw-r--r-- | qt-mobile/qml/mobile-resources.qrc | 1 |
5 files changed, 102 insertions, 142 deletions
diff --git a/qt-mobile/qml/CloudCredentials.qml b/qt-mobile/qml/CloudCredentials.qml new file mode 100644 index 000000000..20bc82f66 --- /dev/null +++ b/qt-mobile/qml/CloudCredentials.qml @@ -0,0 +1,85 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.1 +import org.kde.plasma.mobilecomponents 0.2 as MobileComponents +import org.subsurfacedivelog.mobile 1.0 + +Item { + id: loginWindow + + signal accept + + property string username: login.text; + property string password: password.text; + property bool issave: savePassword.checked; + + ColumnLayout { + anchors.fill: parent + anchors.margins: MobileComponents.Units.gridUnit + + MobileComponents.Heading { + text: "Cloud credentials" + Layout.bottomMargin: MobileComponents.Units.largeSpacing / 2 + } + + Label { + text: "Email" + } + + TextField { + id: login + text: manager.cloudUserName + Layout.fillWidth: true + } + + Label { + text: "Password" + } + + TextField { + id: password + text: manager.cloudPassword + echoMode: TextInput.Password + Layout.fillWidth: true + } + + CheckBox { + text: "Show password" + checked: false + id: showPassword + onCheckedChanged: { + password.echoMode = checked ? TextInput.Normal : TextInput.Password + } + } + + CheckBox { + text: "Remember" + checked: manager.saveCloudPassword + id: savePassword + } + + Item { width: MobileComponents.Units.gridUnit; height: width } + Item { + height: saveButton.height + width: saveButton.width + Button { + id: saveButton + text: "Save" + anchors.centerIn: parent + onClicked: { + manager.cloudUserName = login.text + manager.cloudPassword = password.text + manager.saveCloudPassword = savePassword.checked + manager.savePreferences() + stackView.pop() + } + } + } + + Item { + Layout.fillHeight: true + } + } +} diff --git a/qt-mobile/qml/Preferences.qml b/qt-mobile/qml/Preferences.qml index 575474ac8..de70d17b0 100644 --- a/qt-mobile/qml/Preferences.qml +++ b/qt-mobile/qml/Preferences.qml @@ -7,71 +7,21 @@ import org.kde.plasma.mobilecomponents 0.2 as MobileComponents import org.subsurfacedivelog.mobile 1.0 Item { - id: loginWindow + id: preferencesWindow signal accept - property string username: login.text; - property string password: password.text; - property bool issave: savePassword.checked; - GridLayout { columns: 2 anchors.fill: parent anchors.margins: MobileComponents.Units.gridUnit MobileComponents.Heading { - text: "Cloud credentials" + text: "Preferences" Layout.bottomMargin: MobileComponents.Units.largeSpacing / 2 Layout.columnSpan: 2 } - Label { - text: "Email" - Layout.alignment: Qt.AlignRight - } - - TextField { - id: login - text: manager.cloudUserName - Layout.fillWidth: true - } - - Label { - text: "Password" - Layout.alignment: Qt.AlignRight - } - - TextField { - id: password - text: manager.cloudPassword - echoMode: TextInput.Password - Layout.fillWidth: true - } - - Label { - text: "Show password" - Layout.alignment: Qt.AlignRight - } - - CheckBox { - checked: false - id: showPassword - onCheckedChanged: { - password.echoMode = checked ? TextInput.Normal : TextInput.Password - } - } - - Label { - text: "Remember" - Layout.alignment: Qt.AlignRight - } - - CheckBox { - checked: manager.saveCloudPassword - id: savePassword - } - MobileComponents.Heading { text: "Subsurface GPS data webservice" Layout.topMargin: MobileComponents.Units.largeSpacing @@ -110,9 +60,6 @@ Item { text: "Save" anchors.centerIn: parent onClicked: { - manager.cloudUserName = login.text - manager.cloudPassword = password.text - manager.saveCloudPassword = savePassword.checked manager.distanceThreshold = distanceThreshold.text manager.timeThreshold = timeThreshold.text manager.savePreferences() diff --git a/qt-mobile/qml/StartPage.qml b/qt-mobile/qml/StartPage.qml index 8041a6786..1e2e82bc9 100644 --- a/qt-mobile/qml/StartPage.qml +++ b/qt-mobile/qml/StartPage.qml @@ -31,7 +31,7 @@ Item { Layout.preferredWidth: startpage.buttonWidth text: "Connect to CloudStorage..." onClicked: { - stackView.push(prefsWindow) + stackView.push(cloudCredWindow) } } Button { @@ -58,4 +58,4 @@ Item { Layout.fillHeight: true } } -}
\ No newline at end of file +} diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml index 46123ddb3..fc237c877 100644 --- a/qt-mobile/qml/main.qml +++ b/qt-mobile/qml/main.qml @@ -32,6 +32,13 @@ MobileComponents.ApplicationWindow { }, Action { + text: "Cloud login credentials" + onTriggered: { + stackView.push(cloudCredWindow) + } + }, + + Action { text: "Load Dives" onTriggered: { manager.loadDives(); @@ -145,91 +152,6 @@ MobileComponents.ApplicationWindow { property color accentTextColor: "#ececec" } - Menu { - id: prefsMenu - title: "Menu" - - MenuItem { - text: "Preferences" - onTriggered: { - stackView.push(prefsWindow) - } - } - - MenuItem { - text: "Load Dives" - onTriggered: { - manager.loadDives(); - } - } - - MenuItem { - text: "Download Dives" - onTriggered: { - stackView.push(downloadDivesWindow) - } - } - - MenuItem { - text: "Add Dive" - onTriggered: { - manager.addDive(); - stackView.push(detailsWindow) - } - } - - MenuItem { - text: "Save Changes" - onTriggered: { - manager.saveChanges(); - } - } - - MenuItem { - text: "Run location service" - checkable: true - checked: manager.locationServiceEnabled - onToggled: { - manager.locationServiceEnabled = checked; - } - } - - MenuItem { - text: "Apply GPS data to dives" - onTriggered: { - manager.applyGpsData(); - } - } - - MenuItem { - text: "Send GPS data to server" - onTriggered: { - manager.sendGpsData(); - } - } - - MenuItem { - text: "Clear stored GPS data" - onTriggered: { - manager.clearGpsData(); - } - } - - MenuItem { - text: "View Log" - onTriggered: { - stackView.push(logWindow) - } - } - - MenuItem { - text: "Theme Information" - onTriggered: { - stackView.push(themetest) - } - } - } - toolBar: TopBar { width: parent.width height: Layout.minimumHeight @@ -250,6 +172,11 @@ MobileComponents.ApplicationWindow { visible: false } + CloudCredentials { + id: cloudCredWindow + visible: false + } + DiveDetails { id: detailsWindow visible: false diff --git a/qt-mobile/qml/mobile-resources.qrc b/qt-mobile/qml/mobile-resources.qrc index 19c580da0..ebce4c7b6 100644 --- a/qt-mobile/qml/mobile-resources.qrc +++ b/qt-mobile/qml/mobile-resources.qrc @@ -3,6 +3,7 @@ <file>main.qml</file> <file>TextButton.qml</file> <file>Preferences.qml</file> + <file>CloudCredentials.qml</file> <file>DiveList.qml</file> <file>DiveDetails.qml</file> <file>DownloadFromDiveComputer.qml</file> |