diff options
Diffstat (limited to 'kdevdesigner/designer/workspace.cpp')
-rw-r--r-- | kdevdesigner/designer/workspace.cpp | 218 |
1 files changed, 109 insertions, 109 deletions
diff --git a/kdevdesigner/designer/workspace.cpp b/kdevdesigner/designer/workspace.cpp index db9bd7be..9977c2ab 100644 --- a/kdevdesigner/designer/workspace.cpp +++ b/kdevdesigner/designer/workspace.cpp @@ -24,7 +24,7 @@ ** **********************************************************************/ -#include <qvariant.h> // HP-UX compiler needs this here +#include <tqvariant.h> // HP-UX compiler needs this here #include "workspace.h" #include "formwindow.h" #include "mainwindow.h" @@ -39,22 +39,22 @@ #include <kiconloader.h> #include "kdevdesigner_part.h" -#include <qheader.h> -#include <qdragobject.h> -#include <qfileinfo.h> -#include <qapplication.h> -#include <qpainter.h> -#include <qpen.h> -#include <qobjectlist.h> -#include <qworkspace.h> -#include <qpopupmenu.h> -#include <qtextstream.h> +#include <tqheader.h> +#include <tqdragobject.h> +#include <tqfileinfo.h> +#include <tqapplication.h> +#include <tqpainter.h> +#include <tqpen.h> +#include <tqobjectlist.h> +#include <tqworkspace.h> +#include <tqpopupmenu.h> +#include <tqtextstream.h> #include "qcompletionedit.h" #include <klocale.h> -WorkspaceItem::WorkspaceItem( QListView *parent, Project* p ) - : QListViewItem( parent ) +WorkspaceItem::WorkspaceItem( TQListView *parent, Project* p ) + : TQListViewItem( parent ) { init(); project = p; @@ -63,8 +63,8 @@ WorkspaceItem::WorkspaceItem( QListView *parent, Project* p ) setExpandable( FALSE ); } -WorkspaceItem::WorkspaceItem( QListViewItem *parent, SourceFile* sf ) - : QListViewItem( parent ) +WorkspaceItem::WorkspaceItem( TQListViewItem *parent, SourceFile* sf ) + : TQListViewItem( parent ) { init(); sourceFile = sf; @@ -72,27 +72,27 @@ WorkspaceItem::WorkspaceItem( QListViewItem *parent, SourceFile* sf ) setPixmap( 0, SmallIcon( "designer_filenew.png" , KDevDesignerPartFactory::instance()) ); } -WorkspaceItem::WorkspaceItem( QListViewItem *parent, QObject *o, Project *p ) - : QListViewItem( parent ) +WorkspaceItem::WorkspaceItem( TQListViewItem *parent, TQObject *o, Project *p ) + : TQListViewItem( parent ) { init(); object = o; project = p; t = ObjectType; setPixmap( 0, SmallIcon( "designer_object.png" , KDevDesignerPartFactory::instance()) ); - QObject::connect( p->fakeFormFileFor( o ), SIGNAL( somethingChanged(FormFile*) ), - listView(), SLOT( update() ) ); + TQObject::connect( p->fakeFormFileFor( o ), TQT_SIGNAL( somethingChanged(FormFile*) ), + listView(), TQT_SLOT( update() ) ); } -WorkspaceItem::WorkspaceItem( QListViewItem *parent, FormFile* ff, Type type ) - : QListViewItem( parent ) +WorkspaceItem::WorkspaceItem( TQListViewItem *parent, FormFile* ff, Type type ) + : TQListViewItem( parent ) { init(); formFile = ff; t = type; if ( type == FormFileType ) { setPixmap( 0, SmallIcon( "designer_form.png" , KDevDesignerPartFactory::instance()) ); - QObject::connect( ff, SIGNAL( somethingChanged(FormFile*) ), listView(), SLOT( update(FormFile*) ) ); + TQObject::connect( ff, TQT_SIGNAL( somethingChanged(FormFile*) ), listView(), TQT_SLOT( update(FormFile*) ) ); if ( formFile->supportsCodeFile() ) { (void) new WorkspaceItem( this, formFile, FormSourceType ); } @@ -111,31 +111,31 @@ void WorkspaceItem::init() formFile = 0; } -void WorkspaceItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ) +void WorkspaceItem::paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int align ) { - QColorGroup g( cg ); - g.setColor( QColorGroup::Base, backgroundColor() ); - g.setColor( QColorGroup::Foreground, Qt::black ); + TQColorGroup g( cg ); + g.setColor( TQColorGroup::Base, backgroundColor() ); + g.setColor( TQColorGroup::Foreground, Qt::black ); if ( type() == FormSourceType && ( !formFile->hasFormCode() || ( formFile->codeFileState() == FormFile::Deleted && formFile->formWindow() ) ) && parent() && parent()->parent() && ( (WorkspaceItem*)parent()->parent() )->project && ( (WorkspaceItem*)parent()->parent() )->project->isCpp() ) { - g.setColor( QColorGroup::Text, listView()->palette().disabled().color( QColorGroup::Text) ); - g.setColor( QColorGroup::HighlightedText, listView()->palette().disabled().color( QColorGroup::Text) ); + g.setColor( TQColorGroup::Text, listView()->palette().disabled().color( TQColorGroup::Text) ); + g.setColor( TQColorGroup::HighlightedText, listView()->palette().disabled().color( TQColorGroup::Text) ); } else { - g.setColor( QColorGroup::Text, Qt::black ); + g.setColor( TQColorGroup::Text, Qt::black ); } p->save(); if ( isModified() ) { - QFont f = p->font(); + TQFont f = p->font(); f.setBold( TRUE ); p->setFont( f ); } - QListViewItem::paintCell( p, g, column, width, align ); - p->setPen( QPen( cg.dark(), 1 ) ); + TQListViewItem::paintCell( p, g, column, width, align ); + p->setPen( TQPen( cg.dark(), 1 ) ); if ( column == 0 ) p->drawLine( 0, 0, 0, height() - 1 ); if ( listView()->firstChild() != this ) { @@ -149,16 +149,16 @@ void WorkspaceItem::paintCell( QPainter *p, const QColorGroup &cg, int column, i p->restore(); } -QString WorkspaceItem::text( int column ) const +TQString WorkspaceItem::text( int column ) const { if ( column != 0 ) - return QListViewItem::text( column ); + return TQListViewItem::text( column ); switch( t ) { case ProjectType: if ( project->isDummy() ) { return i18n("<No Project>" ); } else if ( MainWindow::self->singleProjectMode() ) { - return QFileInfo( project->fileName() ).baseName(); + return TQFileInfo( project->fileName() ).baseName(); } return project->makeRelative( project->fileName() ); case FormFileType: @@ -177,10 +177,10 @@ QString WorkspaceItem::text( int column ) const return project->qualifiedName( object ); } - return QString::null; // shut up compiler + return TQString::null; // shut up compiler } -void WorkspaceItem::fillCompletionList( QStringList& completion ) +void WorkspaceItem::fillCompletionList( TQStringList& completion ) { switch( t ) { case ProjectType: @@ -200,7 +200,7 @@ void WorkspaceItem::fillCompletionList( QStringList& completion ) } } -bool WorkspaceItem::checkCompletion( const QString& completion ) +bool WorkspaceItem::checkCompletion( const TQString& completion ) { switch( t ) { case ProjectType: @@ -237,9 +237,9 @@ bool WorkspaceItem::isModified() const return FALSE; // shut up compiler } -QString WorkspaceItem::key( int column, bool ) const +TQString WorkspaceItem::key( int column, bool ) const { - QString key = text( column ); + TQString key = text( column ); if ( t == FormFileType ) key.prepend( "0" ); else if ( t == ObjectType ) @@ -249,7 +249,7 @@ QString WorkspaceItem::key( int column, bool ) const return key; } -QColor WorkspaceItem::backgroundColor() +TQColor WorkspaceItem::backgroundColor() { bool b = useOddColor; if ( t == FormSourceType && parent() ) @@ -260,18 +260,18 @@ QColor WorkspaceItem::backgroundColor() void WorkspaceItem::setOpen( bool b ) { - QListViewItem::setOpen( b ); + TQListViewItem::setOpen( b ); autoOpen = FALSE; } void WorkspaceItem::setAutoOpen( bool b ) { - QListViewItem::setOpen( b ); + TQListViewItem::setOpen( b ); autoOpen = b; } -Workspace::Workspace( QWidget *parent, MainWindow *mw ) - : QListView( parent, 0, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | +Workspace::Workspace( TQWidget *parent, MainWindow *mw ) + : TQListView( parent, 0, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_Tool | WStyle_MinMax | WStyle_SysMenu ), mainWindow( mw ), project( 0 ), completionDirty( FALSE ) { @@ -283,21 +283,21 @@ Workspace::Workspace( QWidget *parent, MainWindow *mw ) header()->setStretchEnabled( TRUE ); header()->hide(); setSorting( 0 ); - setResizePolicy( QScrollView::Manual ); + setResizePolicy( TQScrollView::Manual ); #ifndef Q_WS_MAC - QPalette p( palette() ); - p.setColor( QColorGroup::Base, QColor( *backColor2 ) ); + TQPalette p( palette() ); + p.setColor( TQColorGroup::Base, TQColor( *backColor2 ) ); (void)*selectedBack; // hack setPalette( p ); #endif addColumn( i18n( "Files" ) ); setAllColumnsShowFocus( TRUE ); - connect( this, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), - this, SLOT( itemClicked( int, QListViewItem *, const QPoint& ) ) ), - connect( this, SIGNAL( doubleClicked( QListViewItem * ) ), - this, SLOT( itemDoubleClicked( QListViewItem * ) ) ), - connect( this, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint &, int ) ), - this, SLOT( rmbClicked( QListViewItem *, const QPoint& ) ) ), + connect( this, TQT_SIGNAL( mouseButtonClicked( int, TQListViewItem *, const TQPoint &, int ) ), + this, TQT_SLOT( itemClicked( int, TQListViewItem *, const TQPoint& ) ) ), + connect( this, TQT_SIGNAL( doubleClicked( TQListViewItem * ) ), + this, TQT_SLOT( itemDoubleClicked( TQListViewItem * ) ) ), + connect( this, TQT_SIGNAL( contextMenuRequested( TQListViewItem *, const TQPoint &, int ) ), + this, TQT_SLOT( rmbClicked( TQListViewItem *, const TQPoint& ) ) ), setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOn ); viewport()->setAcceptDrops( TRUE ); @@ -306,7 +306,7 @@ Workspace::Workspace( QWidget *parent, MainWindow *mw ) } -void Workspace::projectDestroyed( QObject* o ) +void Workspace::projectDestroyed( TQObject* o ) { if ( o == project ) { project = 0; @@ -319,23 +319,23 @@ void Workspace::setCurrentProject( Project *pro ) if ( project == pro ) return; if ( project ) { - disconnect( project, SIGNAL( sourceFileAdded(SourceFile*) ), this, SLOT( sourceFileAdded(SourceFile*) ) ); - disconnect( project, SIGNAL( sourceFileRemoved(SourceFile*) ), this, SLOT( sourceFileRemoved(SourceFile*) ) ); - disconnect( project, SIGNAL( formFileAdded(FormFile*) ), this, SLOT( formFileAdded(FormFile*) ) ); - disconnect( project, SIGNAL( formFileRemoved(FormFile*) ), this, SLOT( formFileRemoved(FormFile*) ) ); - disconnect( project, SIGNAL( objectAdded(QObject*) ), this, SLOT( objectAdded(QObject*) ) ); - disconnect( project, SIGNAL( objectRemoved(QObject*) ), this, SLOT( objectRemoved(QObject*) ) ); - disconnect( project, SIGNAL( projectModified() ), this, SLOT( update() ) ); + disconnect( project, TQT_SIGNAL( sourceFileAdded(SourceFile*) ), this, TQT_SLOT( sourceFileAdded(SourceFile*) ) ); + disconnect( project, TQT_SIGNAL( sourceFileRemoved(SourceFile*) ), this, TQT_SLOT( sourceFileRemoved(SourceFile*) ) ); + disconnect( project, TQT_SIGNAL( formFileAdded(FormFile*) ), this, TQT_SLOT( formFileAdded(FormFile*) ) ); + disconnect( project, TQT_SIGNAL( formFileRemoved(FormFile*) ), this, TQT_SLOT( formFileRemoved(FormFile*) ) ); + disconnect( project, TQT_SIGNAL( objectAdded(TQObject*) ), this, TQT_SLOT( objectAdded(TQObject*) ) ); + disconnect( project, TQT_SIGNAL( objectRemoved(TQObject*) ), this, TQT_SLOT( objectRemoved(TQObject*) ) ); + disconnect( project, TQT_SIGNAL( projectModified() ), this, TQT_SLOT( update() ) ); } project = pro; - connect( project, SIGNAL( sourceFileAdded(SourceFile*) ), this, SLOT( sourceFileAdded(SourceFile*) ) ); - connect( project, SIGNAL( sourceFileRemoved(SourceFile*) ), this, SLOT( sourceFileRemoved(SourceFile*) ) ); - connect( project, SIGNAL( formFileAdded(FormFile*) ), this, SLOT( formFileAdded(FormFile*) ) ); - connect( project, SIGNAL( formFileRemoved(FormFile*) ), this, SLOT( formFileRemoved(FormFile*) ) ); - connect( project, SIGNAL( destroyed(QObject*) ), this, SLOT( projectDestroyed(QObject*) ) ); - connect( project, SIGNAL( objectAdded(QObject*) ), this, SLOT( objectAdded(QObject*) ) ); - connect( project, SIGNAL( objectRemoved(QObject*) ), this, SLOT( objectRemoved(QObject*) ) ); - connect( project, SIGNAL( projectModified() ), this, SLOT( update() ) ); + connect( project, TQT_SIGNAL( sourceFileAdded(SourceFile*) ), this, TQT_SLOT( sourceFileAdded(SourceFile*) ) ); + connect( project, TQT_SIGNAL( sourceFileRemoved(SourceFile*) ), this, TQT_SLOT( sourceFileRemoved(SourceFile*) ) ); + connect( project, TQT_SIGNAL( formFileAdded(FormFile*) ), this, TQT_SLOT( formFileAdded(FormFile*) ) ); + connect( project, TQT_SIGNAL( formFileRemoved(FormFile*) ), this, TQT_SLOT( formFileRemoved(FormFile*) ) ); + connect( project, TQT_SIGNAL( destroyed(TQObject*) ), this, TQT_SLOT( projectDestroyed(TQObject*) ) ); + connect( project, TQT_SIGNAL( objectAdded(TQObject*) ), this, TQT_SLOT( objectAdded(TQObject*) ) ); + connect( project, TQT_SIGNAL( objectRemoved(TQObject*) ), this, TQT_SLOT( objectRemoved(TQObject*) ) ); + connect( project, TQT_SIGNAL( projectModified() ), this, TQT_SLOT( update() ) ); clear(); if ( bufferEdit ) @@ -345,13 +345,13 @@ void Workspace::setCurrentProject( Project *pro ) projectItem->setOpen( TRUE ); - for ( QPtrListIterator<SourceFile> sources = project->sourceFiles(); + for ( TQPtrListIterator<SourceFile> sources = project->sourceFiles(); sources.current(); ++sources ) { SourceFile* f = sources.current(); (void) new WorkspaceItem( projectItem, f ); } - for ( QPtrListIterator<FormFile> forms = project->formFiles(); + for ( TQPtrListIterator<FormFile> forms = project->formFiles(); forms.current(); ++forms ) { FormFile* f = forms.current(); if ( f->isFake() ) @@ -360,10 +360,10 @@ void Workspace::setCurrentProject( Project *pro ) (void) new WorkspaceItem( projectItem, f ); } - QObjectList l = project->objects(); - QObjectListIt objs( l ); + TQObjectList l = project->objects(); + TQObjectListIt objs( l ); for ( ;objs.current(); ++objs ) { - QObject* o = objs.current(); + TQObject* o = objs.current(); (void) new WorkspaceItem( projectItem, o, project ); } @@ -397,13 +397,13 @@ void Workspace::formFileRemoved( FormFile* ff ) updateColors(); } -void Workspace::objectAdded( QObject *o ) +void Workspace::objectAdded( TQObject *o ) { (void) new WorkspaceItem( projectItem, o, project ); updateColors(); } -void Workspace::objectRemoved( QObject *o ) +void Workspace::objectRemoved( TQObject *o ) { delete findItem( o ); updateColors(); @@ -417,7 +417,7 @@ void Workspace::update() void Workspace::update( FormFile* ff ) { - QListViewItem* i = findItem( ff ); + TQListViewItem* i = findItem( ff ); if ( i ) { i->repaint(); if ( (i = i->firstChild()) ) @@ -466,7 +466,7 @@ void Workspace::activeEditorChanged( SourceEditor *se ) WorkspaceItem *Workspace::findItem( FormFile* ff) { - QListViewItemIterator it( this ); + TQListViewItemIterator it( this ); for ( ; it.current(); ++it ) { if ( ( (WorkspaceItem*)it.current() )->formFile == ff ) return (WorkspaceItem*)it.current(); @@ -476,7 +476,7 @@ WorkspaceItem *Workspace::findItem( FormFile* ff) WorkspaceItem *Workspace::findItem( SourceFile *sf ) { - QListViewItemIterator it( this ); + TQListViewItemIterator it( this ); for ( ; it.current(); ++it ) { if ( ( (WorkspaceItem*)it.current() )->sourceFile == sf ) return (WorkspaceItem*)it.current(); @@ -484,9 +484,9 @@ WorkspaceItem *Workspace::findItem( SourceFile *sf ) return 0; } -WorkspaceItem *Workspace::findItem( QObject *o ) +WorkspaceItem *Workspace::findItem( TQObject *o ) { - QListViewItemIterator it( this ); + TQListViewItemIterator it( this ); for ( ; it.current(); ++it ) { if ( ( (WorkspaceItem*)it.current() )->object == o ) return (WorkspaceItem*)it.current(); @@ -496,7 +496,7 @@ WorkspaceItem *Workspace::findItem( QObject *o ) void Workspace::closeAutoOpenItems() { - QListViewItemIterator it( this ); + TQListViewItemIterator it( this ); for ( ; it.current(); ++it ) { WorkspaceItem* i = (WorkspaceItem*) it.current(); WorkspaceItem* ip = (WorkspaceItem*) i->parent(); @@ -510,18 +510,18 @@ void Workspace::closeAutoOpenItems() } -void Workspace::closeEvent( QCloseEvent *e ) +void Workspace::closeEvent( TQCloseEvent *e ) { e->accept(); } -void Workspace::itemDoubleClicked( QListViewItem *i ) +void Workspace::itemDoubleClicked( TQListViewItem *i ) { if ( ( (WorkspaceItem*)i)->type()== WorkspaceItem::ProjectType ) i->setOpen( TRUE ); } -void Workspace::itemClicked( int button, QListViewItem *i, const QPoint& ) +void Workspace::itemClicked( int button, TQListViewItem *i, const TQPoint& ) { if ( !i || button != LeftButton ) return; @@ -552,46 +552,46 @@ void Workspace::itemClicked( int button, QListViewItem *i, const QPoint& ) } } -void Workspace::contentsDropEvent( QDropEvent *e ) +void Workspace::contentsDropEvent( TQDropEvent *e ) { - if ( !QUriDrag::canDecode( e ) ) { + if ( !TQUriDrag::canDecode( e ) ) { e->ignore(); } else { - QStringList files; - QUriDrag::decodeLocalFiles( e, files ); + TQStringList files; + TQUriDrag::decodeLocalFiles( e, files ); if ( !files.isEmpty() ) { - for ( QStringList::Iterator it = files.begin(); it != files.end(); ++it ) { - QString fn = *it; + for ( TQStringList::Iterator it = files.begin(); it != files.end(); ++it ) { + TQString fn = *it; mainWindow->fileOpen( "", "", fn ); } } } } -void Workspace::contentsDragEnterEvent( QDragEnterEvent *e ) +void Workspace::contentsDragEnterEvent( TQDragEnterEvent *e ) { - if ( !QUriDrag::canDecode( e ) ) + if ( !TQUriDrag::canDecode( e ) ) e->ignore(); else e->accept(); } -void Workspace::contentsDragMoveEvent( QDragMoveEvent *e ) +void Workspace::contentsDragMoveEvent( TQDragMoveEvent *e ) { - if ( !QUriDrag::canDecode( e ) ) + if ( !TQUriDrag::canDecode( e ) ) e->ignore(); else e->accept(); } -void Workspace::rmbClicked( QListViewItem *i, const QPoint& pos ) +void Workspace::rmbClicked( TQListViewItem *i, const TQPoint& pos ) { if ( !i ) return; WorkspaceItem* wi = (WorkspaceItem*)i; enum { OPEN_SOURCE, REMOVE_SOURCE, OPEN_FORM, REMOVE_FORM, OPEN_FORM_SOURCE, REMOVE_FORM_SOURCE, OPEN_OBJECT_SOURCE }; - QPopupMenu menu( this ); + TQPopupMenu menu( this ); menu.setCheckable( TRUE ); switch ( wi->type() ) { case WorkspaceItem::SourceFileType: @@ -645,19 +645,19 @@ void Workspace::rmbClicked( QListViewItem *i, const QPoint& pos ) } } -bool Workspace::eventFilter( QObject *o, QEvent * e ) +bool Workspace::eventFilter( TQObject *o, TQEvent * e ) { // Reggie, on what type of events do we have to execute updateBufferEdit() - if ( o ==bufferEdit && e->type() != QEvent::ChildRemoved ) + if ( o ==bufferEdit && e->type() != TQEvent::ChildRemoved ) updateBufferEdit(); - return QListView::eventFilter( o, e ); + return TQListView::eventFilter( o, e ); } void Workspace::setBufferEdit( QCompletionEdit *edit ) { bufferEdit = edit; - connect( bufferEdit, SIGNAL( chosen( const QString & ) ), - this, SLOT( bufferChosen( const QString & ) ) ); + connect( bufferEdit, TQT_SIGNAL( chosen( const TQString & ) ), + this, TQT_SLOT( bufferChosen( const TQString & ) ) ); bufferEdit->installEventFilter( this ); } @@ -666,8 +666,8 @@ void Workspace::updateBufferEdit() if ( !bufferEdit || !completionDirty || !MainWindow::self) return; completionDirty = FALSE; - QStringList completion = MainWindow::self->projectFileNames(); - QListViewItemIterator it( this ); + TQStringList completion = MainWindow::self->projectFileNames(); + TQListViewItemIterator it( this ); while ( it.current() ) { ( (WorkspaceItem*)it.current())->fillCompletionList( completion ); ++it; @@ -676,7 +676,7 @@ void Workspace::updateBufferEdit() bufferEdit->setCompletionList( completion ); } -void Workspace::bufferChosen( const QString &buffer ) +void Workspace::bufferChosen( const TQString &buffer ) { if ( bufferEdit ) bufferEdit->setText( "" ); @@ -686,10 +686,10 @@ void Workspace::bufferChosen( const QString &buffer ) return; } - QListViewItemIterator it( this ); + TQListViewItemIterator it( this ); while ( it.current() ) { if ( ( (WorkspaceItem*)it.current())->checkCompletion( buffer ) ) { - itemClicked( LeftButton, it.current(), QPoint() ); + itemClicked( LeftButton, it.current(), TQPoint() ); break; } ++it; @@ -698,7 +698,7 @@ void Workspace::bufferChosen( const QString &buffer ) void Workspace::updateColors() { - QListViewItem* i = firstChild(); + TQListViewItem* i = firstChild(); if ( i ) i = i->firstChild(); bool b = TRUE; |