1 | /**********************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2000-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 | #ifndef DLG2UI_H
|
---|
29 | #define DLG2UI_H
|
---|
30 |
|
---|
31 | #include <qdom.h>
|
---|
32 | #include <qmap.h>
|
---|
33 | #include <qstring.h>
|
---|
34 | #include <qvariant.h>
|
---|
35 |
|
---|
36 | typedef QMap<QString, QString> AttributeMap;
|
---|
37 |
|
---|
38 | struct DlgConnection
|
---|
39 | {
|
---|
40 | QString sender;
|
---|
41 | QString signal;
|
---|
42 | QString slot;
|
---|
43 |
|
---|
44 | #if defined(Q_FULL_TEMPLATE_INSTANTIATION)
|
---|
45 | bool operator==( const DlgConnection& ) const {
|
---|
46 | return sender == sender && signal == signal && slot == slot;
|
---|
47 | }
|
---|
48 | #endif
|
---|
49 | };
|
---|
50 |
|
---|
51 | class Dlg2Ui
|
---|
52 | {
|
---|
53 | public:
|
---|
54 | QStringList convertQtArchitectDlgFile( const QString& fileName );
|
---|
55 |
|
---|
56 | private:
|
---|
57 | QString alias( const QString& name ) const;
|
---|
58 | QString opening( const QString& tag,
|
---|
59 | const AttributeMap& attr = AttributeMap() );
|
---|
60 | QString closing( const QString& tag );
|
---|
61 | void error( const QString& message );
|
---|
62 | void syntaxError();
|
---|
63 | QString getTextValue( const QDomNode& node );
|
---|
64 | QVariant getValue( const QDomNodeList& children, const QString& tagName,
|
---|
65 | const QString& type = "qstring" );
|
---|
66 | void emitHeader();
|
---|
67 | void emitFooter();
|
---|
68 | void emitSimpleValue( const QString& tag, const QString& value,
|
---|
69 | const AttributeMap& attr = AttributeMap() );
|
---|
70 | void emitOpening( const QString& tag,
|
---|
71 | const AttributeMap& attr = AttributeMap() );
|
---|
72 | void emitClosing( const QString& tag );
|
---|
73 | void emitOpeningWidget( const QString& className );
|
---|
74 | QString widgetClassName( const QDomElement& e );
|
---|
75 | void emitColor( const QColor& color );
|
---|
76 | void emitColorGroup( const QString& name, const QColorGroup& group );
|
---|
77 | void emitVariant( const QVariant& val,
|
---|
78 | const QString& stringType = "string" );
|
---|
79 | void emitProperty( const QString& prop, const QVariant& val,
|
---|
80 | const QString& stringType = "string" );
|
---|
81 | void emitAttribute( const QString& attr, const QVariant& val,
|
---|
82 | const QString& stringType = "string" );
|
---|
83 | void emitOpeningLayout( bool needsWidget, const QString& layoutKind,
|
---|
84 | const QString& name, int border, int autoBorder );
|
---|
85 | void flushWidgets();
|
---|
86 | void emitClosingLayout( bool needsWidget, const QString& layoutKind );
|
---|
87 | bool isWidgetType( const QDomElement& e );
|
---|
88 | void emitSpacer( int spacing, int stretch );
|
---|
89 | QString filteredFlags( const QString& flags, const QRegExp& filter );
|
---|
90 | void emitFrameStyleProperty( int style );
|
---|
91 | void emitWidgetBody( const QDomElement& e, bool layouted );
|
---|
92 | bool checkTagName( const QDomElement& e, const QString& tagName );
|
---|
93 | QString normalizeType( const QString& type );
|
---|
94 | QVariant getValue( const QDomElement& e, const QString& tagName,
|
---|
95 | const QString& type = "qstring" );
|
---|
96 | void matchDialogCommon( const QDomElement& dialogCommon );
|
---|
97 | bool needsQLayoutWidget( const QDomElement& e );
|
---|
98 | void matchBoxLayout( const QDomElement& boxLayout );
|
---|
99 | void matchBoxSpacing( const QDomElement& boxSpacing );
|
---|
100 | void matchBoxStretch( const QDomElement& boxStretch );
|
---|
101 | void matchGridLayout( const QDomElement& gridLayout );
|
---|
102 | void matchGridRow( const QDomElement& gridRow );
|
---|
103 | void matchGridSpacer( const QDomElement& gridSpacer );
|
---|
104 | void matchLayoutWidget( const QDomElement& layoutWidget );
|
---|
105 | void matchBox( const QDomElement& box );
|
---|
106 | void matchLayout( const QDomElement& layout );
|
---|
107 | void matchWidgetLayoutCommon( const QDomElement& widgetLayoutCommon );
|
---|
108 | void matchWidget( const QDomElement& widget );
|
---|
109 | void matchWidgets( const QDomElement& widgets );
|
---|
110 | void matchTabOrder( const QDomElement& tabOrder );
|
---|
111 | void matchWidgetLayout( const QDomElement& widgetLayout );
|
---|
112 | void matchDialog( const QDomElement& dialog );
|
---|
113 |
|
---|
114 | QString yyOut;
|
---|
115 | QString yyIndentStr;
|
---|
116 | QString yyFileName;
|
---|
117 | QString yyClassName;
|
---|
118 | QMap<QString, int> yyWidgetTypeSet;
|
---|
119 | QMap<QString, QMap<QString, int> > yyPropertyMap;
|
---|
120 | QMap<QString, QDomElement> yyWidgetMap;
|
---|
121 | QMap<QString, QString> yyCustomWidgets;
|
---|
122 | QValueList<DlgConnection> yyConnections;
|
---|
123 | QMap<QString, QString> yySlots;
|
---|
124 | QMap<QString, QString> yyAliasMap;
|
---|
125 | QStringList yyTabStops;
|
---|
126 | QString yyBoxKind;
|
---|
127 | int yyLayoutDepth;
|
---|
128 | int yyGridRow;
|
---|
129 | int yyGridColumn;
|
---|
130 |
|
---|
131 | int numErrors;
|
---|
132 | int uniqueLayout;
|
---|
133 | int uniqueSpacer;
|
---|
134 | int uniqueWidget;
|
---|
135 | };
|
---|
136 |
|
---|
137 | #endif
|
---|