source: trunk/tools/designer/uic/uic.h@ 9

Last change on this file since 9 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 7.1 KB
Line 
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qt Designer.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
12** licenses may use this file in accordance with the Qt Commercial License
13** Agreement provided with the Software.
14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17**
18** See http://www.trolltech.com/gpl/ for GPL licensing information.
19** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
20** information about Qt Commercial License Agreements.
21**
22** Contact info@trolltech.com if any conditions of this licensing are
23** not clear to you.
24**
25**********************************************************************/
26
27#ifndef UIC_H
28#define UIC_H
29#include <qdom.h>
30#include <qstring.h>
31#include <qstringlist.h>
32#include <qmap.h>
33#include <qtextstream.h>
34#include <qpalette.h>
35#include <qvariant.h>
36
37class Uic : public Qt
38{
39public:
40 Uic( const QString &fn, const char *outputFn, QTextStream& out,
41 QDomDocument doc, bool decl, bool subcl, const QString &trm,
42 const QString& subclname, bool omitForwardDecls );
43
44 void createFormDecl( const QDomElement &e );
45 void createFormImpl( const QDomElement &e );
46
47 void createSubDecl( const QDomElement &e, const QString& subclname );
48 void createSubImpl( const QDomElement &e, const QString& subclname );
49
50 void createObjectDecl( const QDomElement &e );
51 void createSpacerDecl( const QDomElement &e );
52 void createActionDecl( const QDomElement &e );
53 void createToolbarDecl( const QDomElement &e );
54 void createMenuBarDecl( const QDomElement &e );
55 void createPopupMenuDecl( const QDomElement &e );
56 void createActionImpl( const QDomElement &e, const QString &parent );
57 void createToolbarImpl( const QDomElement &e, const QString &parentClass, const QString &parent );
58 void createMenuBarImpl( const QDomElement &e, const QString &parentClass, const QString &parent );
59 void createPopupMenuImpl( const QDomElement &e, const QString &parentClass, const QString &parent );
60 QString createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null );
61 QString createLayoutImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null );
62 QString createObjectInstance( const QString& objClass, const QString& parent, const QString& objName );
63 QString createSpacerImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null );
64 void createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp );
65 QString createListBoxItemImpl( const QDomElement &e, const QString &parent, QString *value = 0 );
66 QString createIconViewItemImpl( const QDomElement &e, const QString &parent );
67 QString createListViewColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 );
68 QString createTableRowColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 );
69 QString createListViewItemImpl( const QDomElement &e, const QString &parent,
70 const QString &parentItem );
71 void createColorGroupImpl( const QString& cg, const QDomElement& e );
72 QColorGroup loadColorGroup( const QDomElement &e );
73
74 QDomElement getObjectProperty( const QDomElement& e, const QString& name );
75 QString getPixmapLoaderFunction( const QDomElement& e );
76 QString getFormClassName( const QDomElement& e );
77 QString getClassName( const QDomElement& e );
78 QString getObjectName( const QDomElement& e );
79 QString getLayoutName( const QDomElement& e );
80 QString getInclude( const QString& className );
81
82 QString setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset );
83
84 QString registerObject( const QString& name );
85 QString registeredName( const QString& name );
86 bool isObjectRegistered( const QString& name );
87 QStringList unique( const QStringList& );
88
89 QString trcall( const QString& sourceText, const QString& comment = "" );
90
91 static void embed( QTextStream& out, const char* project, const QStringList& images );
92
93private:
94 void registerLayouts ( const QDomElement& e );
95
96 QTextStream& out;
97 QTextOStream trout;
98 QString languageChangeBody;
99 QCString outputFileName;
100 QStringList objectNames;
101 QMap<QString,QString> objectMapper;
102 QString indent;
103 QStringList tags;
104 QStringList layouts;
105 QString formName;
106 QString lastItem;
107 QString trmacro;
108 bool nofwd;
109
110 struct Buddy
111 {
112 Buddy( const QString& k, const QString& b )
113 : key( k ), buddy( b ) {}
114 Buddy(){} // for valuelist
115 QString key;
116 QString buddy;
117 bool operator==( const Buddy& other ) const
118 { return (key == other.key); }
119 };
120 struct CustomInclude
121 {
122 QString header;
123 QString location;
124 Q_DUMMY_COMPARISON_OPERATOR(CustomInclude)
125 };
126 QValueList<Buddy> buddies;
127
128 QStringList layoutObjects;
129 bool isLayout( const QString& name ) const;
130
131 uint item_used : 1;
132 uint cg_used : 1;
133 uint pal_used : 1;
134 uint stdsetdef : 1;
135 uint externPixmaps : 1;
136
137 QString uiFileVersion;
138 QString nameOfClass;
139 QStringList namespaces;
140 QString bareNameOfClass;
141 QString pixmapLoaderFunction;
142
143 void registerDatabases( const QDomElement& e );
144 bool isWidgetInTable( const QDomElement& e, const QString& connection, const QString& table );
145 bool isFrameworkCodeGenerated( const QDomElement& e );
146 QString getDatabaseInfo( const QDomElement& e, const QString& tag );
147 void createFormImpl( const QDomElement& e, const QString& form, const QString& connection, const QString& table );
148 void writeFunctionsDecl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst );
149 void writeFunctionsSubDecl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst );
150 void writeFunctionsSubImpl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst,
151 const QString &subClass, const QString &descr );
152 QStringList dbConnections;
153 QMap< QString, QStringList > dbCursors;
154 QMap< QString, QStringList > dbForms;
155
156 static bool isMainWindow;
157 static QString mkBool( bool b );
158 static QString mkBool( const QString& s );
159 bool toBool( const QString& s );
160 static QString fixString( const QString &str, bool encode = FALSE );
161 static bool onlyAscii;
162 static QString mkStdSet( const QString& prop );
163 static QString getComment( const QDomNode& n );
164 QVariant defSpacing, defMargin;
165 QString fileName;
166 bool writeFunctImpl;
167};
168
169#endif
Note: See TracBrowser for help on using the repository browser.