|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the tools applications of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef UIC_H |
|
43 #define UIC_H |
|
44 |
|
45 #include "databaseinfo.h" |
|
46 #include "customwidgetsinfo.h" |
|
47 #include <QtCore/QString> |
|
48 #include <QtCore/QStringList> |
|
49 #include <QtCore/QHash> |
|
50 #include <QtCore/QStack> |
|
51 #include <QtCore/QXmlStreamReader> |
|
52 |
|
53 QT_BEGIN_NAMESPACE |
|
54 |
|
55 class QTextStream; |
|
56 class QIODevice; |
|
57 |
|
58 class Driver; |
|
59 class DomUI; |
|
60 class DomWidget; |
|
61 class DomSpacer; |
|
62 class DomLayout; |
|
63 class DomLayoutItem; |
|
64 class DomItem; |
|
65 |
|
66 struct Option; |
|
67 |
|
68 class Uic |
|
69 { |
|
70 public: |
|
71 Uic(Driver *driver); |
|
72 ~Uic(); |
|
73 |
|
74 bool printDependencies(); |
|
75 |
|
76 inline Driver *driver() const |
|
77 { return drv; } |
|
78 |
|
79 inline QTextStream &output() |
|
80 { return out; } |
|
81 |
|
82 inline const Option &option() const |
|
83 { return opt; } |
|
84 |
|
85 inline QString pixmapFunction() const |
|
86 { return pixFunction; } |
|
87 |
|
88 inline void setPixmapFunction(const QString &f) |
|
89 { pixFunction = f; } |
|
90 |
|
91 inline bool hasExternalPixmap() const |
|
92 { return externalPix; } |
|
93 |
|
94 inline void setExternalPixmap(bool b) |
|
95 { externalPix = b; } |
|
96 |
|
97 inline const DatabaseInfo *databaseInfo() const |
|
98 { return &info; } |
|
99 |
|
100 inline const CustomWidgetsInfo *customWidgetsInfo() const |
|
101 { return &cWidgetsInfo; } |
|
102 |
|
103 bool write(QIODevice *in); |
|
104 |
|
105 #ifdef QT_UIC_JAVA_GENERATOR |
|
106 bool jwrite(DomUI *ui); |
|
107 #endif |
|
108 |
|
109 #ifdef QT_UIC_CPP_GENERATOR |
|
110 bool write(DomUI *ui); |
|
111 #endif |
|
112 |
|
113 bool isMainWindow(const QString &className) const; |
|
114 bool isToolBar(const QString &className) const; |
|
115 bool isStatusBar(const QString &className) const; |
|
116 bool isButton(const QString &className) const; |
|
117 bool isContainer(const QString &className) const; |
|
118 bool isMenuBar(const QString &className) const; |
|
119 bool isMenu(const QString &className) const; |
|
120 |
|
121 private: |
|
122 // copyright header |
|
123 void writeCopyrightHeader(DomUI *ui); |
|
124 DomUI *parseUiFile(QXmlStreamReader &reader); |
|
125 |
|
126 #ifdef QT_UIC_CPP_GENERATOR |
|
127 // header protection |
|
128 void writeHeaderProtectionStart(); |
|
129 void writeHeaderProtectionEnd(); |
|
130 #endif |
|
131 |
|
132 private: |
|
133 Driver *drv; |
|
134 QTextStream &out; |
|
135 Option &opt; |
|
136 DatabaseInfo info; |
|
137 CustomWidgetsInfo cWidgetsInfo; |
|
138 QString pixFunction; |
|
139 bool externalPix; |
|
140 }; |
|
141 |
|
142 QT_END_NAMESPACE |
|
143 |
|
144 #endif // UIC_H |