| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef UIC_H |
| 5 | #define UIC_H |
| 6 | |
| 7 | #include "databaseinfo.h" |
| 8 | #include "customwidgetsinfo.h" |
| 9 | #include <qstring.h> |
| 10 | #include <qstringlist.h> |
| 11 | #include <qstack.h> |
| 12 | #include <qxmlstream.h> |
| 13 | |
| 14 | QT_BEGIN_NAMESPACE |
| 15 | |
| 16 | class QTextStream; |
| 17 | class QIODevice; |
| 18 | |
| 19 | class Driver; |
| 20 | class DomUI; |
| 21 | class DomWidget; |
| 22 | class DomSpacer; |
| 23 | class DomLayout; |
| 24 | class DomLayoutItem; |
| 25 | class DomItem; |
| 26 | |
| 27 | struct Option; |
| 28 | |
| 29 | class Uic |
| 30 | { |
| 31 | Q_DISABLE_COPY_MOVE(Uic) |
| 32 | public: |
| 33 | Uic(Driver *driver); |
| 34 | ~Uic(); |
| 35 | |
| 36 | bool printDependencies(); |
| 37 | |
| 38 | inline Driver *driver() const |
| 39 | { return drv; } |
| 40 | |
| 41 | inline QTextStream &output() |
| 42 | { return out; } |
| 43 | |
| 44 | inline const Option &option() const |
| 45 | { return opt; } |
| 46 | |
| 47 | inline QString pixmapFunction() const |
| 48 | { return pixFunction; } |
| 49 | |
| 50 | inline void setPixmapFunction(const QString &f) |
| 51 | { pixFunction = f; } |
| 52 | |
| 53 | inline const DatabaseInfo *databaseInfo() const |
| 54 | { return &info; } |
| 55 | |
| 56 | inline const CustomWidgetsInfo *customWidgetsInfo() const |
| 57 | { return &cWidgetsInfo; } |
| 58 | |
| 59 | bool write(QIODevice *in); |
| 60 | |
| 61 | bool write(DomUI *ui); |
| 62 | |
| 63 | bool isButton(const QString &className) const; |
| 64 | bool isContainer(const QString &className) const; |
| 65 | bool isMenu(const QString &className) const; |
| 66 | |
| 67 | private: |
| 68 | // copyright header |
| 69 | void writeCopyrightHeaderCpp(const DomUI *ui) const; |
| 70 | void writeCopyrightHeaderPython(const DomUI *ui) const; |
| 71 | static DomUI *parseUiFile(QXmlStreamReader &reader); |
| 72 | |
| 73 | // header protection |
| 74 | void writeHeaderProtectionStart(); |
| 75 | void writeHeaderProtectionEnd(); |
| 76 | |
| 77 | Driver *drv; |
| 78 | QTextStream &out; |
| 79 | Option &opt; |
| 80 | DatabaseInfo info; |
| 81 | CustomWidgetsInfo cWidgetsInfo; |
| 82 | QString pixFunction; |
| 83 | }; |
| 84 | |
| 85 | QT_END_NAMESPACE |
| 86 | |
| 87 | #endif // UIC_H |
| 88 |
