From caa99c1d22ae68e73f9bd85913834cdcec3dda41 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Thu, 3 Oct 2019 18:49:34 -0700 Subject: [PATCH] windows uninstall --- .../qt/resources/qml/HFBase/LoginBase.qml | 2 + launchers/qt/src/.#main.cpp | 1 + launchers/qt/src/Helper_windows.cpp | 1 + .../qt/src/LauncherInstaller_windows.cpp | 67 ++++++++++--------- launchers/qt/src/main.cpp | 2 +- 5 files changed, 40 insertions(+), 33 deletions(-) create mode 100644 launchers/qt/src/.#main.cpp diff --git a/launchers/qt/resources/qml/HFBase/LoginBase.qml b/launchers/qt/resources/qml/HFBase/LoginBase.qml index fd9a52bc94..13c00dff19 100644 --- a/launchers/qt/resources/qml/HFBase/LoginBase.qml +++ b/launchers/qt/resources/qml/HFBase/LoginBase.qml @@ -120,6 +120,8 @@ Item { horizontalCenter: instruction.horizontalCenter topMargin: 4 } + + onAccepted: LauncherState.login(username.text, password.text, displayName.text) } HFButton { diff --git a/launchers/qt/src/.#main.cpp b/launchers/qt/src/.#main.cpp new file mode 100644 index 0000000000..fee0637218 --- /dev/null +++ b/launchers/qt/src/.#main.cpp @@ -0,0 +1 @@ +Dante@DESKTOP-9JK5VFR.10856:1570152789 \ No newline at end of file diff --git a/launchers/qt/src/Helper_windows.cpp b/launchers/qt/src/Helper_windows.cpp index f31f5c7c7c..a6bb1dabd5 100644 --- a/launchers/qt/src/Helper_windows.cpp +++ b/launchers/qt/src/Helper_windows.cpp @@ -8,6 +8,7 @@ #include "objbase.h" #include "objidl.h" #include "shlguid.h" +#include #include #include diff --git a/launchers/qt/src/LauncherInstaller_windows.cpp b/launchers/qt/src/LauncherInstaller_windows.cpp index ffd6218fab..d9ecde395b 100644 --- a/launchers/qt/src/LauncherInstaller_windows.cpp +++ b/launchers/qt/src/LauncherInstaller_windows.cpp @@ -47,42 +47,47 @@ void LauncherInstaller::install() { qDebug() << "not successful"; } - qDebug() << "LauncherInstaller: create uninstall link"; - QString uninstallLinkPath = _launcherInstallDir.absolutePath() + "/Uninstall HQ.lnk"; - if (QFile::exists(uninstallLinkPath)) { - QFile::remove(uninstallLinkPath); - } - - - - QString desktopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); - QString applicationPath = _launcherApplicationsDir.absolutePath(); - - QString appStartLinkPath = applicationPath + "/HQ.lnk"; - QString uninstallAppStartLinkPath = applicationPath + "/Uninstall HQ.lnk"; - QString desktopAppLinkPath = desktopPath + "/HQ.lnk"; - - - createSymbolicLink((LPCSTR)oldLauncherPath.toStdString().c_str(), (LPCSTR)uninstallLinkPath.toStdString().c_str(), - (LPCSTR)("Click to Uninstall HQ"), (LPCSTR)("--uninstall")); - - createSymbolicLink((LPCSTR)oldLauncherPath.toStdString().c_str(), (LPCSTR)uninstallAppStartLinkPath.toStdString().c_str(), - (LPCSTR)("Click to Uninstall HQ"), (LPCSTR)("--uninstall")); - - createSymbolicLink((LPCSTR)oldLauncherPath.toStdString().c_str(), (LPCSTR)desktopAppLinkPath.toStdString().c_str(), - (LPCSTR)("Click to Setup and Launch HQ")); - - createSymbolicLink((LPCSTR)oldLauncherPath.toStdString().c_str(), (LPCSTR)appStartLinkPath.toStdString().c_str(), - (LPCSTR)("Click to Setup and Launch HQ")); + deleteShortcuts(); + createShortcuts(); createApplicationRegistryKeys(); } else { - qDebug() << "FAILED!!!!!!!"; + qDebug() << "Failed to install HQ Launcher"; } } +void LauncherInstaller::createShortcuts() { + QString launcherPath = _launcherInstallDir.absolutePath() + "/HQ Launcher.exe"; + + QString uninstallLinkPath = _launcherInstallDir.absolutePath() + "/Uninstall HQ.lnk"; + QString desktopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); + QString applicationPath = _launcherApplicationsDir.absolutePath(); + + QString appStartLinkPath = applicationPath + "/HQ Launcher.lnk"; + QString uninstallAppStartLinkPath = applicationPath + "/Uninstall HQ.lnk"; + QString desktopAppLinkPath = desktopPath + "/HQ Launcher.lnk"; + + + createSymbolicLink((LPCSTR)launcherPath.toStdString().c_str(), (LPCSTR)uninstallLinkPath.toStdString().c_str(), + (LPCSTR)("Click to Uninstall HQ"), (LPCSTR)("--uninstall")); + + createSymbolicLink((LPCSTR)launcherPath.toStdString().c_str(), (LPCSTR)uninstallAppStartLinkPath.toStdString().c_str(), + (LPCSTR)("Click to Uninstall HQ"), (LPCSTR)("--uninstall")); + + createSymbolicLink((LPCSTR)launcherPath.toStdString().c_str(), (LPCSTR)desktopAppLinkPath.toStdString().c_str(), + (LPCSTR)("Click to Setup and Launch HQ")); + + createSymbolicLink((LPCSTR)launcherPath.toStdString().c_str(), (LPCSTR)appStartLinkPath.toStdString().c_str(), + (LPCSTR)("Click to Setup and Launch HQ")); +} + void LauncherInstaller::uninstall() { qDebug() << "Uninstall Launcher"; + deleteShortcuts(); + deleteApplicationRegistryKeys(); +} + +void LauncherInstaller::deleteShortcuts() { QString desktopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); QString applicationPath = _launcherApplicationsDir.absolutePath(); @@ -91,7 +96,7 @@ void LauncherInstaller::uninstall() { QFile::remove(uninstallLinkPath); } - QString appStartLinkPath = applicationPath + "/HQ.lnk"; + QString appStartLinkPath = applicationPath + "/HQ Launcher.lnk"; if (QFile::exists(appStartLinkPath)) { QFile::remove(appStartLinkPath); } @@ -101,12 +106,10 @@ void LauncherInstaller::uninstall() { QFile::remove(uninstallAppStartLinkPath); } - QString desktopAppLinkPath = desktopPath + "/HQ.lnk"; + QString desktopAppLinkPath = desktopPath + "/HQ Launcher.lnk"; if (QFile::exists(desktopAppLinkPath)) { QFile::remove(desktopAppLinkPath); } - - deleteApplicationRegistryKeys(); } diff --git a/launchers/qt/src/main.cpp b/launchers/qt/src/main.cpp index 0965a5742f..29d5251cc1 100644 --- a/launchers/qt/src/main.cpp +++ b/launchers/qt/src/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) { #ifdef Q_OS_WIN LauncherInstaller launcherInstaller(argv[0]); if (options->contains("--restart") || launcherInstaller.runningOutsideOfInstallDir()) { - launcherInstaller.install(); + launcherInstaller.install(); } else if (options->contains("--uninstall")) { launcherInstaller.uninstall(); return 0;