From 0afbad6557fa7a689640993686597c53c82325b0 Mon Sep 17 00:00:00 2001 From: dante ruiz Date: Fri, 4 Oct 2019 14:30:34 -0700 Subject: [PATCH] cmake improvments --- launchers/qt/CMakeLists.txt | 9 ++--- .../qml/HFBase/CreateAccountBase.qml | 2 ++ launchers/qt/src/Helper_darwin.mm | 33 ++++++++++++++++--- .../qt/src/LauncherInstaller_windows.cpp | 5 +++ 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/launchers/qt/CMakeLists.txt b/launchers/qt/CMakeLists.txt index 7056e953ba..c087e87bf2 100644 --- a/launchers/qt/CMakeLists.txt +++ b/launchers/qt/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.10) -project(HQLauncher) - +cmake_minimum_required(VERSION 3.0) if (APPLE) - set(ENV{MACOSX_DEPLOYMENT_TARGET} 10.9) + set(ENV{MACOSX_DEPLOYMENT_TARGET} 10.10) endif() +project(HQLauncher) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules") include("cmake/macros/SetPackagingParameters.cmake") @@ -195,6 +194,8 @@ elseif (APPLE) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${APP_NAME}.app/Contents/Resources" + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_SOURCE_DIR}/resources/images "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${APP_NAME}.app/Contents/Resources/" COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${APP_NAME}.app/Contents/MacOS/" ln -sf ./HQ\ Launcher updater # Older versions of Launcher put updater in `/Contents/Resources/updater`. COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${APP_NAME}.app/Contents/Resources" ln -sf ../MacOS/HQ\ Launcher updater diff --git a/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml b/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml index 84633da3ac..283c7d7841 100644 --- a/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml +++ b/launchers/qt/resources/qml/HFBase/CreateAccountBase.qml @@ -145,6 +145,8 @@ Item { leftMargin: root.marginLeft topMargin: 4 } + + onAccepted: LauncherState.signup(email.text, username.text, passwordField.text, displayName.text) } HFButton { diff --git a/launchers/qt/src/Helper_darwin.mm b/launchers/qt/src/Helper_darwin.mm index b4fb9f8a6e..422859fa67 100644 --- a/launchers/qt/src/Helper_darwin.mm +++ b/launchers/qt/src/Helper_darwin.mm @@ -42,10 +42,35 @@ void launchClient(const QString& clientPath, const QString& homePath, const QStr void launchAutoUpdater(const QString& autoUpdaterPath) { - NSTask* task = [[NSTask alloc] init]; - task.launchPath = [autoUpdaterPath.toNSString() stringByAppendingString:@"/Contents/Resources/updater"]; - task.arguments = @[[[NSBundle mainBundle] bundlePath], autoUpdaterPath.toNSString()]; - [task launch]; + NSException *exception; + bool launched = false; + // Older versions of Launcher put updater in `/Contents/Resources/updater`. + NSString* newLauncher = autoUpdaterPath.toNSString(); + for (NSString *bundlePath in @[@"/Contents/MacOS/updater", + @"/Contents/Resources/updater", + ]) { + NSTask* task = [[NSTask alloc] init]; + task.launchPath = [newLauncher stringByAppendingString: bundlePath]; + task.arguments = @[[[NSBundle mainBundle] bundlePath], newLauncher]; + + NSLog(@"launching updater: %@ %@", task.launchPath, task.arguments); + + @try { + [task launch]; + } + @catch (NSException *e) { + NSLog(@"couldn't launch updater: %@, %@", e.name, e.reason); + exception = e; + continue; + } + + launched = true; + break; + } + + if (!launched) { + @throw exception; + } exit(0); } diff --git a/launchers/qt/src/LauncherInstaller_windows.cpp b/launchers/qt/src/LauncherInstaller_windows.cpp index d9ecde395b..c91a001754 100644 --- a/launchers/qt/src/LauncherInstaller_windows.cpp +++ b/launchers/qt/src/LauncherInstaller_windows.cpp @@ -84,6 +84,11 @@ void LauncherInstaller::createShortcuts() { void LauncherInstaller::uninstall() { qDebug() << "Uninstall Launcher"; deleteShortcuts(); + + QString launcherPath = _launcherInstallDir.absolutePath() + "/HQ Launcher.exe"; + if (QFile::exists(launcherPath)) { + QFile::remove(launcherPath); + } deleteApplicationRegistryKeys(); }