|
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
2 ;; |
|
3 ;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ;; All rights reserved. |
|
5 ;; Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ;; |
|
7 ;; This file is part of the tools applications of the Qt Toolkit. |
|
8 ;; |
|
9 ;; $QT_BEGIN_LICENSE:LGPL$ |
|
10 ;; No Commercial Usage |
|
11 ;; This file contains pre-release code and may not be distributed. |
|
12 ;; You may use this file in accordance with the terms and conditions |
|
13 ;; contained in the Technology Preview License Agreement accompanying |
|
14 ;; this package. |
|
15 ;; |
|
16 ;; GNU Lesser General Public License Usage |
|
17 ;; Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ;; General Public License version 2.1 as published by the Free Software |
|
19 ;; Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ;; packaging of this file. Please review the following information to |
|
21 ;; ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ;; |
|
24 ;; In addition, as a special exception, Nokia gives you certain additional |
|
25 ;; rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ;; version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ;; |
|
28 ;; If you have questions regarding the use of this file, please contact |
|
29 ;; Nokia at qt-info@nokia.com. |
|
30 ;; |
|
31 ;; |
|
32 ;; |
|
33 ;; |
|
34 ;; |
|
35 ;; |
|
36 ;; |
|
37 ;; |
|
38 ;; $QT_END_LICENSE$ |
|
39 ;; |
|
40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
41 ; UI Extension Module |
|
42 |
|
43 !ifdef MODULE_REGISTERUIEXT |
|
44 |
|
45 ;------------------------------------------------------------------------------------------------ |
|
46 !macro REGISTERUIEXT_INITIALIZE |
|
47 !include "includes\system.nsh" |
|
48 |
|
49 !ifndef MODULE_REGISTERUIEXT_QTDIR |
|
50 !ifdef MODULE_MINGW |
|
51 !define MODULE_REGISTERUIEXT_QTDIR $MINGW_INSTDIR |
|
52 !endif |
|
53 |
|
54 !ifdef MODULE_MSVC |
|
55 !define MODULE_REGISTERUIEXT_QTDIR $MSVC_INSTDIR |
|
56 !endif |
|
57 !endif |
|
58 |
|
59 !define MODULE_REGISTERUIEXT_INTERNAL_DESC "Trolltech.DesignerForm" |
|
60 !define MODULE_REGISTERUIEXT_DESC_DESIGNER "Open with Qt Designer" |
|
61 !define MODULE_REGISTERUIEXT_DESC_DEVENV "Open with Visual Studio .NET" |
|
62 !define MODULE_REGISTERUIEXT_FILE_DESC "Qt Designer File" |
|
63 !macroend |
|
64 |
|
65 ;------------------------------------------------------------------------------------------------ |
|
66 |
|
67 !macro REGISTERUIEXT_SECTIONS |
|
68 |
|
69 Function GetSelectedVSIP |
|
70 Push $0 |
|
71 Push $1 |
|
72 |
|
73 StrCpy $0 "" |
|
74 !ifdef MODULE_VSIP |
|
75 !ifdef VSIP_SEC01 |
|
76 SectionGetFlags ${VSIP_SEC01} $1 |
|
77 IntOp $1 $1 & 1 |
|
78 IntCmp $1 0 +2 |
|
79 StrCpy $0 "7.1" |
|
80 !endif |
|
81 !ifdef VSIP_SEC02 |
|
82 SectionGetFlags ${VSIP_SEC02} $1 |
|
83 IntOp $1 $1 & 1 |
|
84 IntCmp $1 0 +2 |
|
85 StrCpy $0 "8.0" |
|
86 !endif |
|
87 !endif |
|
88 |
|
89 Pop $1 |
|
90 Exch $0 |
|
91 FunctionEnd |
|
92 |
|
93 SectionGroup "File Associations" |
|
94 Section "UI Files (*.ui)" REGISTERUIEXT_SEC01 |
|
95 call ModuleRegisterUI |
|
96 SectionEnd |
|
97 SectionGroupEnd |
|
98 |
|
99 Function ModuleRegisterUI |
|
100 push $0 |
|
101 push $1 |
|
102 |
|
103 WriteRegDWORD SHCTX "$PRODUCT_UNIQUE_KEY" "UIExtRegistered" 1 |
|
104 WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}" "" "${MODULE_REGISTERUIEXT_FILE_DESC}" |
|
105 WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell" "" "open" |
|
106 |
|
107 Call GetSelectedVSIP |
|
108 Pop $1 |
|
109 |
|
110 StrCmp "$1" "" 0 RegisterVSIP |
|
111 WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell\open" "" "${MODULE_REGISTERUIEXT_DESC_DESIGNER}" |
|
112 WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell\open\command" "" "${MODULE_REGISTERUIEXT_QTDIR}\bin\designer.exe $\"%1$\"" |
|
113 WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\DefaultIcon" "" "${MODULE_REGISTERUIEXT_QTDIR}\bin\designer.exe,0" |
|
114 goto RegisterFinished |
|
115 |
|
116 RegisterVSIP: |
|
117 Push $1 |
|
118 Call GetVSInstallationDir |
|
119 Pop $0 |
|
120 |
|
121 WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell\open" "" "${MODULE_REGISTERUIEXT_DESC_DEVENV}" |
|
122 WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\shell\${MODULE_REGISTERUIEXT_DESC_DEVENV}\command" "" "$0\devenv.exe $\"%1$\"" |
|
123 WriteRegStr HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}\DefaultIcon" "" "$VSIP_INSTDIR\ui.ico" |
|
124 RegisterFinished: |
|
125 WriteRegStr HKCR ".ui" "" "${MODULE_REGISTERUIEXT_INTERNAL_DESC}" |
|
126 |
|
127 pop $1 |
|
128 pop $0 |
|
129 FunctionEnd |
|
130 |
|
131 !macroend |
|
132 |
|
133 ;------------------------------------------------------------------------------------------------ |
|
134 |
|
135 !macro REGISTERUIEXT_DESCRIPTION |
|
136 !insertmacro MUI_DESCRIPTION_TEXT ${REGISTERUIEXT_SEC01} "This will associate the file extention .ui with the Qt GUI editor." |
|
137 !macroend |
|
138 |
|
139 ;------------------------------------------------------------------------------------------------ |
|
140 |
|
141 !macro REGISTERUIEXT_STARTUP |
|
142 StrCmp $RUNNING_AS_ADMIN "true" +2 |
|
143 SectionSetFlags ${REGISTERUIEXT_SEC01} 16 |
|
144 !macroend |
|
145 |
|
146 ;------------------------------------------------------------------------------------------------ |
|
147 |
|
148 !macro REGISTERUIEXT_FINISH |
|
149 !macroend |
|
150 |
|
151 ;------------------------------------------------------------------------------------------------ |
|
152 |
|
153 !macro REGISTERUIEXT_UNSTARTUP |
|
154 !macroend |
|
155 |
|
156 ;------------------------------------------------------------------------------------------------ |
|
157 |
|
158 !macro REGISTERUIEXT_UNINSTALL |
|
159 Function un.ModuleRegisterUI |
|
160 push $1 |
|
161 ReadRegStr $1 HKCR ".ui" "" |
|
162 strcmp $1 "${MODULE_REGISTERUIEXT_INTERNAL_DESC}" 0 continue |
|
163 ; do not delete this key since a subkey openwithlist |
|
164 ; or open withprogid may exist |
|
165 WriteRegStr HKCR ".ui" "" "" |
|
166 continue: |
|
167 ; just delete it since nobody else is supposed to use it |
|
168 DeleteRegKey HKCR "${MODULE_REGISTERUIEXT_INTERNAL_DESC}" |
|
169 |
|
170 pop $1 |
|
171 FunctionEnd |
|
172 |
|
173 Section -un.ModuleRegisterUIExtSection |
|
174 push $0 |
|
175 ReadRegDWORD $0 SHCTX "$PRODUCT_UNIQUE_KEY" "UIExtRegistered" |
|
176 intcmp $0 1 0 DoneUnRegister |
|
177 call un.ModuleRegisterUI |
|
178 DoneUnRegister: |
|
179 pop $0 |
|
180 SectionEnd |
|
181 !macroend |
|
182 |
|
183 ;------------------------------------------------------------------------------------------------ |
|
184 |
|
185 !macro REGISTERUIEXT_UNFINISH |
|
186 !macroend |
|
187 |
|
188 ;------------------------------------------------------------------------------------------------ |
|
189 |
|
190 !else |
|
191 !macro REGISTERUIEXT_INITIALIZE |
|
192 !macroend |
|
193 !macro REGISTERUIEXT_SECTIONS |
|
194 !macroend |
|
195 !macro REGISTERUIEXT_DESCRIPTION |
|
196 !macroend |
|
197 !macro REGISTERUIEXT_STARTUP |
|
198 !macroend |
|
199 !macro REGISTERUIEXT_FINISH |
|
200 !macroend |
|
201 !macro REGISTERUIEXT_UNSTARTUP |
|
202 !macroend |
|
203 !macro REGISTERUIEXT_UNINSTALL |
|
204 !macroend |
|
205 !macro REGISTERUIEXT_UNFINISH |
|
206 !macroend |
|
207 !endif |