summaryrefslogtreecommitdiff
path: root/sowatchui/qml/sowatch.js
diff options
context:
space:
mode:
Diffstat (limited to 'sowatchui/qml/sowatch.js')
-rw-r--r--sowatchui/qml/sowatch.js29
1 files changed, 29 insertions, 0 deletions
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();
+}