1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 14:46:33 +02:00

* Manually merged stever's tomahawk.nsi patch.

This commit is contained in:
Christian Muehlhaeuser
2011-03-25 10:23:43 +00:00
parent 3ba36fc38e
commit 89c3f266a7
2 changed files with 46 additions and 75 deletions

View File

@@ -4,7 +4,7 @@
; Some installer script options (comment-out options not required) ; Some installer script options (comment-out options not required)
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
;!define OPTION_LICENSE_AGREEMENT ;!define OPTION_LICENSE_AGREEMENT
;!define OPTION_UAC_PLUGIN_ENHANCED !define OPTION_UAC_PLUGIN_ENHANCED
!define OPTION_SECTION_SC_START_MENU !define OPTION_SECTION_SC_START_MENU
!define OPTION_SECTION_SC_DESKTOP !define OPTION_SECTION_SC_DESKTOP
!define OPTION_SECTION_SC_QUICK_LAUNCH !define OPTION_SECTION_SC_QUICK_LAUNCH
@@ -58,17 +58,10 @@ InstType Full
InstType Minimal InstType Minimal
CRCCheck On CRCCheck On
SetCompressor /SOLID lzma SetCompressor /SOLID lzma
RequestExecutionLevel user ;Now using the UAC plugin.
ReserveFile tomahawk.ini ReserveFile tomahawk.ini
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll" ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
;The UAC plugin provides an elevated user.
;Otherwise request admin level here.
!ifdef OPTION_UAC_PLUGIN_ENHANCED
RequestExecutionLevel user
!else
RequestExecutionLevel admin
!endif
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Include some required header files. ; Include some required header files.
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@@ -79,9 +72,7 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
!include Memento.nsh ;Remember user selections. !include Memento.nsh ;Remember user selections.
!include WinVer.nsh ;Windows version detection. !include WinVer.nsh ;Windows version detection.
!include WordFunc.nsh ;Used by VersionCompare macro function. !include WordFunc.nsh ;Used by VersionCompare macro function.
!ifdef OPTION_UAC_PLUGIN_ENHANCED !include UAC.nsh ;Used by the UAC elevation to install as user or admin.
!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
!endif
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Memento selections stored in registry. ; Memento selections stored in registry.
@@ -146,18 +137,12 @@ UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
############################################################################## ##############################################################################
Function LaunchTomahawk Function LaunchTomahawk
!ifdef OPTION_UAC_PLUGIN_ENHANCED ${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
!else
Exec "$INSTDIR\tomahawk.exe"
!endif
FunctionEnd FunctionEnd
!ifdef OPTION_UAC_PLUGIN_ENHANCED
Function LaunchTomahawkAsUser Function LaunchTomahawkAsUser
Exec "$INSTDIR\tomahawk.exe" Exec "$INSTDIR\tomahawk.exe"
FunctionEnd FunctionEnd
!endif
############################################################################## ##############################################################################
# # # #
@@ -260,12 +245,10 @@ Function PageLeaveReinstall
Delete $R1 Delete $R1
RMDir $INSTDIR RMDir $INSTDIR
no_remove_uninstaller: no_remove_uninstaller:
StrCmp $R0 "2" +2 0 StrCmp $R0 "2" 0 +3
UAC::Unload
Quit
BringToFront BringToFront
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload
Quit
!endif
reinst_done: reinst_done:
FunctionEnd FunctionEnd
@@ -380,7 +363,7 @@ SectionGroup "Shortcuts"
CreateShortCut "$SMPROGRAMS\Tomahawk\LICENSE.lnk" "$INSTDIR\LICENSE.txt" CreateShortCut "$SMPROGRAMS\Tomahawk\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
CreateShortCut "$SMPROGRAMS\Tomahawk\Tomahawk.lnk" "$INSTDIR\tomahawk.exe" CreateShortCut "$SMPROGRAMS\Tomahawk\Tomahawk.lnk" "$INSTDIR\tomahawk.exe"
CreateShortCut "$SMPROGRAMS\Tomahawk\Release notes.lnk" "$INSTDIR\NOTES.txt" CreateShortCut "$SMPROGRAMS\Tomahawk\Release notes.lnk" "$INSTDIR\NOTES.txt"
CreateShortCut "$SMPROGRAMS\Tomahawk\Uninstall.lnk" "$INSTDIR\Uninstall.exe" CreateShortCut "$SMPROGRAMS\Tomahawk\Uninstall.lnk" "$INSTDIR\uninstall.exe"
SetShellVarContext current SetShellVarContext current
${MementoSectionEnd} ${MementoSectionEnd}
!endif !endif
@@ -424,7 +407,7 @@ Section -post
SetDetailsPrint textonly SetDetailsPrint textonly
DetailPrint "Writing Uninstaller" DetailPrint "Writing Uninstaller"
SetDetailsPrint listonly SetDetailsPrint listonly
WriteUninstaller $INSTDIR\Uninstall.exe WriteUninstaller $INSTDIR\uninstall.exe
;Registry keys required for installer version handling and uninstaller. ;Registry keys required for installer version handling and uninstaller.
SetDetailsPrint textonly SetDetailsPrint textonly
@@ -568,27 +551,25 @@ Function .onInit
${MementoSectionRestore} ${MementoSectionRestore}
!ifdef OPTION_UAC_PLUGIN_ENHANCED UAC_Elevate:
UAC_Elevate: UAC::RunElevated
UAC::RunElevated StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user? StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 0 $0 0 UAC_Err ; Error? StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper? Quit
Quit
UAC_Err: UAC_Err:
MessageBox MB_ICONSTOP "Unable to elevate, error $0" MessageBox MB_ICONSTOP "Unable to elevate, error $0"
Abort Abort
UAC_ElevationAborted: UAC_ElevationAborted:
Abort Abort
UAC_Success: UAC_Success:
StrCmp 1 $3 +4 ;Admin? StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again? StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox MB_ICONSTOP "This installer requires admin access, try again" MessageBox MB_ICONSTOP "This installer requires admin access, try again"
goto UAC_Elevate goto UAC_Elevate
!endif
;Prevent multiple instances. ;Prevent multiple instances.
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkInstaller") i .r1 ?e' System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkInstaller") i .r1 ?e'
@@ -610,15 +591,11 @@ FunctionEnd
Function .onInstSuccess Function .onInstSuccess
${MementoSectionSave} ${MementoSectionSave}
!ifdef OPTION_UAC_PLUGIN_ENHANCED UAC::Unload ;Must call unload!
UAC::Unload ;Must call unload!
!endif
FunctionEnd FunctionEnd
Function .onInstFailed Function .onInstFailed
!ifdef OPTION_UAC_PLUGIN_ENHANCED UAC::Unload ;Must call unload!
UAC::Unload ;Must call unload!
!endif
FunctionEnd FunctionEnd
############################################################################## ##############################################################################
@@ -628,27 +605,25 @@ FunctionEnd
############################################################################## ##############################################################################
Function un.onInit Function un.onInit
!ifdef OPTION_UAC_PLUGIN_ENHANCED UAC_Elevate:
UAC_Elevate: UAC::RunElevated
UAC::RunElevated StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user? StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 0 $0 0 UAC_Err ; Error? StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper? Quit
Quit
UAC_Err: UAC_Err:
MessageBox MB_ICONSTOP "Unable to elevate, error $0" MessageBox MB_ICONSTOP "Unable to elevate, error $0"
Abort Abort
UAC_ElevationAborted: UAC_ElevationAborted:
Abort Abort
UAC_Success: UAC_Success:
StrCmp 1 $3 +4 ;Admin? StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again? StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again" MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
goto UAC_Elevate goto UAC_Elevate
!endif
;Prevent multiple instances. ;Prevent multiple instances.
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkUninstaller") i .r1 ?e' System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkUninstaller") i .r1 ?e'
@@ -659,13 +634,9 @@ Function un.onInit
FunctionEnd FunctionEnd
Function un.onUnInstSuccess Function un.onUnInstSuccess
!ifdef OPTION_UAC_PLUGIN_ENHANCED UAC::Unload ;Must call unload!
UAC::Unload ;Must call unload!
!endif
FunctionEnd FunctionEnd
Function un.onUnInstFailed Function un.onUnInstFailed
!ifdef OPTION_UAC_PLUGIN_ENHANCED UAC::Unload ;Must call unload!
UAC::Unload ;Must call unload!
!endif
FunctionEnd FunctionEnd

View File

@@ -38,8 +38,8 @@ main( int argc, char *argv[] )
// used for url handler // used for url handler
AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler ); AEEventHandlerUPP h = AEEventHandlerUPP( appleEventHandler );
AEInstallEventHandler( 'GURL', 'GURL', h, 0, false ); AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
#endif #endif
TomahawkApp a( argc, argv ); TomahawkApp a( argc, argv );
KDSingleApplicationGuard guard( &a, KDSingleApplicationGuard::AutoKillOtherInstances ); KDSingleApplicationGuard guard( &a, KDSingleApplicationGuard::AutoKillOtherInstances );
QObject::connect( &guard, SIGNAL( instanceStarted( KDSingleApplicationGuard::Instance ) ), &a, SLOT( instanceStarted( KDSingleApplicationGuard::Instance ) ) ); QObject::connect( &guard, SIGNAL( instanceStarted( KDSingleApplicationGuard::Instance ) ), &a, SLOT( instanceStarted( KDSingleApplicationGuard::Instance ) ) );