mirror of https://github.com/Nheko-Reborn/nheko
Windows icon fix and change the installer to QT Installer Framework on Windows (#85)
parent
1a3bacd96e
commit
4ba1f2ea83
@ -0,0 +1,36 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||||
|
<plist version="1.0"> |
||||||
|
<dict> |
||||||
|
<key>CFBundleDevelopmentRegion</key> |
||||||
|
<string>English</string> |
||||||
|
<key>CFBundleExecutable</key> |
||||||
|
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> |
||||||
|
<key>CFBundleGetInfoString</key> |
||||||
|
<string>${MACOSX_BUNDLE_INFO_STRING}</string> |
||||||
|
<key>CFBundleIconFile</key> |
||||||
|
<string>${MACOSX_BUNDLE_ICON_FILE}</string> |
||||||
|
<key>CFBundleIdentifier</key> |
||||||
|
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string> |
||||||
|
<key>CFBundleInfoDictionaryVersion</key> |
||||||
|
<string>6.0</string> |
||||||
|
<key>CFBundleLongVersionString</key> |
||||||
|
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string> |
||||||
|
<key>CFBundleName</key> |
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string> |
||||||
|
<key>CFBundlePackageType</key> |
||||||
|
<string>APPL</string> |
||||||
|
<key>CFBundleShortVersionString</key> |
||||||
|
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string> |
||||||
|
<key>CFBundleVersion</key> |
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string> |
||||||
|
<key>CSResourcesFileMapped</key> |
||||||
|
<true/> |
||||||
|
<key>LSRequiresCarbon</key> |
||||||
|
<true/> |
||||||
|
<key>NSHumanReadableCopyright</key> |
||||||
|
<string>${MACOSX_BUNDLE_COPYRIGHT}</string> |
||||||
|
<key>NSPrincipalClass</key> |
||||||
|
<string>NSApplication</string> |
||||||
|
</dict> |
||||||
|
</plist> |
@ -0,0 +1,76 @@ |
|||||||
|
macro(fix_project_version) |
||||||
|
if (NOT PROJECT_VERSION_PATCH) |
||||||
|
set(PROJECT_VERSION_PATCH 0) |
||||||
|
endif() |
||||||
|
|
||||||
|
if (NOT PROJECT_VERSION_TWEAK) |
||||||
|
set(PROJECT_VERSION_TWEAK 0) |
||||||
|
endif() |
||||||
|
endmacro() |
||||||
|
|
||||||
|
macro(add_project_meta FILES_TO_INCLUDE) |
||||||
|
if (NOT RESOURCE_FOLDER) |
||||||
|
set(RESOURCE_FOLDER resources) |
||||||
|
endif() |
||||||
|
|
||||||
|
if (NOT ICON_NAME) |
||||||
|
set(ICON_NAME nheko) |
||||||
|
endif() |
||||||
|
|
||||||
|
if (APPLE) |
||||||
|
set(ICON_FILE ${RESOURCE_FOLDER}/${ICON_NAME}.icns) |
||||||
|
elseif (WIN32) |
||||||
|
set(ICON_FILE ${RESOURCE_FOLDER}/${ICON_NAME}.ico) |
||||||
|
endif() |
||||||
|
|
||||||
|
if (WIN32) |
||||||
|
configure_file("${PROJECT_SOURCE_DIR}/cmake/windows_metafile.rc.in" |
||||||
|
"windows_metafile.rc" |
||||||
|
) |
||||||
|
set(RES_FILES "windows_metafile.rc") |
||||||
|
set(CMAKE_RC_COMPILER_INIT windres) |
||||||
|
ENABLE_LANGUAGE(RC) |
||||||
|
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>") |
||||||
|
endif() |
||||||
|
|
||||||
|
if (APPLE) |
||||||
|
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) |
||||||
|
|
||||||
|
# Identify MacOS bundle |
||||||
|
set(MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}) |
||||||
|
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}) |
||||||
|
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION}) |
||||||
|
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") |
||||||
|
set(MACOSX_BUNDLE_COPYRIGHT ${COPYRIGHT}) |
||||||
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${IDENTIFIER}) |
||||||
|
set(MACOSX_BUNDLE_ICON_FILE ${ICON_NAME}) |
||||||
|
endif() |
||||||
|
|
||||||
|
if (APPLE) |
||||||
|
set(${FILES_TO_INCLUDE} ${ICON_FILE}) |
||||||
|
elseif (WIN32) |
||||||
|
set(${FILES_TO_INCLUDE} ${RES_FILES}) |
||||||
|
endif() |
||||||
|
endmacro() |
||||||
|
|
||||||
|
macro(init_os_bundle) |
||||||
|
if (APPLE) |
||||||
|
set(OS_BUNDLE MACOSX_BUNDLE) |
||||||
|
elseif (WIN32) |
||||||
|
IF(CMAKE_BUILD_TYPE MATCHES Release) |
||||||
|
set(OS_BUNDLE WIN32) |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
endmacro() |
||||||
|
|
||||||
|
macro(fix_win_compiler) |
||||||
|
if (MSVC) |
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES |
||||||
|
WIN32_EXECUTABLE YES |
||||||
|
LINK_FLAGS "/ENTRY:mainCRTStartup" |
||||||
|
) |
||||||
|
endif() |
||||||
|
endmacro() |
||||||
|
|
||||||
|
init_os_bundle() |
||||||
|
fix_win_compiler() |
@ -0,0 +1,28 @@ |
|||||||
|
#include "winver.h" |
||||||
|
|
||||||
|
IDI_ICON1 ICON DISCARDABLE "@ICON_FILE@" |
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO |
||||||
|
FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ |
||||||
|
PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ |
||||||
|
FILEFLAGS 0x0L |
||||||
|
FILEFLAGSMASK 0x3fL |
||||||
|
FILEOS 0x00040004L |
||||||
|
FILETYPE 0x1L |
||||||
|
FILESUBTYPE 0x0L |
||||||
|
BEGIN |
||||||
|
BLOCK "StringFileInfo" |
||||||
|
BEGIN |
||||||
|
BLOCK "000004b0" |
||||||
|
BEGIN |
||||||
|
VALUE "CompanyName", "@COMPANY@" |
||||||
|
VALUE "FileDescription", "@PROJECT_NAME@" |
||||||
|
VALUE "FileVersion", "@PROJECT_VERSION@" |
||||||
|
VALUE "LegalCopyright", "@COPYRIGHT@" |
||||||
|
VALUE "InternalName", "@PROJECT_NAME@" |
||||||
|
VALUE "OriginalFilename", "@PROJECT_NAME@.exe" |
||||||
|
VALUE "ProductName", "@PROJECT_NAME@" |
||||||
|
VALUE "ProductVersion", "@PROJECT_VERSION@" |
||||||
|
END |
||||||
|
END |
||||||
|
END |
@ -0,0 +1,28 @@ |
|||||||
|
function Component() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
Component.prototype.createOperations = function() |
||||||
|
{ |
||||||
|
component.createOperations(); |
||||||
|
|
||||||
|
try |
||||||
|
{ |
||||||
|
if( installer.value("os") === "win" ) |
||||||
|
{ |
||||||
|
/** |
||||||
|
* Cleanup AppData and registry |
||||||
|
*/ |
||||||
|
component.addElevatedOperation("Execute","UNDOEXECUTE","cmd /C reg delete HKEY_CURRENT_USER\Software\nheko\nheko /f"); |
||||||
|
var localappdata = installer.environmentVariable("LOCALAPPDATA"); |
||||||
|
if( localappdata != "" ) |
||||||
|
{ |
||||||
|
component.addElevatedOperation("Execute","UNDOEXECUTE","cmd /C rmdir "+localappdata+"\nheko /f"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
catch( e ) |
||||||
|
{ |
||||||
|
print( e ); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<Package> |
||||||
|
<DisplayName>Cleanup AppData and Registry</DisplayName> |
||||||
|
<Description>Cleans up AppData and Registry when selected (logs you out) - Broken</Description> |
||||||
|
<Version>__VERSION__</Version> |
||||||
|
<ReleaseDate>__DATE__</ReleaseDate> |
||||||
|
<SortingPriority>80</SortingPriority> |
||||||
|
<Script>installscript.qs</Script> |
||||||
|
<Checkable>false</Checkable> |
||||||
|
</Package> |
@ -0,0 +1,15 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<Installer> |
||||||
|
<Name>Nheko</Name> |
||||||
|
<Version>__VERSION__</Version> |
||||||
|
<Title>Nheko Installer</Title> |
||||||
|
<Publisher>Mujx</Publisher> |
||||||
|
<ProductUrl>https://github.com/mujx/nheko</ProductUrl> |
||||||
|
<InstallerWindowIcon>nheko</InstallerWindowIcon> |
||||||
|
<InstallerApplicationIcon>nheko</InstallerApplicationIcon> |
||||||
|
<Logo>nheko.png</Logo> |
||||||
|
<StartMenuDir>Nheko</StartMenuDir> |
||||||
|
<TargetDir>@ApplicationsDir@/nheko</TargetDir> |
||||||
|
<RunProgram>@TargetDir@/nheko.exe</RunProgram> |
||||||
|
<ControlScript>controlscript.qs</ControlScript> |
||||||
|
</Installer> |
@ -0,0 +1,25 @@ |
|||||||
|
/** |
||||||
|
* Source: http://stackoverflow.com/questions/21389105/qt-installer-framework-offline-update-how |
||||||
|
*/ |
||||||
|
|
||||||
|
function Controller() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
Controller.prototype.TargetDirectoryPageCallback = function() |
||||||
|
{ |
||||||
|
var widget = gui.currentPageWidget(); |
||||||
|
widget.TargetDirectoryLineEdit.textChanged.connect( this, Controller.prototype.targetChanged ); |
||||||
|
Controller.prototype.targetChanged( widget.TargetDirectoryLineEdit.text ); |
||||||
|
} |
||||||
|
|
||||||
|
Controller.prototype.targetChanged = function( text ) |
||||||
|
{ |
||||||
|
if( text != "" && installer.fileExists(text + "/components.xml") ) |
||||||
|
{ |
||||||
|
if( QMessageBox.question("PreviousInstallation", "Previous installation detected", "Do you want to uninstall the previous installation?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes ) |
||||||
|
{ |
||||||
|
installer.execute( text+"/maintenancetool.exe", new Array("--script", text+"/uninstall.qs") ) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
function Component() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
Component.prototype.createOperations = function() |
||||||
|
{ |
||||||
|
component.createOperations(); |
||||||
|
|
||||||
|
try |
||||||
|
{ |
||||||
|
if( installer.value("os") === "win" ) |
||||||
|
{ |
||||||
|
/** |
||||||
|
* Start Menu Shortcut |
||||||
|
*/ |
||||||
|
component.addOperation( "CreateShortcut", "@TargetDir@\\nheko.exe", "@StartMenuDir@\\nheko.lnk", |
||||||
|
"workingDirectory=@TargetDir@", "iconPath=@TargetDir@\\nheko.exe", |
||||||
|
"iconId=0", "description=Desktop client for the Matrix protocol"); |
||||||
|
|
||||||
|
/** |
||||||
|
* Desktop Shortcut |
||||||
|
*/ |
||||||
|
component.addOperation( "CreateShortcut", "@TargetDir@\\nheko.exe", "@DesktopDir@\\nheko.lnk", |
||||||
|
"workingDirectory=@TargetDir@", "iconPath=@TargetDir@\\nheko.exe", |
||||||
|
"iconId=0", "description=Desktop client for the Matrix protocol"); |
||||||
|
} |
||||||
|
} |
||||||
|
catch( e ) |
||||||
|
{ |
||||||
|
print( e ); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<Package> |
||||||
|
<DisplayName>Nheko</DisplayName> |
||||||
|
<Description>Desktop client for the Matrix protocol</Description> |
||||||
|
<Version>__VERSION__</Version> |
||||||
|
<ReleaseDate>__DATE__</ReleaseDate> |
||||||
|
<Licenses> |
||||||
|
<License name="Nheko License - GPLv3" file="license.txt" /> |
||||||
|
</Licenses> |
||||||
|
<Default>true</Default> |
||||||
|
<ForcedInstallation>true</ForcedInstallation> |
||||||
|
<SortingPriority>100</SortingPriority> |
||||||
|
<Script>installscript.qs</Script> |
||||||
|
</Package> |
@ -0,0 +1,18 @@ |
|||||||
|
function Controller() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
Controller.prototype.IntroductionPageCallback = function() |
||||||
|
{ |
||||||
|
gui.clickButton( buttons.NextButton ); |
||||||
|
} |
||||||
|
|
||||||
|
Controller.prototype.ReadyForInstallationPageCallback = function() |
||||||
|
{ |
||||||
|
gui.clickButton( buttons.CommitButton ); |
||||||
|
} |
||||||
|
|
||||||
|
Controller.prototype.FinishedPageCallback = function() |
||||||
|
{ |
||||||
|
gui.clickButton( buttons.FinishButton ); |
||||||
|
} |
Loading…
Reference in new issue