Eneboo - Documentación para desarrolladores
|
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 GLADE2UI_H 00029 #define GLADE2UI_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 GladeAction 00039 { 00040 QString text; 00041 QString menuText; 00042 QString toolTip; 00043 int accel; 00044 QString iconSet; 00045 }; 00046 00047 struct GladeConnection 00048 { 00049 QString sender; 00050 QString signal; 00051 QString slot; 00052 }; 00053 00054 class Glade2Ui 00055 { 00056 public: 00057 Glade2Ui(); 00058 00059 QStringList convertGladeFile( const QString& fileName ); 00060 00061 private: 00062 QString imageName( const QString& fileName ); 00063 QString opening( const QString& tag, 00064 const AttributeMap& attr = AttributeMap() ); 00065 QString closing( const QString& tag ); 00066 QString atom( const QString& tag, 00067 const AttributeMap& attr = AttributeMap() ); 00068 void error( const QString& message ); 00069 void syntaxError(); 00070 QString getTextValue( const QDomNode& node ); 00071 void emitHeader(); 00072 void emitFooter(); 00073 void emitSimpleValue( const QString& tag, const QString& value, 00074 const AttributeMap& attr = AttributeMap() ); 00075 void emitOpening( const QString& tag, 00076 const AttributeMap& attr = AttributeMap() ); 00077 void emitClosing( const QString& tag ); 00078 void emitAtom( const QString& tag, 00079 const AttributeMap& attr = AttributeMap() ); 00080 void emitVariant( const QVariant& val, 00081 const QString& stringType = "string" ); 00082 void emitProperty( const QString& prop, const QVariant& val, 00083 const QString& stringType = "string" ); 00084 void emitFontProperty( const QString& prop, int pointSize, bool bold ); 00085 void emitAttribute( const QString& prop, const QVariant& val, 00086 const QString& stringType = "string" ); 00087 QString gtk2qtClass( const QString& gtkClass, 00088 const QValueList<QDomElement>& childWidgets ); 00089 00090 int matchAccelOnActivate( const QDomElement& accel ); 00091 void emitGtkMenu( const QDomElement& menu ); 00092 void emitGtkMenuBarChildWidgets( 00093 const QValueList<QDomElement>& childWidgets ); 00094 void emitGtkToolbarChildWidgets( 00095 const QValueList<QDomElement>& childWidgets ); 00096 void emitPushButton( const QString& text, const QString& name ); 00097 void attach( AttributeMap *attr, int leftAttach, int rightAttach, 00098 int topAttach, int bottomAttach ); 00099 void emitSpacer( const QString& orientation, int leftAttach = -1, 00100 int rightAttach = -1, int topAttach = -1, 00101 int bottomAttach = -1 ); 00102 void emitPixmap( const QString& imageName, int leftAttach = -1, 00103 int rightAttach = -1, int topAttach = -1, 00104 int bottomAttach = -1 ); 00105 void emitGnomeAbout( QString copyright, QString authors, QString comments ); 00106 void emitGnomeAppChildWidgetsPass1( 00107 const QValueList<QDomElement>& childWidgets ); 00108 void doPass2( const QValueList<QDomElement>& childWidgets, 00109 QValueList<QDomElement> *menuBar, 00110 QValueList<QValueList<QDomElement> > *toolBars ); 00111 void emitGnomeAppChildWidgetsPass2( 00112 const QValueList<QDomElement>& childWidgets ); 00113 void emitGtkButtonChildWidgets( QValueList<QDomElement> childWidgets ); 00114 void emitGtkComboChildWidgets( const QValueList<QDomElement>& childWidgets, 00115 const QStringList& items ); 00116 void emitGtkNotebookChildWidgets( 00117 const QValueList<QDomElement>& childWidgets ); 00118 void emitQListViewColumns( const QDomElement& qlistview ); 00119 void emitGtkScrolledWindowChildWidgets( 00120 const QValueList<QDomElement>& childWidgets, 00121 const QString& qtClass ); 00122 void emitGnomeDruidPage( const QDomElement& druidPage ); 00123 void emitGtkWindowChildWidgets( const QValueList<QDomElement>& childWidgets, 00124 const QString& qtClass ); 00125 bool packEnd( const QDomElement& widget ); 00126 void emitChildWidgets( const QValueList<QDomElement>& childWidgets, 00127 bool layouted, int leftAttach = -1, 00128 int rightAttach = -1, int topAttach = -1, 00129 int bottomAttach = -1 ); 00130 void emitOpeningWidget( const QString& qtClass, int leftAttach = -1, 00131 int rightAttach = -1, int topAttach = -1, 00132 int bottomAttach = -1 ); 00133 bool shouldPullup( const QValueList<QDomElement>& childWidgets ); 00134 QString emitWidget( const QDomElement& widget, bool layouted, 00135 int leftAttach = -1, int rightAttach = -1, 00136 int topAttach = -1, int bottomAttach = -1 ); 00137 00138 QString yyOut; 00139 QString yyIndentStr; 00140 QString yyFileName; 00141 QString yyProgramName; 00142 QString yyPixmapDirectory; 00143 QMap<QString, QString> yyClassNameMap; 00144 QMap<QString, QString> yyStockMap; 00145 QMap<QString, int> yyKeyMap; 00146 QMap<QString, QString> yyCustomWidgets; 00147 QMap<QString, QString> yyStockItemActions; 00148 QMap<QString, GladeAction> yyActions; 00149 QValueList<GladeConnection> yyConnections; 00150 QMap<QString, QString> yySlots; 00151 QString yyFormName; 00152 QMap<QString, QString> yyImages; 00153 00154 int numErrors; 00155 int uniqueAction; 00156 int uniqueForm; 00157 int uniqueMenuBar; 00158 int uniqueSpacer; 00159 int uniqueToolBar; 00160 }; 00161 00162 #endif