source: trunk/tools/installer/nsis/includes/instdir.nsh@ 166

Last change on this file since 166 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 11.0 KB
Line 
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2;;
3;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4;; Contact: Qt Software Information ([email protected])
5;;
6;; This file is part of the tools applications of the Qt Toolkit.
7;;
8;; $QT_BEGIN_LICENSE:LGPL$
9;; Commercial Usage
10;; Licensees holding valid Qt Commercial licenses may use this file in
11;; accordance with the Qt Commercial License Agreement provided with the
12;; Software or, alternatively, in accordance with the terms contained in
13;; a written agreement between you and Nokia.
14;;
15;; GNU Lesser General Public License Usage
16;; Alternatively, this file may be used under the terms of the GNU Lesser
17;; General Public License version 2.1 as published by the Free Software
18;; Foundation and appearing in the file LICENSE.LGPL included in the
19;; packaging of this file. Please review the following information to
20;; ensure the GNU Lesser General Public License version 2.1 requirements
21;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22;;
23;; In addition, as a special exception, Nokia gives you certain
24;; additional rights. These rights are described in the Nokia Qt LGPL
25;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26;; package.
27;;
28;; GNU General Public License Usage
29;; Alternatively, this file may be used under the terms of the GNU
30;; General Public License version 3.0 as published by the Free Software
31;; Foundation and appearing in the file LICENSE.GPL included in the
32;; packaging of this file. Please review the following information to
33;; ensure the GNU General Public License version 3.0 requirements will be
34;; met: http://www.gnu.org/copyleft/gpl.html.
35;;
36;; If you are unsure which license is appropriate for your use, please
37;; contact the sales department at [email protected].
38;; $QT_END_LICENSE$
39;;
40;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
41;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
42;;
43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
44!ifndef INSTDIR_1
45 !macro INSTDIR_INITIALIZE
46 !define MUI_DIRECTORYPAGE_VARIABLE $${INSTDIR_0}_INSTDIR
47 !ifdef ${INSTDIR_0}_ValidateDirectory
48 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "${INSTDIR_0}_ValidateDirectoryFunc"
49 !endif
50 !insertmacro MUI_PAGE_DIRECTORY
51 !macroend
52 !macro INSTDIR_FUNCTIONS
53 !macroend
54 !macro INSTDIR_STARTUP
55 !macroend
56!else
57!macro INSTDIR_INITIALIZE
58 !define INSTDIR_INI_FILE "instdir.ini"
59 !define INSTDIR_0_DIRFIELD "Field 10"
60 !define INSTDIR_0_TEXTFIELD "Field 13"
61 !define INSTDIR_1_DIRFIELD "Field 7"
62 !define INSTDIR_1_TEXTFIELD "Field 11"
63 !define INSTDIR_2_DIRFIELD "Field 5"
64 !define INSTDIR_2_TEXTFIELD "Field 8"
65 !define INSTDIR_3_DIRFIELD "Field 3"
66 !define INSTDIR_3_TEXTFIELD "Field 6"
67 !define INSTDIR_4_DIRFIELD "Field 2"
68 !define INSTDIR_4_TEXTFIELD "Field 4"
69 !define INSTDIR_5_DIRFIELD "Field 9"
70 !define INSTDIR_5_TEXTFIELD "Field 12"
71 !define INSTDIR_DIRHEIGHT 18
72
73 Page custom InitInstDirs UpdateInstDirs
74
75 LangString InstDirLicenseTitle ${LANG_ENGLISH} "Installation Directories"
76 LangString InstDirLicenseTitleDescription ${LANG_ENGLISH} "Select the directories where you want the software installed."
77!macroend
78
79!macro INSTDIR_FUNCTIONS
80 Function InitInstDirs
81 push $0
82 push $1
83 push $2
84 push $3
85
86 !insertmacro MUI_HEADER_TEXT "$(InstDirLicenseTitle)" "$(InstDirLicenseTitleDescription)"
87 strcpy $0 "129"
88
89!ifdef INSTDIR_0
90 SectionGetFlags ${${INSTDIR_0}_SEC01} $1
91!ifdef ${INSTDIR_0}_SEC02
92 SectionGetFlags ${${INSTDIR_0}_SEC02} $3
93 IntOp $1 $1 | $3
94!endif
95 IntOp $2 $1 & 1 ;just care about the first flag
96 StrCpy $1 "READONLY"
97 StrCmp "$2" "1" +2
98 StrCpy $1 "DISABLED"
99 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Flags" "$1"
100 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "Flags" "$1"
101 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Text" "${INSTDIR_0_TEXT}"
102 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "State" $${INSTDIR_0}_INSTDIR
103!else
104 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "Type" "Unknown"
105 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Type" "Unknown"
106 intop $0 $0 - ${INSTDIR_DIRHEIGHT}
107!endif
108!ifdef INSTDIR_1
109 SectionGetFlags ${${INSTDIR_1}_SEC01} $1
110!ifdef ${INSTDIR_1}_SEC02
111 SectionGetFlags ${${INSTDIR_1}_SEC02} $3
112 IntOp $1 $1 | $3
113!endif
114 IntOp $2 $1 & 1 ;just care about the first flag
115 StrCpy $1 "READONLY"
116 StrCmp "$2" "1" +2
117 StrCpy $1 "DISABLED"
118 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Flags" "$1"
119 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "Flags" "$1"
120 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Text" "${INSTDIR_1_TEXT}"
121 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "State" $${INSTDIR_1}_INSTDIR
122!else
123 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "Type" "Unknown"
124 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Type" "Unknown"
125 intop $0 $0 - ${INSTDIR_DIRHEIGHT}
126!endif
127!ifdef INSTDIR_2
128 SectionGetFlags ${${INSTDIR_2}_SEC01} $1
129!ifdef ${INSTDIR_2}_SEC02
130 SectionGetFlags ${${INSTDIR_2}_SEC02} $3
131 IntOp $1 $1 | $3
132!endif
133 IntOp $2 $1 & 1 ;just care about the first flag
134 StrCpy $1 "READONLY"
135 StrCmp "$2" "1" +2
136 StrCpy $1 "DISABLED"
137 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Flags" "$1"
138 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "Flags" "$1"
139 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Text" "${INSTDIR_2_TEXT}"
140 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "State" $${INSTDIR_2}_INSTDIR
141!else
142 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "Type" "Unknown"
143 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Type" "Unknown"
144 intop $0 $0 - ${INSTDIR_DIRHEIGHT}
145!endif
146!ifdef INSTDIR_3
147 SectionGetFlags ${${INSTDIR_3}_SEC01} $1
148!ifdef ${INSTDIR_3}_SEC02
149 SectionGetFlags ${${INSTDIR_3}_SEC02} $3
150 IntOp $1 $1 | $3
151!endif
152 IntOp $2 $1 & 1 ;just care about the first flag
153 StrCpy $1 "READONLY"
154 StrCmp "$2" "1" +2
155 StrCpy $1 "DISABLED"
156 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Flags" "$1"
157 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "Flags" "$1"
158 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Text" "${INSTDIR_3_TEXT}"
159 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "State" $${INSTDIR_3}_INSTDIR
160!else
161 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "Type" "Unknown"
162 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Type" "Unknown"
163 intop $0 $0 - ${INSTDIR_DIRHEIGHT}
164!endif
165!ifdef INSTDIR_4
166 SectionGetFlags ${${INSTDIR_4}_SEC01} $1
167!ifdef ${INSTDIR_4}_SEC02
168 SectionGetFlags ${${INSTDIR_4}_SEC02} $3
169 IntOp $1 $1 | $3
170!endif
171 IntOp $2 $1 & 1 ;just care about the first flag
172 StrCpy $1 "READONLY"
173 StrCmp "$2" "1" +2
174 StrCpy $1 "DISABLED"
175 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Flags" "$1"
176 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "Flags" "$1"
177 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Text" "${INSTDIR_4_TEXT}"
178 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "State" $${INSTDIR_4}_INSTDIR
179!else
180 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "Type" "Unknown"
181 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Type" "Unknown"
182 intop $0 $0 - ${INSTDIR_DIRHEIGHT}
183!endif
184!ifdef INSTDIR_5
185 SectionGetFlags ${${INSTDIR_5}_SEC01} $1
186!ifdef ${INSTDIR_5}_SEC02
187 SectionGetFlags ${${INSTDIR_5}_SEC02} $3
188 IntOp $1 $1 | $3
189!endif
190 IntOp $2 $1 & 1 ;just care about the first flag
191 StrCpy $1 "READONLY"
192 StrCmp "$2" "1" +2
193 StrCpy $1 "DISABLED"
194 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Flags" "$1"
195 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "Flags" "$1"
196 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Text" "${INSTDIR_5_TEXT}"
197 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "State" $${INSTDIR_5}_INSTDIR
198!else
199 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "Type" "Unknown"
200 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Type" "Unknown"
201 intop $0 $0 - ${INSTDIR_DIRHEIGHT}
202!endif
203
204 !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "Field 1" "Bottom" "$0"
205 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${INSTDIR_INI_FILE}"
206
207 pop $3
208 pop $2
209 pop $1
210 pop $0
211 FunctionEnd
212
213 Function UpdateInstDirs
214!ifdef INSTDIR_0
215 !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_0}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "State"
216 !ifdef ${INSTDIR_0}_ValidateDirectory
217 call ${INSTDIR_0}_ValidateDirectoryFunc
218 !endif
219!endif
220!ifdef INSTDIR_1
221 !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_1}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "State"
222 !ifdef ${INSTDIR_1}_ValidateDirectory
223 call ${INSTDIR_1}_ValidateDirectoryFunc
224 !endif
225!endif
226!ifdef INSTDIR_2
227 !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_2}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "State"
228 !ifdef ${INSTDIR_2}_ValidateDirectory
229 call ${INSTDIR_2}_ValidateDirectoryFunc
230 !endif
231!endif
232!ifdef INSTDIR_3
233 !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_3}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "State"
234 !ifdef ${INSTDIR_3}_ValidateDirectory
235 call ${INSTDIR_3}_ValidateDirectoryFunc
236 !endif
237!endif
238!ifdef INSTDIR_4
239 !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_4}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "State"
240 !ifdef ${INSTDIR_4}_ValidateDirectory
241 call ${INSTDIR_4}_ValidateDirectoryFunc
242 !endif
243!endif
244!ifdef INSTDIR_5
245 !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_5}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "State"
246 !ifdef ${INSTDIR_5}_ValidateDirectory
247 call ${INSTDIR_5}_ValidateDirectoryFunc
248 !endif
249!endif
250 FunctionEnd
251!macroend
252
253!macro INSTDIR_STARTUP
254 !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${INSTDIR_INI_FILE}"
255!macroend
256
257!endif ;ifndef INSTDIR_1
Note: See TracBrowser for help on using the repository browser.