summaryrefslogtreecommitdiff
path: root/sowatchui/qml
diff options
context:
space:
mode:
Diffstat (limited to 'sowatchui/qml')
-rw-r--r--sowatchui/qml/MainPage.qml9
-rw-r--r--sowatchui/qml/ServiceLoader.qml7
-rw-r--r--sowatchui/qml/main.qml43
-rw-r--r--sowatchui/qml/sowatch.js29
4 files changed, 88 insertions, 0 deletions
diff --git a/sowatchui/qml/MainPage.qml b/sowatchui/qml/MainPage.qml
new file mode 100644
index 0000000..45b72f3
--- /dev/null
+++ b/sowatchui/qml/MainPage.qml
@@ -0,0 +1,9 @@
+import QtQuick 1.1
+import com.nokia.meego 1.0
+
+import "sowatch.js" as Sowatch
+
+Page {
+ tools: commonTools
+
+}
diff --git a/sowatchui/qml/ServiceLoader.qml b/sowatchui/qml/ServiceLoader.qml
new file mode 100644
index 0000000..8128ca7
--- /dev/null
+++ b/sowatchui/qml/ServiceLoader.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.1
+import QtMobility.serviceframework 1.1
+
+Service {
+ id: sowatch
+ interfaceName: "com.javispedro.sowatch.service"
+}
diff --git a/sowatchui/qml/main.qml b/sowatchui/qml/main.qml
new file mode 100644
index 0000000..8697b6d
--- /dev/null
+++ b/sowatchui/qml/main.qml
@@ -0,0 +1,43 @@
+import QtQuick 1.1
+import com.nokia.meego 1.0
+
+import "sowatch.js" as Sowatch
+
+PageStackWindow {
+ id: appWindow
+
+ initialPage: mainPage
+
+ MainPage {
+ id: mainPage
+ }
+
+ ToolBarLayout {
+ id: commonTools
+ visible: true
+ ToolIcon {
+ platformIconId: "toolbar-view-menu"
+ anchors.right: (parent === undefined) ? undefined : parent.right
+ onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close()
+ }
+ }
+
+ Menu {
+ id: myMenu
+ visualParent: pageStack
+ MenuLayout {
+ MenuItem {
+ text: qsTr("Start service")
+ onClicked: {
+ Sowatch.start();
+ }
+ }
+ MenuItem {
+ text: qsTr("Stop service")
+ onClicked: {
+ Sowatch.stop();
+ }
+ }
+ }
+ }
+}
diff --git a/sowatchui/qml/sowatch.js b/sowatchui/qml/sowatch.js
new file mode 100644
index 0000000..f2d48dd
--- /dev/null
+++ b/sowatchui/qml/sowatch.js
@@ -0,0 +1,29 @@
+var service = null;
+
+function getService() {
+ var component = Qt.createComponent("ServiceLoader.qml");
+ if (component.status == Component.Ready) {
+ var loader = component.createObject(null);
+ service = loader.serviceObject;
+ }
+}
+
+function checkService() {
+ if (service === null) {
+ getService();
+ }
+}
+
+function start() {
+ getService();
+}
+
+function stop() {
+ checkService();
+ service.terminate();
+}
+
+function restart() {
+ stop();
+ start();
+}