From 24a27dcfdd6ce8f3e5a635404e6650081ebd63ca Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 14 Dec 2014 06:40:01 +0100 Subject: convert appconfig into a dialog --- app/qml/pages/AppConfigDialog.qml | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 app/qml/pages/AppConfigDialog.qml (limited to 'app/qml/pages/AppConfigDialog.qml') diff --git a/app/qml/pages/AppConfigDialog.qml b/app/qml/pages/AppConfigDialog.qml new file mode 100644 index 0000000..65a1f5b --- /dev/null +++ b/app/qml/pages/AppConfigDialog.qml @@ -0,0 +1,53 @@ +import QtQuick 2.0 +import QtQml 2.1 +import QtWebKit 3.0 +import Sailfish.Silica 1.0 + +Dialog { + id: appConfigPage + + property alias url: webview.url + property string uuid + property string name + + SilicaWebView { + id: webview + visible: url != "" + anchors.fill: parent + + header: DialogHeader { + title: "Configuring " + name + } + + onNavigationRequested: { + console.log("appconfig navigation requested to " + request.url); + var url = request.url.toString(); + if (/^pebblejs:\/\/close/.exec(url)) { + var data = decodeURIComponent(url.substring(17)); + console.log("appconfig requesting close; data: " + data); + pebbled.setAppConfiguration(uuid, data); + appConfigPage.canAccept = true; + appConfigPage.accept(); + request.action = WebView.IgnoreRequest; + } else { + request.action = WebView.AcceptRequest; + } + } + } + + Text { + anchors.centerIn: parent + visible: url == "" + text: qsTr("No configuration settings available") + width: parent.width - 2*Theme.paddingLarge + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.Wrap + font { + pixelSize: Theme.fontSizeLarge + family: Theme.fontFamilyHeading + } + color: Theme.highlightColor + } + + canAccept: false +} -- cgit v1.2.3 From 6b1ffd680201314171d3e23c7abbec83f32f1dad Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 14 Dec 2014 17:48:24 +0100 Subject: add progress bar and scroll indicator to appconfig dialog --- app/qml/pages/AppConfigDialog.qml | 16 ++++++++++++++++ app/translations/pebble-es.ts | 2 +- app/translations/pebble.ts | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'app/qml/pages/AppConfigDialog.qml') diff --git a/app/qml/pages/AppConfigDialog.qml b/app/qml/pages/AppConfigDialog.qml index 65a1f5b..92f188f 100644 --- a/app/qml/pages/AppConfigDialog.qml +++ b/app/qml/pages/AppConfigDialog.qml @@ -33,6 +33,22 @@ Dialog { request.action = WebView.AcceptRequest; } } + + VerticalScrollDecorator { flickable: webview } + } + + ProgressBar { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + + visible: webview.visible && webview.loading + minimumValue: 0 + maximumValue: 100 + indeterminate: webview.loadProgress === 0 + value: webview.loadProgress } Text { diff --git a/app/translations/pebble-es.ts b/app/translations/pebble-es.ts index 7332e4c..3a8da7d 100644 --- a/app/translations/pebble-es.ts +++ b/app/translations/pebble-es.ts @@ -22,7 +22,7 @@ AppConfigDialog - + No configuration settings available No hay opciones disponibles para configurar diff --git a/app/translations/pebble.ts b/app/translations/pebble.ts index 3cc8b6d..0c61f38 100644 --- a/app/translations/pebble.ts +++ b/app/translations/pebble.ts @@ -22,7 +22,7 @@ AppConfigDialog - + No configuration settings available -- cgit v1.2.3 From e1d94fc21ecbce16815810c4f274f349b49e82a3 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 21 Dec 2014 21:03:18 +0100 Subject: add itemselector to the appconfig webview --- app/app.pro | 1 + app/qml/pages/AppConfigDialog.qml | 18 ++++++++++++++- app/qml/pages/WebItemSelDialog.qml | 45 ++++++++++++++++++++++++++++++++++++++ app/translations/pebble-es.ts | 2 +- app/translations/pebble.ts | 2 +- 5 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 app/qml/pages/WebItemSelDialog.qml (limited to 'app/qml/pages/AppConfigDialog.qml') diff --git a/app/app.pro b/app/app.pro index ca03ab1..97c6232 100644 --- a/app/app.pro +++ b/app/app.pro @@ -25,6 +25,7 @@ OTHER_FILES += \ qml/pages/AboutPage.qml \ qml/pages/InstallAppDialog.qml \ qml/pages/AppConfigDialog.qml \ + qml/pages/WebItemSelDialog.qml \ qml/pebble.qml \ qml/images/* \ translations/*.ts \ diff --git a/app/qml/pages/AppConfigDialog.qml b/app/qml/pages/AppConfigDialog.qml index 92f188f..304bced 100644 --- a/app/qml/pages/AppConfigDialog.qml +++ b/app/qml/pages/AppConfigDialog.qml @@ -19,6 +19,8 @@ Dialog { title: "Configuring " + name } + VerticalScrollDecorator { flickable: webview } + onNavigationRequested: { console.log("appconfig navigation requested to " + request.url); var url = request.url.toString(); @@ -34,7 +36,21 @@ Dialog { } } - VerticalScrollDecorator { flickable: webview } + experimental.itemSelector: Component { + Item { + Component.onCompleted: { + var dialog = pageStack.push(Qt.resolvedUrl("WebItemSelDialog.qml"), { + model: model.items + }); + dialog.onRejected.connect(function() { + model.reject(); + }); + dialog.onAccepted.connect(function() { + model.accept(dialog.selectedIndex); + }); + } + } + } } ProgressBar { diff --git a/app/qml/pages/WebItemSelDialog.qml b/app/qml/pages/WebItemSelDialog.qml new file mode 100644 index 0000000..f8c49f2 --- /dev/null +++ b/app/qml/pages/WebItemSelDialog.qml @@ -0,0 +1,45 @@ +import QtQuick 2.0 +import QtQml 2.1 +import Sailfish.Silica 1.0 + +Dialog { + id: itemSelDialog + property alias model: listView.model + property int selectedIndex: -1 + + SilicaListView { + id: listView + anchors.fill: parent + + VerticalScrollDecorator { flickable: webview } + + header: PageHeader { + } + + delegate: ListItem { + id: itemDelegate + contentHeight: Theme.itemSizeSmall + + Label { + anchors { + left: parent.left + leftMargin: Theme.paddingMedium + right: parent.right + rightMargin: Theme.paddingMedium + verticalCenter: parent.verticalCenter + } + text: model.text + color: model.enabled ? + (itemDelegate.highlighted ? Theme.highlightColor : Theme.primaryColor) + : Theme.secondaryColor + truncationMode: TruncationMode.Fade + } + + enabled: model.enabled + onClicked: { + selectedIndex = model.index; + accept(); + } + } + } +} diff --git a/app/translations/pebble-es.ts b/app/translations/pebble-es.ts index 3a8da7d..18b1ec2 100644 --- a/app/translations/pebble-es.ts +++ b/app/translations/pebble-es.ts @@ -22,7 +22,7 @@ AppConfigDialog - + No configuration settings available No hay opciones disponibles para configurar diff --git a/app/translations/pebble.ts b/app/translations/pebble.ts index 0c61f38..222645c 100644 --- a/app/translations/pebble.ts +++ b/app/translations/pebble.ts @@ -22,7 +22,7 @@ AppConfigDialog - + No configuration settings available -- cgit v1.2.3 From e6ec758b364fcaf9fda35e56740c3fcd7e8fe25e Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 21 Dec 2014 22:36:14 +0100 Subject: use overridePageStackNavigation to ensure accept() works --- app/qml/pages/AppConfigDialog.qml | 2 ++ app/translations/pebble-es.ts | 2 +- app/translations/pebble.ts | 2 +- rpm/pebble.spec | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) (limited to 'app/qml/pages/AppConfigDialog.qml') diff --git a/app/qml/pages/AppConfigDialog.qml b/app/qml/pages/AppConfigDialog.qml index 304bced..1562985 100644 --- a/app/qml/pages/AppConfigDialog.qml +++ b/app/qml/pages/AppConfigDialog.qml @@ -21,6 +21,8 @@ Dialog { VerticalScrollDecorator { flickable: webview } + overridePageStackNavigation: true + onNavigationRequested: { console.log("appconfig navigation requested to " + request.url); var url = request.url.toString(); diff --git a/app/translations/pebble-es.ts b/app/translations/pebble-es.ts index 18b1ec2..0316ecb 100644 --- a/app/translations/pebble-es.ts +++ b/app/translations/pebble-es.ts @@ -22,7 +22,7 @@ AppConfigDialog - + No configuration settings available No hay opciones disponibles para configurar diff --git a/app/translations/pebble.ts b/app/translations/pebble.ts index 222645c..7a78d9d 100644 --- a/app/translations/pebble.ts +++ b/app/translations/pebble.ts @@ -22,7 +22,7 @@ AppConfigDialog - + No configuration settings available diff --git a/rpm/pebble.spec b/rpm/pebble.spec index 9fb9575..02cbe6c 100644 --- a/rpm/pebble.spec +++ b/rpm/pebble.spec @@ -13,7 +13,7 @@ Name: pebble %{!?qtc_make:%define qtc_make make} %{?qtc_builddir:%define _builddir %qtc_builddir} Summary: Support for Pebble watch in SailfishOS -Version: 0.12.1b +Version: 0.12.1c Release: 1 Group: Qt/Qt License: GPL3 -- cgit v1.2.3