diff options
Diffstat (limited to 'rockwork/qml/Main.qml')
| -rw-r--r-- | rockwork/qml/Main.qml | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/rockwork/qml/Main.qml b/rockwork/qml/Main.qml new file mode 100644 index 0000000..aae852b --- /dev/null +++ b/rockwork/qml/Main.qml @@ -0,0 +1,45 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import RockPool 1.0 + +/*! + \brief MainView with a Label and Button elements. +*/ + +ApplicationWindow { + id: app + + ServiceController { + id: serviceController + Component.onCompleted: { + 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)}) + app.cover.replace(Qt.resolvedUrl("CoverPage.qml"), {pebble: pebbles.get(0)}) + } else { + pageStack.push(Qt.resolvedUrl("PebblesPage.qml")) + } + } + + PageStack { + id: pageStack + Component.onCompleted: loadStack(); + } +} |
