diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/viewcontainer.cpp | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip |
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/viewcontainer.cpp')
-rw-r--r-- | src/viewcontainer.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/viewcontainer.cpp b/src/viewcontainer.cpp index 4f145dd..9242562 100644 --- a/src/viewcontainer.cpp +++ b/src/viewcontainer.cpp @@ -19,21 +19,21 @@ #include <kglobalsettings.h> #include <klocale.h> #include <ktabwidget.h> -#include <qobjectlist.h> +#include <tqobjectlist.h> -ViewContainer::ViewContainer( const QString & caption, KTechlab * ktechlab, QWidget * parent ) - : QWidget( ktechlab ? ktechlab->tabWidget() : parent ) +ViewContainer::ViewContainer( const TQString & caption, KTechlab * ktechlab, TQWidget * tqparent ) + : TQWidget( ktechlab ? ktechlab->tabWidget() : tqparent ) { b_deleted = false; p_ktechlab = ktechlab; if (ktechlab) - connect( ktechlab, SIGNAL(needUpdateCaptions()), this, SLOT(updateCaption()) ); + connect( ktechlab, TQT_SIGNAL(needUpdateCaptions()), this, TQT_SLOT(updateCaption()) ); - QHBoxLayout *layout = new QHBoxLayout(this); + TQHBoxLayout *tqlayout = new TQHBoxLayout(this); m_baseViewArea = new ViewArea( this, this, 0, "viewarea_0" ); - connect( m_baseViewArea, SIGNAL(destroyed(QObject* )), this, SLOT(baseViewAreaDestroyed(QObject* )) ); + connect( m_baseViewArea, TQT_SIGNAL(destroyed(TQObject* )), this, TQT_SLOT(baseViewAreaDestroyed(TQObject* )) ); - layout->addWidget(m_baseViewArea); + tqlayout->addWidget(m_baseViewArea); m_activeViewArea = 0; b_focused = false; @@ -112,7 +112,7 @@ View *ViewContainer::view( uint id ) const return 0l; // We do not want a recursive search as ViewAreas also hold other ViewAreas - QObjectList *l = va->queryList( "View", 0, false, false ); + TQObjectList *l = va->queryList( "View", 0, false, false ); View *view = 0l; if ( !l->isEmpty() ) view = dynamic_cast<View*>(l->first()); @@ -124,7 +124,7 @@ View *ViewContainer::view( uint id ) const ViewArea *ViewContainer::viewArea( uint id ) const { - if ( !m_viewAreaMap.contains(id) ) + if ( !m_viewAreaMap.tqcontains(id) ) return 0l; return m_viewAreaMap[id]; @@ -192,7 +192,7 @@ int ViewContainer::createViewArea( int relativeViewArea, ViewArea::Position posi // setActiveViewArea(id); ViewArea *viewArea = relative->createViewArea( position, id ); -// ViewArea *viewArea = new ViewArea( m_splitter, id, (const char*)("viewarea_"+QString::number(id)) ); +// ViewArea *viewArea = new ViewArea( m_splitter, id, (const char*)("viewarea_"+TQString::number(id)) ); viewArea->show(); // remove? return id; @@ -211,7 +211,7 @@ void ViewContainer::setViewAreaRemoved( uint id ) if (b_deleted) return; - ViewAreaMap::iterator it = m_viewAreaMap.find(id); + ViewAreaMap::iterator it = m_viewAreaMap.tqfind(id); if ( it == m_viewAreaMap.end() ) return; @@ -231,7 +231,7 @@ void ViewContainer::findActiveViewArea() } -void ViewContainer::baseViewAreaDestroyed( QObject *obj ) +void ViewContainer::baseViewAreaDestroyed( TQObject *obj ) { if (!obj) return; @@ -296,7 +296,7 @@ void ViewContainer::saveState( KConfig *config ) } -void ViewContainer::restoreState( KConfig *config, const QString &groupName ) +void ViewContainer::restoreState( KConfig *config, const TQString &groupName ) { config->setGroup(groupName); int baseAreaId = config->readNumEntry("BaseViewArea"); @@ -342,7 +342,7 @@ void ViewContainer::setIdUsed( int id ) void ViewContainer::updateCaption() { - QString caption; + TQString caption; if ( !activeView() || !activeView()->document() ) caption = i18n("(empty)"); @@ -375,8 +375,8 @@ void ViewContainer::setKTechlabDeleted() -ViewArea::ViewArea( QWidget *parent, ViewContainer *viewContainer, int id, const char *name ) - : QSplitter( parent, name ) +ViewArea::ViewArea( TQWidget *tqparent, ViewContainer *viewContainer, int id, const char *name ) + : TQSplitter( tqparent, name ) { p_viewContainer = viewContainer; m_id = id; @@ -412,18 +412,18 @@ ViewArea *ViewArea::createViewArea( Position position, uint id ) setOrientation( ( position == Right ) ? Qt::Horizontal : Qt::Vertical ); - p_viewArea1 = new ViewArea( this, p_viewContainer, m_id, (const char*)("viewarea_"+QString::number(m_id)) ); - p_viewArea2 = new ViewArea( this, p_viewContainer, id, (const char*)("viewarea_"+QString::number(id)) ); + p_viewArea1 = new ViewArea( this, p_viewContainer, m_id, (const char*)("viewarea_"+TQString::number(m_id)) ); + p_viewArea2 = new ViewArea( this, p_viewContainer, id, (const char*)("viewarea_"+TQString::number(id)) ); - connect( p_viewArea1, SIGNAL(destroyed(QObject* )), this, SLOT(viewAreaDestroyed(QObject* )) ); - connect( p_viewArea2, SIGNAL(destroyed(QObject* )), this, SLOT(viewAreaDestroyed(QObject* )) ); + connect( p_viewArea1, TQT_SIGNAL(destroyed(TQObject* )), this, TQT_SLOT(viewAreaDestroyed(TQObject* )) ); + connect( p_viewArea2, TQT_SIGNAL(destroyed(TQObject* )), this, TQT_SLOT(viewAreaDestroyed(TQObject* )) ); - p_view->reparent( p_viewArea1, QPoint(), true ); + p_view->reparent( p_viewArea1, TQPoint(), true ); p_viewArea1->setView(p_view); p_view = 0l; m_id = p_viewContainer->uniqueParentId(); - QValueList<int> splitPos; + TQValueList<int> splitPos; int pos = ((orientation() == Qt::Horizontal) ? width()/2 : height()/2); splitPos << pos << pos; setSizes(splitPos); @@ -434,9 +434,9 @@ ViewArea *ViewArea::createViewArea( Position position, uint id ) } -void ViewArea::viewAreaDestroyed( QObject *obj ) +void ViewArea::viewAreaDestroyed( TQObject *obj ) { - ViewArea *viewArea = static_cast<ViewArea*>(obj); + ViewArea *viewArea = static_cast<ViewArea*>(TQT_TQWIDGET(obj)); if ( viewArea == p_viewArea1 ) p_viewArea1 = 0l; @@ -459,7 +459,7 @@ void ViewArea::setView( View *view ) return; } p_view = view; - connect( view, SIGNAL(destroyed()), this, SLOT(viewDestroyed()) ); + connect( view, TQT_SIGNAL(destroyed()), this, TQT_SLOT(viewDestroyed()) ); } @@ -501,13 +501,13 @@ void ViewArea::saveState( KConfig *config ) { config->writeEntry( orientationKey(m_id), (orientation() == Qt::Horizontal) ? "LeftRight" : "TopBottom" ); - QValueList<int> contains; + TQValueList<int> tqcontains; if (va1Ok) - contains << p_viewArea1->id(); + tqcontains << p_viewArea1->id(); if (va2Ok) - contains << p_viewArea2->id(); + tqcontains << p_viewArea2->id(); - config->writeEntry( containsKey(m_id), contains ); + config->writeEntry( containsKey(m_id), tqcontains ); if (va1Ok) p_viewArea1->saveState(config); if (va2Ok) @@ -520,7 +520,7 @@ void ViewArea::saveState( KConfig *config ) } -void ViewArea::restoreState( KConfig *config, int id, const QString &groupName ) +void ViewArea::restoreState( KConfig *config, int id, const TQString &groupName ) { if (!config) return; @@ -541,35 +541,35 @@ void ViewArea::restoreState( KConfig *config, int id, const QString &groupName ) config->setGroup(groupName); if ( config->hasKey( orientationKey(id) ) ) { - QString orientation = config->readEntry( orientationKey(m_id) ); + TQString orientation = config->readEntry( orientationKey(m_id) ); setOrientation( (orientation == "LeftRight") ? Qt::Horizontal : Qt::Vertical ); } config->setGroup(groupName); if ( config->hasKey( containsKey(m_id) ) ) { - typedef QValueList<int> IntList; - IntList contains = config->readIntListEntry( containsKey(m_id) ); + typedef TQValueList<int> IntList; + IntList tqcontains = config->readIntListEntry( containsKey(m_id) ); - if ( contains.isEmpty() || contains.size() > 2 ) - kdError() << k_funcinfo << "Contained list has wrong size of " << contains.size() << endl; + if ( tqcontains.isEmpty() || tqcontains.size() > 2 ) + kdError() << k_funcinfo << "Contained list has wrong size of " << tqcontains.size() << endl; else { - if ( contains.size() >= 1 ) + if ( tqcontains.size() >= 1 ) { - int viewArea1Id = contains[0]; - p_viewArea1 = new ViewArea( this, p_viewContainer, viewArea1Id, (const char*)("viewarea_"+QString::number(viewArea1Id)) ); - connect( p_viewArea1, SIGNAL(destroyed(QObject* )), this, SLOT(viewAreaDestroyed(QObject* )) ); + int viewArea1Id = tqcontains[0]; + p_viewArea1 = new ViewArea( this, p_viewContainer, viewArea1Id, (const char*)("viewarea_"+TQString::number(viewArea1Id)) ); + connect( p_viewArea1, TQT_SIGNAL(destroyed(TQObject* )), this, TQT_SLOT(viewAreaDestroyed(TQObject* )) ); p_viewArea1->restoreState( config, viewArea1Id, groupName ); p_viewArea1->show(); } - if ( contains.size() >= 2 ) + if ( tqcontains.size() >= 2 ) { - int viewArea2Id = contains[1]; - p_viewArea2 = new ViewArea( this, p_viewContainer, viewArea2Id, (const char*)("viewarea_"+QString::number(viewArea2Id)) ); - connect( p_viewArea2, SIGNAL(destroyed(QObject* )), this, SLOT(viewAreaDestroyed(QObject* )) ); + int viewArea2Id = tqcontains[1]; + p_viewArea2 = new ViewArea( this, p_viewContainer, viewArea2Id, (const char*)("viewarea_"+TQString::number(viewArea2Id)) ); + connect( p_viewArea2, TQT_SIGNAL(destroyed(TQObject* )), this, TQT_SLOT(viewAreaDestroyed(TQObject* )) ); p_viewArea2->restoreState( config, viewArea2Id, groupName ); p_viewArea2->show(); } @@ -585,24 +585,24 @@ void ViewArea::restoreState( KConfig *config, int id, const QString &groupName ) } } -QString ViewArea::fileKey( int id ) +TQString ViewArea::fileKey( int id ) { - return QString("ViewArea ") + QString::number(id) + QString(" file"); + return TQString("ViewArea ") + TQString::number(id) + TQString(" file"); } -QString ViewArea::containsKey( int id ) +TQString ViewArea::containsKey( int id ) { - return QString("ViewArea ") + QString::number(id) + QString(" contains"); + return TQString("ViewArea ") + TQString::number(id) + TQString(" tqcontains"); } -QString ViewArea::orientationKey( int id ) +TQString ViewArea::orientationKey( int id ) { - return QString("ViewArea ") + QString::number(id) + QString(" orientation"); + return TQString("ViewArea ") + TQString::number(id) + TQString(" orientation"); } ViewContainerDrag::ViewContainerDrag( ViewContainer *viewContainer ) - : QStoredDrag( "dontcare", viewContainer) + : TQStoredDrag( "dontcare", viewContainer) { p_viewContainer = viewContainer; } |