Eneboo - Documentación para desarrolladores
|
00001 /********************************************************************** 00002 ** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved. 00003 ** 00004 ** This file is part of Qt Designer. 00005 ** 00006 ** This file may be distributed and/or modified under the terms of the 00007 ** GNU General Public License version 2 as published by the Free Software 00008 ** Foundation and appearing in the file LICENSE.GPL included in the 00009 ** packaging of this file. 00010 ** 00011 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00012 ** licenses may use this file in accordance with the Qt Commercial License 00013 ** Agreement provided with the Software. 00014 ** 00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 ** 00018 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00019 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00020 ** information about Qt Commercial License Agreements. 00021 ** 00022 ** Contact info@trolltech.com if any conditions of this licensing are 00023 ** not clear to you. 00024 ** 00025 **********************************************************************/ 00026 00027 #ifndef UIC_H 00028 #define UIC_H 00029 #include <qdom.h> 00030 #include <qstring.h> 00031 #include <qstringlist.h> 00032 #include <qmap.h> 00033 #include <qtextstream.h> 00034 #include <qpalette.h> 00035 #include <qvariant.h> 00036 00037 class Uic : public Qt 00038 { 00039 public: 00040 Uic( const QString &fn, const char *outputFn, QTextStream& out, 00041 QDomDocument doc, bool decl, bool subcl, const QString &trm, 00042 const QString& subclname, bool omitForwardDecls ); 00043 00044 void createFormDecl( const QDomElement &e ); 00045 void createFormImpl( const QDomElement &e ); 00046 00047 void createSubDecl( const QDomElement &e, const QString& subclname ); 00048 void createSubImpl( const QDomElement &e, const QString& subclname ); 00049 00050 void createObjectDecl( const QDomElement &e ); 00051 void createSpacerDecl( const QDomElement &e ); 00052 void createActionDecl( const QDomElement &e ); 00053 void createToolbarDecl( const QDomElement &e ); 00054 void createMenuBarDecl( const QDomElement &e ); 00055 void createPopupMenuDecl( const QDomElement &e ); 00056 void createActionImpl( const QDomElement &e, const QString &parent ); 00057 void createToolbarImpl( const QDomElement &e, const QString &parentClass, const QString &parent ); 00058 void createMenuBarImpl( const QDomElement &e, const QString &parentClass, const QString &parent ); 00059 void createPopupMenuImpl( const QDomElement &e, const QString &parentClass, const QString &parent ); 00060 QString createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null ); 00061 QString createLayoutImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null ); 00062 QString createObjectInstance( const QString& objClass, const QString& parent, const QString& objName ); 00063 QString createSpacerImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null ); 00064 void createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp ); 00065 QString createListBoxItemImpl( const QDomElement &e, const QString &parent, QString *value = 0 ); 00066 QString createIconViewItemImpl( const QDomElement &e, const QString &parent ); 00067 QString createListViewColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 ); 00068 QString createTableRowColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 ); 00069 QString createListViewItemImpl( const QDomElement &e, const QString &parent, 00070 const QString &parentItem ); 00071 void createColorGroupImpl( const QString& cg, const QDomElement& e ); 00072 QColorGroup loadColorGroup( const QDomElement &e ); 00073 00074 QDomElement getObjectProperty( const QDomElement& e, const QString& name ); 00075 QString getPixmapLoaderFunction( const QDomElement& e ); 00076 QString getFormClassName( const QDomElement& e ); 00077 QString getClassName( const QDomElement& e ); 00078 QString getObjectName( const QDomElement& e ); 00079 QString getLayoutName( const QDomElement& e ); 00080 QString getInclude( const QString& className ); 00081 00082 QString setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset ); 00083 00084 QString registerObject( const QString& name ); 00085 QString registeredName( const QString& name ); 00086 bool isObjectRegistered( const QString& name ); 00087 QStringList unique( const QStringList& ); 00088 00089 QString trcall( const QString& sourceText, const QString& comment = "" ); 00090 00091 static void embed( QTextStream& out, const char* project, const QStringList& images ); 00092 00093 private: 00094 void registerLayouts ( const QDomElement& e ); 00095 00096 QTextStream& out; 00097 QTextOStream trout; 00098 QString languageChangeBody; 00099 QCString outputFileName; 00100 QStringList objectNames; 00101 QMap<QString,QString> objectMapper; 00102 QString indent; 00103 QStringList tags; 00104 QStringList layouts; 00105 QString formName; 00106 QString lastItem; 00107 QString trmacro; 00108 bool nofwd; 00109 00110 struct Buddy 00111 { 00112 Buddy( const QString& k, const QString& b ) 00113 : key( k ), buddy( b ) {} 00114 Buddy(){} // for valuelist 00115 QString key; 00116 QString buddy; 00117 bool operator==( const Buddy& other ) const 00118 { return (key == other.key); } 00119 }; 00120 struct CustomInclude 00121 { 00122 QString header; 00123 QString location; 00124 Q_DUMMY_COMPARISON_OPERATOR(CustomInclude) 00125 }; 00126 QValueList<Buddy> buddies; 00127 00128 QStringList layoutObjects; 00129 bool isLayout( const QString& name ) const; 00130 00131 uint item_used : 1; 00132 uint cg_used : 1; 00133 uint pal_used : 1; 00134 uint stdsetdef : 1; 00135 uint externPixmaps : 1; 00136 00137 QString uiFileVersion; 00138 QString nameOfClass; 00139 QStringList namespaces; 00140 QString bareNameOfClass; 00141 QString pixmapLoaderFunction; 00142 00143 void registerDatabases( const QDomElement& e ); 00144 bool isWidgetInTable( const QDomElement& e, const QString& connection, const QString& table ); 00145 bool isFrameworkCodeGenerated( const QDomElement& e ); 00146 QString getDatabaseInfo( const QDomElement& e, const QString& tag ); 00147 void createFormImpl( const QDomElement& e, const QString& form, const QString& connection, const QString& table ); 00148 void writeFunctionsDecl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst ); 00149 void writeFunctionsSubDecl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst ); 00150 void writeFunctionsSubImpl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst, 00151 const QString &subClass, const QString &descr ); 00152 QStringList dbConnections; 00153 QMap< QString, QStringList > dbCursors; 00154 QMap< QString, QStringList > dbForms; 00155 00156 static bool isMainWindow; 00157 static QString mkBool( bool b ); 00158 static QString mkBool( const QString& s ); 00159 bool toBool( const QString& s ); 00160 static QString fixString( const QString &str, bool encode = FALSE ); 00161 static bool onlyAscii; 00162 static QString mkStdSet( const QString& prop ); 00163 static QString getComment( const QDomNode& n ); 00164 QVariant defSpacing, defMargin; 00165 QString fileName; 00166 bool writeFunctImpl; 00167 }; 00168 00169 #endif