diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-10-17 20:54:22 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2011-10-17 20:54:22 +0200 |
commit | e8781ec2d43ec3f7f905e20fc76b1910e83ee0c8 (patch) | |
tree | 34a842fb825ecc14454ff044fc6af92e29b4ae10 /sowatchui/qml | |
parent | e42e7dca8df8d1e4966545894e2dde228f19b6f0 (diff) | |
download | sowatch-e8781ec2d43ec3f7f905e20fc76b1910e83ee0c8.tar.gz sowatch-e8781ec2d43ec3f7f905e20fc76b1910e83ee0c8.zip |
Major change: sowatchd is now a QtM service
Diffstat (limited to 'sowatchui/qml')
-rw-r--r-- | sowatchui/qml/MainPage.qml | 9 | ||||
-rw-r--r-- | sowatchui/qml/ServiceLoader.qml | 7 | ||||
-rw-r--r-- | sowatchui/qml/main.qml | 43 | ||||
-rw-r--r-- | sowatchui/qml/sowatch.js | 29 |
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(); +} |