bool MetaDataBase::addCustomWidget( CustomWidget *wid ) { setupDataBase(); for ( CustomWidget *w = cWidgets->first(); w; w = cWidgets->next() ) { if ( *wid == *w ) { for ( QValueList<QCString>::ConstIterator it = wid->lstSignals.begin(); it != wid->lstSignals.end(); ++it ) { if ( !w->hasSignal( *it ) ) w->lstSignals.append( *it ); } for ( QValueList<Slot>::ConstIterator it2 = wid->lstSlots.begin(); it2 != wid->lstSlots.end(); ++it2 ) { if ( !w->hasSlot( MetaDataBase::normalizeSlot( (*it2).slot ).latin1() ) ) w->lstSlots.append( *it2 ); } for ( QValueList<Property>::ConstIterator it3 = wid->lstProperties.begin(); it3 != wid->lstProperties.end(); ++it3 ) { if ( !w->hasProperty( (*it3).property ) ) w->lstProperties.append( *it3 ); } delete wid; return false; } } WidgetDatabaseRecord *r = new WidgetDatabaseRecord; r->name = wid->className; r->group = WidgetDatabase::widgetGroup( "Custom" ); r->toolTip = wid->className; r->iconSet = new QIconSet( *wid->pixmap, *wid->pixmap ); r->isContainer = wid->isContainer; wid->id = WidgetDatabase::addCustomWidget( r ); cWidgets->append( wid ); return true; }
void MetaDataBase::addSlot( QObject *o, const QCString &slot, const QString& specifier, const QString &access, const QString &language, const QString &returnType ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return; } Slot s; s.slot = slot; s.specifier = specifier; s.access = access; s.language = language; s.returnType = returnType; QValueList<MetaDataBase::Slot>::Iterator it = r->slotList.find( s ); if ( it != r->slotList.end() ) r->slotList.remove( it ); r->slotList.append( s ); #ifndef KOMMANDER ( (FormWindow*)o )->formFile()->addSlotCode( s ); #endif }
QString WidgetDatabase::widgetGroup( int i ) { setupDataBase(); if ( i >= 0 && i < (int)wGroups->count() ) return wGroups->at( i ); return QString::null; }
void MetaDataBase::setSignalList( QObject *o, const QStringList &sigs ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return; } r->sigs.clear(); for ( QStringList::ConstIterator it = sigs.begin(); it != sigs.end(); ++it ) { QString s = (*it).simplifyWhiteSpace(); bool hasSemicolon = s.endsWith( ";" ); if ( hasSemicolon ) s = s.left( s.length() - 1 ); int p = s.find( '(' ); if ( p < 0 ) p = s.length(); int sp = s.find( ' ' ); if ( sp >= 0 && sp < p ) { s = s.mid( sp+1 ); p -= sp + 1; } if ( p == (int) s.length() ) s += "()"; if ( hasSemicolon ) s += ";"; r->sigs << s; } }
mainWindow::mainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::mainWindow) { //#ifndef WIN32 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); //#endif ui->setupUi(this); setupDataBase(); setupTable(); setupComboBox(); ui->mainToolBar->addAction(ui->actionAjouter_console); ui->mainToolBar->addAction(ui->actionEditer_ligne); ui->mainToolBar->addAction(ui->actionSupprimer_ligne); connect(ui->buttonAdd, SIGNAL(clicked()), this, SLOT(addGame())); connect(ui->actionAjouter_console, SIGNAL(triggered()), this, SLOT(addConsole())); connect(ui->actionSupprimer_ligne, SIGNAL(triggered()), this, SLOT(deleteGame())); connect(ui->actionEditer_ligne, SIGNAL(triggered()), this, SLOT(editGame())); connect(ui->actionExporter_en_csv, SIGNAL(triggered()), this, SLOT(exportCSV())); connect(ui->actionImporter_un_CSV, SIGNAL(triggered()), this, SLOT(importCSV())); }
QString WidgetDatabase::group( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) return QString::null; return r->group; }
bool WidgetDatabase::isCommon( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) return FALSE; return r->isCommon; }
bool WidgetDatabase::isCustomPluginWidget( int id ) { setupDataBase( id ); WidgetDatabaseRecord *r = at( id ); if ( !r ) return FALSE; return r->isPlugin; }
QString WidgetDatabase::className( int id ) { setupDataBase(); WidgetDatabaseRecord *r = at( id ); if ( !r ) return QString::null; return r->name; }
QString WidgetDatabase::toolTip( int id ) { setupDataBase(); WidgetDatabaseRecord *r = at( id ); if ( !r ) return QString::null; return r->toolTip; }
QString WidgetDatabase::whatsThis( int id ) { setupDataBase(); WidgetDatabaseRecord *r = at( id ); if ( !r ) return QString::null; return r->whatsThis; }
bool WidgetDatabase::isContainer( int id ) { setupDataBase(); WidgetDatabaseRecord *r = at( id ); if ( !r ) return FALSE; return r->isContainer; }
void MetaDataBase::clear( QObject *o ) { if ( !o ) return; setupDataBase(); db->remove( (void*)o ); for ( QPtrDictIterator<QWidget> it( *( (FormWindow*)o )->widgets() ); it.current(); ++it ) db->remove( (void*)it.current() ); }
/*! Returns the id for \a name or -1 if \a name is unknown. */ int WidgetDatabase::idFromClassName( const QString &name ) { setupDataBase( -1 ); if ( name.isEmpty() ) return 0; int *i = className2Id->find( name ); if ( i ) return *i; if ( name == "FormWindow" ) return idFromClassName( "QLayoutWidget" ); #ifdef UIC setupDataBase( -2 ); i = className2Id->find( name ); if ( i ) return *i; #endif return -1; }
QString WidgetDatabase::includeFile( int id ) { setupDataBase(); WidgetDatabaseRecord *r = at( id ); if ( !r ) return QString::null; if ( r->includeFile.isNull() ) return r->name.lower() + ".h"; return r->includeFile; }
QValueList<MetaDataBase::Connection> MetaDataBase::connections( QObject *o ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return QValueList<Connection>(); } return r->connections; }
void MetaDataBase::setSlotList( QObject *o, const QValueList<Slot> &slotList ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return; } r->slotList = slotList; }
QCursor MetaDataBase::cursor( QWidget *w ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)w ); if ( !r ) { w->unsetCursor(); return w->cursor(); } return r->cursor; }
void MetaDataBase::setFakeProperty( QObject *o, const QString &property, const QVariant& value ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return; } r->fakeProperties[property] = value; }
QMap<QString,QVariant>* MetaDataBase::fakeProperties( QObject* o ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return 0; } return &r->fakeProperties; }
QValueList<MetaDataBase::Slot> MetaDataBase::slotList( QObject *o ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return QValueList<Slot>(); } return r->slotList; }
void MetaDataBase::setTabOrder( QWidget *w, const QWidgetList &order ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*) w ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", w, w->name(), w->className() ); return; } r->tabOrder = order; }
QWidgetList MetaDataBase::tabOrder( QWidget *w ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*) w ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", w, w->name(), w->className() ); return QWidgetList(); } return r->tabOrder; }
QStringList MetaDataBase::signalList( QObject *o ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return QStringList(); } return r->sigs; }
void MetaDataBase::setIncludes( QObject *o, const QValueList<Include> &incs ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return; } r->includes = incs; }
QValueList<MetaDataBase::Include> MetaDataBase::includes( QObject *o ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return QValueList<Include>(); } return r->includes; }
void MetaDataBase::setCursor( QWidget *w, const QCursor &c ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)w ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", w, w->name(), w->className() ); return; } r->cursor = c; }
MetaDataBase::MetaInfo MetaDataBase::metaInfo( QObject *o ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return MetaInfo(); } return r->metaInfo; }
void MetaDataBase::setMetaInfo( QObject *o, MetaInfo mi ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return; } r->metaInfo = mi; }
void MetaDataBase::setForwards( QObject *o, const QStringList &fwds ) { setupDataBase(); MetaDataBaseRecord *r = db->find( (void*)o ); if ( !r ) { qWarning( "No entry for %p (%s, %s) found in MetaDataBase", o, o->name(), o->className() ); return; } r->forwards = fwds; }