From a1e9542350cc617412781af88d5b33133d4be8f4 Mon Sep 17 00:00:00 2001 From: Victor Tran Date: Fri, 13 Jul 2018 21:43:04 +1000 Subject: Uninstall from Control Panel works now --- installer/installer.pro | 3 ++- installer/maintainwindow.cpp | 1 + installer/maintainwindow.ui | 8 +++++++- installer/mainwindow.cpp | 4 +++- installer/process/installworker.cpp | 14 +++++++------- installer/process/removeworker.cpp | 1 - installer/resources.qrc | 1 + installer/translations/pt_BR.qm | Bin 0 -> 111 bytes 8 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 installer/translations/pt_BR.qm (limited to 'installer') diff --git a/installer/installer.pro b/installer/installer.pro index 1c2fd5f..396b087 100644 --- a/installer/installer.pro +++ b/installer/installer.pro @@ -188,7 +188,8 @@ FORMS += \ maintainwindow.ui TRANSLATIONS += \ - translations/vi_VN.ts + translations/vi_VN.ts \ + translations/pt_BR.ts win32 { #CONFIG += embed_manifest_exe diff --git a/installer/maintainwindow.cpp b/installer/maintainwindow.cpp index 447d3f5..8f8eb5b 100644 --- a/installer/maintainwindow.cpp +++ b/installer/maintainwindow.cpp @@ -32,6 +32,7 @@ MaintainWindow::MaintainWindow(QWidget *parent) : metadataFile.open(QFile::ReadOnly); metadata = QJsonDocument::fromJson(metadataFile.readAll()).object(); + this->setWindowTitle(tr("Modify %1").arg(metadata.value("name").toString())); ui->areYouSureText->setText(tr("Are you sure you want to uninstall %1?").arg(metadata.value("name").toString())); } diff --git a/installer/maintainwindow.ui b/installer/maintainwindow.ui index 35349ea..7bb57fa 100644 --- a/installer/maintainwindow.ui +++ b/installer/maintainwindow.ui @@ -13,6 +13,10 @@ Modify Application Name + + + :/icon.svg:/icon.svg + @@ -445,6 +449,8 @@ 1 - + + + diff --git a/installer/mainwindow.cpp b/installer/mainwindow.cpp index b02c45f..1e9b207 100644 --- a/installer/mainwindow.cpp +++ b/installer/mainwindow.cpp @@ -206,7 +206,9 @@ void MainWindow::on_installButton_clicked() QStringList psArgs; psArgs.append("-FilePath \"" + QApplication::applicationFilePath() + "\""); psArgs.append("-ArgumentList (" + args.join(",") + ")"); - psArgs.append("-Verb runAs"); + if (ui->installEveryone->isChecked()) { + psArgs.append("-Verb runAs"); + } psArgs.append("-PassThru"); psArgs.append("-Wait"); diff --git a/installer/process/installworker.cpp b/installer/process/installworker.cpp index e7708ad..581deb3 100644 --- a/installer/process/installworker.cpp +++ b/installer/process/installworker.cpp @@ -103,8 +103,8 @@ bool InstallWorker::startWork() { dataRoot.insert("appurl", url); //Write uninstall information to registry - QUuid uuid = QUuid::createUuid(); - dataRoot.insert("registryUuid", uuid.toString()); + //QUuid uuid = QUuid::createUuid(); + dataRoot.insert("registryUuid", name); /*HKEY SoftwareEntry; HKEY hive; LPCWSTR keyPath = (LPCWSTR) QString("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + uuid.toString()).utf16(); @@ -128,17 +128,17 @@ bool InstallWorker::startWork() { QSettings* settings; if (isGlobalInstall) { - settings = new QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + uuid.toString(), QSettings::NativeFormat); + settings = new QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + name, QSettings::NativeFormat); } else { - settings = new QSettings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + uuid.toString(), QSettings::NativeFormat); + settings = new QSettings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + name, QSettings::NativeFormat); } settings->setValue("DisplayName", name); settings->setValue("Publisher", vendor); settings->setValue("Contact", vendor); - settings->setValue("ModifyPath", dest.absoluteFilePath("uninstall.exe")); - settings->setValue("UninstallString", dest.absoluteFilePath("uninstall.exe")); - settings->setValue("InstallDate", QDateTime::currentDateTime().toString("yyyymmdd")); + settings->setValue("ModifyPath", "\"" + dest.absoluteFilePath("uninstall.exe").replace("/", "\\") + "\""); + settings->setValue("UninstallString", "\"" + dest.absoluteFilePath("uninstall.exe").replace("/", "\\") + "\""); + settings->setValue("InstallDate", QDateTime::currentDateTime().toString("yyyyMMdd")); settings->setValue("InstallLocation", dest.path()); settings->setValue("DisplayIcon", executableFile.absoluteFilePath() + ",0"); settings->sync(); diff --git a/installer/process/removeworker.cpp b/installer/process/removeworker.cpp index 2bca275..5356f26 100644 --- a/installer/process/removeworker.cpp +++ b/installer/process/removeworker.cpp @@ -75,7 +75,6 @@ bool RemoveWorker::startWork() { dest.removeRecursively(); //Remove registry entry - QSettings* settings; if (metadata.value("global").toBool()) { settings = new QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", QSettings::NativeFormat); diff --git a/installer/resources.qrc b/installer/resources.qrc index 661ed75..f7f5198 100644 --- a/installer/resources.qrc +++ b/installer/resources.qrc @@ -4,5 +4,6 @@ icon-bp.svg background.svg translations/vi_VN.qm + translations/pt_BR.qm diff --git a/installer/translations/pt_BR.qm b/installer/translations/pt_BR.qm new file mode 100644 index 0000000..c2e08c5 Binary files /dev/null and b/installer/translations/pt_BR.qm differ -- cgit v1.2.3