From d47d30c8dc4ddf2a6bd84162dedb159559cfeacc Mon Sep 17 00:00:00 2001 From: Victor Tran Date: Wed, 5 Dec 2018 01:56:15 +1100 Subject: New flag to update an app --- installer/main.cpp | 22 +++++++++++++------- installer/mainwindow.cpp | 18 ++++++++++++++-- installer/mainwindow.h | 4 ++++ installer/translations/en_AU.ts | 12 +++++------ installer/translations/en_GB.ts | 12 +++++------ installer/translations/en_NZ.ts | 12 +++++------ installer/translations/en_US.ts | 12 +++++------ installer/translations/pt_BR.qm | Bin 111 -> 5885 bytes installer/translations/pt_BR.ts | 44 ++++++++++++++++++++++++---------------- installer/translations/vi_VN.qm | Bin 4905 -> 5921 bytes installer/translations/vi_VN.ts | 12 +++++------ 11 files changed, 91 insertions(+), 57 deletions(-) diff --git a/installer/main.cpp b/installer/main.cpp index e1ebadf..a36d8a5 100644 --- a/installer/main.cpp +++ b/installer/main.cpp @@ -26,7 +26,15 @@ int main(int argc, char *argv[]) qsrand(QDateTime::currentMSecsSinceEpoch()); qDebug() << a.arguments(); - if (a.arguments().contains("--install")) { + if (a.arguments().contains("--update-from-app")) { + //Install UI mode (triggered from update action inside app) + + MainWindow w; + w.setAutoProgress(true); + w.show(); + + return a.exec(); + } else if (a.arguments().contains("--install")) { //Installer mode InstallWorker worker; if (!worker.startWork()) return 1; @@ -86,13 +94,13 @@ int main(int argc, char *argv[]) box.exec(); return 1; } - } - - //Install UI mode - MainWindow w; - w.show(); + } else { + //Install UI mode + MainWindow w; + w.show(); - return a.exec(); + return a.exec(); + } } QString calculateSize(quint64 size) { diff --git a/installer/mainwindow.cpp b/installer/mainwindow.cpp index a739455..e66e273 100644 --- a/installer/mainwindow.cpp +++ b/installer/mainwindow.cpp @@ -152,7 +152,11 @@ void MainWindow::getInstallerMetadata() { ui->licenseLabel->setVisible(false); } - ui->stack->setCurrentIndex(2); + if (autoProgress) { + ui->installButton->click(); + } else { + ui->stack->setCurrentIndex(2); + } }); connect(reply, QOverload::of(&QNetworkReply::error), [=](QNetworkReply::NetworkError code) { ui->metadataErrorLabel->setText(tr("Couldn't retrieve metadata")); @@ -288,7 +292,13 @@ void MainWindow::on_installButton_clicked() installDone = true; this->setWindowFlag(Qt::WindowCloseButtonHint, true); this->show(); - ui->stack->setCurrentIndex(5); + + if (autoProgress) { + ui->openCheckbox->setChecked(true); + ui->finishButton->click(); + } else { + ui->stack->setCurrentIndex(5); + } taskbarButton->progress()->setVisible(false); } else if (parts.at(0) == "ALERT") { @@ -440,3 +450,7 @@ void MainWindow::on_licenseLabel_linkActivated(const QString &link) { licenseWidget->show(link, this->licenses.value(link)); } + +void MainWindow::setAutoProgress(bool autoProgress) { + this->autoProgress = autoProgress; +} diff --git a/installer/mainwindow.h b/installer/mainwindow.h index fbbeb8b..dec5600 100644 --- a/installer/mainwindow.h +++ b/installer/mainwindow.h @@ -38,6 +38,9 @@ class MainWindow : public QMainWindow explicit MainWindow(QWidget *parent = 0); ~MainWindow(); + public slots: + void setAutoProgress(bool autoProgress); + private slots: void on_installOptions_clicked(); @@ -79,6 +82,7 @@ class MainWindow : public QMainWindow QWinTaskbarButton* taskbarButton; QLocalSocket* sock = nullptr; bool installDone = false; + bool autoProgress = false; LicenseWidget* licenseWidget; QMap licenses; diff --git a/installer/translations/en_AU.ts b/installer/translations/en_AU.ts index 5f44930..523097c 100644 --- a/installer/translations/en_AU.ts +++ b/installer/translations/en_AU.ts @@ -215,32 +215,32 @@ - + Couldn't retrieve metadata - + Couldn't connect securely to the server - + %1 currently running - + Before we continue, you'll need to close %1. - + Getting ready to install %1... - + Warning diff --git a/installer/translations/en_GB.ts b/installer/translations/en_GB.ts index 1532ccc..0fea2cb 100644 --- a/installer/translations/en_GB.ts +++ b/installer/translations/en_GB.ts @@ -215,32 +215,32 @@ - + Couldn't retrieve metadata - + Couldn't connect securely to the server - + %1 currently running - + Before we continue, you'll need to close %1. - + Getting ready to install %1... - + Warning diff --git a/installer/translations/en_NZ.ts b/installer/translations/en_NZ.ts index 4974953..aa563f1 100644 --- a/installer/translations/en_NZ.ts +++ b/installer/translations/en_NZ.ts @@ -215,32 +215,32 @@ - + Couldn't retrieve metadata - + Couldn't connect securely to the server - + %1 currently running - + Before we continue, you'll need to close %1. - + Getting ready to install %1... - + Warning diff --git a/installer/translations/en_US.ts b/installer/translations/en_US.ts index 78c941c..0a5b43a 100644 --- a/installer/translations/en_US.ts +++ b/installer/translations/en_US.ts @@ -215,32 +215,32 @@ - + Couldn't retrieve metadata - + Couldn't connect securely to the server - + %1 currently running - + Before we continue, you'll need to close %1. - + Getting ready to install %1... - + Warning diff --git a/installer/translations/pt_BR.qm b/installer/translations/pt_BR.qm index c2e08c5..9472a44 100644 Binary files a/installer/translations/pt_BR.qm and b/installer/translations/pt_BR.qm differ diff --git a/installer/translations/pt_BR.ts b/installer/translations/pt_BR.ts index 7207494..9da94dd 100644 --- a/installer/translations/pt_BR.ts +++ b/installer/translations/pt_BR.ts @@ -27,27 +27,35 @@ %n days remaining - %n dia restante - %n dias restantes - + + %n dia restante + %n dias restantes + + %n hours remaining - %n hora restante - %n horas restantes - + + %n hora restante + %n horas restantes + + %n minutes remaining - %n minuto restante - %n minutos restantes - + + %n minuto restante + %n minutos restantes + + %n seconds remaining - %n segundo restante - %n segundos restantes - + + %n segundo restante + %n segundos restantes + + MainWindow @@ -207,32 +215,32 @@ Instalando %1, você está concordando com os termos da %2. - + Couldn't retrieve metadata Não pode receber metadata - + Couldn't connect securely to the server Não pode estabelecer uma conexão segura com o servidor - + %1 currently running %1 rodando - + Before we continue, you'll need to close %1. Antes de continuar, você precisará fechar %1. - + Getting ready to install %1... Preparando para instalar %1… - + Warning Atenção diff --git a/installer/translations/vi_VN.qm b/installer/translations/vi_VN.qm index f35e2e7..597cb58 100644 Binary files a/installer/translations/vi_VN.qm and b/installer/translations/vi_VN.qm differ diff --git a/installer/translations/vi_VN.ts b/installer/translations/vi_VN.ts index ca1c596..30e0850 100644 --- a/installer/translations/vi_VN.ts +++ b/installer/translations/vi_VN.ts @@ -211,32 +211,32 @@ Khi bạn cài đặt %1, bạn sẽ đồng ý với các điều khoản của cái %2. - + Couldn't retrieve metadata Không nhận siêu dữ liệu được - + Couldn't connect securely to the server Không kết nối an toàn đến máy chủ được - + %1 currently running %1 đang chạy - + Before we continue, you'll need to close %1. Trước khi chúng tôi tiếp tục được, bạn sẽ cần đóng %1. - + Getting ready to install %1... Đang chuẩn bị cài đặt %1... - + Warning Cảnh báo -- cgit v1.2.3