From f3929af0e4f38915641033be33645e10609c5547 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 21 Apr 2016 11:39:37 -0700 Subject: QML UI: add new Kirigami file Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/mobile-resources.qrc | 1 + 1 file changed, 1 insertion(+) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc index 0592c1119..a02896c59 100644 --- a/mobile-widgets/qml/mobile-resources.qrc +++ b/mobile-widgets/qml/mobile-resources.qrc @@ -46,6 +46,7 @@ kirigami/private/ActionButton.qml kirigami/private/BackButton.qml kirigami/private/ContextIcon.qml + kirigami/private/DefaultListItemBackground.qml kirigami/private/EdgeShadow.qml kirigami/private/MenuIcon.qml kirigami/private/PageStack.js -- cgit v1.2.3-70-g09d2 From 85560531da8205feca045305843b704f497a3d05 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 21 Apr 2016 12:14:37 -0700 Subject: QML UI: don't exit on iOS Apparently users interpret that as a crash. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveList.qml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index 73bb06a86..e5ce929d2 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -282,9 +282,11 @@ Kirigami.ScrollablePage { event.accepted = true; } if (!startPageWrapper.visible) { - manager.quit() - // we shouldn't come back from there, but just in case - event.accepted = true + if (Qt.platform.os != "ios") { + manager.quit() + // we shouldn't come back from there, but just in case + event.accepted = true + } } } } -- cgit v1.2.3-70-g09d2 From 4e62bfa9a9cb9b715769189a292f655262157333 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 21 Apr 2016 14:00:37 -0700 Subject: QML UI: allow changing input fields with tab/return key This assumes a physical keyboard (e.g., iPad with BT keyboard). Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/CloudCredentials.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml index d63227619..2bb42a6ed 100644 --- a/mobile-widgets/qml/CloudCredentials.qml +++ b/mobile-widgets/qml/CloudCredentials.qml @@ -23,6 +23,17 @@ Item { id: outerLayout width: loginWindow.width - loginWindow.leftPadding - loginWindow.rightPadding - 2 * Kirigami.Units.gridUnit + function goToNext() { + for (var i = 0; i < children.length; ++i) + if (children[i].focus) { + children[i].nextItemInFocusChain().forceActiveFocus() + break + } + } + + Keys.onReturnPressed: goToNext() + Keys.onTabPressed: goToNext() + onVisibleChanged: { if (visible && manager.accessingCloud < 0) { manager.appendTextToLog("Credential scrn: show kbd was: " + (Qt.inputMethod.isVisible ? "visible" : "invisible")) -- cgit v1.2.3-70-g09d2 From 6af77b08b2a37cdc61cded2a4b6c449485107180 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 21 Apr 2016 04:43:37 -0700 Subject: QML UI: rename menu entry for offline use That really is what it boils down to. Also removes a few stray spaces in the warning text. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/main.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 06e691eee..372de1f27 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -150,16 +150,16 @@ Kirigami.ApplicationWindow { } } Kirigami.Action { - text: syncToCloud ? "Disable auto cloud sync" : "Enable auto cloud sync" + text: syncToCloud ? "Offline mode" : "Enable auto cloud sync" onTriggered: { syncToCloud = !syncToCloud if (!syncToCloud) { var alertText = "Turning off automatic sync to cloud causes all data\n" - alertText +=" to only be stored locally.\n" + alertText +="to only be stored locally.\n" alertText += "This can be very useful in situations with\n" - alertText += " limited or no network access.\n" + alertText += "limited or no network access.\n" alertText += "Please chose 'Manual sync with cloud' if you have network\n" - alertText += " connectivity and want to sync your data to cloud storage." + alertText += "connectivity and want to sync your data to cloud storage." showPassiveNotification(alertText, 10000) } } -- cgit v1.2.3-70-g09d2 From a5af2478d47e70097404ef93f780338483826ad6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 21 Apr 2016 04:46:22 -0700 Subject: QML UI: reword the intro text to mention offline mode Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/StartPage.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/StartPage.qml b/mobile-widgets/qml/StartPage.qml index 41fe469c2..980e0921c 100644 --- a/mobile-widgets/qml/StartPage.qml +++ b/mobile-widgets/qml/StartPage.qml @@ -16,8 +16,10 @@ ColumnLayout { Layout.fillWidth: true Layout.margins: Kirigami.Units.gridUnit Layout.topMargin: Kirigami.Units.gridUnit * 3 - text: "In order to use Subsurface-mobile you need to have a Subsurface cloud storage account " + - "(which can be created with the Subsurface desktop application)." + text: "To use Subsurface-mobile with Subsurface cloud storage, please enter " + + "your cloud credentials.\n\n" + + "To use Subsurface-mobile only with local data on this device, select " + + "Offline mode in the Manage dives entry in the main menu." wrapMode: Text.WordWrap } Kirigami.Label { -- cgit v1.2.3-70-g09d2 From be30724ba0eeaba214c099921579f2023d2a9a7a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 21 Apr 2016 04:52:47 -0700 Subject: QML UI: allow switching to offline mode without valid credentials If the user wants to work offline, they don't need validated credentials. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/main.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 372de1f27..858e9d003 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -122,7 +122,6 @@ Kirigami.ApplicationWindow { }, Kirigami.Action { text: "Manage dives" - enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL /* * disable for the beta to avoid confusion Action { @@ -135,6 +134,7 @@ Kirigami.ApplicationWindow { */ Kirigami.Action { text: "Add dive manually" + enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL onTriggered: { returnTopPage() // otherwise odd things happen with the page stack startAddDive() @@ -142,6 +142,7 @@ Kirigami.ApplicationWindow { } Kirigami.Action { text: "Manual sync with cloud" + enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL onTriggered: { globalDrawer.close() detailsWindow.endEditMode() -- cgit v1.2.3-70-g09d2 From 34628f8e6d2156d7eae9bfbb64d5b43ca58e1a34 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 21 Apr 2016 05:21:56 -0700 Subject: QML UI: add option to disable cloud to start screen Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveList.qml | 8 ++++ mobile-widgets/qml/icons/nocloud.svg | 71 +++++++++++++++++++++++++++++++++ mobile-widgets/qml/mobile-resources.qrc | 1 + 3 files changed, 80 insertions(+) create mode 100644 mobile-widgets/qml/icons/nocloud.svg (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index e5ce929d2..355e0ba34 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -217,6 +217,7 @@ Kirigami.ScrollablePage { onVisibleChanged: { if (visible) { page.actions.main = page.saveAction + page.actions.right = page.offlineAction title = "Cloud credentials" } else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL) { page.actions.main = page.addDiveAction @@ -276,6 +277,13 @@ Kirigami.ScrollablePage { } } + property QtObject offlineAction: Action { + iconName: "qrc:/qml/nocloud.svg" + onTriggered: { + manager.syncToCloud = false + } + } + onBackRequested: { if (startPageWrapper.visible && diveListView.count > 0 && manager.credentialStatus != QMLManager.INVALID) { manager.credentialStatus = oldStatus diff --git a/mobile-widgets/qml/icons/nocloud.svg b/mobile-widgets/qml/icons/nocloud.svg new file mode 100644 index 000000000..0661d32e6 --- /dev/null +++ b/mobile-widgets/qml/icons/nocloud.svg @@ -0,0 +1,71 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc index a02896c59..4fe82a66a 100644 --- a/mobile-widgets/qml/mobile-resources.qrc +++ b/mobile-widgets/qml/mobile-resources.qrc @@ -21,6 +21,7 @@ icons/context-menu.png icons/menu-edit.png icons/menu-back.png + icons/nocloud.svg kirigami/qmldir -- cgit v1.2.3-70-g09d2 From 6b43b3015dcfff3c0c535e9fee69e2011feeda17 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 22 Apr 2016 05:05:57 -0700 Subject: QML UI: turn off 'no cloud' button when not in use This needs to be actively cleared. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveList.qml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index 355e0ba34..b9a75abb4 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -221,9 +221,11 @@ Kirigami.ScrollablePage { title = "Cloud credentials" } else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL) { page.actions.main = page.addDiveAction + page.actions.right = null title = "Dive list" } else { page.actions.main = null + page.actions.right = null title = "Dive list" } } -- cgit v1.2.3-70-g09d2 From 27fccbbe4ea21ef4723ded4e01d5ea0df67fb61f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 22 Apr 2016 05:19:34 -0700 Subject: QML UI: when chosing 'no cloud', switch to dive list Currently we don't remember that we picked 'no cloud' across restarts. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveList.qml | 7 +++++-- mobile-widgets/qmlmanager.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index b9a75abb4..98a7a260f 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -211,7 +211,7 @@ Kirigami.ScrollablePage { ScrollView { id: startPageWrapper anchors.fill: parent - opacity: (diveListView.count > 0 && (credentialStatus == QMLManager.VALID || credentialStatus == QMLManager.VALID_EMAIL)) ? 0 : 1 + opacity: credentialStatus === QMLManager.NOCLOUD || (diveListView.count > 0 && (credentialStatus == QMLManager.VALID || credentialStatus == QMLManager.VALID_EMAIL)) ? 0 : 1 visible: opacity > 0 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } onVisibleChanged: { @@ -219,10 +219,12 @@ Kirigami.ScrollablePage { page.actions.main = page.saveAction page.actions.right = page.offlineAction title = "Cloud credentials" - } else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL) { + } else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD) { page.actions.main = page.addDiveAction page.actions.right = null title = "Dive list" + if (diveListView.count === 0) + showPassiveNotification(qsTr("Please tap the '+' button to add a dive"), 3000) } else { page.actions.main = null page.actions.right = null @@ -283,6 +285,7 @@ Kirigami.ScrollablePage { iconName: "qrc:/qml/nocloud.svg" onTriggered: { manager.syncToCloud = false + manager.credentialStatus = QMLManager.NOCLOUD } } diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index ece2c7b59..860e3c3ad 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -39,7 +39,8 @@ public: UNKNOWN, INVALID, VALID_EMAIL, - VALID + VALID, + NOCLOUD }; static QMLManager *instance(); -- cgit v1.2.3-70-g09d2 From 8946edfd922c6e3abde9d52f25e4818207a0f508 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 22 Apr 2016 05:21:26 -0700 Subject: QML UI: adapt "Manage dives" to no cloud status If we are in no cloud mode - allow adding dives via the menu - enabling / disabling automatic sync makes no sense. - if the user wants to manually sync the cloud, they need to first enter credentials. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/main.qml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 858e9d003..ad3f68e37 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -134,7 +134,7 @@ Kirigami.ApplicationWindow { */ Kirigami.Action { text: "Add dive manually" - enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL + enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD onTriggered: { returnTopPage() // otherwise odd things happen with the page stack startAddDive() @@ -142,16 +142,25 @@ Kirigami.ApplicationWindow { } Kirigami.Action { text: "Manual sync with cloud" - enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL + enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD onTriggered: { - globalDrawer.close() - detailsWindow.endEditMode() - manager.saveChangesCloud(true); - globalDrawer.close() + if (manager.credentialStatus === QMLManager.NOCLOUD) { + returnTopPage() + oldStatus = manager.credentialStatus + manager.startPageText = "Enter valid cloud storage credentials" + manager.credentialStatus = QMLManager.UNKNOWN + globalDrawer.close() + } else { + globalDrawer.close() + detailsWindow.endEditMode() + manager.saveChangesCloud(true); + globalDrawer.close() + } } } Kirigami.Action { text: syncToCloud ? "Offline mode" : "Enable auto cloud sync" + enabled: manager.credentialStatus !== QMLManager.NOCLOUD onTriggered: { syncToCloud = !syncToCloud if (!syncToCloud) { -- cgit v1.2.3-70-g09d2 From 49e2113ae8ab175638554e6aaaab3bb61181a9a3 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 27 Apr 2016 05:41:38 -0700 Subject: Remove hack that's no longer needed Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveDetails.qml | 2 -- 1 file changed, 2 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 3f42a1ed5..5735266f6 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -30,8 +30,6 @@ Kirigami.Page { property alias gpsCheckbox: detailsEdit.gpsCheckbox property int updateCurrentIdx: manager.updateSelectedDive - property bool contentItem: true // HACK to work around Kirigami issue - remove once that's addressed upstream - title: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.location : "Dive details" state: "view" leftPadding: 0 -- cgit v1.2.3-70-g09d2 From 15431f418e724c0f729dd2ffa140a0b7efda23e9 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 27 Apr 2016 05:44:18 -0700 Subject: QML UI: use anchor to fill parent Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/main.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index ad3f68e37..1927d6224 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -334,8 +334,7 @@ Kirigami.ApplicationWindow { DiveDetails { id: detailsWindow visible: false - width: parent.width - height: parent.height + anchors.fill: parent } DownloadFromDiveComputer { -- cgit v1.2.3-70-g09d2 From 247358be37d060fb070b92dd6768aefae40fa024 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 29 Apr 2016 06:22:48 -0700 Subject: Clean up comparison syntax in qml For consistency. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DiveList.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index 98a7a260f..436bf3d8d 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -211,10 +211,11 @@ Kirigami.ScrollablePage { ScrollView { id: startPageWrapper anchors.fill: parent - opacity: credentialStatus === QMLManager.NOCLOUD || (diveListView.count > 0 && (credentialStatus == QMLManager.VALID || credentialStatus == QMLManager.VALID_EMAIL)) ? 0 : 1 + opacity: credentialStatus === QMLManager.NOCLOUD || (diveListView.count > 0 && (credentialStatus === QMLManager.VALID || credentialStatus === QMLManager.VALID_EMAIL)) ? 0 : 1 visible: opacity > 0 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } onVisibleChanged: { + print("startPageWrapper onVisibleChanged credentialStatus " + credentialStatus + " diveListView.count " + diveListView.count) if (visible) { page.actions.main = page.saveAction page.actions.right = page.offlineAction @@ -290,7 +291,7 @@ Kirigami.ScrollablePage { } onBackRequested: { - if (startPageWrapper.visible && diveListView.count > 0 && manager.credentialStatus != QMLManager.INVALID) { + if (startPageWrapper.visible && diveListView.count > 0 && manager.credentialStatus !== QMLManager.INVALID) { manager.credentialStatus = oldStatus event.accepted = true; } -- cgit v1.2.3-70-g09d2 From 78d420ac322507596f010fc639924f052c14ed82 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 30 Apr 2016 06:44:15 -0700 Subject: QML UI: make text match the implementation Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/StartPage.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/StartPage.qml b/mobile-widgets/qml/StartPage.qml index 980e0921c..e9c785672 100644 --- a/mobile-widgets/qml/StartPage.qml +++ b/mobile-widgets/qml/StartPage.qml @@ -18,8 +18,8 @@ ColumnLayout { Layout.topMargin: Kirigami.Units.gridUnit * 3 text: "To use Subsurface-mobile with Subsurface cloud storage, please enter " + "your cloud credentials.\n\n" + - "To use Subsurface-mobile only with local data on this device, select " + - "Offline mode in the Manage dives entry in the main menu." + "To use Subsurface-mobile only with local data on this device, tap " + + "on the no cloud icon below." wrapMode: Text.WordWrap } Kirigami.Label { -- cgit v1.2.3-70-g09d2