NSIS: Drop hardcoded qt's translation filenames
[qBittorrent.git] / dist / windows / options.nsi
blobe82a6361bbb6502de3b2fac5cc768ef1b69744d4
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 !include "WinVer.nsh"
18 !ifdef APP64BIT
19 !include "x64.nsh"
20 !endif
22 ;For the file association
23 !define SHCNE_ASSOCCHANGED 0x8000000
24 !define SHCNF_IDLIST 0
26 ;For special folder detection
27 !define CSIDL_APPDATA '0x1A' ;Application Data path
28 !define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
30 ; Program specific
31 !define PROG_VERSION "4.5.0"
33 !define MUI_FINISHPAGE_RUN
34 !define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
35 !define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
37 !ifndef APP64BIT
38 ; The name of the installer
39 Name "qBittorrent ${PROG_VERSION}"
41 ; The file to write
42 OutFile "qbittorrent_${PROG_VERSION}_setup.exe"
43 !else
44 ; The name of the installer
45 Name "qBittorrent ${PROG_VERSION} x64"
47 ; The file to write
48 OutFile "qbittorrent_${PROG_VERSION}_x64_setup.exe"
49 !endif
51 ;Installer Version Information
52 VIAddVersionKey "ProductName" "qBittorrent"
53 VIAddVersionKey "CompanyName" "The qBittorrent project"
54 VIAddVersionKey "LegalCopyright" "Copyright ©2006-2022 The qBittorrent project"
55 VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client"
56 VIAddVersionKey "FileVersion" "${PROG_VERSION}"
58 VIProductVersion "${PROG_VERSION}.0"
60 ; The default installation directory. It changes depending if we install in the 64bit dir or not.
61 ; A caveat of this is if a user has installed a 32bit version and then runs the 64bit installer
62 ; (which in turn launches the 32bit uninstaller first) the value will still point to the 32bit location.
63 ; The user has to manually uninstall the old version and THEN run the 64bit installer
64 !ifndef APP64BIT
65 InstallDir $PROGRAMFILES32\qBittorrent
66 !else
67 InstallDir $PROGRAMFILES64\qBittorrent
68 !endif
70 ; Registry key to check for directory (so if you install again, it will
71 ; overwrite the old one automatically)
72 InstallDirRegKey HKLM Software\qbittorrent InstallLocation
74 ; Request application privileges for Windows Vista
75 RequestExecutionLevel user
77 ;--------------------------------
78 ;General Settings
79 !define MUI_ABORTWARNING
80 !define MUI_HEADERIMAGE
81 !define MUI_COMPONENTSPAGE_NODESC
82 ;!define MUI_ICON "qbittorrent.ico"
83 !define MUI_LICENSEPAGE_CHECKBOX
84 !define MUI_LANGDLL_ALLLANGUAGES
86 ;--------------------------------
87 ;Remember the unistaller/installer language
88 !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
89 !define MUI_LANGDLL_REGISTRY_KEY "Software\qbittorrent"
90 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
92 ;--------------------------------
93 ;Installer Pages
94 !insertmacro MUI_PAGE_WELCOME
95 !insertmacro MUI_PAGE_LICENSE "license.txt"
96 !insertmacro MUI_PAGE_COMPONENTS
97 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE check_instance
98 !insertmacro MUI_PAGE_DIRECTORY
99 !insertmacro MUI_PAGE_INSTFILES
100 !insertmacro MUI_PAGE_FINISH
102 ;--------------------------------
103 ;Uninstaller Pages
104 !insertmacro MUI_UNPAGE_CONFIRM
105 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.check_instance
106 !insertmacro MUI_UNPAGE_COMPONENTS
107 !insertmacro MUI_UNPAGE_INSTFILES
109 !insertmacro MUI_RESERVEFILE_LANGDLL
110 ReserveFile "${NSISDIR}\Plugins\x86-unicode\FindProcDLL.dll"
111 ReserveFile "${NSISDIR}\Plugins\x86-unicode\UAC.dll"
113 !macro Init thing
114 uac_tryagain:
115 !insertmacro UAC_RunElevated
116 ${Switch} $0
117 ${Case} 0
118 ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
119 ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
120 ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
121 MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0
122 ${EndIf}
123 ;fall-through and die
124 ${Case} 1223
125 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, aborting!"
126 Quit
127 ${Case} 1062
128 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!"
129 Quit
130 ${Default}
131 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate , error $0"
132 Quit
133 ${EndSwitch}
135 SetShellVarContext all
136 !macroend