Skip to content
Snippets Groups Projects
Commit f712dc34 authored by akiraohgaki's avatar akiraohgaki
Browse files

Download progress

parent 87972869
No related branches found
No related tags found
No related merge requests found
import QtQuick 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Dialogs 1.2
Window {
id: root
......@@ -47,14 +47,12 @@ Window {
onAccepted: Qt.quit()
}
MessageDialog {
// We maybe use generic Dialog component for
// this dialog if we drop Qt 5.2 support
Dialog {
id: progressDialog
title: root.title
contentItem: Item {
implicitWidth: 400
implicitHeight: 100
implicitHeight: 150
Column {
anchors.fill: parent
anchors.margins: 12
......@@ -64,6 +62,10 @@ Window {
text: ''
font.bold: true
}
Label {
id: informativeLabel
text: ''
}
ProgressBar {
id: progressBar
maximumValue: 1
......@@ -72,6 +74,11 @@ Window {
anchors.left: parent.left
anchors.right: parent.right
}
Label {
id: progressLabel
text: ''
anchors.right: parent.right
}
Button {
id: cancelButton
text: 'Cancel'
......@@ -81,7 +88,9 @@ Window {
}
}
property alias primaryLabel: primaryLabel
property alias informativeLabel: informativeLabel
property alias progressBar: progressBar
property alias progressLabel: progressLabel
}
Component.onCompleted: {
......@@ -119,7 +128,11 @@ Window {
});
xdgUrlHandler.downloadProgress.connect(function(received, total) {
console.log([received, total]);
progressDialog.primaryLabel.text = 'Downloading... ';
progressDialog.informativeLabel.text = metadata.filename;
progressDialog.progressBar.value = received / total;
progressDialog.progressLabel.text = convertByteToHumanReadable(received)
+ ' / ' + convertByteToHumanReadable(total)
});
if (xdgUrlHandler.isValid()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment