Fixed a potential issue where the downloader window closes but the downloader instance keeps running

This commit is contained in:
Marco Dalla Tiezza
2024-06-13 19:19:21 +02:00
parent 0f898ff6f5
commit 1d0c459402
3 changed files with 101 additions and 96 deletions

View File

@@ -6638,7 +6638,7 @@ G@\x11\x10HG\x93Hp\xec\x0au\xe3\xcd\x1e\xf4\
>k\xd0\xd3b\x1eG\xb5_d\xde\xb6{\x8f\x95\xc5\ >k\xd0\xd3b\x1eG\xb5_d\xde\xb6{\x8f\x95\xc5\
U\xaf\xbc\xfd\xe9\xb5\x9f\xe5\xe3}r\xba?\xbbI\x06\ U\xaf\xbc\xfd\xe9\xb5\x9f\xe5\xe3}r\xba?\xbbI\x06\
\xfe\xfc\x0f\xf4\xcd*2\ \xfe\xfc\x0f\xf4\xcd*2\
\x00\x00\x070\ \x00\x00\x07^\
i\ i\
mport QtQuick\x0d\x0ai\ mport QtQuick\x0d\x0ai\
mport QtQuick.Wi\ mport QtQuick.Wi\
@@ -6667,94 +6667,97 @@ Qt.Dialog\x0d\x0a\x0d\x0a \
temis - Download\ temis - Download\
er\x22)\x0d\x0a\x0d\x0a sign\ er\x22)\x0d\x0a\x0d\x0a sign\
al onAbort()\x0d\x0a\x0d\x0a\ al onAbort()\x0d\x0a\x0d\x0a\
function upd\ onClosing: {\
ateProgressBar(b\ \x0d\x0a onAbor\
ytesReceived, by\ t()\x0d\x0a }\x0d\x0a\x0d\x0a \
tesTotal) {\x0d\x0a \ function updat\
progressBar\ eProgressBar(byt\
.value = bytesRe\ esReceived, byte\
ceived\x0d\x0a \ sTotal) {\x0d\x0a \
progressBar.to =\ progressBar.v\
bytesTotal\x0d\x0a \ alue = bytesRece\
}\x0d\x0a\x0d\x0a functi\ ived\x0d\x0a pr\
on setIndetermin\ ogressBar.to = b\
ateBar() {\x0d\x0a \ ytesTotal\x0d\x0a }\
progressBar.\ \x0d\x0a\x0d\x0a function\
indeterminate = \ setIndeterminat\
true\x0d\x0a }\x0d\x0a\x0d\x0a \ eBar() {\x0d\x0a \
function upda\ progressBar.in\
teStatus(arg) {\x0d\ determinate = tr\
\x0a progres\ ue\x0d\x0a }\x0d\x0a\x0d\x0a \
sLabel.text = ar\ function update\
g\x0d\x0a }\x0d\x0a\x0d\x0a \ Status(arg) {\x0d\x0a \
Page {\x0d\x0a \ progressL\
id: page\x0d\x0a \ abel.text = arg\x0d\
anchors.fill: \ \x0a }\x0d\x0a\x0d\x0a Pa\
parent\x0d\x0a\x0d\x0a \ ge {\x0d\x0a id\
ColumnLayout {\ : page\x0d\x0a \
\x0d\x0a id\ anchors.fill: pa\
: columnLayout\x0d\x0a\ rent\x0d\x0a\x0d\x0a \
anch\ ColumnLayout {\x0d\x0a\
ors.fill: parent\ id: \
\x0d\x0a\x0d\x0a \ columnLayout\x0d\x0a \
Label {\x0d\x0a \ anchor\
text: q\ s.fill: parent\x0d\x0a\
sTr(\x22Downloading\ \x0d\x0a La\
in progress...\x22\ bel {\x0d\x0a \
)\x0d\x0a \ text: qsT\
Layout.alignm\ r(\x22Downloading i\
ent: Qt.AlignHCe\ n progress...\x22)\x0d\
nter | Qt.AlignV\ \x0a \
Center\x0d\x0a \ Layout.alignmen\
t: Qt.AlignHCent\
er | Qt.AlignVCe\
nter\x0d\x0a \
}\x0d\x0a\x0d\x0a \ }\x0d\x0a\x0d\x0a \
ProgressBar\ ProgressBar {\
{\x0d\x0a \
id: progress\
Bar\x0d\x0a \
Layout.righ\
tMargin: 20\x0d\x0a \
Lay\
out.leftMargin: \
20\x0d\x0a \
Layout.fillW\
idth: true\x0d\x0a \
inde\
terminate: false\
\x0d\x0a \ \x0d\x0a \
value: 0\x0d\x0a \ id: progressBa\
to: \ r\x0d\x0a \
0\x0d\x0a }\ Layout.rightM\
\x0d\x0a\x0d\x0a \ argin: 20\x0d\x0a \
Label {\x0d\x0a \ Layou\
id: pro\ t.leftMargin: 20\
gressLabel\x0d\x0a \ \x0d\x0a \
Layo\ Layout.fillWid\
ut.alignment: Qt\ th: true\x0d\x0a \
.AlignHCenter | \ indete\
Qt.AlignVCenter\x0d\ rminate: false\x0d\x0a\
\
value: 0\x0d\x0a \
to: 0\x0d\
\x0a }\x0d\x0a\ \x0a }\x0d\x0a\
\x0d\x0a Bu\ \x0d\x0a La\
tton {\x0d\x0a \ bel {\x0d\x0a \
Layout.a\ id: progr\
lignment: Qt.Ali\ essLabel\x0d\x0a \
gnHCenter | Qt.A\ Layout\
lignBottom\x0d\x0a \ .alignment: Qt.A\
text\ lignHCenter | Qt\
: qsTr(\x22Abort\x22)\x0d\ .AlignVCenter\x0d\x0a \
\x0a \ }\x0d\x0a\x0d\x0a\
icon.source: \x22q\ Butt\
rc:/images/icons\ on {\x0d\x0a \
/abort.svg\x22\x0d\x0a \ Layout.ali\
dis\ gnment: Qt.Align\
play: AbstractBu\ HCenter | Qt.Ali\
tton.TextBesideI\ gnBottom\x0d\x0a \
con\x0d\x0a \ text: \
flat: true\x0d\ qsTr(\x22Abort\x22)\x0d\x0a \
\x0a \ i\
onClicked: { on\ con.source: \x22qrc\
Abort() }\x0d\x0a \ :/images/icons/a\
bort.svg\x22\x0d\x0a \
displ\
ay: AbstractButt\
on.TextBesideIco\
n\x0d\x0a \
flat: true\x0d\x0a \
o\
nClicked: { onAb\
ort() }\x0d\x0a \
}\x0d\x0a \ }\x0d\x0a \
}\x0d\x0a }\x0d\x0a}\x0d\x0a\ }\x0d\x0a }\x0d\x0a}\x0d\x0a\
\x00\x00\x05\xac\ \x00\x00\x05\xac\
i\ i\
mport QtQuick\x0d\x0ai\ mport QtQuick\x0d\x0ai\
@@ -7305,12 +7308,12 @@ qt_resource_struct = b"\
\x00\x00\x01\x8f\xff^8P\ \x00\x00\x01\x8f\xff^8P\
\x00\x00\x03<\x00\x01\x00\x00\x00\x01\x00\x01>\xe2\ \x00\x00\x03<\x00\x01\x00\x00\x00\x01\x00\x01>\xe2\
\x00\x00\x01\x90\x11\xc7\x00\xf9\ \x00\x00\x01\x90\x11\xc7\x00\xf9\
\x00\x00\x05\xa8\x00\x00\x00\x00\x00\x01\x00\x01\xa0\xab\ \x00\x00\x05\xa8\x00\x00\x00\x00\x00\x01\x00\x01\xa0\xd9\
\x00\x00\x01\x8f\xff^8P\ \x00\x00\x01\x8f\xff^8P\
\x00\x00\x03r\x00\x01\x00\x00\x00\x01\x00\x01I=\ \x00\x00\x03r\x00\x01\x00\x00\x00\x01\x00\x01I=\
\x00\x00\x01\x8f\xff^8_\ \x00\x00\x01\x8f\xff^8_\
\x00\x00\x05\x86\x00\x00\x00\x00\x00\x01\x00\x01\x99w\ \x00\x00\x05\x86\x00\x00\x00\x00\x00\x01\x00\x01\x99w\
\x00\x00\x01\x90\x11\xad[\xc5\ \x00\x00\x01\x90\x12\x9a\x0f\x0b\
\x00\x00\x03X\x00\x02\x00\x00\x00\x04\x00\x00\x00+\ \x00\x00\x03X\x00\x02\x00\x00\x00\x04\x00\x00\x00+\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x04\xc4\x00\x01\x00\x00\x00\x01\x00\x01vE\ \x00\x00\x04\xc4\x00\x01\x00\x00\x00\x01\x00\x01vE\
@@ -7329,13 +7332,13 @@ qt_resource_struct = b"\
\x00\x00\x01\x8f\xff^8P\ \x00\x00\x01\x8f\xff^8P\
\x00\x00\x05\x06\x00\x00\x00\x00\x00\x01\x00\x01\x85\xde\ \x00\x00\x05\x06\x00\x00\x00\x00\x00\x01\x00\x01\x85\xde\
\x00\x00\x01\x8f\xff^8P\ \x00\x00\x01\x8f\xff^8P\
\x00\x00\x05\xdc\x00\x01\x00\x00\x00\x01\x00\x01\xa9^\ \x00\x00\x05\xdc\x00\x01\x00\x00\x00\x01\x00\x01\xa9\x8c\
\x00\x00\x01\x8f\xff^8_\ \x00\x00\x01\x8f\xff^8_\
\x00\x00\x06$\x00\x01\x00\x00\x00\x01\x00\x01\xaf\xa3\ \x00\x00\x06$\x00\x01\x00\x00\x00\x01\x00\x01\xaf\xd1\
\x00\x00\x01\x8f\xff^8_\ \x00\x00\x01\x8f\xff^8_\
\x00\x00\x05\xc0\x00\x01\x00\x00\x00\x01\x00\x01\xa6[\ \x00\x00\x05\xc0\x00\x01\x00\x00\x00\x01\x00\x01\xa6\x89\
\x00\x00\x01\x8f\xff^8_\ \x00\x00\x01\x8f\xff^8_\
\x00\x00\x06\x00\x00\x01\x00\x00\x00\x01\x00\x01\xac!\ \x00\x00\x06\x00\x00\x01\x00\x00\x00\x01\x00\x01\xacO\
\x00\x00\x01\x8f\xff^8_\ \x00\x00\x01\x8f\xff^8_\
" "

View File

@@ -74,9 +74,7 @@ class UIDownloader(QObject):
self.reply.errorOccurred.connect(self.on_error) self.reply.errorOccurred.connect(self.on_error)
else: else:
self.close_ui.emit() self.close_ui.emit()
self.show_popup_error( self.show_popup_error(self.file.errorString())
self.file.errorString()
)
@Slot() @Slot()

View File

@@ -24,6 +24,10 @@ Window {
signal onAbort() signal onAbort()
onClosing: {
onAbort()
}
function updateProgressBar(bytesReceived, bytesTotal) { function updateProgressBar(bytesReceived, bytesTotal) {
progressBar.value = bytesReceived progressBar.value = bytesReceived
progressBar.to = bytesTotal progressBar.to = bytesTotal