-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
78 lines (68 loc) · 1.34 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
import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.2;
Window {
property bool started : false;
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Column {
anchors.centerIn: parent
visible: !started
Button {
text: "Start"
onClicked: {
downloadManager.start();
started = true;
}
}
Row {
CheckBox {
id: parallelCheckbox
checked: downloadManager.isParallel
onClicked: {
downloadManager.isParallel = !downloadManager.isParallel;
}
}
Text {
anchors.verticalCenter: parallelCheckbox.verticalCenter
text: "Parallel downloads"
}
}
}
Item {
visible: started
anchors.fill: parent
Text {
id: statusText
text: "Remaining downloads: " + downloadManager.remainingDownloads;
height: 30
}
ListModel {
id: finishedDownloads
}
ListView {
model: finishedDownloads
anchors.top: statusText.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
delegate : Text {
text: url
anchors.left: parent.left
anchors.right: parent.right
color: success ? "green" : "red"
}
}
}
Connections {
target: downloadManager
onDownloaded: {
finishedDownloads.append({'url': url, 'success': true});
}
onError: {
finishedDownloads.append({'url': url, 'success': false});
}
}
}