1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the tools applications of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
32
#include <qnamespace.h>
35
#include <qstringlist.h>
37
#include <qtextstream.h>
39
#include <qbytearray.h>
51
typedef QList<QPair<int, Color> > ColorGroup;
56
Ui3Reader(QTextStream &stream);
59
void generateUi4(const QString &fn, const QString &outputFn, QDomDocument doc);
61
void generate(const QString &fn, const QString &outputFn,
62
QDomDocument doc, bool decl, bool subcl, const QString &trm,
63
const QString& subclname, bool omitForwardDecls);
65
void embed(const char *project, const QStringList &images);
67
void setTrMacro(const QString &trmacro);
68
void setForwardDeclarationsEnabled(bool b);
69
void setOutputFileName(const QString &fileName);
71
void createFormDecl(const QDomElement &e);
72
void createFormImpl(const QDomElement &e);
74
void createSubDecl(const QDomElement &e, const QString& subclname);
75
void createSubImpl(const QDomElement &e, const QString& subclname);
77
void createColorGroupImpl(const QString& cg, const QDomElement& e);
78
ColorGroup loadColorGroup(const QDomElement &e);
80
QDomElement getObjectProperty(const QDomElement& e, const QString& name);
81
QString getPixmapLoaderFunction(const QDomElement& e);
82
QString getFormClassName(const QDomElement& e);
83
QString getClassName(const QDomElement& e);
84
QString getObjectName(const QDomElement& e);
85
QString getLayoutName(const QDomElement& e);
87
QString registerObject(const QString& name);
88
QString registeredName(const QString& name);
89
bool isObjectRegistered(const QString& name);
90
QStringList unique(const QStringList&);
92
QString trcall(const QString& sourceText, const QString& comment = QString());
94
QDomElement parse(const QDomDocument &doc);
99
void errorInvalidProperty(const QString &propertyName, const QString &widgetName, const QString &widgetClass);
101
DomUI *generateUi4(const QDomElement &e);
102
DomWidget *createWidget(const QDomElement &w, const QString &widgetClass = QString());
103
void createProperties(const QDomElement &e, QList<DomProperty*> *properties, const QString &className);
104
void createAttributes(const QDomElement &e, QList<DomProperty*> *properties, const QString &className);
105
DomLayout *createLayout(const QDomElement &e);
106
DomLayoutItem *createLayoutItem(const QDomElement &e);
107
DomProperty *readProperty(const QDomElement &e);
108
void fixActionGroup(DomActionGroup *g);
109
QString fixActionProperties(QList<DomProperty*> &properties, bool isActionGroup = false);
111
QString fixHeaderName(const QString &headerName) const;
112
QString fixClassName(const QString &className) const;
113
QString fixDeclaration(const QString &declaration) const;
114
QString fixType(const QString &type) const;
118
QString languageChangeBody;
119
QString outputFileName;
120
QStringList objectNames;
121
QMap<QString,QString> objectMapper;
132
Buddy(const QString& k, const QString& b)
133
: key(k), buddy(b) {}
134
Buddy(){} // for valuelist
137
bool operator==(const Buddy& other) const
138
{ return (key == other.key); }
144
Q_DUMMY_COMPARISON_OPERATOR(CustomInclude)
146
QList<Buddy> buddies;
148
QStringList layoutObjects;
149
bool isLayout(const QString& name) const;
155
uint externPixmaps : 1;
157
QString uiFileVersion;
159
QStringList namespaces;
160
QString bareNameOfClass;
161
QString pixmapLoaderFunction;
163
void registerDatabases(const QDomElement& e);
164
bool isWidgetInTable(const QDomElement& e, const QString& connection, const QString& table);
165
bool isFrameworkCodeGenerated(const QDomElement& e);
166
QString getDatabaseInfo(const QDomElement& e, const QString& tag);
167
void createFormImpl(const QDomElement& e, const QString& form, const QString& connection, const QString& table);
168
void writeFunctionsDecl(const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst);
169
void writeFunctionsSubDecl(const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst);
170
void writeFunctionsSubImpl(const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst,
171
const QString &subClass, const QString &descr);
172
QStringList dbConnections;
173
QMap<QString, QStringList> dbCursors;
174
QMap<QString, QStringList> dbForms;
176
static bool isMainWindow;
177
static QString mkBool(bool b);
178
static QString mkBool(const QString& s);
179
bool toBool(const QString& s);
180
static QString fixString(const QString &str, bool encode = false);
181
static bool onlyAscii;
182
static QString mkStdSet(const QString& prop);
183
static QString getComment(const QDomNode& n);
184
QVariant defSpacing, defMargin;
191
QMap<QString, bool> candidateCustomWidgets;