Skip to content

Commit e04d898

Browse files
bovirusgastoner
authored andcommitted
Show on top left of Windows installer version number as x.x.x (#888)
* Update mediawriter_native.nsi * Update mediawriter.nsi
1 parent a62bf36 commit e04d898

File tree

4 files changed

+51
-13
lines changed

4 files changed

+51
-13
lines changed

src/app/main.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ int main(int argc, char **argv)
5151
mDebug() << "Application constructed";
5252

5353
QTranslator translator;
54-
QLocale locale(QLocale::system().language(), QLocale::system().script(), QLocale::system().territory());
55-
if (translator.load(locale, QLatin1String(), QLatin1String(), ":/translations")) {
56-
mDebug() << "Localization " << locale;
54+
if (translator.load(QLocale(), QLatin1String(), QLatin1String(), ":/translations")) {
5755
app.installTranslator(&translator);
5856
}
5957

src/app/qml/DownloadPage.qml

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Page {
4242
qsTr("Preparing %1").arg(file)
4343
else if (currentStatus === Units.DownloadStatus.Ready)
4444
qsTr("Ready to write %1").arg(file)
45+
else if (currentStatus === Units.DownloadStatus.Stopped)
46+
qsTr("%1 has been stopped").arg(file)
4547
else if (currentStatus == Units.DownloadStatus.Failed_Download)
4648
qsTr("Failed to download %1").arg(file)
4749
else
@@ -78,12 +80,12 @@ Page {
7880
}
7981

8082
QQC2.Label {
81-
visible: currentStatus == Units.DownloadStatus.Downloading
83+
visible: currentStatus == Units.DownloadStatus.Downloading || currentStatus == Units.DownloadStatus.Stopped
8284
text: downloadPage.leftStr
8385
}
8486

8587
QQC2.Label {
86-
visible: currentStatus == Units.DownloadStatus.Downloading
88+
visible: currentStatus == Units.DownloadStatus.Downloading || currentStatus == Units.DownloadStatus.Stopped
8789
text: downloadPage.rightStr
8890
}
8991
}
@@ -135,6 +137,14 @@ Page {
135137
wrapMode: QQC2.Label.Wrap
136138
}
137139

140+
QQC2.Label {
141+
id: messageContinueDownload
142+
visible: currentStatus === Units.DownloadStatus.Stopped
143+
text: qsTr("Download has been stopped.")
144+
wrapMode: Label.Wrap
145+
width: mainColumn.width
146+
}
147+
138148
QQC2.Label {
139149
id: messageSelectedImage
140150
visible: releases.selected.isLocal
@@ -228,19 +238,37 @@ Page {
228238
releases.variant
229239
}
230240
}
241+
},
242+
State {
243+
name: "stopped"
244+
when: currentStatus === Units.DownloadStatus.Stopped
245+
PropertyChanges {
246+
target: progressBar;
247+
value: releases.variant.progress.ratio
248+
}
249+
PropertyChanges {
250+
target: messageContinueDownload;
251+
visible: true
252+
}
231253
}
232254
]
233255

