fixing last mac warning and taskbar icon for windows

This commit is contained in:
danteruiz 2019-10-01 14:41:46 -07:00
parent 13e8dc036c
commit 18fde053cb
12 changed files with 87 additions and 4 deletions

View file

@ -165,7 +165,11 @@ set(TARGET_NAME ${PROJECT_NAME})
set_packaging_parameters()
if (WIN32)
add_executable(${PROJECT_NAME} ${src_files} ${RES_SOURCES})
set(CONFIGURE_ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/resources/images/interface.ico")
message(${CONFIGURE_ICON_PATH})
set(CONFIGURE_ICON_RC_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Icon.rc")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/Icon.rc.in" ${CONFIGURE_ICON_RC_OUTPUT})
add_executable(${PROJECT_NAME} WIN32 ${src_files} ${RES_SOURCES} ${CONFIGURE_ICON_RC_OUTPUT})
elseif (APPLE)
set_target_properties(${this_target} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.in)

View file

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "@CONFIGURE_ICON_PATH@"

View file

@ -3228,6 +3228,7 @@ struct mz_zip_internal_state_tag
static MZ_FORCEINLINE mz_uint mz_zip_array_range_check(const mz_zip_array *pArray, mz_uint index)
{
MZ_ASSERT(index < pArray->m_size);
(void)(pArray);
return index;
}
#define MZ_ZIP_ARRAY_ELEMENT(array_ptr, element_type, index) ((element_type *)((array_ptr)->m_p))[mz_zip_array_range_check(array_ptr, index)]

View file

@ -0,0 +1,13 @@
//
// Launcher.rc2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -21,4 +21,7 @@ bool isLauncherAlreadyRunning();
#ifdef Q_OS_WIN
HRESULT createSymbolicLink(LPCSTR lpszPathObj, LPCSTR lpszPathLink, LPCSTR lpszDesc, LPCSTR lpszArgs = (LPCSTR)"");
bool insertRegistryKey(const std::string& regPath, const std::string& name, const std::string& value);
bool insertRegistryKey(const std::string& regPath, const std::string& name, DWORD value);
bool deleteRegistryKey(const std::string& regPath);
#endif

View file

@ -6,6 +6,8 @@
#include "objbase.h"
#include "objidl.h"
#include "shlguid.h"
#include <tlhelp32.h>
#include <strsafe.h>
#include <QCoreApplication>
void launchClient(const QString& clientPath, const QString& homePath, const QString& defaultScriptsPath,
@ -113,3 +115,35 @@ HRESULT createSymbolicLink(LPCSTR lpszPathObj, LPCSTR lpszPathLink, LPCSTR lpszD
CoUninitialize();
return SUCCEEDED(hres);
}
bool insertRegistryKey(const std::string& regPath, const std::string& name, const std::string& value) {
HKEY key;
auto status = RegCreateKeyExA(HKEY_CURRENT_USER, regPath.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_QUERY_VALUE, NULL, &key, NULL);
if (status == ERROR_SUCCESS) {
status = RegSetValueExA(key, name.c_str(), 0, REG_SZ, (const BYTE*)value.c_str(), (DWORD)(value.size() + 1));
return (bool) (status == ERROR_SUCCESS);
}
RegCloseKey(key);
return false;
}
bool insertRegistryKey(const std::string& regPath, const std::string& name, DWORD value) {
HKEY key;
auto status = RegCreateKeyExA(HKEY_CURRENT_USER, regPath.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_QUERY_VALUE, NULL, &key, NULL);
if (status == ERROR_SUCCESS) {
status = RegSetValueExA(key, name.c_str(), 0, REG_DWORD, (const BYTE*)&value, sizeof(value));
return (bool) TRUE;
}
RegCloseKey(key);
return false;
}
bool deleteRegistryKey(const std::string& regPath) {
TCHAR szDelKey[MAX_PATH * 2];
StringCchCopy(szDelKey, MAX_PATH * 2, regPath.c_str());
auto status = RegDeleteKey(HKEY_CURRENT_USER, szDelKey);
if (status == ERROR_SUCCESS) {
return (bool) TRUE;
}
return false;
}

View file

@ -13,7 +13,7 @@ Launcher::Launcher(int& argc, char**argv) : QGuiApplication(argc, argv) {
_launcherWindow = std::make_unique<LauncherWindow>();
_launcherWindow->rootContext()->setContextProperty("LauncherState", _launcherState.get());
_launcherWindow->rootContext()->setContextProperty("PathUtils", new PathUtils());
_launcherWindow->setFlags(Qt::FramelessWindowHint);
_launcherWindow->setFlags(Qt::FramelessWindowHint | Qt::Window);
LauncherState::declareQML();
_launcherWindow->setSource(QUrl(PathUtils::resourcePath("qml/root.qml")));
_launcherWindow->setResizeMode(QQuickView::SizeRootObjectToView);

View file

@ -70,6 +70,8 @@ void LauncherInstaller::install() {
createSymbolicLink((LPCSTR)oldLauncherPath.toStdString().c_str(), (LPCSTR)appStartLinkPath.toStdString().c_str(),
(LPCSTR)("Click to Setup and Launch HQ"));
createApplicationRegistryKeys();
} else {
qDebug() << "FAILED!!!!!!!";
}
@ -100,3 +102,26 @@ void LauncherInstaller::uninstall() {
QFile::remove(desktopAppLinkPath);
}
}
void LauncherInstaller::createApplicationRegistryKeys() {
const std::string REGISTRY_PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\HQ";
bool success = insertRegistryKey(REGISTRY_PATH, "DisplayName", "HQ");
std::string installPath = _launcherInstallDir.absolutePath().toStdString();
success = insertRegistryKey(REGISTRY_PATH, "InstallLocation", installPath);
std::string applicationExe = installPath + "/HQ Launcher.exe";
std::string uninstallPath = '"' + applicationExe + '"' + " --uninstall";
success = insertRegistryKey(REGISTRY_PATH, "UninstallString", uninstallPath);
success = insertRegistryKey(REGISTRY_PATH, "DisplayVersion", "DEV");
success = insertRegistryKey(REGISTRY_PATH, "DisplayIcon", applicationExe);
success = insertRegistryKey(REGISTRY_PATH, "Publisher", "High Fidelity");
//success = LauncherUtils::insertRegistryKey(REGISTRY_PATH, "InstallDate", LauncherUtils::cStringToStd(CTime::GetCurrentTime().Format("%Y%m%d")));
//success = LauncherUtils::insertRegistryKey(REGISTRY_PATH, "EstimatedSize", (DWORD)size);
success = insertRegistryKey(REGISTRY_PATH, "NoModify", (DWORD)1);
success = insertRegistryKey(REGISTRY_PATH, "NoRepair", (DWORD)1);
qDebug() << "--------: " << success;
}
void LauncherInstaller::deleteApplicationRegistryKeys() {
}

View file

@ -11,7 +11,9 @@ public:
bool runningOutsideOfInstallDir();
private:
void createShortcuts();
void createApplicationRegistryKeys();
void deleteShortcuts();
void deleteApplicationRegistryKeys();
QDir _launcherInstallDir;
QDir _launcherApplicationsDir;

View file

@ -5,6 +5,8 @@
class LauncherWindow : public QQuickView {
public:
LauncherWindow() = default;
~LauncherWindow() = default;
void keyPressEvent(QKeyEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;

View file

@ -35,8 +35,6 @@ int main(int argc, char *argv[]) {
return 0;
}
closeInterfaceIfRunning();
// waitForInterfaceToClose();
// auto updater
if (argc == 3) {
if (hasSuffix(argv[1], "app") && hasSuffix(argv[2], "app")) {
swapLaunchers(argv[1], argv[2]);