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/app.pro | 4 +-- app/qml/pages/AppConfigDialog.qml | 53 +++++++++++++++++++++++++++++++++++++++ app/qml/pages/AppConfigPage.qml | 49 ------------------------------------ app/qml/pages/WatchPage.qml | 3 ++- 4 files changed, 57 insertions(+), 52 deletions(-) create mode 100644 app/qml/pages/AppConfigDialog.qml delete mode 100644 app/qml/pages/AppConfigPage.qml (limited to 'app') diff --git a/app/app.pro b/app/app.pro index 48fcf68..9cc2d09 100644 --- a/app/app.pro +++ b/app/app.pro @@ -27,5 +27,5 @@ OTHER_FILES += \ qml/images/* \ pebble.desktop \ pebble.png \ - qml/pages/AppConfigPage.qml \ - qml/pages/InstallAppDialog.qml + qml/pages/InstallAppDialog.qml \ + 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 +} diff --git a/app/qml/pages/AppConfigPage.qml b/app/qml/pages/AppConfigPage.qml deleted file mode 100644 index 00eb05c..0000000 --- a/app/qml/pages/AppConfigPage.qml +++ /dev/null @@ -1,49 +0,0 @@ -import QtQuick 2.0 -import QtQml 2.1 -import QtWebKit 3.0 -import Sailfish.Silica 1.0 - -Page { - id: appConfigPage - - property alias url: webview.url - property string name - - SilicaWebView { - id: webview - visible: url != "" - anchors.fill: parent - - header: PageHeader { - 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); - pageStack.pop(); - 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 - } -} diff --git a/app/qml/pages/WatchPage.qml b/app/qml/pages/WatchPage.qml index 3a712ab..9096df6 100644 --- a/app/qml/pages/WatchPage.qml +++ b/app/qml/pages/WatchPage.qml @@ -109,8 +109,9 @@ Page { console.log("going to call configure on app with uuid " + uuid); var url = pebbled.configureApp(uuid); console.log("received url: " + url); - pageStack.push(Qt.resolvedUrl("AppConfigPage.qml"), { + pageStack.push(Qt.resolvedUrl("AppConfigDialog.qml"), { url: url, + uuid: uuid, name: appInfo.longName }); } -- cgit v1.2.3