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 2.0
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.2
Window { Window {
id: root id: root
...@@ -47,14 +47,12 @@ Window { ...@@ -47,14 +47,12 @@ Window {
onAccepted: Qt.quit() onAccepted: Qt.quit()
} }
MessageDialog { Dialog {
// We maybe use generic Dialog component for
// this dialog if we drop Qt 5.2 support
id: progressDialog id: progressDialog
title: root.title title: root.title
contentItem: Item { contentItem: Item {
implicitWidth: 400 implicitWidth: 400
implicitHeight: 100 implicitHeight: 150
Column { Column {
anchors.fill: parent anchors.fill: parent
anchors.margins: 12 anchors.margins: 12
...@@ -64,6 +62,10 @@ Window { ...@@ -64,6 +62,10 @@ Window {
text: '' text: ''
font.bold: true font.bold: true
} }
Label {
id: informativeLabel
text: ''
}
ProgressBar { ProgressBar {
id: progressBar id: progressBar
maximumValue: 1 maximumValue: 1
...@@ -72,6 +74,11 @@ Window { ...@@ -72,6 +74,11 @@ Window {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
} }
Label {
id: progressLabel
text: ''
anchors.right: parent.right
}
Button { Button {
id: cancelButton id: cancelButton
text: 'Cancel' text: 'Cancel'
...@@ -81,7 +88,9 @@ Window { ...@@ -81,7 +88,9 @@ Window {
} }
} }
property alias primaryLabel: primaryLabel property alias primaryLabel: primaryLabel
property alias informativeLabel: informativeLabel
property alias progressBar: progressBar property alias progressBar: progressBar
property alias progressLabel: progressLabel
} }
Component.onCompleted: { Component.onCompleted: {
...@@ -119,7 +128,11 @@ Window { ...@@ -119,7 +128,11 @@ Window {
}); });
xdgUrlHandler.downloadProgress.connect(function(received, total) { 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()) { 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