diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2016-02-16 23:40:04 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2016-02-16 23:40:04 +0100 |
| commit | 07fb609095291f8d8544441925dea3d60d636f87 (patch) | |
| tree | f17f17badc7c0ad8f0147b8968bae91016244a97 /rockwork/qml/Main.qml | |
| parent | e54ee938a3e637f654b393f41ce2ad123d448639 (diff) | |
Moved qml to subdir to unbundle
Diffstat (limited to 'rockwork/qml/Main.qml')
| -rw-r--r-- | rockwork/qml/Main.qml | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/rockwork/qml/Main.qml b/rockwork/qml/Main.qml new file mode 100644 index 0000000..2bdece3 --- /dev/null +++ b/rockwork/qml/Main.qml @@ -0,0 +1,53 @@ +import QtQuick 2.4 +import QtQuick.Layouts 1.1 +import Ubuntu.Components 1.3 +import RockWork 1.0 + +/*! + \brief MainView with a Label and Button elements. +*/ + +MainView { + applicationName: "rockwork.mzanetti" + + width: units.gu(40) + height: units.gu(70) + + ServiceController { + id: serviceController + serviceName: "rockworkd" + Component.onCompleted: { + if (!serviceController.serviceFileInstalled) { + print("Service file not installed. Installing now.") + serviceController.installServiceFile(); + } + if (!serviceController.serviceRunning) { + print("Service not running. Starting now.") + serviceController.startService(); + } + if (pebbles.version !== version) { + print("Service file version (", version, ") is not equal running service version (", pebbles.version, "). Restarting service.") + serviceController.restartService(); + } + } + } + + Pebbles { + id: pebbles + onCountChanged: loadStack() + } + + function loadStack() { + pageStack.clear() + if (pebbles.count == 1) { + pageStack.push(Qt.resolvedUrl("MainMenuPage.qml"), {pebble: pebbles.get(0)}) + } else { + pageStack.push(Qt.resolvedUrl("PebblesPage.qml")) + } + } + + PageStack { + id: pageStack + Component.onCompleted: loadStack(); + } +} |
