1 | /**********************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved.
|
---|
4 | **
|
---|
5 | ** This file is part of Qt Designer.
|
---|
6 | **
|
---|
7 | ** This file may be distributed and/or modified under the terms of the
|
---|
8 | ** GNU General Public License version 2 as published by the Free Software
|
---|
9 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
10 | ** packaging of this file.
|
---|
11 | **
|
---|
12 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
13 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
14 | ** Agreement provided with the Software.
|
---|
15 | **
|
---|
16 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
17 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
18 | **
|
---|
19 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
20 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
21 | ** information about Qt Commercial License Agreements.
|
---|
22 | **
|
---|
23 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
24 | ** not clear to you.
|
---|
25 | **
|
---|
26 | **********************************************************************/
|
---|
27 |
|
---|
28 | #include "kdevdlg2ui.h"
|
---|
29 | #include <qdir.h>
|
---|
30 | #include <qstring.h>
|
---|
31 | #include <qptrstack.h>
|
---|
32 |
|
---|
33 | /// some little helpers ///
|
---|
34 |
|
---|
35 | void KDEVDLG2UI::wi()
|
---|
36 | {
|
---|
37 | for ( int i = 0; i < indentation; i++ )
|
---|
38 | *out << " ";
|
---|
39 | }
|
---|
40 |
|
---|
41 | void KDEVDLG2UI::indent()
|
---|
42 | {
|
---|
43 | indentation++;
|
---|
44 | }
|
---|
45 |
|
---|
46 | void KDEVDLG2UI::undent()
|
---|
47 | {
|
---|
48 | indentation--;
|
---|
49 | }
|
---|
50 |
|
---|
51 | void KDEVDLG2UI::writeClass( const QString& name )
|
---|
52 | {
|
---|
53 | wi(); *out << "<class>" << name << "</class>" << endl;
|
---|
54 | }
|
---|
55 |
|
---|
56 | void KDEVDLG2UI::writeWidgetStart( const QString& qclass )
|
---|
57 | {
|
---|
58 | wi(); *out << "<widget class=\"" << qclass << "\">" << endl;
|
---|
59 | }
|
---|
60 |
|
---|
61 | void KDEVDLG2UI::writeWidgetEnd()
|
---|
62 | {
|
---|
63 | wi(); *out << "</widget>" << endl;
|
---|
64 | }
|
---|
65 |
|
---|
66 | void KDEVDLG2UI::writeCString( const QString& name, const QString& value )
|
---|
67 | {
|
---|
68 | wi(); *out << "<property>" << endl; indent();
|
---|
69 | wi(); *out << "<name>" << name << "</name>" << endl;
|
---|
70 | wi(); *out << "<cstring>" << value << "</cstring>" << endl; undent();
|
---|
71 | wi(); *out << "</property>" << endl;
|
---|
72 | }
|
---|
73 |
|
---|
74 | void KDEVDLG2UI::writeString( const QString& name, const QString& value )
|
---|
75 | {
|
---|
76 | wi(); *out << "<property>" << endl; indent();
|
---|
77 | wi(); *out << "<name>" << name << "</name>" << endl;
|
---|
78 | wi(); *out << "<string>" << value << "</string>" << endl; undent();
|
---|
79 | wi(); *out << "</property>" << endl;
|
---|
80 | }
|
---|
81 |
|
---|
82 | void KDEVDLG2UI::writeRect( const QString& name, int x, int y, int w, int h )
|
---|
83 | {
|
---|
84 | wi(); *out << "<property>" << endl; indent();
|
---|
85 | wi(); *out << "<name>" << name << "</name>" << endl;
|
---|
86 | wi(); *out << "<rect>" << endl; indent();
|
---|
87 | wi(); *out << "<x>" << x << "</x>" << endl;
|
---|
88 | wi(); *out << "<y>" << y << "</y>" << endl;
|
---|
89 | wi(); *out << "<width>" << w << "</width>" << endl;
|
---|
90 | wi(); *out << "<height>" << h << "</height>" << endl; undent();
|
---|
91 | wi(); *out << "</rect>" << endl; undent();
|
---|
92 | wi(); *out << "</property>" << endl;
|
---|
93 | }
|
---|
94 |
|
---|
95 | void KDEVDLG2UI::writeFont( const QString& family, int pointsize )
|
---|
96 | {
|
---|
97 | wi(); *out << "<property>" << endl; indent();
|
---|
98 | wi(); *out << "<name>font</name>" << endl;
|
---|
99 | wi(); *out << "<font>" << endl; indent();
|
---|
100 | wi(); *out << "<family>" << family << "</family>" << endl;
|
---|
101 | wi(); *out << "<pointsize>" << pointsize << "</pointsize>" << endl; undent();
|
---|
102 | wi(); *out << "</font>" << endl; undent();
|
---|
103 | wi(); *out << "</property>" << endl;
|
---|
104 | }
|
---|
105 |
|
---|
106 | void KDEVDLG2UI::writeBool( const QString& name, bool value )
|
---|
107 | {
|
---|
108 | wi(); *out << "<property>" << endl; indent();
|
---|
109 | wi(); *out << "<name>" << name << "</name>" << endl;
|
---|
110 | wi(); *out << "<bool>" << (value ? "true" : "false") << "</bool>" << endl; undent();
|
---|
111 | wi(); *out << "</property>" << endl;
|
---|
112 | }
|
---|
113 |
|
---|
114 | void KDEVDLG2UI::writeNumber( const QString& name, int value )
|
---|
115 | {
|
---|
116 | wi(); *out << "<property>" << endl; indent();
|
---|
117 | wi(); *out << "<name>" << name << "</name>" << endl;
|
---|
118 | wi(); *out << "<number>" << value << "</number>" << endl; undent();
|
---|
119 | wi(); *out << "</property>" << endl;
|
---|
120 | }
|
---|
121 |
|
---|
122 | void KDEVDLG2UI::writeEnum( const QString& name, const QString& value )
|
---|
123 | {
|
---|
124 | wi(); *out << "<property>" << endl; indent();
|
---|
125 | wi(); *out << "<name>" << name << "</name>" << endl;
|
---|
126 | wi(); *out << "<enum>" << value << "</enum>" << endl; undent();
|
---|
127 | wi(); *out << "</property>" << endl;
|
---|
128 | }
|
---|
129 |
|
---|
130 | void KDEVDLG2UI::writeSet( const QString& name, const QString& value )
|
---|
131 | {
|
---|
132 | wi(); *out << "<property>" << endl; indent();
|
---|
133 | wi(); *out << "<name>" << name << "</name>" << endl;
|
---|
134 | wi(); *out << "<set>" << value << "</set>" << endl; undent();
|
---|
135 | wi(); *out << "</property>" << endl;
|
---|
136 | }
|
---|
137 |
|
---|
138 | void KDEVDLG2UI::writeItem( const QString& name, const QString& value )
|
---|
139 | {
|
---|
140 | wi(); *out << "<item>" << endl; indent();
|
---|
141 | writeString( name, value ); undent();
|
---|
142 | wi(); *out << "</item>" << endl;
|
---|
143 | }
|
---|
144 |
|
---|
145 | void KDEVDLG2UI::writeColumn( const QString& name, const QString& value )
|
---|
146 | {
|
---|
147 | wi(); *out << "<column>" << endl; indent();
|
---|
148 | writeString( name, value ); undent();
|
---|
149 | wi(); *out << "</column>" << endl;
|
---|
150 | }
|
---|
151 |
|
---|
152 | void KDEVDLG2UI::writeColor( const QString& name, const QString& value )
|
---|
153 | {
|
---|
154 | int color = value.toInt();
|
---|
155 |
|
---|
156 | int r = color & 0x00ff0000 >> 16;
|
---|
157 | int g = color & 0x0000ff00 >> 8;
|
---|
158 | int b = color & 0x000000ff;
|
---|
159 |
|
---|
160 | wi(); *out << "<property>" << endl; indent(); //###FIX
|
---|
161 | wi(); *out << "<name>" << name << "</name>" << endl;
|
---|
162 | wi(); *out << "<color>" << endl; indent();
|
---|
163 | wi(); *out << "<red>" << r << "</red>" << endl;
|
---|
164 | wi(); *out << "<green>" << g << "</green>" << endl;
|
---|
165 | wi(); *out << "<blue>" << b << "</blue>" << endl; undent();
|
---|
166 | wi(); *out << "</color>" << endl;
|
---|
167 | wi(); *out << "</property>" << endl;
|
---|
168 | }
|
---|
169 |
|
---|
170 | void KDEVDLG2UI::writeStyles( const QStringList styles, bool isFrame )
|
---|
171 | {
|
---|
172 | if ( isFrame ) {
|
---|
173 | bool defineFrame = FALSE;
|
---|
174 | QString shadow = "NoFrame";
|
---|
175 | QString shape = "StyledPanel";
|
---|
176 | int width = 2;
|
---|
177 | if ( styles.contains( "WS_EX_STATICEDGE" ) ) {
|
---|
178 | shadow = "Plain";
|
---|
179 | width = 1;
|
---|
180 | defineFrame = TRUE;
|
---|
181 | }
|
---|
182 | if ( styles.contains( "WS_EX_CLIENTEDGE" ) ) {
|
---|
183 | shadow = "Sunken";
|
---|
184 | defineFrame = TRUE;
|
---|
185 | }
|
---|
186 | if ( styles.contains( "WS_EX_DLGMODALFRAME" ) ) {
|
---|
187 | shadow = "Raised";
|
---|
188 | defineFrame = TRUE;
|
---|
189 | }
|
---|
190 | if ( !styles.contains( "WS_BORDER" ) ) {
|
---|
191 | shape = "NoFrame";
|
---|
192 | defineFrame = TRUE;
|
---|
193 | }
|
---|
194 |
|
---|
195 | if ( defineFrame ) {
|
---|
196 | writeEnum( "frameShape", "StyledPanel" );
|
---|
197 | writeEnum( "frameShadow", shadow );
|
---|
198 | writeNumber( "lineWidth", width );
|
---|
199 | }
|
---|
200 | }
|
---|
201 |
|
---|
202 | if ( styles.contains("WS_DISABLED") )
|
---|
203 | writeBool("enabled", FALSE );
|
---|
204 | if ( styles.contains("WS_EX_ACCEPTFILES") )
|
---|
205 | writeBool("acceptDrops", TRUE );
|
---|
206 | if ( styles.contains("WS_EX_TRANSPARENT") )
|
---|
207 | writeBool("autoMask", TRUE );
|
---|
208 | if ( !styles.contains("WS_TABSTOP") )
|
---|
209 | writeEnum("focusPolicy", "NoFocus");
|
---|
210 | }
|
---|
211 |
|
---|
212 | /*!
|
---|
213 | Constructs a KDEVDLG2UI object
|
---|
214 | */
|
---|
215 |
|
---|
216 | KDEVDLG2UI::KDEVDLG2UI( QTextStream* input, const QString& name )
|
---|
217 | {
|
---|
218 | className = name;
|
---|
219 | writeToFile = TRUE;
|
---|
220 | in = input;
|
---|
221 | indentation = 0;
|
---|
222 | out = 0;
|
---|
223 | }
|
---|
224 |
|
---|
225 | /*!
|
---|
226 | Destructs the KDEVDLG2UI object
|
---|
227 | */
|
---|
228 |
|
---|
229 | KDEVDLG2UI::~KDEVDLG2UI()
|
---|
230 | {
|
---|
231 | }
|
---|
232 |
|
---|
233 | /*!
|
---|
234 | Parses the input stream and writes the output to files.
|
---|
235 | */
|
---|
236 |
|
---|
237 | bool KDEVDLG2UI::parse()
|
---|
238 | {
|
---|
239 | QFile fileOut;
|
---|
240 | QString buffer;
|
---|
241 |
|
---|
242 | if ( writeToFile ) {
|
---|
243 |
|
---|
244 | QString outputFile = QString( className ) + ".ui";
|
---|
245 | fileOut.setName( outputFile );
|
---|
246 | if (!fileOut.open( IO_WriteOnly ) )
|
---|
247 | qFatal( "kdevdlg2ui: Could not open output file '%s'", outputFile.latin1() );
|
---|
248 | out = new QTextStream( &fileOut );
|
---|
249 | targetFiles.append( outputFile );
|
---|
250 | } else {
|
---|
251 | out = new QTextStream( &buffer, IO_WriteOnly );
|
---|
252 | }
|
---|
253 |
|
---|
254 | writeDialog( className );
|
---|
255 |
|
---|
256 | delete out;
|
---|
257 | out = 0;
|
---|
258 |
|
---|
259 | return TRUE;
|
---|
260 | }
|
---|
261 |
|
---|
262 | /*!
|
---|
263 | Parses the input stream and writes the output in \a get.
|
---|
264 | */
|
---|
265 | bool KDEVDLG2UI::parse( QStringList& get )
|
---|
266 | {
|
---|
267 | writeToFile = FALSE;
|
---|
268 | bool result = parse();
|
---|
269 | get = target;
|
---|
270 | return result;
|
---|
271 | }
|
---|
272 |
|
---|
273 | /*!
|
---|
274 | Replaces characters like '&', '<' and '>' with the proper encoding.
|
---|
275 | */
|
---|
276 | void KDEVDLG2UI::cleanString( QString * text )
|
---|
277 | {
|
---|
278 | if ( !text ) return;
|
---|
279 | text->replace( "\\n", "\n" );
|
---|
280 | text->replace( "\\t", "\t" );
|
---|
281 | text->replace( "&", "&" );
|
---|
282 | text->replace( "<", "<" );
|
---|
283 | text->replace( ">", ">" );
|
---|
284 | }
|
---|
285 |
|
---|
286 | /*!
|
---|
287 | Builds a number of UI dialog out of the current input stream
|
---|
288 | */
|
---|
289 | bool KDEVDLG2UI::writeDialog( const QString& name )
|
---|
290 | {
|
---|
291 | *out << "<!DOCTYPE UI><UI>" << endl;
|
---|
292 | writeClass( name );
|
---|
293 |
|
---|
294 | while ( !in->eof() ) {
|
---|
295 |
|
---|
296 | line = in->readLine().simplifyWhiteSpace();
|
---|
297 |
|
---|
298 | if ( line.left( 4 ) == "data" ) {
|
---|
299 | // ignore data section
|
---|
300 | while ( line.left( 1 ) != "}" && !in->eof() ) {
|
---|
301 | line = in->readLine();
|
---|
302 | }
|
---|
303 | } else if ( line.left( 4 ) == "item" ) {
|
---|
304 | writeWidgetStart( line.section( "//", 0, 0 ).section( " ", 1, 1 ) );
|
---|
305 | } else if ( line.left( 1 ) == "{" ) {
|
---|
306 | indent();
|
---|
307 | } else if ( line.left( 1 ) == "}" ) {
|
---|
308 | undent();
|
---|
309 | writeWidgetEnd();
|
---|
310 | } else if ( line.left( 4 ) == "Name" ) {
|
---|
311 | QString name = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
312 | writeString( "name", name );
|
---|
313 | } else if ( line.left( 4 ) == "Font" ) {
|
---|
314 | QString font = line.section( "//", 0, 0 ).section( "\"", 1 );
|
---|
315 | QString family = font.section("\"", 1, 1 );
|
---|
316 | int pointSize = font.section("\"", 3, 3 ).toInt();
|
---|
317 | //int weight = font.section("\"", 5, 5 ).toInt();
|
---|
318 | //bool italic = ( font.section("\"", 7, 7 ) == "TRUE" );
|
---|
319 | writeFont( family, pointSize ); // weight, italic ?
|
---|
320 | } else if ( line.left( 9 ) == "IsEnabled" ) {
|
---|
321 | bool isEnabled =
|
---|
322 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
323 | writeBool( "enabled", isEnabled );
|
---|
324 | } else if ( line.left( 12 ) == "AcceptsDrops" ) {
|
---|
325 | bool acceptDrops =
|
---|
326 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
327 | writeBool( "acceptDrops", acceptDrops );
|
---|
328 | } else if ( line.left( 12 ) == "isAutoResize" ) {
|
---|
329 | bool isAutoResize =
|
---|
330 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
331 | writeBool( "autoResize", isAutoResize ); //###FIX: obsolete
|
---|
332 | } else if ( line.left( 12 ) == "isAutoRepeat" ) {
|
---|
333 | bool isAutoRepeat =
|
---|
334 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
335 | writeBool( "autoRepeat", isAutoRepeat );
|
---|
336 | } else if ( line.left( 9 ) == "isDefault" ) {
|
---|
337 | bool isDefault =
|
---|
338 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
339 | writeBool( "default", isDefault );
|
---|
340 | } else if ( line.left( 13 ) == "isAutoDefault" ) {
|
---|
341 | bool isAutoDefault =
|
---|
342 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
343 | writeBool( "autoDefault", isAutoDefault );
|
---|
344 | } else if ( line.left( 14 ) == "isToggleButton" ) {
|
---|
345 | bool isToggleButton =
|
---|
346 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
347 | writeBool( "toggleButton", isToggleButton );
|
---|
348 | } else if ( line.left( 11 ) == "isToggledOn" ) {
|
---|
349 | bool isToggledOn =
|
---|
350 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
351 | writeBool( "on", isToggledOn );
|
---|
352 | } else if ( line.left( 8 ) == "hasFrame" ) {
|
---|
353 | bool hasFrame =
|
---|
354 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
355 | writeBool( "frame", hasFrame );
|
---|
356 | } else if ( line.left( 10 ) == "isReadOnly" ) {
|
---|
357 | bool isReadOnly =
|
---|
358 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
359 | writeBool( "readOnly", isReadOnly );
|
---|
360 | } else if ( line.left( 9 ) == "isChecked" ) {
|
---|
361 | bool isChecked =
|
---|
362 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
363 | writeBool( "checked", isChecked );
|
---|
364 | } else if ( line.left( 16 ) == "isAutoCompletion" ) {
|
---|
365 | bool isAutoCompl =
|
---|
366 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
367 | writeBool( "autoCompletion", isAutoCompl );
|
---|
368 | } else if ( line.left( 8 ) == "EditText" ) {
|
---|
369 | bool editText =
|
---|
370 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
371 | writeBool( "editable", editText );
|
---|
372 | } else if ( line.left( 10 ) == "isTracking" ) {
|
---|
373 | bool isTracking =
|
---|
374 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
375 | writeBool( "tracking", isTracking );
|
---|
376 | } else if ( line.left( 16 ) == "isMultiSelection" ) {
|
---|
377 | bool isMultiSel =
|
---|
378 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
379 | writeBool( "multiSelection", isMultiSel );
|
---|
380 | } else if ( line.left( 21 ) == "isAllColumnsShowFocus" ) {
|
---|
381 | bool isAllColsShowFocus =
|
---|
382 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
383 | writeBool( "allColumnsShowFocus", isAllColsShowFocus );
|
---|
384 | } else if ( line.left( 16 ) == "isRootDecorated" ) {
|
---|
385 | bool isRootDec =
|
---|
386 | ( line.section( "//", 0, 0 ).section("\"", 1, 1 ) == "true" );
|
---|
387 | writeBool( "rootIsDecorated", isRootDec );
|
---|
388 | } else if ( line.left( 1 ) == "X" ) {
|
---|
389 | int x = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
390 | line = in->readLine().stripWhiteSpace();
|
---|
391 | int y = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
392 | line = in->readLine().stripWhiteSpace();
|
---|
393 | int w = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
394 | line = in->readLine().stripWhiteSpace();
|
---|
395 | int h = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
396 | writeRect( "geometry", x, y, w, h );
|
---|
397 | } else if ( line.left( 8 ) == "MinWidth" ) {
|
---|
398 | int minw = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
399 | writeNumber( "minimumWidth", minw );
|
---|
400 | } else if ( line.left( 9 ) == "MinHeight" ) {
|
---|
401 | int minh = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
402 | writeNumber( "minimumHeight", minh );
|
---|
403 | } else if ( line.left( 8 ) == "MaxWidth" ) {
|
---|
404 | int maxw = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
405 | writeNumber( "maximumWidth", maxw );
|
---|
406 | } else if ( line.left( 9 ) == "MaxHeight" ) {
|
---|
407 | int maxh = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
408 | writeNumber( "maximumHeight", maxh );
|
---|
409 | } else if ( line.left( 4 ) == "Text" ) {
|
---|
410 | QString text = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
411 | cleanString( & text );
|
---|
412 | writeString( "text", text );
|
---|
413 | } else if ( line.left( 5 ) == "Title" ) {
|
---|
414 | QString title = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
415 | cleanString( & title );
|
---|
416 | writeString( "title", title );
|
---|
417 | } else if ( line.left( 5 ) == "Buddy" ) {
|
---|
418 | QString buddy = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
419 | writeString( "buddy", buddy );
|
---|
420 | } else if ( line.left( 14 ) == "SpecialValText" ) {
|
---|
421 | QString text = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
422 | writeString( "specialValueText", text );
|
---|
423 | } else if ( line.left( 6 ) == "Prefix" ) {
|
---|
424 | QString text = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
425 | writeString( "prefix", text );
|
---|
426 | } else if ( line.left( 6 ) == "Suffix" ) {
|
---|
427 | QString text = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
428 | writeString( "suffix", text );
|
---|
429 | } else if ( line.left( 5 ) == "Value" ) {
|
---|
430 | int v = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
431 | writeNumber( "value", v );
|
---|
432 | } else if ( line.left( 8 ) == "MinValue" ) {
|
---|
433 | int minv = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
434 | writeNumber( "minValue", minv );
|
---|
435 | } else if ( line.left( 8 ) == "MaxValue" ) {
|
---|
436 | int maxv = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
437 | writeNumber( "maxValue", maxv );
|
---|
438 | } else if ( line.left( 9 ) == "SizeLimit" ) {
|
---|
439 | int limit = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
440 | writeNumber( "sizeLimit", limit );
|
---|
441 | } else if ( line.left( 9 ) == "MaxLength" ) {
|
---|
442 | int maxl = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
443 | writeNumber( "maxLength", maxl );
|
---|
444 | } else if ( line.left( 8 ) == "MaxCount" ) {
|
---|
445 | int maxc = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
446 | writeNumber( "maxCount", maxc );
|
---|
447 | } else if ( line.left( 14 ) == "CursorPosition" ) {
|
---|
448 | int pos = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
449 | writeNumber( "cursorPosition", pos );
|
---|
450 | } else if ( line.left( 9 ) == "NumDigits" ) {
|
---|
451 | int digits = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
452 | writeNumber( "numDigits", digits );
|
---|
453 | } else if ( line.left( 10 ) == "TotalSteps" ) {
|
---|
454 | int steps = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
455 | writeNumber( "totalSteps", steps );
|
---|
456 | } else if ( line.left( 12 ) == "TreeStepSize" ) {
|
---|
457 | int stepSize = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
458 | writeNumber( "treeStepSize", stepSize );
|
---|
459 | } else if ( line.left( 10 ) == "ItemMargin" ) {
|
---|
460 | int margin = line.section( "//", 0, 0 ).section("\"", 1, 1 ).toInt();
|
---|
461 | writeNumber( "itemMargin", margin );
|
---|
462 | } else if ( line.left( 7 ) == "ToolTip" ) {
|
---|
463 | QString text = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
464 | writeString( "toolTip", text );
|
---|
465 | } else if ( line.left( 9 ) == "QuickHelp" ) {
|
---|
466 | QString text = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
467 | cleanString( & text );
|
---|
468 | writeString( "whatsThis", text );
|
---|
469 | } else if ( line.left( 15 ) == "InsertionPolicy" ) {
|
---|
470 | QString policy = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
471 | cleanString( & policy );
|
---|
472 | writeEnum( "insertionPolicy", policy ); //###FIX: QComboBox::
|
---|
473 | } else if ( line.left( 11 ) == "Orientation" ) {
|
---|
474 | QString orientation =
|
---|
475 | line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
476 | cleanString( & orientation );
|
---|
477 | if ( orientation == "V" )
|
---|
478 | writeEnum( "orientation", "Qt::Vertical" );
|
---|
479 | else if ( orientation == "H" )
|
---|
480 | writeEnum( "orientation", "Qt::Horizontal" );
|
---|
481 | } else if ( line.left( 14 ) == "vScrollBarMode" ) {
|
---|
482 | QString mode = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
483 | cleanString( & mode );
|
---|
484 | writeEnum( "vScrollBarMode", mode );
|
---|
485 | } else if ( line.left( 14 ) == "hScrollBarMode" ) {
|
---|
486 | QString mode = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
487 | cleanString( & mode );
|
---|
488 | writeEnum( "hScrollBarMode", mode );
|
---|
489 | } else if ( line.left( 7 ) == "Entries" ) {
|
---|
490 | QString entries = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
491 | cleanString( & entries );
|
---|
492 | QStringList l = QStringList::split( '\n', entries );
|
---|
493 | for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it )
|
---|
494 | writeItem( "text", *it );
|
---|
495 | } else if ( line.left( 7 ) == "Columns" ) {
|
---|
496 | QString columns = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
497 | cleanString( & columns );
|
---|
498 | QStringList l = QStringList::split( '\n', columns );
|
---|
499 | for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it )
|
---|
500 | writeColumn( "text", *it );
|
---|
501 | } else if ( line.left( 6 ) == "BgMode" ) {
|
---|
502 | QString mode = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
503 | cleanString( & mode );
|
---|
504 | writeString( "backgroundMode", mode ); //###FIX: QWidget:::
|
---|
505 | } else if ( line.left( 10 ) == "BgPalColor" ) {
|
---|
506 | QString color = line.section( "//", 0, 0 ).section("\"", 1, 1 );
|
---|
507 | cleanString( & color );
|
---|
508 | writeColor( "paletteBackgroundColor", color );
|
---|
509 | } //else {
|
---|
510 | //if ( line.length() )
|
---|
511 | //qDebug( "IGNORED: %s", line.latin1() );
|
---|
512 | //}
|
---|
513 | }
|
---|
514 | *out << "</UI>" << endl;
|
---|
515 | return TRUE;
|
---|
516 | }
|
---|
517 |
|
---|