-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.qml
103 lines (87 loc) · 3.22 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import org.debins.ddpkg 1.0
ApplicationWindow {
id: app
visible: true
width: 320
height: 425
title: ddpkg.fileName
MainForm{
id: mainForm
}
Connections{
target: mainForm.terminal_ma
onClicked: {
if(!mainForm.terminal_fl.enabled){
app.setWidth(620)
app.setHeight(350)
mainForm.terminal_fl.enabled = true
}else{
app.setWidth(320)
app.setHeight(425)
mainForm.terminal_fl.enabled = false
}
}
}
DDpkg{
id: ddpkg
property bool packexists: false
Component.onCompleted: {
if(packageExists){
mainForm.newVersion = newVersion
mainForm.oldVersion = oldVersion
if(newVersion || oldVersion){
mainForm.currentVersion = packageCurrentVersion.substring(0, 8) + " -> " + packageVersion.substring(0, 8);
}else{
mainForm.currentVersion = "";
}
}
packexists = packageExists
}
onInstallFinished: {
mainForm.popup.background.color = "#007700"
mainForm.popup.color = "#fff"
mainForm.popup.text = qsTr("Successfully Installed!")
mainForm.popup.closePolicy = Popup.CloseOnEscape | Popup.CloseOnPressOutside
mainForm.newVersion = false;
mainForm.oldVersion = false;
mainForm.install.source = "img/reinstall.png"
mainForm.install_txt.text = qsTr("Reinstall")
mainForm.terminal_btn_co.visible = false;
packexists = true
mainForm.currentVersion = ""
ddpkg.getPackageCurrentVersion()
}
onInstallError: {
mainForm.popup.background.color = "#AA0000"
mainForm.popup.color = "#fff"
mainForm.popup.text = qsTr("Error: ") + ddpkg.getErrorMessage(errorCode)
mainForm.popup.closePolicy = Popup.CloseOnEscape | Popup.CloseOnPressOutside
mainForm.terminal_btn_co.color = "#990000";
}
onUninstallFinished: {
mainForm.popup.background.color = "#007700"
mainForm.popup.color = "#fff"
mainForm.popup.text = qsTr("Successfully Uninstalled!")
mainForm.popup.closePolicy = Popup.CloseOnEscape | Popup.CloseOnPressOutside
mainForm.newVersion = false;
mainForm.oldVersion = false;
mainForm.terminal_btn_co.visible = false;
packexists = false
mainForm.currentVersion = ""
}
onUninstallError: {
mainForm.popup.background.color = "#AA0000"
mainForm.popup.color = "#fff"
mainForm.popup.text = qsTr("Error: ") + ddpkg.getErrorMessage(errorCode)
mainForm.popup.closePolicy = Popup.CloseOnEscape | Popup.CloseOnPressOutside
mainForm.terminal_btn_co.color = "#990000";
}
onOutputChanged: {
mainForm.terminal_fl.terminal_ta.append(output.replace("\n",""))
mainForm.popup.text = output
}
}
}