diff options
| author | Javier <dev.git@javispedro.com> | 2014-12-03 00:48:19 +0100 |
|---|---|---|
| committer | Javier <dev.git@javispedro.com> | 2014-12-03 00:48:19 +0100 |
| commit | 69822e4dcf541a52e4202d5ff566364fb90e6ec0 (patch) | |
| tree | 5485db6e7d94517f2763db735ce4cfc2eec260cd /app/qml/pages | |
| parent | 843e8c2550f69de3b9dfc3ec5f13d2c3a5710896 (diff) | |
implement UI for JS app configuration
Diffstat (limited to 'app/qml/pages')
| -rw-r--r-- | app/qml/pages/AboutPage.qml | 2 | ||||
| -rw-r--r-- | app/qml/pages/AppConfigPage.qml (renamed from app/qml/pages/WebViewPage.qml) | 15 | ||||
| -rw-r--r-- | app/qml/pages/WatchPage.qml | 30 |
3 files changed, 41 insertions, 6 deletions
diff --git a/app/qml/pages/AboutPage.qml b/app/qml/pages/AboutPage.qml index bec1031..8fd009e 100644 --- a/app/qml/pages/AboutPage.qml +++ b/app/qml/pages/AboutPage.qml @@ -40,7 +40,7 @@ Page { anchors { left: parent.left right: parent.right - margins: Theme.paddingSmall + margins: Theme.paddingMedium } font.pixelSize: Theme.fontSizeTiny horizontalAlignment: Text.AlignJustify diff --git a/app/qml/pages/WebViewPage.qml b/app/qml/pages/AppConfigPage.qml index 2c6fcf0..8fb31ca 100644 --- a/app/qml/pages/WebViewPage.qml +++ b/app/qml/pages/AppConfigPage.qml @@ -4,21 +4,26 @@ import QtWebKit 3.0 import Sailfish.Silica 1.0 Page { - id: webviewPage + id: appConfigPage property alias url: webview.url + property string uuid SilicaWebView { id: webview anchors.fill: parent + header: PageHeader { + title: "Configuring " + uuid + } + onNavigationRequested: { - console.log("navigation requested to " + request.url); - var url = request.url.toString() + console.log("appconfig navigation requested to " + request.url); + var url = request.url.toString(); if (/^pebblejs:\/\/close/.exec(url)) { var data = decodeURI(url.substring(17)); - console.log("match with pebble close regexp. data: " + data); - pebbled.webviewClosed(data); + console.log("appconfig requesting close; data: " + data); + pebbled.setAppConfiguration(uuid, data); pageStack.pop(); request.action = WebView.IgnoreRequest; } else { diff --git a/app/qml/pages/WatchPage.qml b/app/qml/pages/WatchPage.qml index 90e5ec9..8169507 100644 --- a/app/qml/pages/WatchPage.qml +++ b/app/qml/pages/WatchPage.qml @@ -77,6 +77,36 @@ Page { } } + + Label { + text: qsTr("App configuration") + font.family: Theme.fontFamilyHeading + color: Theme.highlightColor + anchors.right: parent.right + anchors.rightMargin: Theme.paddingMedium + } + + Button { + text: "Configure current app" + anchors { + left: parent.left + right: parent.right + margins: Theme.paddingLarge + } + onClicked: { + var uuid = pebbled.appUuid; + console.log("going to configureApp " + uuid); + var url = pebbled.configureApp(uuid); + console.log("obtained configure URL " + url); + if (url) { + pageStack.push(Qt.resolvedUrl("AppConfigPage.qml"), { + url: url, + uuid: uuid + }); + } + } + } + } } } |
