Bump to 4.1.2
[qBittorrent.git] / dist / windows / options.nsi
bloba44b56d4bf5e6424af0bc72d33b2472bcafaab5a
1 Unicode true
2 ManifestDPIAware true
3 ;Compress the header too
4 !packhdr "$%TEMP%\exehead.tmp" 'upx.exe -9 --best --ultra-brute "$%TEMP%\exehead.tmp"'
6 ;Setting the compression
7 SetCompressor /SOLID LZMA
8 SetCompressorDictSize 64
9 XPStyle on
11 ;Uncomment when packaging 64bit qbittorrent
12 ;!define APP64BIT
14 !include "MUI.nsh"
15 !include "UAC.nsh"
16 !include "FileFunc.nsh"
17 !ifdef APP64BIT
18 !include "x64.nsh"
19 !endif
21 ;For the file association
22 !define SHCNE_ASSOCCHANGED 0x8000000
23 !define SHCNF_IDLIST 0
25 ;For special folder detection
26 !define CSIDL_APPDATA '0x1A' ;Application Data path
27 !define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
29 ; Program specific
30 !define PROG_VERSION "4.1.2"
32 !define MUI_FINISHPAGE_RUN
33 !define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
34 !define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
36 !ifndef APP64BIT
37 ; The name of the installer
38 Name "qBittorrent ${PROG_VERSION}"
40 ; The file to write
41 OutFile "qbittorrent_${PROG_VERSION}_setup.exe"
42 !else
43 ; The name of the installer
44 Name "qBittorrent ${PROG_VERSION} x64"
46 ; The file to write
47 OutFile "qbittorrent_${PROG_VERSION}_x64_setup.exe"
48 !endif
50 ;Installer Version Information
51 VIAddVersionKey "ProductName" "qBittorrent"
52 VIAddVersionKey "CompanyName" "The qBittorrent project"
53 VIAddVersionKey "LegalCopyright" "Copyright ©2006-2018 The qBittorrent project"
54 VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client"
55 VIAddVersionKey "FileVersion" "${PROG_VERSION}"
57 VIProductVersion "${PROG_VERSION}.0"
59 ; The default installation directory. It changes depending if we install in the 64bit dir or not.
60 ; A caveat of this is if a user has installed a 32bit version and then runs the 64bit installer
61 ; (which in turn launches the 32bit uninstaller first) the value will still point to the 32bit location.
62 ; The user has to manually uninstall the old version and THEN run the 64bit installer
63 !ifndef APP64BIT
64 InstallDir $PROGRAMFILES32\qBittorrent
65 !else
66 InstallDir $PROGRAMFILES64\qBittorrent
67 !endif
69 ; Registry key to check for directory (so if you install again, it will
70 ; overwrite the old one automatically)
71 InstallDirRegKey HKLM Software\qbittorrent InstallLocation
73 ; Request application privileges for Windows Vista
74 RequestExecutionLevel user
76 ;--------------------------------
77 ;General Settings
78 !define MUI_ABORTWARNING
79 !define MUI_HEADERIMAGE
80 !define MUI_COMPONENTSPAGE_NODESC
81 ;!define MUI_ICON "qbittorrent.ico"
82 !define MUI_LICENSEPAGE_CHECKBOX
83 !define MUI_LANGDLL_ALLLANGUAGES
85 ;--------------------------------
86 ;Remember the unistaller/installer language
87 !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
88 !define MUI_LANGDLL_REGISTRY_KEY "Software\qbittorrent"
89 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
91 ;--------------------------------
92 ;Installer Pages
93 !insertmacro MUI_PAGE_WELCOME
94 !insertmacro MUI_PAGE_LICENSE "license.txt"
95 !insertmacro MUI_PAGE_COMPONENTS
96 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE check_instance
97 !insertmacro MUI_PAGE_DIRECTORY
98 !insertmacro MUI_PAGE_INSTFILES
99 !insertmacro MUI_PAGE_FINISH
101 ;--------------------------------
102 ;Uninstaller Pages
103 !insertmacro MUI_UNPAGE_CONFIRM
104 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.check_instance
105 !insertmacro MUI_UNPAGE_COMPONENTS
106 !insertmacro MUI_UNPAGE_INSTFILES
108 !insertmacro MUI_RESERVEFILE_LANGDLL
109 ReserveFile "${NSISDIR}\Plugins\x86-unicode\FindProcDLL.dll"
110 ReserveFile "${NSISDIR}\Plugins\x86-unicode\UAC.dll"
112 !macro Init thing
113 uac_tryagain:
114 !insertmacro UAC_RunElevated
115 ${Switch} $0
116 ${Case} 0
117 ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
118 ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
119 ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
120 MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0
121 ${EndIf}
122 ;fall-through and die
123 ${Case} 1223
124 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, aborting!"
125 Quit
126 ${Case} 1062
127 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!"
128 Quit
129 ${Default}
130 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate , error $0"
131 Quit
132 ${EndSwitch}
134 SetShellVarContext all
135 !macroend