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 METADATABASE_H 00028 #define METADATABASE_H 00029 00030 #include <qvariant.h> 00031 #include <qstring.h> 00032 #include <qstringlist.h> 00033 #include <qmap.h> 00034 #include <qptrlist.h> 00035 #include <qsizepolicy.h> 00036 #include <qsize.h> 00037 #include <qwidgetlist.h> 00038 #include <qcursor.h> 00039 00040 #include "pixmapchooser.h" 00041 #include "../interfaces/languageinterface.h" 00042 00043 class QObject; 00044 class QPixmap; 00045 struct LanguageInterface; 00046 00047 class MetaDataBase 00048 { 00049 public: 00050 struct Connection 00051 { 00052 QObject *sender, *receiver; 00053 QCString signal, slot; 00054 bool operator==( const Connection &c ) const { 00055 return sender == c.sender && receiver == c.receiver && 00056 signal == c.signal && slot == c.slot ; 00057 } 00058 }; 00059 00060 struct Function 00061 { 00062 QString returnType; 00063 QCString function; 00064 QString specifier; 00065 QString access; 00066 QString type; 00067 QString language; 00068 bool operator==( const Function &f ) const { 00069 return ( returnType == f.returnType && 00070 function == f.function && 00071 specifier == f.specifier && 00072 access == f.access && 00073 type == f.type && 00074 language == f.language 00075 ); 00076 } 00077 }; 00078 00079 struct Property 00080 { 00081 QCString property; 00082 QString type; 00083 bool operator==( const Property &p ) const { 00084 return property == p.property && 00085 type == p.type; 00086 } 00087 }; 00088 00089 struct CustomWidget 00090 { 00091 CustomWidget(); 00092 CustomWidget( const CustomWidget &w ); 00093 ~CustomWidget() { delete pixmap; } // inlined to work around 2.7.2.3 bug 00094 bool operator==( const CustomWidget &w ) const; 00095 CustomWidget &operator=( const CustomWidget &w ); 00096 00097 bool hasSignal( const QCString &signal ) const; 00098 bool hasSlot( const QCString &slot ) const; 00099 bool hasProperty( const QCString &prop ) const; 00100 00101 enum IncludePolicy { Global, Local }; 00102 QString className; 00103 QString includeFile; 00104 IncludePolicy includePolicy; 00105 QSize sizeHint; 00106 QSizePolicy sizePolicy; 00107 QPixmap *pixmap; 00108 QValueList<QCString> lstSignals; 00109 QValueList<Function> lstSlots; 00110 QValueList<Property> lstProperties; 00111 int id; 00112 bool isContainer; 00113 }; 00114 00115 struct Include 00116 { 00117 Include() : header(), location(), implDecl( "in implementation" ) {} 00118 QString header; 00119 QString location; 00120 bool operator==( const Include &i ) const { 00121 return header == i.header && location == i.location; 00122 } 00123 QString implDecl; 00124 }; 00125 00126 struct Variable 00127 { 00128 QString varName; 00129 QString varAccess; 00130 bool operator==( const Variable &v ) const { 00131 return varName == v.varName && 00132 varAccess == v.varAccess; 00133 } 00134 }; 00135 00136 struct MetaInfo 00137 { 00138 MetaInfo() : classNameChanged( FALSE ) { } 00139 QString className; 00140 bool classNameChanged; 00141 QString comment; 00142 QString author; 00143 }; 00144 00145 MetaDataBase(); 00146 static void clearDataBase(); 00147 00148 static void addEntry( QObject *o ); 00149 static void removeEntry( QObject *o ); 00150 static void setPropertyChanged( QObject *o, const QString &property, bool changed ); 00151 static bool isPropertyChanged( QObject *o, const QString &property ); 00152 static void setPropertyComment( QObject *o, const QString &property, const QString &comment ); 00153 static QString propertyComment( QObject *o, const QString &property ); 00154 static QStringList changedProperties( QObject *o ); 00155 00156 static void setFakeProperty( QObject *o, const QString &property, const QVariant& value ); 00157 static QVariant fakeProperty( QObject * o, const QString &property ); 00158 static QMap<QString,QVariant>* fakeProperties( QObject* o ); 00159 00160 static void setSpacing( QObject *o, int spacing ); 00161 static int spacing( QObject *o ); 00162 static void setMargin( QObject *o, int margin ); 00163 static int margin( QObject *o ); 00164 00165 static void setResizeMode( QObject *o, const QString &mode ); 00166 static QString resizeMode( QObject *o ); 00167 00168 static void addConnection( QObject *o, QObject *sender, const QCString &signal, 00169 QObject *receiver, const QCString &slot, bool addCode = TRUE ); 00170 static void removeConnection( QObject *o, QObject *sender, const QCString &signal, 00171 QObject *receiver, const QCString &slot ); 00172 static bool hasConnection( QObject *o, QObject *sender, const QCString &signal, 00173 QObject *receiver, const QCString &slot ); 00174 static void setupConnections( QObject *o, const QValueList<LanguageInterface::Connection> &conns ); 00175 static QValueList<Connection> connections( QObject *o ); 00176 static QValueList<Connection> connections( QObject *o, QObject *sender, QObject *receiver ); 00177 static QValueList<Connection> connections( QObject *o, QObject *object ); 00178 static void doConnections( QObject *o ); 00179 00180 static void addFunction( QObject *o, const QCString &function, const QString &specifier, 00181 const QString &access, const QString &type, const QString &language, 00182 const QString &returnType ); 00183 static void removeFunction( QObject *o, const QCString &function, const QString &specifier, 00184 const QString &access, const QString &type, const QString &language, 00185 const QString &returnType ); 00186 static void removeFunction( QObject *o, const QString &function ); 00187 static QValueList<Function> functionList( QObject *o, bool onlyFunctions = FALSE ); 00188 static QValueList<Function> slotList( QObject *o ); 00189 static bool isSlotUsed( QObject *o, const QCString &slot ); 00190 static bool hasFunction( QObject *o, const QCString &function, bool onlyCustom = FALSE ); 00191 static bool hasSlot( QObject *o, const QCString &slot, bool onlyCustom = FALSE ); 00192 static void changeFunction( QObject *o, const QString &function, const QString &newName, 00193 const QString &returnType ); 00194 static void changeFunctionAttributes( QObject *o, const QString &oldName, const QString &newName, 00195 const QString &specifier, const QString &access, 00196 const QString &type, const QString &language, 00197 const QString &returnType ); 00198 static QString languageOfFunction( QObject *o, const QCString &function ); 00199 static void setFunctionList( QObject *o, const QValueList<Function> &functionList ); 00200 00201 00202 static bool addCustomWidget( CustomWidget *w ); 00203 static void removeCustomWidget( CustomWidget *w ); 00204 static QPtrList<CustomWidget> *customWidgets(); 00205 static CustomWidget *customWidget( int id ); 00206 static bool isWidgetNameUsed( CustomWidget *w ); 00207 static bool hasCustomWidget( const QString &className ); 00208 00209 static void setTabOrder( QWidget *w, const QWidgetList &order ); 00210 static QWidgetList tabOrder( QWidget *w ); 00211 00212 static void setIncludes( QObject *o, const QValueList<Include> &incs ); 00213 static QValueList<Include> includes( QObject *o ); 00214 00215 static void setForwards( QObject *o, const QStringList &fwds ); 00216 static QStringList forwards( QObject *o ); 00217 00218 static void setVariables( QObject *o, const QValueList<Variable> &vars ); 00219 static void addVariable( QObject *o, const QString &name, const QString &access ); 00220 static void removeVariable( QObject *o, const QString &name ); 00221 static QValueList<Variable> variables( QObject *o ); 00222 static bool hasVariable( QObject *o, const QString &name ); 00223 static QString extractVariableName( const QString &name ); 00224 00225 static void setSignalList( QObject *o, const QStringList &sigs ); 00226 static QStringList signalList( QObject *o ); 00227 00228 static void setMetaInfo( QObject *o, MetaInfo mi ); 00229 static MetaInfo metaInfo( QObject *o ); 00230 00231 static void setCursor( QWidget *w, const QCursor &c ); 00232 static QCursor cursor( QWidget *w ); 00233 00234 static void setPixmapArgument( QObject *o, int pixmap, const QString &arg ); 00235 static QString pixmapArgument( QObject *o, int pixmap ); 00236 static void clearPixmapArguments( QObject *o ); 00237 00238 static void setPixmapKey( QObject *o, int pixmap, const QString &arg ); 00239 static QString pixmapKey( QObject *o, int pixmap ); 00240 static void clearPixmapKeys( QObject *o ); 00241 00242 static void setColumnFields( QObject *o, const QMap<QString, QString> &columnFields ); 00243 static QMap<QString, QString> columnFields( QObject *o ); 00244 00245 static void setEditor( const QStringList &langs ); 00246 static bool hasEditor( const QString &lang ); 00247 00248 static void setupInterfaceManagers( const QString &plugDir ); 00249 static QStringList languages(); 00250 00251 static LanguageInterface *languageInterface( const QString &lang ); 00252 00253 static QString normalizeFunction( const QString &f ); 00254 00255 static void clear( QObject *o ); 00256 00257 static void setBreakPoints( QObject *o, const QValueList<uint> &l ); 00258 static void setBreakPointCondition( QObject *o, int line, const QString &condition ); 00259 static QValueList<uint> breakPoints( QObject *o ); 00260 static QString breakPointCondition( QObject *o, int line ); 00261 00262 static void setExportMacro( QObject *o, const QString ¯o ); 00263 static QString exportMacro( QObject *o ); 00264 00265 static bool hasObject( QObject *o ); 00266 00267 }; 00268 00269 #endif