-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMainForm.ui.qml
357 lines (315 loc) · 10.1 KB
/
MainForm.ui.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
import QtQuick 2.4
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.0
Item {
id: root
anchors.fill: parent
property alias installed: installed
property string currentVersion: ""
property bool newVersion: false
property bool oldVersion: false
property var install: install
property var install_txt: install_txt
property var terminal_ma : terminal_ma
property var terminal_fl: terminal_fl
property var terminal_btn_co: terminal_btn_co
Rectangle {
id: base
x: 0
y: 0
width: 320
height: 425
border.color: "#000000"
border.width: 0
color: "#f3f3f3"
Image {
id: debicon
x: 85
y: 25
width: 150
height: 150
anchors.horizontalCenterOffset: 0
anchors.horizontalCenter: parent.horizontalCenter
source: "img/debicon.png"
Text {
id: fileinfo
x: 55
y: 184
color: "#2d2d2d"
text: ddpkg.fileSize + " | " + ddpkg.packageVersion
style: Text.Raised
verticalAlignment: Text.AlignVCenter
font.bold: false
anchors.horizontalCenterOffset: 0
styleColor: "#ffffff"
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 13
}
Text {
id: filename
x: 12
y: 161
color: "#2d2d2d"
text: ddpkg.fileName
anchors.horizontalCenterOffset: 0
styleColor: "#ffffff"
style: Text.Raised
font.bold: true
font.pixelSize: 16
anchors.horizontalCenter: parent.horizontalCenter
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
Image {
id: installed
y: 2
x: parent.contentWidth + 4
visible: ddpkg.packexists
source: "img/installed.png"
MouseArea{
id: installed_ma
anchors.fill: parent
hoverEnabled: true
ToolTip{
id: installed_tt
text: ddpkg.packageName + " " + ddpkg.packageCurrentVersion + qsTr(" is installed.")
background: Rectangle{
color: "#f5f5f5"
border.width: 1
border.color: "#999"
}
visible: installed_ma.containsMouse
}
Connections{
target: ddpkg
onPackageCurrentVersionChanged: {
installed_tt.text = ddpkg.packageName + " " + ddpkg.packageCurrentVersion + qsTr(" is installed.")
}
}
}
}
}
}
Rectangle {
id: install_rect
x: 27
y: 253
width: 120
height: 144
radius: 10
border.color: "#44000000"
border.width: install_ma.containsMouse ? 1 : 0
color: install_ma.pressed ? "#eeeeee" : "#ffffff"
MouseArea {
id: install_ma
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
hoverEnabled: true
}
Image {
id: install
x: 15
y: 8
width: 90
height: 90
source: "img/install.png"
Text {
id: install_txt
x: 37
y: 94
text: qsTr("Install")
anchors.horizontalCenterOffset: 0
anchors.horizontalCenter: parent.horizontalCenter
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 16
}
Text {
id: install_ver
x: 46
y: 114
width: parent.width+8
color: "#2d2d2d"
text: currentVersion
wrapMode: Text.Wrap
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 13
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenterOffset: 0
verticalAlignment: Text.AlignVCenter
}
}
}
Rectangle {
id: uninstall_rect
enabled: ddpkg.packageExists
x: 173
y: 253
width: 120
height: 144
radius: 10
border.color: "#44000000"
border.width: uninstall_ma.containsMouse ? 1 : 0
color: enabled ? uninstall_ma.pressed ? "#eeeeee" : "#ffffff" : "#dddddd"
MouseArea {
id: uninstall_ma
width: 120
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
hoverEnabled: true
}
Image {
id: uninstall
x: 15
y: 8
width: 90
height: 90
source: "img/uninstall.png"
Text {
id: uninstall_txt
x: 37
y: 94
text: qsTr("Uninstall")
font.bold: false
anchors.horizontalCenterOffset: 0
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 16
verticalAlignment: Text.AlignVCenter
}
}
ColorOverlay {
anchors.fill: uninstall
source: uninstall
visible: !parent.enabled
color: "#bbbbbb"
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
}
}
Rectangle {
id: split_rect
x: 27
y: 239
width: 270
height: 1
color: "#cccccc"
anchors.horizontalCenter: parent.horizontalCenter
border.width: 0
}
}
Flickable{
id: terminal_fl
anchors.fill: parent
flickableDirection: Flickable.VerticalFlick
enabled: false
visible: enabled
property var terminal_ta: TextArea {
id: terminal_ta
anchors.fill: parent
text: ">_\n"
font.pointSize: 10
background: Rectangle{
color: "#222"
}
color: "#fff"
visible: terminal_fl.enabled
readOnly: true
wrapMode: TextEdit.WordWrap
}
TextArea.flickable: terminal_ta
ScrollBar.vertical: ScrollBar{}
}
Image {
id: terminal_btn
x: parent.width - 16 - 8
y: 8
source: "img/downarrow.png"
opacity: terminal_ma.pressed ? 0.8 : 1
MouseArea {
id: terminal_ma
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}
}
ColorOverlay {
id: terminal_btn_co
anchors.fill: terminal_btn
source: terminal_btn
visible: false
color: "#009900"
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
}
Connections {
target: install_ma
onClicked: {
popup.closePolicy = Popup.NoAutoClose
popup.background.color = "#f0f0f0"
popup.color = "#000"
popup.text = qsTr("Installing...") + "\n"
popup.open()
terminal_btn_co.visible = true
terminal_fl.terminal_ta.text = "";
ddpkg.install()
}
}
Connections {
target: uninstall_ma
onClicked: {
popup.closePolicy = Popup.NoAutoClose
popup.background.color = "#f0f0f0"
popup.color = "#000"
popup.text = qsTr("Uninstalling...") + "\n"
popup.open()
terminal_btn_co.visible = true
terminal_fl.terminal_ta.text = "";
ddpkg.uninstall()
}
}
Connections {
target: ddpkg
onPackexistsChanged: {
uninstall_rect.enabled = ddpkg.packexists
if (ddpkg.packexists) {
if (newVersion) {
install.source = "img/upgrade.png"
install_txt.text = qsTr("Upgrade")
} else if(oldVersion){
install.source = "img/downgrade.png"
install_txt.text = qsTr("Downgrade")
} else {
install.source = "img/reinstall.png"
install_txt.text = qsTr("Reinstall")
}
} else {
install.source = "img/install.png"
install_txt.text = qsTr("Install")
}
}
}
property var popup: Popup{
id: popup
width: parent.width
height: parent.height/3
y: parent.height / 2 - parent.height / 8
modal: true
property string text: ""
property string color: "#000"
background: Rectangle{
color: "#f0f0f0"
}
property int lineCount: topic.lineCount
Text{
id: topic
text: popup.text
color: popup.color
wrapMode: Text.Wrap
anchors.fill: parent
}
}
}