25 import
"qrc:/gcompris/src/core/core.js" as Core
59 property bool autohide:
false;
66 property bool reportSuccess:
true;
73 property bool reportError:
true;
83 property bool dynamic:
false
90 property alias backgroundButtonVisible: backgroundButton.visible
97 property alias abortButtonVisible: abortButton.visible
106 property int fixedFontSize: 14
123 Behavior on opacity { NumberAnimation { duration: 200 } }
124 onOpacityChanged: opacity === 0 ? close() : null
128 if (downloadDialog.dynamic)
129 Core.destroyDialog(downloadDialog);
131 downloadDialog.close();
144 enabled: downloadDialog.opacity != 0
151 horizontalCenter: parent.horizontalCenter
153 topMargin: parent.height * 0.1
155 width: parent.width * 0.8
161 horizontalAlignment: Text.AlignHCenter
163 wrapMode: TextEdit.WordWrap
166 text: qsTr(
"Downloading ...")
170 anchors.fill: instructionTxt
175 border.color:
"white"
177 GradientStop { position: 0.0; color:
"#fff" }
178 GradientStop { position: 0.9; color:
"#fff" }
179 GradientStop { position: 1.0; color:
"#ddd" }
184 id: downloadDialogProgress
187 horizontalCenter: parent.horizontalCenter
188 top: instructionTxt.bottom
192 Layout.alignment: Qt.AlignHCenter
194 Layout.fillWidth:
true
205 horizontalCenter: parent.horizontalCenter
206 top: downloadDialogProgress.bottom
210 text: qsTr(
"Background")
215 onClicked: downloadDialog.shutdown();
223 horizontalCenter: parent.horizontalCenter
224 top: backgroundButton.bottom
235 downloadDialog.finished();
236 downloadDialog.shutdown();
247 downloadDialog.finished();
248 if (downloadDialog.reportError
251 var messageDialog = Core.showMessageDialog(
main,
252 qsTr(
"Download error") + code +
": " + msg,
256 downloadDialog.shutdown();
263 onDownloadProgress: downloadDialogProgress.value = 100 * bytesReceived / bytesTotal;
267 downloadDialogProgress.value = 0;
270 onDownloadFinished: {
272 downloadDialog.finished();
273 if (downloadDialog.reportSuccess
277 downloadDialog.stop();
280 infText = qsTr(
"Your download finished successfully. The data files are now available.")
282 + qsTr(
"Restart any currently active activity.");
283 }
else if (code == 2)
284 infText = qsTr(
"Your local data files are up-to-date.")
286 var messageDialog = Core.showMessageDialog(
main,
292 } else if (downloadDialog.autohide)
293 downloadDialog.shutdown();
Q_INVOKABLE void shutdown()
Shutdown DownloadManager instance.
Q_INVOKABLE void abortDownloads()
Abort all currently running downloads.
A QML component unifying text presentation in GCompris.
A singleton class responsible for downloading, updating and maintaining remote resources.
Q_INVOKABLE bool downloadIsRunning() const
Whether any download is currently running.
GCompris' main QML file defining the top level window.
A general purpose singleton that exposes miscellaneous native functions to the QML layer...
qreal ratio
Ratio factor used for scaling of sizes on high-dpi devices.