Mercurial > projects > qtd
comparison tools/duic/treewalker.cpp @ 1:e78566595089
initial import
author | mandel |
---|---|
date | Mon, 11 May 2009 16:01:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:36fb74dc547d | 1:e78566595089 |
---|---|
1 /**************************************************************************** | |
2 ** | |
3 ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). | |
4 ** Contact: Qt Software Information (qt-info@nokia.com) | |
5 ** | |
6 ** This file is part of the tools applications of the Qt Toolkit. | |
7 ** | |
8 ** Commercial Usage | |
9 ** Licensees holding valid Qt Commercial licenses may use this file in | |
10 ** accordance with the Qt Commercial License Agreement provided with the | |
11 ** Software or, alternatively, in accordance with the terms contained in | |
12 ** a written agreement between you and Nokia. | |
13 ** | |
14 ** | |
15 ** GNU General Public License Usage | |
16 ** Alternatively, this file may be used under the terms of the GNU | |
17 ** General Public License versions 2.0 or 3.0 as published by the Free | |
18 ** Software Foundation and appearing in the file LICENSE.GPL included in | |
19 ** the packaging of this file. Please review the following information | |
20 ** to ensure GNU General Public Licensing requirements will be met: | |
21 ** http://www.fsf.org/licensing/licenses/info/GPLv2.html and | |
22 ** http://www.gnu.org/copyleft/gpl.html. In addition, as a special | |
23 ** exception, Nokia gives you certain additional rights. These rights | |
24 ** are described in the Nokia Qt GPL Exception version 1.3, included in | |
25 ** the file GPL_EXCEPTION.txt in this package. | |
26 ** | |
27 ** Qt for Windows(R) Licensees | |
28 ** As a special exception, Nokia, as the sole copyright holder for Qt | |
29 ** Designer, grants users of the Qt/Eclipse Integration plug-in the | |
30 ** right for the Qt/Eclipse Integration to link to functionality | |
31 ** provided by Qt Designer and its related libraries. | |
32 ** | |
33 ** If you are unsure which license is appropriate for your use, please | |
34 ** contact the sales department at qt-sales@nokia.com. | |
35 ** | |
36 ****************************************************************************/ | |
37 | |
38 #include "treewalker.h" | |
39 #include "ui4.h" | |
40 | |
41 QT_BEGIN_NAMESPACE | |
42 | |
43 void TreeWalker::acceptUI(DomUI *ui) | |
44 { | |
45 acceptWidget(ui->elementWidget()); | |
46 acceptTabStops(ui->elementTabStops()); | |
47 | |
48 if (ui->elementImages()) | |
49 acceptImages(ui->elementImages()); | |
50 } | |
51 | |
52 void TreeWalker::acceptLayoutDefault(DomLayoutDefault *layoutDefault) | |
53 { | |
54 Q_UNUSED(layoutDefault); | |
55 } | |
56 | |
57 void TreeWalker::acceptLayoutFunction(DomLayoutFunction *layoutFunction) | |
58 { | |
59 Q_UNUSED(layoutFunction); | |
60 } | |
61 | |
62 void TreeWalker::acceptTabStops(DomTabStops *tabStops) | |
63 { | |
64 Q_UNUSED(tabStops); | |
65 } | |
66 | |
67 void TreeWalker::acceptLayout(DomLayout *layout) | |
68 { | |
69 for (int i=0; i<layout->elementProperty().size(); ++i) | |
70 acceptProperty(layout->elementProperty().at(i)); | |
71 | |
72 for (int i=0; i<layout->elementItem().size(); ++i) | |
73 acceptLayoutItem(layout->elementItem().at(i)); | |
74 } | |
75 | |
76 void TreeWalker::acceptLayoutItem(DomLayoutItem *layoutItem) | |
77 { | |
78 switch (layoutItem->kind()) { | |
79 case DomLayoutItem::Widget: | |
80 acceptWidget(layoutItem->elementWidget()); | |
81 return; | |
82 case DomLayoutItem::Layout: | |
83 acceptLayout(layoutItem->elementLayout()); | |
84 return; | |
85 case DomLayoutItem::Spacer: | |
86 acceptSpacer(layoutItem->elementSpacer()); | |
87 return; | |
88 case DomLayoutItem::Unknown: | |
89 break; | |
90 } | |
91 | |
92 Q_ASSERT( 0 ); | |
93 } | |
94 | |
95 void TreeWalker::acceptWidget(DomWidget *widget) | |
96 { | |
97 for (int i=0; i<widget->elementAction().size(); ++i) | |
98 acceptAction(widget->elementAction().at(i)); | |
99 | |
100 for (int i=0; i<widget->elementActionGroup().size(); ++i) | |
101 acceptActionGroup(widget->elementActionGroup().at(i)); | |
102 | |
103 for (int i=0; i<widget->elementAddAction().size(); ++i) | |
104 acceptActionRef(widget->elementAddAction().at(i)); | |
105 | |
106 for (int i=0; i<widget->elementProperty().size(); ++i) | |
107 acceptProperty(widget->elementProperty().at(i)); | |
108 | |
109 | |
110 | |
111 // recurse down | |
112 DomWidgets childWidgets; | |
113 for (int i=0; i<widget->elementWidget().size(); ++i) { | |
114 DomWidget *child = widget->elementWidget().at(i); | |
115 childWidgets += child; | |
116 acceptWidget(child); | |
117 } | |
118 | |
119 if (!widget->elementLayout().isEmpty()) | |
120 acceptLayout(widget->elementLayout().at(0)); | |
121 | |
122 const DomScripts scripts(widget->elementScript()); | |
123 acceptWidgetScripts(scripts, widget, childWidgets); | |
124 } | |
125 | |
126 void TreeWalker::acceptSpacer(DomSpacer *spacer) | |
127 { | |
128 for (int i=0; i<spacer->elementProperty().size(); ++i) | |
129 acceptProperty(spacer->elementProperty().at(i)); | |
130 } | |
131 | |
132 void TreeWalker::acceptColor(DomColor *color) | |
133 { | |
134 Q_UNUSED(color); | |
135 } | |
136 | |
137 void TreeWalker::acceptColorGroup(DomColorGroup *colorGroup) | |
138 { | |
139 Q_UNUSED(colorGroup); | |
140 } | |
141 | |
142 void TreeWalker::acceptPalette(DomPalette *palette) | |
143 { | |
144 acceptColorGroup(palette->elementActive()); | |
145 acceptColorGroup(palette->elementInactive()); | |
146 acceptColorGroup(palette->elementDisabled()); | |
147 } | |
148 | |
149 void TreeWalker::acceptFont(DomFont *font) | |
150 { | |
151 Q_UNUSED(font); | |
152 } | |
153 | |
154 void TreeWalker::acceptPoint(DomPoint *point) | |
155 { | |
156 Q_UNUSED(point); | |
157 } | |
158 | |
159 void TreeWalker::acceptRect(DomRect *rect) | |
160 { | |
161 Q_UNUSED(rect); | |
162 } | |
163 | |
164 void TreeWalker::acceptSizePolicy(DomSizePolicy *sizePolicy) | |
165 { | |
166 Q_UNUSED(sizePolicy); | |
167 } | |
168 | |
169 void TreeWalker::acceptSize(DomSize *size) | |
170 { | |
171 Q_UNUSED(size); | |
172 } | |
173 | |
174 void TreeWalker::acceptDate(DomDate *date) | |
175 { | |
176 Q_UNUSED(date); | |
177 } | |
178 | |
179 void TreeWalker::acceptTime(DomTime *time) | |
180 { | |
181 Q_UNUSED(time); | |
182 } | |
183 | |
184 void TreeWalker::acceptDateTime(DomDateTime *dateTime) | |
185 { | |
186 Q_UNUSED(dateTime); | |
187 } | |
188 | |
189 void TreeWalker::acceptProperty(DomProperty *property) | |
190 { | |
191 switch (property->kind()) { | |
192 case DomProperty::Bool: | |
193 case DomProperty::Color: | |
194 case DomProperty::Cstring: | |
195 case DomProperty::Cursor: | |
196 case DomProperty::CursorShape: | |
197 case DomProperty::Enum: | |
198 case DomProperty::Font: | |
199 case DomProperty::Pixmap: | |
200 case DomProperty::IconSet: | |
201 case DomProperty::Palette: | |
202 case DomProperty::Point: | |
203 case DomProperty::PointF: | |
204 case DomProperty::Rect: | |
205 case DomProperty::RectF: | |
206 case DomProperty::Set: | |
207 case DomProperty::Locale: | |
208 case DomProperty::SizePolicy: | |
209 case DomProperty::Size: | |
210 case DomProperty::SizeF: | |
211 case DomProperty::String: | |
212 case DomProperty::Number: | |
213 case DomProperty::LongLong: | |
214 case DomProperty::Char: | |
215 case DomProperty::Date: | |
216 case DomProperty::Time: | |
217 case DomProperty::DateTime: | |
218 case DomProperty::Url: | |
219 case DomProperty::Unknown: | |
220 case DomProperty::StringList: | |
221 case DomProperty::Float: | |
222 case DomProperty::Double: | |
223 case DomProperty::UInt: | |
224 case DomProperty::ULongLong: | |
225 case DomProperty::Brush: | |
226 break; | |
227 } | |
228 } | |
229 | |
230 void TreeWalker::acceptCustomWidgets(DomCustomWidgets *customWidgets) | |
231 { | |
232 for (int i=0; i<customWidgets->elementCustomWidget().size(); ++i) | |
233 acceptCustomWidget(customWidgets->elementCustomWidget().at(i)); | |
234 } | |
235 | |
236 void TreeWalker::acceptCustomWidget(DomCustomWidget *customWidget) | |
237 { | |
238 Q_UNUSED(customWidget); | |
239 } | |
240 | |
241 void TreeWalker::acceptAction(DomAction *action) | |
242 { | |
243 Q_UNUSED(action); | |
244 } | |
245 | |
246 void TreeWalker::acceptActionGroup(DomActionGroup *actionGroup) | |
247 { | |
248 for (int i=0; i<actionGroup->elementAction().size(); ++i) | |
249 acceptAction(actionGroup->elementAction().at(i)); | |
250 | |
251 for (int i=0; i<actionGroup->elementActionGroup().size(); ++i) | |
252 acceptActionGroup(actionGroup->elementActionGroup().at(i)); | |
253 } | |
254 | |
255 void TreeWalker::acceptActionRef(DomActionRef *actionRef) | |
256 { | |
257 Q_UNUSED(actionRef); | |
258 } | |
259 | |
260 void TreeWalker::acceptImages(DomImages *images) | |
261 { | |
262 for (int i=0; i<images->elementImage().size(); ++i) | |
263 acceptImage(images->elementImage().at(i)); | |
264 } | |
265 | |
266 void TreeWalker::acceptImage(DomImage *image) | |
267 { | |
268 Q_UNUSED(image); | |
269 } | |
270 | |
271 void TreeWalker::acceptIncludes(DomIncludes *includes) | |
272 { | |
273 for (int i=0; i<includes->elementInclude().size(); ++i) | |
274 acceptInclude(includes->elementInclude().at(i)); | |
275 } | |
276 | |
277 void TreeWalker::acceptInclude(DomInclude *incl) | |
278 { | |
279 Q_UNUSED(incl); | |
280 } | |
281 | |
282 void TreeWalker::acceptConnections(DomConnections *connections) | |
283 { | |
284 for (int i=0; i<connections->elementConnection().size(); ++i) | |
285 acceptConnection(connections->elementConnection().at(i)); | |
286 } | |
287 | |
288 void TreeWalker::acceptConnection(DomConnection *connection) | |
289 { | |
290 acceptConnectionHints(connection->elementHints()); | |
291 } | |
292 | |
293 void TreeWalker::acceptConnectionHints(DomConnectionHints *connectionHints) | |
294 { | |
295 for (int i=0; i<connectionHints->elementHint().size(); ++i) | |
296 acceptConnectionHint(connectionHints->elementHint().at(i)); | |
297 } | |
298 | |
299 void TreeWalker::acceptConnectionHint(DomConnectionHint *connectionHint) | |
300 { | |
301 Q_UNUSED(connectionHint); | |
302 } | |
303 | |
304 void TreeWalker::acceptWidgetScripts(const DomScripts &, DomWidget *, const DomWidgets &) | |
305 { | |
306 } | |
307 | |
308 QT_END_NAMESPACE |