2020-08-05 14:33:14 +00:00
|
|
|
Var uninstallerPath
|
2017-04-05 00:04:59 +00:00
|
|
|
|
|
|
|
Section "-hidden"
|
2013-01-27 23:12:02 +00:00
|
|
|
|
|
|
|
;Search if qBittorrent is already installed.
|
2017-04-05 00:04:59 +00:00
|
|
|
FindFirst $0 $1 "$uninstallerPath\uninst.exe"
|
2013-01-27 23:12:02 +00:00
|
|
|
FindClose $0
|
2013-02-02 00:36:15 +00:00
|
|
|
StrCmp $1 "" done
|
2016-01-03 15:38:50 +00:00
|
|
|
|
2013-01-27 23:20:39 +00:00
|
|
|
;Run the uninstaller of the previous install.
|
2016-01-03 15:38:50 +00:00
|
|
|
DetailPrint $(inst_unist)
|
2017-04-05 00:04:59 +00:00
|
|
|
ExecWait '"$uninstallerPath\uninst.exe" /S _?=$uninstallerPath'
|
|
|
|
Delete "$uninstallerPath\uninst.exe"
|
|
|
|
RMDir "$uninstallerPath"
|
2016-01-03 15:38:50 +00:00
|
|
|
|
2013-01-27 23:12:02 +00:00
|
|
|
done:
|
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
|
2013-01-23 19:06:50 +00:00
|
|
|
Section $(inst_qbt_req) ;"qBittorrent (required)"
|
|
|
|
|
|
|
|
SectionIn RO
|
2017-03-31 06:47:29 +00:00
|
|
|
|
2013-01-23 19:06:50 +00:00
|
|
|
; Set output path to the installation directory.
|
|
|
|
SetOutPath $INSTDIR
|
2022-10-01 22:00:55 +00:00
|
|
|
; Put files there
|
2023-10-20 06:04:56 +00:00
|
|
|
File "${QBT_DIST_DIR}\qbittorrent.exe"
|
2013-01-23 19:06:50 +00:00
|
|
|
File "qt.conf"
|
2023-10-20 06:04:56 +00:00
|
|
|
File /nonfatal /r /x "${QBT_DIST_DIR}\qbittorrent.exe" "${QBT_DIST_DIR}\*.*"
|
2017-03-31 06:47:29 +00:00
|
|
|
|
|
|
|
; Write the installation path into the registry
|
2014-02-23 10:31:02 +00:00
|
|
|
WriteRegStr HKLM "Software\qBittorrent" "InstallLocation" "$INSTDIR"
|
2017-03-31 06:47:29 +00:00
|
|
|
|
2023-10-24 10:31:01 +00:00
|
|
|
; Register qBittorrent as possible default program for .torrent files and magnet links
|
|
|
|
WriteRegStr HKLM "Software\qBittorrent\Capabilities" "ApplicationDescription" "A BitTorrent client in Qt"
|
|
|
|
WriteRegStr HKLM "Software\qBittorrent\Capabilities" "ApplicationName" "qBittorrent"
|
|
|
|
WriteRegStr HKLM "Software\qBittorrent\Capabilities\FileAssociations" ".torrent" "qBittorrent.File.Torrent"
|
|
|
|
WriteRegStr HKLM "Software\qBittorrent\Capabilities\UrlAssociations" "magnet" "qBittorrent.Url.Magnet"
|
|
|
|
WriteRegStr HKLM "Software\RegisteredApplications" "qBittorrent" "Software\qBittorrent\Capabilities"
|
|
|
|
; Register qBittorrent ProgIDs
|
|
|
|
WriteRegStr HKLM "Software\Classes\qBittorrent.File.Torrent" "" "Torrent File"
|
|
|
|
WriteRegStr HKLM "Software\Classes\qBittorrent.File.Torrent\DefaultIcon" "" '"$INSTDIR\qbittorrent.exe",1'
|
|
|
|
WriteRegStr HKLM "Software\Classes\qBittorrent.File.Torrent\shell\open\command" "" '"$INSTDIR\qbittorrent.exe" "%1"'
|
|
|
|
WriteRegStr HKLM "Software\Classes\qBittorrent.Url.Magnet" "" "Magnet URI"
|
|
|
|
WriteRegStr HKLM "Software\Classes\qBittorrent.Url.Magnet\DefaultIcon" "" '"$INSTDIR\qbittorrent.exe",1'
|
|
|
|
WriteRegStr HKLM "Software\Classes\qBittorrent.Url.Magnet\shell\open\command" "" '"$INSTDIR\qbittorrent.exe" "%1"'
|
|
|
|
|
|
|
|
WriteRegStr HKLM "Software\Classes\.torrent" "Content Type" "application/x-bittorrent"
|
|
|
|
WriteRegStr HKLM "Software\Classes\magnet" "" "URL:Magnet URI"
|
|
|
|
WriteRegStr HKLM "Software\Classes\magnet" "Content Type" "application/x-magnet"
|
|
|
|
WriteRegStr HKLM "Software\Classes\magnet" "URL Protocol" ""
|
|
|
|
|
|
|
|
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p 0, p 0)'
|
|
|
|
|
2013-01-23 19:06:50 +00:00
|
|
|
; Write the uninstall keys for Windows
|
2022-10-02 01:11:46 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "DisplayName" "qBittorrent"
|
2014-02-23 10:31:02 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "UninstallString" '"$INSTDIR\uninst.exe"'
|
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "DisplayIcon" '"$INSTDIR\qbittorrent.exe",0'
|
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "Publisher" "The qBittorrent project"
|
2017-12-26 23:22:03 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "URLInfoAbout" "https://www.qbittorrent.org"
|
2022-10-01 23:11:17 +00:00
|
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "DisplayVersion" "${QBT_VERSION}"
|
2014-02-23 10:31:02 +00:00
|
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "NoModify" 1
|
|
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "NoRepair" 1
|
2017-03-31 06:47:29 +00:00
|
|
|
WriteUninstaller "uninst.exe"
|
2013-01-27 18:46:40 +00:00
|
|
|
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
|
|
|
IntFmt $0 "0x%08X" $0
|
2014-02-23 10:31:02 +00:00
|
|
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "EstimatedSize" "$0"
|
2017-03-31 06:47:29 +00:00
|
|
|
|
2013-01-23 19:06:50 +00:00
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
; Optional section (can be disabled by the user)
|
2023-06-25 07:45:18 +00:00
|
|
|
Section /o $(inst_desktop) ;"Create Desktop Shortcut"
|
2013-01-23 19:06:50 +00:00
|
|
|
|
|
|
|
CreateShortCut "$DESKTOP\qBittorrent.lnk" "$INSTDIR\qbittorrent.exe"
|
2017-03-31 06:47:29 +00:00
|
|
|
|
2013-01-23 19:06:50 +00:00
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section $(inst_startmenu) ;"Create Start Menu Shortcut"
|
|
|
|
|
2017-03-31 06:47:29 +00:00
|
|
|
CreateDirectory "$SMPROGRAMS\qBittorrent"
|
2013-01-23 19:06:50 +00:00
|
|
|
CreateShortCut "$SMPROGRAMS\qBittorrent\qBittorrent.lnk" "$INSTDIR\qbittorrent.exe"
|
2021-04-08 03:39:03 +00:00
|
|
|
CreateShortCut "$SMPROGRAMS\qBittorrent\$(inst_uninstall_link_description).lnk" "$INSTDIR\uninst.exe"
|
2017-03-31 06:47:29 +00:00
|
|
|
|
2013-01-23 19:06:50 +00:00
|
|
|
SectionEnd
|
|
|
|
|
2020-02-02 11:01:55 +00:00
|
|
|
Section /o $(inst_startup) ;"Start qBittorrent on Windows start up"
|
|
|
|
|
|
|
|
!insertmacro UAC_AsUser_Call Function inst_startup_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
|
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Function inst_startup_user
|
|
|
|
|
|
|
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "qBittorrent" "$INSTDIR\qbittorrent.exe"
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2013-01-27 17:57:20 +00:00
|
|
|
Section $(inst_firewall)
|
|
|
|
|
2013-01-27 23:20:39 +00:00
|
|
|
DetailPrint $(inst_firewallinfo)
|
2017-03-31 06:47:29 +00:00
|
|
|
nsisFirewallW::AddAuthorizedApplication "$INSTDIR\qbittorrent.exe" "qBittorrent"
|
|
|
|
|
2013-01-27 17:57:20 +00:00
|
|
|
SectionEnd
|
|
|
|
|
2020-03-10 13:17:22 +00:00
|
|
|
Section $(inst_pathlimit) ;"Disable Windows path length limit (260 character MAX_PATH limitation, requires Windows 10 1607 or later)"
|
|
|
|
|
|
|
|
WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1
|
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
2013-01-23 19:06:50 +00:00
|
|
|
;--------------------------------
|
|
|
|
|
2014-07-28 16:29:51 +00:00
|
|
|
Function .onInit
|
|
|
|
|
|
|
|
!insertmacro Init "installer"
|
|
|
|
!insertmacro MUI_LANGDLL_DISPLAY
|
2020-03-07 18:02:21 +00:00
|
|
|
|
2023-10-20 06:04:56 +00:00
|
|
|
${IfNot} ${AtLeastWaaS} 1809 ; Windows 10 1809. Min supported version by Qt6
|
|
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION $(inst_requires_win10)
|
|
|
|
Abort
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
${IfNot} ${RunningX64}
|
|
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION $(inst_requires_64bit)
|
|
|
|
Abort
|
|
|
|
${EndIf}
|
2017-04-03 21:32:40 +00:00
|
|
|
|
2016-01-03 15:38:50 +00:00
|
|
|
;Search if qBittorrent is already installed.
|
|
|
|
FindFirst $0 $1 "$INSTDIR\uninst.exe"
|
|
|
|
FindClose $0
|
|
|
|
StrCmp $1 "" done
|
|
|
|
|
2017-04-05 00:04:59 +00:00
|
|
|
;Copy old value to var so we can call the correct uninstaller
|
|
|
|
StrCpy $uninstallerPath $INSTDIR
|
|
|
|
|
2016-01-03 15:38:50 +00:00
|
|
|
;Inform the user
|
|
|
|
MessageBox MB_OKCANCEL|MB_ICONINFORMATION $(inst_uninstall_question) /SD IDOK IDOK done
|
|
|
|
Quit
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
2013-01-23 19:06:50 +00:00
|
|
|
FunctionEnd
|
2013-01-27 22:44:51 +00:00
|
|
|
|
|
|
|
Function check_instance
|
|
|
|
|
2014-07-28 16:29:51 +00:00
|
|
|
check:
|
|
|
|
FindProcDLL::FindProc "qbittorrent.exe"
|
|
|
|
StrCmp $R0 "1" 0 notfound
|
|
|
|
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(inst_warning) IDRETRY check IDCANCEL done
|
|
|
|
|
|
|
|
done:
|
|
|
|
Abort
|
|
|
|
|
|
|
|
notfound:
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function PageFinishRun
|
|
|
|
|
|
|
|
!insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\qbittorrent.exe" "" "" ""
|
2013-01-27 22:44:51 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
2017-03-31 06:49:23 +00:00
|
|
|
|
|
|
|
Function .onInstSuccess
|
|
|
|
SetErrorLevel 0
|
|
|
|
FunctionEnd
|