Esempio n. 1
0
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;
}
Esempio n. 2
0
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
}
Esempio n. 3
0
QString WidgetDatabase::widgetGroup( int i )
{
    setupDataBase();
    if ( i >= 0 && i < (int)wGroups->count() )
	return wGroups->at( i );
    return QString::null;
}
Esempio n. 4
0
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;
    }
}
Esempio n. 5
0
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()));
}
Esempio n. 6
0
QString WidgetDatabase::group( int id )
{
    setupDataBase( id );
    WidgetDatabaseRecord *r = at( id );
    if ( !r )
	return QString::null;
    return r->group;
}
Esempio n. 7
0
bool WidgetDatabase::isCommon( int id )
{
    setupDataBase( id );
    WidgetDatabaseRecord *r = at( id );
    if ( !r )
	return FALSE;
    return r->isCommon;
}
Esempio n. 8
0
bool WidgetDatabase::isCustomPluginWidget( int id )
{
    setupDataBase( id );
    WidgetDatabaseRecord *r = at( id );
    if ( !r )
	return FALSE;
    return r->isPlugin;
}
Esempio n. 9
0
QString WidgetDatabase::className( int id )
{
    setupDataBase();
    WidgetDatabaseRecord *r = at( id );
    if ( !r )
	return QString::null;
    return r->name;
}
Esempio n. 10
0
QString WidgetDatabase::toolTip( int id )
{
    setupDataBase();
    WidgetDatabaseRecord *r = at( id );
    if ( !r )
	return QString::null;
    return r->toolTip;
}
Esempio n. 11
0
QString WidgetDatabase::whatsThis( int id )
{
    setupDataBase();
    WidgetDatabaseRecord *r = at( id );
    if ( !r )
	return QString::null;
    return r->whatsThis;
}
Esempio n. 12
0
bool WidgetDatabase::isContainer( int id )
{
    setupDataBase();
    WidgetDatabaseRecord *r = at( id );
    if ( !r )
	return FALSE;
    return r->isContainer;
}
Esempio n. 13
0
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() );
}
Esempio n. 14
0
/*!  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;
}
Esempio n. 15
0
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;
}
Esempio n. 16
0
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;
}
Esempio n. 17
0
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;
}
Esempio n. 18
0
QCursor MetaDataBase::cursor( QWidget *w )
{
    setupDataBase();
    MetaDataBaseRecord *r = db->find( (void*)w );
    if ( !r ) {
        w->unsetCursor();
        return w->cursor();
    }

    return r->cursor;
}
Esempio n. 19
0
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;
}
Esempio n. 20
0
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;
}
Esempio n. 21
0
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;
}
Esempio n. 22
0
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;
}
Esempio n. 23
0
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;
}
Esempio n. 24
0
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;
}
Esempio n. 25
0
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;
}
Esempio n. 26
0
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;
}
Esempio n. 27
0
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;
}
Esempio n. 28
0
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;
}
Esempio n. 29
0
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;
}
Esempio n. 30
0
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;
}