source: trunk/tools/designer/plugins/glade/glade2ui.h

Last change on this file was 197, checked in by rudi, 14 years ago

Added QtDesigner

File size: 6.0 KB
Line 
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 GLADE2UI_H
29#define GLADE2UI_H
30
31#include <qdom.h>
32#include <qmap.h>
33#include <qstring.h>
34#include <qvariant.h>
35
36typedef QMap<QString, QString> AttributeMap;
37
38struct GladeAction
39{
40 QString text;
41 QString menuText;
42 QString toolTip;
43 int accel;
44 QString iconSet;
45};
46
47struct GladeConnection
48{
49 QString sender;
50 QString signal;
51 QString slot;
52};
53
54class Glade2Ui
55{
56public:
57 Glade2Ui();
58
59 QStringList convertGladeFile( const QString& fileName );
60
61private:
62 QString imageName( const QString& fileName );
63 QString opening( const QString& tag,
64 const AttributeMap& attr = AttributeMap() );
65 QString closing( const QString& tag );
66 QString atom( const QString& tag,
67 const AttributeMap& attr = AttributeMap() );
68 void error( const QString& message );
69 void syntaxError();
70 QString getTextValue( const QDomNode& node );
71 void emitHeader();
72 void emitFooter();
73 void emitSimpleValue( const QString& tag, const QString& value,
74 const AttributeMap& attr = AttributeMap() );
75 void emitOpening( const QString& tag,
76 const AttributeMap& attr = AttributeMap() );
77 void emitClosing( const QString& tag );
78 void emitAtom( const QString& tag,
79 const AttributeMap& attr = AttributeMap() );
80 void emitVariant( const QVariant& val,
81 const QString& stringType = "string" );
82 void emitProperty( const QString& prop, const QVariant& val,
83 const QString& stringType = "string" );
84 void emitFontProperty( const QString& prop, int pointSize, bool bold );
85 void emitAttribute( const QString& prop, const QVariant& val,
86 const QString& stringType = "string" );
87 QString gtk2qtClass( const QString& gtkClass,
88 const QValueList<QDomElement>& childWidgets );
89
90 int matchAccelOnActivate( const QDomElement& accel );
91 void emitGtkMenu( const QDomElement& menu );
92 void emitGtkMenuBarChildWidgets(
93 const QValueList<QDomElement>& childWidgets );
94 void emitGtkToolbarChildWidgets(
95 const QValueList<QDomElement>& childWidgets );
96 void emitPushButton( const QString& text, const QString& name );
97 void attach( AttributeMap *attr, int leftAttach, int rightAttach,
98 int topAttach, int bottomAttach );
99 void emitSpacer( const QString& orientation, int leftAttach = -1,
100 int rightAttach = -1, int topAttach = -1,
101 int bottomAttach = -1 );
102 void emitPixmap( const QString& imageName, int leftAttach = -1,
103 int rightAttach = -1, int topAttach = -1,
104 int bottomAttach = -1 );
105 void emitGnomeAbout( QString copyright, QString authors, QString comments );
106 void emitGnomeAppChildWidgetsPass1(
107 const QValueList<QDomElement>& childWidgets );
108 void doPass2( const QValueList<QDomElement>& childWidgets,
109 QValueList<QDomElement> *menuBar,
110 QValueList<QValueList<QDomElement> > *toolBars );
111 void emitGnomeAppChildWidgetsPass2(
112 const QValueList<QDomElement>& childWidgets );
113 void emitGtkButtonChildWidgets( QValueList<QDomElement> childWidgets );
114 void emitGtkComboChildWidgets( const QValueList<QDomElement>& childWidgets,
115 const QStringList& items );
116 void emitGtkNotebookChildWidgets(
117 const QValueList<QDomElement>& childWidgets );
118 void emitQListViewColumns( const QDomElement& qlistview );
119 void emitGtkScrolledWindowChildWidgets(
120 const QValueList<QDomElement>& childWidgets,
121 const QString& qtClass );
122 void emitGnomeDruidPage( const QDomElement& druidPage );
123 void emitGtkWindowChildWidgets( const QValueList<QDomElement>& childWidgets,
124 const QString& qtClass );
125 bool packEnd( const QDomElement& widget );
126 void emitChildWidgets( const QValueList<QDomElement>& childWidgets,
127 bool layouted, int leftAttach = -1,
128 int rightAttach = -1, int topAttach = -1,
129 int bottomAttach = -1 );
130 void emitOpeningWidget( const QString& qtClass, int leftAttach = -1,
131 int rightAttach = -1, int topAttach = -1,
132 int bottomAttach = -1 );
133 bool shouldPullup( const QValueList<QDomElement>& childWidgets );
134 QString emitWidget( const QDomElement& widget, bool layouted,
135 int leftAttach = -1, int rightAttach = -1,
136 int topAttach = -1, int bottomAttach = -1 );
137
138 QString yyOut;
139 QString yyIndentStr;
140 QString yyFileName;
141 QString yyProgramName;
142 QString yyPixmapDirectory;
143 QMap<QString, QString> yyClassNameMap;
144 QMap<QString, QString> yyStockMap;
145 QMap<QString, int> yyKeyMap;
146 QMap<QString, QString> yyCustomWidgets;
147 QMap<QString, QString> yyStockItemActions;
148 QMap<QString, GladeAction> yyActions;
149 QValueList<GladeConnection> yyConnections;
150 QMap<QString, QString> yySlots;
151 QString yyFormName;
152 QMap<QString, QString> yyImages;
153
154 int numErrors;
155 int uniqueAction;
156 int uniqueForm;
157 int uniqueMenuBar;
158 int uniqueSpacer;
159 int uniqueToolBar;
160};
161
162#endif
Note: See TracBrowser for help on using the repository browser.