Eneboo - Documentación para desarrolladores
src/qt/tools/designer/plugins/dlg/dlg2ui.h
Ir a la documentación de este archivo.
00001 /**********************************************************************
00002 **
00003 ** Copyright (C) 2000-2007 Trolltech ASA.  All rights reserved.
00004 **
00005 ** This file is part of Qt Designer.
00006 **
00007 ** This file may be distributed and/or modified under the terms of the
00008 ** GNU General Public License version 2 as published by the Free Software
00009 ** Foundation and appearing in the file LICENSE.GPL included in the
00010 ** packaging of this file.
00011 **
00012 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00013 ** licenses may use this file in accordance with the Qt Commercial License
00014 ** Agreement provided with the Software.
00015 **
00016 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00017 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00018 **
00019 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00020 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00021 **   information about Qt Commercial License Agreements.
00022 **
00023 ** Contact info@trolltech.com if any conditions of this licensing are
00024 ** not clear to you.
00025 **
00026 **********************************************************************/
00027 
00028 #ifndef DLG2UI_H
00029 #define DLG2UI_H
00030 
00031 #include <qdom.h>
00032 #include <qmap.h>
00033 #include <qstring.h>
00034 #include <qvariant.h>
00035 
00036 typedef QMap<QString, QString> AttributeMap;
00037 
00038 struct DlgConnection
00039 {
00040     QString sender;
00041     QString signal;
00042     QString slot;
00043 
00044 #if defined(Q_FULL_TEMPLATE_INSTANTIATION)
00045     bool operator==( const DlgConnection& ) const {
00046         return sender == sender && signal == signal && slot == slot;
00047     }
00048 #endif
00049 };
00050 
00051 class Dlg2Ui
00052 {
00053 public:
00054     QStringList convertQtArchitectDlgFile( const QString& fileName );
00055 
00056 private:
00057     QString alias( const QString& name ) const;
00058     QString opening( const QString& tag,
00059                      const AttributeMap& attr = AttributeMap() );
00060     QString closing( const QString& tag );
00061     void error( const QString& message );
00062     void syntaxError();
00063     QString getTextValue( const QDomNode& node );
00064     QVariant getValue( const QDomNodeList& children, const QString& tagName,
00065                        const QString& type = "qstring" );
00066     void emitHeader();
00067     void emitFooter();
00068     void emitSimpleValue( const QString& tag, const QString& value,
00069                           const AttributeMap& attr = AttributeMap() );
00070     void emitOpening( const QString& tag,
00071                       const AttributeMap& attr = AttributeMap() );
00072     void emitClosing( const QString& tag );
00073     void emitOpeningWidget( const QString& className );
00074     QString widgetClassName( const QDomElement& e );
00075     void emitColor( const QColor& color );
00076     void emitColorGroup( const QString& name, const QColorGroup& group );
00077     void emitVariant( const QVariant& val,
00078                       const QString& stringType = "string" );
00079     void emitProperty( const QString& prop, const QVariant& val,
00080                        const QString& stringType = "string" );
00081     void emitAttribute( const QString& attr, const QVariant& val,
00082                            const QString& stringType = "string" );
00083     void emitOpeningLayout( bool needsWidget, const QString& layoutKind,
00084                             const QString& name, int border, int autoBorder );
00085     void flushWidgets();
00086     void emitClosingLayout( bool needsWidget, const QString& layoutKind );
00087     bool isWidgetType( const QDomElement& e );
00088     void emitSpacer( int spacing, int stretch );
00089     QString filteredFlags( const QString& flags, const QRegExp& filter );
00090     void emitFrameStyleProperty( int style );
00091     void emitWidgetBody( const QDomElement& e, bool layouted );
00092     bool checkTagName( const QDomElement& e, const QString& tagName );
00093     QString normalizeType( const QString& type );
00094     QVariant getValue( const QDomElement& e, const QString& tagName,
00095                        const QString& type = "qstring" );
00096     void matchDialogCommon( const QDomElement& dialogCommon );
00097     bool needsQLayoutWidget( const QDomElement& e );
00098     void matchBoxLayout( const QDomElement& boxLayout );
00099     void matchBoxSpacing( const QDomElement& boxSpacing );
00100     void matchBoxStretch( const QDomElement& boxStretch );
00101     void matchGridLayout( const QDomElement& gridLayout );
00102     void matchGridRow( const QDomElement& gridRow );
00103     void matchGridSpacer( const QDomElement& gridSpacer );
00104     void matchLayoutWidget( const QDomElement& layoutWidget );
00105     void matchBox( const QDomElement& box );
00106     void matchLayout( const QDomElement& layout );
00107     void matchWidgetLayoutCommon( const QDomElement& widgetLayoutCommon );
00108     void matchWidget( const QDomElement& widget );
00109     void matchWidgets( const QDomElement& widgets );
00110     void matchTabOrder( const QDomElement& tabOrder );
00111     void matchWidgetLayout( const QDomElement& widgetLayout );
00112     void matchDialog( const QDomElement& dialog );
00113 
00114     QString yyOut;
00115     QString yyIndentStr;
00116     QString yyFileName;
00117     QString yyClassName;
00118     QMap<QString, int> yyWidgetTypeSet;
00119     QMap<QString, QMap<QString, int> > yyPropertyMap;
00120     QMap<QString, QDomElement> yyWidgetMap;
00121     QMap<QString, QString> yyCustomWidgets;
00122     QValueList<DlgConnection> yyConnections;
00123     QMap<QString, QString> yySlots;
00124     QMap<QString, QString> yyAliasMap;
00125     QStringList yyTabStops;
00126     QString yyBoxKind;
00127     int yyLayoutDepth;
00128     int yyGridRow;
00129     int yyGridColumn;
00130 
00131     int numErrors;
00132     int uniqueLayout;
00133     int uniqueSpacer;
00134     int uniqueWidget;
00135 };
00136 
00137 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'