234-
// There will be only [Finish] button on the right side so [Cancel] button
235-
// is not necessary
236256
previousButtonVisible: currentStatus != Units.DownloadStatus.Finished
237-
previousButtonText: qsTr("Cancel")
257+
previousButtonText: {
258+
if (releases.variant.status === Units.DownloadStatus.Downloading)
259+
return qsTr("Pause")
260+
else
261+
return qsTr("Cancel")
262+
}
238263
onPreviousButtonClicked: {
239264
if (releases.variant.status === Units.DownloadStatus.Write_Verifying ||
240265
releases.variant.status === Units.DownloadStatus.Writing ||
241-
releases.variant.status === Units.DownloadStatus.Downloading ||
266+
releases.variant.status === Units.DownloadStatus.Stopped ||
242267
releases.variant.status === Units.DownloadStatus.Download_Verifying) {
243268
cancelDialog.show()
269+
} else if (releases.variant.status === Units.DownloadStatus.Downloading) {
270+
downloadManager.cancel()
271+
releases.variant.setStatus(Units.DownloadStatus.Stopped)
244272
} else {
245273
releases.variant.resetStatus()
246274
downloadManager.cancel()
@@ -249,7 +277,9 @@ Page {
249277
}
250278

251279
nextButtonVisible: {
252-
if (currentStatus == Units.DownloadStatus.Finished)
280+
// This will be [Finish] or [Resume] button to finish download or resume download
281+
if (currentStatus == Units.DownloadStatus.Finished ||
282+
currentStatus == Units.DownloadStatus.Stopped)
253283
return true
254284
// This will be [Retry] button to start the process again if there is a drive plugged in
255285
else if (currentStatus == Units.DownloadStatus.Ready ||
@@ -260,14 +290,15 @@ Page {
260290
return false
261291
}
262292
nextButtonText: {
263-
264293
if (releases.variant.status === Units.DownloadStatus.Write_Verifying ||
265294
releases.variant.status === Units.DownloadStatus.Writing ||
266295
releases.variant.status === Units.DownloadStatus.Downloading ||
267296
releases.variant.status === Units.DownloadStatus.Download_Verifying)
268297
return qsTr("Cancel")
269298
else if (releases.variant.status == Units.DownloadStatus.Ready)
270299
return qsTr("Write")
300+
else if (releases.variant.status === Units.DownloadStatus.Stopped)
301+
return qsTr("Resume")
271302
else if (releases.variant.status === Units.DownloadStatus.Finished)
272303
return qsTr("Finish")
273304
else
@@ -288,6 +319,13 @@ Page {
288319
releases.variant.download()
289320
drives.selected.setImage(releases.variant)
290321
drives.selected.write(releases.variant)
322+
} else if (releases.variant.status === Units.DownloadStatus.Stopped) {
323+
if (selectedOption != Units.MainSelect.Write)
324+
releases.variant.download()
325+
if (drives.length) {
326+
drives.selected.setImage(releases.variant)
327+
drives.selected.write(releases.variant)
328+
}
291329
}
292330
}
293331
}

src/app/qml/Units.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ QtObject {
5858
Downloading,
5959
Download_Verifying,
6060
Ready,
61+
Stopped,
6162
Writing_Not_Possible,
6263
Writing,
6364
Write_Verifying,

src/app/releasemanager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,13 @@ class ReleaseVariant : public QObject, public DownloadReceiver
373373
public:
374374
enum Type { LIVE = 0, NETINSTALL, FULL, ATOMIC };
375375
Q_ENUMS(Type)
376-
enum Status { PREPARING = 0, DOWNLOADING, DOWNLOAD_VERIFYING, READY, WRITING_NOT_POSSIBLE, WRITING, WRITE_VERIFYING, FINISHED, FAILED_VERIFICATION, FAILED_DOWNLOAD, FAILED };
376+
enum Status { PREPARING = 0, DOWNLOADING, DOWNLOAD_VERIFYING, READY, STOPPED, WRITING_NOT_POSSIBLE, WRITING, WRITE_VERIFYING, FINISHED, FAILED_VERIFICATION, FAILED_DOWNLOAD, FAILED };
377377
Q_ENUMS(Status)
378378
const QStringList m_statusStrings{tr("Preparing"),
379379
tr("Downloading"),
380380
tr("Checking the download"),
381381
tr("Ready to write"),
382+
tr("Download has been stopped"),
382383
tr("Image file was saved to your downloads folder. Writing is not possible"),
383384
tr("Writing"),
384385
tr("Checking the written data"),
@@ -414,7 +415,6 @@ class ReleaseVariant : public QObject, public DownloadReceiver
414415

415416
Status status() const;
416417
QString statusString() const;
417-
void setStatus(Status s);
418418
QString errorString() const;
419419
void setErrorString(const QString &o);
420420

@@ -439,6 +439,7 @@ class ReleaseVariant : public QObject, public DownloadReceiver
439439
public slots:
440440
void download();
441441
void resetStatus();
442+
void setStatus(Status s);
442443

443444
private:
444445
QString m_temporaryIso{};

0 commit comments

Comments
 (0)