This repository has been archived by the owner on Mar 28, 2019. It is now read-only.
forked from Aseman-Land/Cutegram
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.qml
45 lines (41 loc) · 1.42 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import QtQuick 2.3
import AsemanTools 1.0
import QtQuick.Dialogs 1.1
AsemanApplication {
id: app
applicationName: "Cutegram"
applicationDisplayName: "Cutegram"
applicationVersion: "2.9.5"
applicationId: "a584f4cd-5f3b-4030-8486-cb9441563da8"
organizationName: "Aseman"
organizationDomain: "land.aseman"
property variant appMain
Component.onCompleted: {
if(app.isRunning) {
console.debug("Another instance is running. Trying to make that visible...")
Tools.jsDelayCall(1, function(){
app.sendMessage("show")
app.exit(0)
})
} else {
var component = Qt.createComponent("app/AppMain.qml", Component.Asynchronous);
var callback = function(){
if(component.status == Component.Ready)
appMain = component.createObject(app)
else if(component.status == Component.Error) {
console.error(component.errorString())
errorDialog.informativeText = component.errorString()
errorDialog.setVisible(true)
}
}
component.statusChanged.connect(callback)
callback()
}
}
MessageDialog {
id: errorDialog
title: "Fatal Error"
text: "Cutegram could not be started. Additional information:"
onAccepted: app.exit(1)
}
}