diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 00:38:19 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 00:38:19 +0000 |
commit | f0296ef9e1f94e23c00d6f490e565d1dc768416d (patch) | |
tree | 7f3fd9f99621c111ff67f2d62feb5960a3371853 /src/part/radialMap | |
parent | 3098eb909534268622ce776f9a7bb5310d31b3c1 (diff) | |
download | filelight-f0296ef9e1f94e23c00d6f490e565d1dc768416d.tar.gz filelight-f0296ef9e1f94e23c00d6f490e565d1dc768416d.zip |
TQt4 port Filelight
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/filelight@1233561 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/part/radialMap')
-rw-r--r-- | src/part/radialMap/builder.cpp | 14 | ||||
-rw-r--r-- | src/part/radialMap/labels.cpp | 36 | ||||
-rw-r--r-- | src/part/radialMap/map.cpp | 62 | ||||
-rw-r--r-- | src/part/radialMap/radialMap.h | 10 | ||||
-rw-r--r-- | src/part/radialMap/segmentTip.cpp | 76 | ||||
-rw-r--r-- | src/part/radialMap/segmentTip.h | 12 | ||||
-rw-r--r-- | src/part/radialMap/widget.cpp | 42 | ||||
-rw-r--r-- | src/part/radialMap/widget.h | 43 | ||||
-rw-r--r-- | src/part/radialMap/widgetEvents.cpp | 62 |
9 files changed, 179 insertions, 178 deletions
diff --git a/src/part/radialMap/builder.cpp b/src/part/radialMap/builder.cpp index 68dc382..bae6626 100644 --- a/src/part/radialMap/builder.cpp +++ b/src/part/radialMap/builder.cpp @@ -40,7 +40,7 @@ RadialMap::Builder::Builder( RadialMap::Map *m, const Directory* const d, bool f void RadialMap::Builder::findVisibleDepth( const Directory* const dir, const unsigned int depth ) { - //**** because I don't use the same minimumSize criteria as in the visual function + //**** because I don't use the same tqminimumSize criteria as in the visual function // this can lead to incorrect visual representation //**** BUT, you can't set those limits until you know m_depth! @@ -84,7 +84,7 @@ RadialMap::Builder::build( const Directory* const dir, const unsigned int depth, { //first iteration: dir == m_root - if( dir->children() == 0 ) //we do fileCount rather than size to avoid chance of divide by zero later + if( dir->tqchildren() == 0 ) //we do fileCount rather than size to avoid chance of divide by zero later return false; uint hiddenSize = 0, hiddenFileCount = 0; @@ -116,13 +116,13 @@ RadialMap::Builder::build( const Directory* const dir, const unsigned int depth, hiddenSize += (*it)->size(); if( (*it)->isDirectory() ) //**** considered virtual, but dir wouldn't count itself! - hiddenFileCount += static_cast<const Directory*>(*it)->children(); //need to add one to count the dir as well + hiddenFileCount += static_cast<const Directory*>(*it)->tqchildren(); //need to add one to count the dir as well ++hiddenFileCount; } } - if( hiddenFileCount == dir->children() && !Config::showSmallFiles ) + if( hiddenFileCount == dir->tqchildren() && !Config::showSmallFiles ) return true; else if( (Config::showSmallFiles && hiddenSize > m_limits[depth]) || (depth == 0 && (hiddenSize > dir->size()/8)) /*|| > size() * 0.75*/ ) @@ -130,9 +130,9 @@ RadialMap::Builder::build( const Directory* const dir, const unsigned int depth, //append a segment for unrepresented space - a "fake" segment // I dunno how to i18n this - const QString s = i18n( "There can't ever be only 1 file", "%1 files, each about %2" ) - .arg( hiddenFileCount ) - .arg( File::humanReadableSize( hiddenSize/hiddenFileCount ) ); + const TQString s = i18n( "There can't ever be only 1 file", "%1 files, each about %2" ) + .tqarg( hiddenFileCount ) + .tqarg( File::humanReadableSize( hiddenSize/hiddenFileCount ) ); (m_signature + depth)->append( new Segment( new File( s.local8Bit(), hiddenSize ), a_start, a_end - a_start, true ) ); } diff --git a/src/part/radialMap/labels.cpp b/src/part/radialMap/labels.cpp index 73a7ba8..402a7f7 100644 --- a/src/part/radialMap/labels.cpp +++ b/src/part/radialMap/labels.cpp @@ -2,10 +2,10 @@ //Copyright: See COPYING file that comes with this distribution #include <kstringhandler.h> -#include <qfont.h> -#include <qfontmetrics.h> -#include <qpainter.h> -#include <qptrlist.h> +#include <tqfont.h> +#include <tqfontmetrics.h> +#include <tqpainter.h> +#include <tqptrlist.h> #include "Config.h" #include "fileTree.h" @@ -30,13 +30,13 @@ namespace RadialMap int x1, y1, x2, y2, x3; int tx, ty; - QString qs; + TQString qs; }; - class LabelList : public QPtrList<Label> + class LabelList : public TQPtrList<Label> { protected: - int compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 ) + int compareItems( TQPtrCollection::Item item1, TQPtrCollection::Item item2 ) { //you add 1440 to work round the fact that later you want the circle split vertically //and as it is you start at 3 o' clock. It's to do with rightPrevY, stops annoying bug @@ -60,12 +60,12 @@ namespace RadialMap void -RadialMap::Widget::paintExplodedLabels( QPainter &paint ) const +RadialMap::Widget::paintExplodedLabels( TQPainter &paint ) const { //we are a friend of RadialMap::Map LabelList list; list.setAutoDelete( true ); - QPtrListIterator<Label> it( list ); + TQPtrListIterator<Label> it( list ); unsigned int startLevel = 0; @@ -80,7 +80,7 @@ RadialMap::Widget::paintExplodedLabels( QPainter &paint ) const //find the range of levels we will be potentially drawing labels for //startLevel is the level above whatever m_focus is in for( const Directory *p = (const Directory*)m_focus->file(); p != m_tree; ++startLevel ) - p = p->parent(); + p = p->tqparent(); //range=2 means 2 levels to draw labels for @@ -122,7 +122,7 @@ RadialMap::Widget::paintExplodedLabels( QPainter &paint ) const // if so, remove the least significant labels it.toFirst(); - QPtrListIterator<Label> jt( it ); + TQPtrListIterator<Label> jt( it ); ++jt; while( jt ) //**** no need to check _it_ as jt will be NULL if _it_ was too @@ -202,15 +202,15 @@ RadialMap::Widget::paintExplodedLabels( QPainter &paint ) const bool rightSide; - QFont font; + TQFont font; for( it.toFirst(); it != 0; ++it ) { - //** bear in mind that text is drawn with QPoint param as BOTTOM left corner of text box - QString qs = (*it)->segment->file()->name(); + //** bear in mind that text is drawn with TQPoint param as BOTTOM left corner of text box + TQString qs = (*it)->segment->file()->name(); if( varySizes ) font.setPointSize( sizes[(*it)->lvl] ); - QFontMetrics fm( font ); + TQFontMetrics fm( font ); int fmh = fm.height(); //used to ensure label texts don't overlap int fmhD4 = fmh / 4; @@ -305,14 +305,14 @@ RadialMap::Widget::paintExplodedLabels( QPainter &paint ) const //5. Render labels - paint.setPen( QPen( Qt::black, 1 ) ); + paint.setPen( TQPen( TQt::black, 1 ) ); for( it.toFirst(); it != 0; ++it ) { if( varySizes ) { - //**** how much overhead in making new QFont each time? + //**** how much overhead in making new TQFont each time? // (implicate sharing remember) - QFont font = paint.font(); + TQFont font = paint.font(); font.setPointSize( sizes[(*it)->lvl] ); paint.setFont( font ); } diff --git a/src/part/radialMap/map.cpp b/src/part/radialMap/map.cpp index 8eb8f02..e106ed7 100644 --- a/src/part/radialMap/map.cpp +++ b/src/part/radialMap/map.cpp @@ -4,11 +4,11 @@ #include <kcursor.h> //make() #include <kglobalsettings.h> //kdeColours #include <kimageeffect.h> //desaturate() -#include <qapplication.h> //make() -#include <qimage.h> //make() & paint() -#include <qfont.h> //ctor -#include <qfontmetrics.h> //ctor -#include <qpainter.h> +#include <tqapplication.h> //make() +#include <tqimage.h> //make() & paint() +#include <tqfont.h> //ctor +#include <tqfontmetrics.h> //ctor +#include <tqpainter.h> #include "builder.h" #include "Config.h" @@ -18,7 +18,7 @@ #include "sincos.h" #include "widget.h" -#define COLOR_GREY QColor( 0, 0, 140, QColor::Hsv ) +#define COLOR_GREY TQColor( 0, 0, 140, TQColor::Hsv ) RadialMap::Map::Map() @@ -28,7 +28,7 @@ RadialMap::Map::Map() , m_visibleDepth( DEFAULT_RING_DEPTH ) { //FIXME this is all broken. No longer is a maximum depth! - const int fmh = QFontMetrics( QFont() ).height(); + const int fmh = TQFontMetrics( TQFont() ).height(); const int fmhD4 = fmh / 4; MAP_2MARGIN = 2 * ( fmh - (fmhD4 - LABEL_MAP_SPACER) ); //margin is dependent on fitting in labels at top and bottom } @@ -39,7 +39,7 @@ RadialMap::Map::~Map() } void -RadialMap::Map::invalidate( const bool desaturateTheImage ) +RadialMap::Map::tqinvalidate( const bool desaturateTheImage ) { DEBUG_ANNOUNCE @@ -48,7 +48,7 @@ RadialMap::Map::invalidate( const bool desaturateTheImage ) if( desaturateTheImage ) { - QImage img = this->convertToImage(); + TQImage img = this->convertToImage(); KImageEffect::desaturate( img, 0.7 ); KImageEffect::toGray( img, true ); @@ -69,7 +69,7 @@ RadialMap::Map::make( const Directory *tree, bool refresh ) // even if it makes it a lie? //slow operation so set the wait cursor - QApplication::setOverrideCursor( KCursor::waitCursor() ); + TQApplication::setOverrideCursor( KCursor::waitCursor() ); { //build a signature of visible components @@ -94,7 +94,7 @@ RadialMap::Map::make( const Directory *tree, bool refresh ) //paint the pixmap aaPaint(); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } void @@ -114,7 +114,7 @@ RadialMap::Map::setRingBreadth() } bool -RadialMap::Map::resize( const QRect &rect ) +RadialMap::Map::resize( const TQRect &rect ) { DEBUG_ANNOUNCE @@ -138,7 +138,7 @@ RadialMap::Map::resize( const QRect &rect ) if( size < minSize ) size = minSize; - //this QRect is used by paint() + //this TQRect is used by paint() m_rect.setRect( mD2, mD2, size, size ); } @@ -173,12 +173,12 @@ RadialMap::Map::colorise() { DEBUG_ANNOUNCE - QColor cp, cb; + TQColor cp, cb; double darkness = 1; double contrast = (double)Config::contrast / (double)100; int h, s1, s2, v1, v2; - QColor kdeColour[2] = { KGlobalSettings::inactiveTitleColor(), KGlobalSettings::activeTitleColor() }; + TQColor kdeColour[2] = { KGlobalSettings::inactiveTitleColor(), KGlobalSettings::activeTitleColor() }; double deltaRed = (double)(kdeColour[0].red() - kdeColour[1].red()) / 2880; //2880 for semicircle double deltaGreen = (double)(kdeColour[0].green() - kdeColour[1].green()) / 2880; @@ -193,7 +193,7 @@ RadialMap::Map::colorise() case 2000: //HACK for summary view if( (*it)->file()->name() == "Used" ) { - cb = QApplication::palette().active().color( QColorGroup::Highlight ); + cb = TQApplication::tqpalette().active().color( TQColorGroup::Highlight ); cb.getHsv( &h, &s1, &v1 ); if( s1 > 80 ) @@ -206,8 +206,8 @@ RadialMap::Map::colorise() cp.setHsv( h, s2, v2 ); } else { - cp = Qt::gray; - cb = Qt::white; + cp = TQt::gray; + cb = TQt::white; } (*it)->setPalette( cp, cb ); @@ -272,7 +272,7 @@ RadialMap::Map::colorise() //**** may be better to store KDE colours as H and S and vary V as others //**** perhaps make saturation difference for s2 dependent on contrast too //**** fake segments don't work with highContrast - //**** may work better with cp = cb rather than Qt::white + //**** may work better with cp = cb rather than TQt::white //**** you have to ensure the grey of files is sufficient, currently it works only with rainbow (perhaps use contrast there too) //**** change v1,v2 to vp, vb etc. //**** using percentages is not strictly correct as the eye doesn't work like that @@ -286,9 +286,9 @@ RadialMap::Map::aaPaint() { //paint() is called during continuous processes //aaPaint() is not and is slower so set overidecursor (make sets it too) - QApplication::setOverrideCursor( KCursor::waitCursor() ); + TQApplication::setOverrideCursor( KCursor::waitCursor() ); paint( Config::antiAliasFactor ); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } void @@ -299,8 +299,8 @@ RadialMap::Map::paint( unsigned int scaleFactor ) if (scaleFactor == 0) //just in case scaleFactor = 1; - QPainter paint; - QRect rect = m_rect; + TQPainter paint; + TQRect rect = m_rect; int step = m_ringBreadth; int excess = -1; @@ -349,8 +349,8 @@ RadialMap::Map::paint( unsigned int scaleFactor ) if( (*it)->hasHiddenChildren() ) { //draw arrow head to indicate undisplayed files/directories - QPointArray pts( 3 ); - QPoint pos, cpos = rect.center(); + TQPointArray pts( 3 ); + TQPoint pos, cpos = rect.center(); int a[3] = { (*it)->start(), (*it)->length(), 0 }; a[2] = a[0] + (a[1] / 2); //assign to halfway between @@ -385,11 +385,11 @@ RadialMap::Map::paint( unsigned int scaleFactor ) { //**** code is bloated! paint.save(); - QPen pen = paint.pen(); + TQPen pen = paint.pen(); int width = 2 * scaleFactor; pen.setWidth( width ); paint.setPen( pen ); - QRect rect2 = rect; + TQRect rect2 = rect; width /= 2; rect2.addCoords( width, width, -width, -width ); paint.drawArc( rect2, (*it)->start(), (*it)->length() ); @@ -409,7 +409,7 @@ RadialMap::Map::paint( unsigned int scaleFactor ) // if( excess > 0 ) rect.addCoords( excess, excess, 0, 0 ); //ugly paint.setPen( COLOR_GREY ); - paint.setBrush( Qt::white ); + paint.setBrush( TQt::white ); paint.drawEllipse( rect ); if( scaleFactor > 1 ) @@ -425,16 +425,16 @@ RadialMap::Map::paint( unsigned int scaleFactor ) y2 /= scaleFactor; rect.setCoords( x1, y1, x2, y2 ); - QImage img = this->convertToImage(); + TQImage img = this->convertToImage(); img = img.smoothScale( this->size() / (int)scaleFactor ); this->convertFromImage( img ); paint.begin( this ); paint.setPen( COLOR_GREY ); - paint.setBrush( Qt::white ); + paint.setBrush( TQt::white ); } - paint.drawText( rect, Qt::AlignCenter, m_centerText ); + paint.drawText( rect, TQt::AlignCenter, m_centerText ); m_innerRadius = rect.width() / 2; //rect.width should be multiple of 2 diff --git a/src/part/radialMap/radialMap.h b/src/part/radialMap/radialMap.h index 5023b89..5c864c5 100644 --- a/src/part/radialMap/radialMap.h +++ b/src/part/radialMap/radialMap.h @@ -4,7 +4,7 @@ #ifndef RADIALMAP_H #define RADIALMAP_H -#include <qcolor.h> +#include <tqcolor.h> class File; @@ -26,8 +26,8 @@ namespace RadialMap uint length() const { return m_angleSegment; } uint end() const { return m_angleStart + m_angleSegment; } const File *file() const { return m_file; } - const QColor& pen() const { return m_pen; } - const QColor& brush() const { return m_brush; } + const TQColor& pen() const { return m_pen; } + const TQColor& brush() const { return m_brush; } bool isFake() const { return m_fake; } bool hasHiddenChildren() const { return m_hasHiddenChildren; } @@ -38,11 +38,11 @@ namespace RadialMap friend class Builder; private: - void setPalette( const QColor &p, const QColor &b ) { m_pen = p; m_brush = b; } + void setPalette( const TQColor &p, const TQColor &b ) { m_pen = p; m_brush = b; } const uint m_angleStart, m_angleSegment; const File* const m_file; - QColor m_pen, m_brush; + TQColor m_pen, m_brush; bool m_hasHiddenChildren; const bool m_fake; }; diff --git a/src/part/radialMap/segmentTip.cpp b/src/part/radialMap/segmentTip.cpp index f73e845..e677197 100644 --- a/src/part/radialMap/segmentTip.cpp +++ b/src/part/radialMap/segmentTip.cpp @@ -10,8 +10,8 @@ #include <kglobalsettings.h> #include <klocale.h> #include <kpixmapeffect.h> -#include <qpainter.h> -#include <qtooltip.h> //for its palette +#include <tqpainter.h> +#include <tqtooltip.h> //for its palette @@ -29,20 +29,20 @@ bool isBackingStoreActive() buffer[ N ] = '\0'; pclose( xdpyinfo ); - return QString::fromLocal8Bit( buffer ).contains( "backing-store YES" ); + return TQString(TQString::fromLocal8Bit( buffer )).tqcontains( "backing-store YES" ); } SegmentTip::SegmentTip( uint h ) - : QWidget( 0, 0, WNoAutoErase | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WStyle_StaysOnTop | WX11BypassWM ) + : TQWidget( 0, 0, WNoAutoErase | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WStyle_StaysOnTop | WX11BypassWM ) , m_cursorHeight( -h ) , m_backing_store( isBackingStoreActive() ) { - setBackgroundMode( Qt::NoBackground ); + setBackgroundMode( TQt::NoBackground ); } void -SegmentTip::moveTo( QPoint p, const QWidget &canvas, bool placeAbove ) +SegmentTip::moveTo( TQPoint p, const TQWidget &canvas, bool placeAbove ) { //**** this function is very slow and seems to be visibly influenced by operations like mapFromGlobal() (who knows why!) // ** so any improvements are much desired @@ -51,7 +51,7 @@ SegmentTip::moveTo( QPoint p, const QWidget &canvas, bool placeAbove ) p.rx() -= rect().center().x(); p.ry() -= (placeAbove ? 8 + height() : m_cursorHeight - 8); - const QRect screen = KGlobalSettings::desktopGeometry( parentWidget() ); + const TQRect screen = KGlobalSettings::desktopGeometry( tqparentWidget() ); const int x = p.x(); const int y = p.y(); @@ -66,25 +66,25 @@ SegmentTip::moveTo( QPoint p, const QWidget &canvas, bool placeAbove ) if( y2 > sh ) p.ry() -= y2 - sh; - //I'm using this QPoint to determine where to offset the bitBlt in m_pixmap - QPoint offset = canvas.mapToGlobal( QPoint() ) - p; + //I'm using this TQPoint to determine where to offset the bitBlt in m_pixmap + TQPoint offset = canvas.mapToGlobal( TQPoint() ) - p; if( offset.x() < 0 ) offset.setX( 0 ); if( offset.y() < 0 ) offset.setY( 0 ); - const QRect alphaMaskRect( canvas.mapFromGlobal( p ), size() ); - const QRect intersection( alphaMaskRect.intersect( canvas.rect() ) ); + const TQRect alphaMaskRect( canvas.mapFromGlobal( p ), size() ); + const TQRect intersection( alphaMaskRect.intersect( canvas.rect() ) ); m_pixmap.resize( size() ); //move to updateTip once you are sure it can never be null - bitBlt( &m_pixmap, offset, &canvas, intersection, Qt::CopyROP ); + bitBlt( &m_pixmap, offset, &canvas, intersection, TQt::CopyROP ); - QColor const c = QToolTip::palette().color( QPalette::Active, QColorGroup::Background ); + TQColor const c = TQToolTip::palette().color( TQPalette::Active, TQColorGroup::Background ); if (!m_backing_store) m_pixmap.fill( c ); - QPainter paint( &m_pixmap ); - paint.setPen( Qt::black ); - paint.setBrush( Qt::NoBrush ); + TQPainter paint( &m_pixmap ); + paint.setPen( TQt::black ); + paint.setBrush( TQt::NoBrush ); paint.drawRect( rect() ); paint.end(); @@ -105,15 +105,15 @@ SegmentTip::moveTo( QPoint p, const QWidget &canvas, bool placeAbove ) void SegmentTip::updateTip( const File* const file, const Directory* const root ) { - const QString s1 = file->fullPath( root ); - QString s2 = file->humanReadableSize(); + const TQString s1 = file->fullPath( root ); + TQString s2 = file->humanReadableSize(); KLocale *loc = KGlobal::locale(); const uint MARGIN = 3; const uint pc = 100 * file->size() / root->size(); uint maxw = 0; uint h = fontMetrics().height()*2 + 2*MARGIN; - if( pc > 0 ) s2 += QString( " (%1%)" ).arg( loc->formatNumber( pc, 0 ) ); + if( pc > 0 ) s2 += TQString( " (%1%)" ).tqarg( loc->formatNumber( pc, 0 ) ); m_text = s1; m_text += '\n'; @@ -121,11 +121,11 @@ SegmentTip::updateTip( const File* const file, const Directory* const root ) if( file->isDirectory() ) { - double files = static_cast<const Directory*>(file)->children(); - const uint pc = uint((100 * files) / (double)root->children()); - QString s3 = i18n( "Files: %1" ).arg( loc->formatNumber( files, 0 ) ); + double files = static_cast<const Directory*>(file)->tqchildren(); + const uint pc = uint((100 * files) / (double)root->tqchildren()); + TQString s3 = i18n( "Files: %1" ).tqarg( loc->formatNumber( files, 0 ) ); - if( pc > 0 ) s3 += QString( " (%1%)" ).arg( loc->formatNumber( pc, 0 ) ); + if( pc > 0 ) s3 += TQString( " (%1%)" ).tqarg( loc->formatNumber( pc, 0 ) ); maxw = fontMetrics().width( s3 ); h += fontMetrics().height(); @@ -141,19 +141,19 @@ SegmentTip::updateTip( const File* const file, const Directory* const root ) } bool -SegmentTip::event( QEvent *e ) +SegmentTip::event( TQEvent *e ) { switch( e->type() ) { - case QEvent::Show: + case TQEvent::Show: kapp->installEventFilter( this ); break; - case QEvent::Hide: + case TQEvent::Hide: kapp->removeEventFilter( this ); break; - case QEvent::Paint: + case TQEvent::Paint: { - //QPainter( this ).drawPixmap( 0, 0, m_pixmap ); + //TQPainter( this ).drawPixmap( 0, 0, m_pixmap ); bitBlt( this, 0, 0, &m_pixmap ); return true; } @@ -161,22 +161,22 @@ SegmentTip::event( QEvent *e ) ; } - return false/*QWidget::event( e )*/; + return false/*TQWidget::event( e )*/; } bool -SegmentTip::eventFilter( QObject*, QEvent *e ) +SegmentTip::eventFilter( TQObject*, TQEvent *e ) { switch ( e->type() ) { - case QEvent::Leave: -// case QEvent::MouseButtonPress: -// case QEvent::MouseButtonRelease: - case QEvent::KeyPress: - case QEvent::KeyRelease: - case QEvent::FocusIn: - case QEvent::FocusOut: - case QEvent::Wheel: + case TQEvent::Leave: +// case TQEvent::MouseButtonPress: +// case TQEvent::MouseButtonRelease: + case TQEvent::KeyPress: + case TQEvent::KeyRelease: + case TQEvent::FocusIn: + case TQEvent::FocusOut: + case TQEvent::Wheel: hide(); //FALL THROUGH default: return false; //allow this event to passed to target diff --git a/src/part/radialMap/segmentTip.h b/src/part/radialMap/segmentTip.h index 8bc479e..b082b62 100644 --- a/src/part/radialMap/segmentTip.h +++ b/src/part/radialMap/segmentTip.h @@ -5,28 +5,28 @@ #define SEGMENTTIP_H #include <kpixmap.h> -#include <qwidget.h> +#include <tqwidget.h> class File; class Directory; namespace RadialMap { - class SegmentTip : public QWidget + class SegmentTip : public TQWidget { public: SegmentTip( uint ); void updateTip( const File*, const Directory* ); - void moveTo( QPoint, const QWidget&, bool ); + void moveTo( TQPoint, const TQWidget&, bool ); private: - virtual bool eventFilter( QObject*, QEvent* ); - virtual bool event( QEvent* ); + virtual bool eventFilter( TQObject*, TQEvent* ); + virtual bool event( TQEvent* ); uint m_cursorHeight; KPixmap m_pixmap; - QString m_text; + TQString m_text; bool m_backing_store; }; } diff --git a/src/part/radialMap/widget.cpp b/src/part/radialMap/widget.cpp index 9c82c53..66565c0 100644 --- a/src/part/radialMap/widget.cpp +++ b/src/part/radialMap/widget.cpp @@ -4,10 +4,10 @@ #include <kcursor.h> //ctor #include <klocale.h> #include <kurl.h> -#include <qapplication.h> //sendEvent -#include <qbitmap.h> //ctor - finding cursor size -#include <qcursor.h> //slotPostMouseEvent() -#include <qtimer.h> //member +#include <tqapplication.h> //sendEvent +#include <tqbitmap.h> //ctor - finding cursor size +#include <tqcursor.h> //slotPostMouseEvent() +#include <tqtimer.h> //member #include "Config.h" #include "debug.h" @@ -17,23 +17,23 @@ -RadialMap::Widget::Widget( QWidget *parent, const char *name ) - : QWidget( parent, name, Qt::WNoAutoErase ) +RadialMap::Widget::Widget( TQWidget *tqparent, const char *name ) + : TQWidget( tqparent, name, TQt::WNoAutoErase ) , m_tree( 0 ) , m_focus( 0 ) , m_rootSegment( 0 ) //TODO we don't delete it, *shrug* { setAcceptDrops( true ); - setBackgroundColor( Qt::white ); + setBackgroundColor( TQt::white ); const QBitmap *cursor = KCursor::handCursor().bitmap(); m_tip = new SegmentTip(cursor ? cursor->height() : 16); - connect( this, SIGNAL(created( const Directory* )), SLOT(sendFakeMouseEvent()) ); - connect( this, SIGNAL(created( const Directory* )), SLOT(update()) ); - connect( &m_timer, SIGNAL(timeout()), SLOT(resizeTimeout()) ); + connect( this, TQT_SIGNAL(created( const Directory* )), TQT_SLOT(sendFakeMouseEvent()) ); + connect( this, TQT_SIGNAL(created( const Directory* )), TQT_SLOT(update()) ); + connect( &m_timer, TQT_SIGNAL(timeout()), TQT_SLOT(resizeTimeout()) ); } -QString +TQString RadialMap::Widget::path() const { return m_tree->fullPath(); @@ -46,11 +46,11 @@ RadialMap::Widget::url( File const * const file ) const } void -RadialMap::Widget::invalidate( const bool b ) +RadialMap::Widget::tqinvalidate( const bool b ) { if( isValid() ) { - //**** have to check that only way to invalidate is this function frankly + //**** have to check that only way to tqinvalidate is this function frankly //**** otherwise you may get bugs.. //disable mouse tracking @@ -65,22 +65,22 @@ RadialMap::Widget::invalidate( const bool b ) //FIXME move this disablement thing no? // it is confusing in other areas, like the whole createFromCache() thing - m_map.invalidate( b ); //b signifies whether the pixmap is made to look disabled or not + m_map.tqinvalidate( b ); //b signifies whether the pixmap is made to look disabled or not if( b ) update(); //tell rest of Filelight - emit invalidated( url() ); + emit tqinvalidated( url() ); } } void RadialMap::Widget::create( const Directory *tree ) { - //it is not the responsibility of create() to invalidate first + //it is not the responsibility of create() to tqinvalidate first //skip invalidation at your own risk - //FIXME make it the responsibility of create to invalidate first + //FIXME make it the responsibility of create to tqinvalidate first if( tree ) { @@ -102,16 +102,16 @@ RadialMap::Widget::create( const Directory *tree ) void RadialMap::Widget::createFromCache( const Directory *tree ) { - //no scan was necessary, use cached tree, however we MUST still emit invalidate - invalidate( false ); + //no scan was necessary, use cached tree, however we MUST still emit tqinvalidate + tqinvalidate( false ); create( tree ); } void RadialMap::Widget::sendFakeMouseEvent() //slot { - QMouseEvent me( QEvent::MouseMove, mapFromGlobal( QCursor::pos() ), Qt::NoButton, Qt::NoButton ); - QApplication::sendEvent( this, &me ); + TQMouseEvent me( TQEvent::MouseMove, mapFromGlobal( TQCursor::pos() ), Qt::NoButton, Qt::NoButton ); + TQApplication::sendEvent( this, &me ); } void diff --git a/src/part/radialMap/widget.h b/src/part/radialMap/widget.h index 6fdf0e2..a0e51eb 100644 --- a/src/part/radialMap/widget.h +++ b/src/part/radialMap/widget.h @@ -5,7 +5,7 @@ #define WIDGET_H #include <kurl.h> -#include <qtimer.h> +#include <tqtimer.h> #include "segmentTip.h" template <class T> class Chain; @@ -25,10 +25,10 @@ namespace RadialMap ~Map(); void make( const Directory *, bool = false ); - bool resize( const QRect& ); + bool resize( const TQRect& ); bool isNull() const { return ( m_signature == 0 ); } - void invalidate( const bool ); + void tqinvalidate( const bool ); friend class Builder; friend class Widget; @@ -41,24 +41,25 @@ namespace RadialMap Chain<Segment> *m_signature; - QRect m_rect; + TQRect m_rect; uint m_ringBreadth; ///ring breadth uint m_innerRadius; ///radius of inner circle uint m_visibleDepth; ///visible level depth of system - QString m_centerText; + TQString m_centerText; uint MAP_2MARGIN; }; - class Widget : public QWidget + class Widget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - Widget( QWidget* = 0, const char* = 0 ); + Widget( TQWidget* = 0, const char* = 0 ); ~Widget() { delete m_tip; } - QString path() const; + TQString path() const; KURL url( File const * const = 0 ) const; bool isValid() const { return m_tree != 0; } @@ -69,7 +70,7 @@ namespace RadialMap void zoomIn(); void zoomOut(); void create( const Directory* ); - void invalidate( const bool = true ); + void tqinvalidate( const bool = true ); void refresh( int ); private slots: @@ -80,31 +81,31 @@ namespace RadialMap signals: void activated( const KURL& ); - void invalidated( const KURL& ); + void tqinvalidated( const KURL& ); void created( const Directory* ); - void mouseHover( const QString& ); + void mouseHover( const TQString& ); void giveMeTreeFor( const KURL& ); protected: - virtual void paintEvent( QPaintEvent* ); - virtual void resizeEvent( QResizeEvent* ); - virtual void mouseMoveEvent( QMouseEvent* ); - virtual void mousePressEvent( QMouseEvent* ); - virtual void dragEnterEvent( QDragEnterEvent* ); - virtual void dropEvent( QDropEvent* ); + virtual void paintEvent( TQPaintEvent* ); + virtual void resizeEvent( TQResizeEvent* ); + virtual void mouseMoveEvent( TQMouseEvent* ); + virtual void mousePressEvent( TQMouseEvent* ); + virtual void dragEnterEvent( TQDragEnterEvent* ); + virtual void dropEvent( TQDropEvent* ); protected: - const Segment *segmentAt( QPoint& ) const; //FIXME const reference for a library others can use + const Segment *segmentAt( TQPoint& ) const; //FIXME const reference for a library others can use const Segment *rootSegment() const { return m_rootSegment; } ///never == 0 const Segment *focusSegment() const { return m_focus; } ///0 == nothing in focus private: - void paintExplodedLabels( QPainter& ) const; + void paintExplodedLabels( TQPainter& ) const; const Directory *m_tree; const Segment *m_focus; - QPoint m_offset; - QTimer m_timer; + TQPoint m_offset; + TQTimer m_timer; Map m_map; SegmentTip *m_tip; Segment *m_rootSegment; diff --git a/src/part/radialMap/widgetEvents.cpp b/src/part/radialMap/widgetEvents.cpp index 71db1c0..1ad304e 100644 --- a/src/part/radialMap/widgetEvents.cpp +++ b/src/part/radialMap/widgetEvents.cpp @@ -15,15 +15,15 @@ #include <kpopupmenu.h> //::mousePressEvent() #include <krun.h> //::mousePressEvent() #include <kurldrag.h> -#include <qapplication.h>//QApplication::setOverrideCursor() -#include <qclipboard.h> -#include <qpainter.h> -#include <qtimer.h> //::resizeEvent() +#include <tqapplication.h>//TQApplication::setOverrideCursor() +#include <tqclipboard.h> +#include <tqpainter.h> +#include <tqtimer.h> //::resizeEvent() void -RadialMap::Widget::resizeEvent( QResizeEvent* ) +RadialMap::Widget::resizeEvent( TQResizeEvent* ) { if( m_map.resize( rect() ) ) m_timer.start( 500, true ); //will cause signature to rebuild for new size @@ -34,13 +34,13 @@ RadialMap::Widget::resizeEvent( QResizeEvent* ) } void -RadialMap::Widget::paintEvent( QPaintEvent* ) +RadialMap::Widget::paintEvent( TQPaintEvent* ) { - //bltBit for some Qt setups will bitBlt _after_ the labels are painted. Which buggers things up! - //shame as bitBlt is faster, possibly Qt bug? Should report the bug? - seems to be race condition + //bltBit for some TQt setups will bitBlt _after_ the labels are painted. Which buggers things up! + //shame as bitBlt is faster, possibly TQt bug? Should report the bug? - seems to be race condition //bitBlt( this, m_offset, &m_map ); - QPainter paint( this ); + TQPainter paint( this ); paint.drawPixmap( m_offset, m_map ); @@ -63,9 +63,9 @@ RadialMap::Widget::paintEvent( QPaintEvent* ) } const RadialMap::Segment* -RadialMap::Widget::segmentAt( QPoint &e ) const +RadialMap::Widget::segmentAt( TQPoint &e ) const { - //determine which segment QPoint e is above + //determine which segment TQPoint e is above e -= m_offset; @@ -110,12 +110,12 @@ RadialMap::Widget::segmentAt( QPoint &e ) const } void -RadialMap::Widget::mouseMoveEvent( QMouseEvent *e ) +RadialMap::Widget::mouseMoveEvent( TQMouseEvent *e ) { //set m_focus to what we hover over, update UI if it's a new segment Segment const * const oldFocus = m_focus; - QPoint p = e->pos(); + TQPoint p = e->pos(); m_focus = segmentAt( p ); //NOTE p is passed by non-const reference @@ -127,11 +127,11 @@ RadialMap::Widget::mouseMoveEvent( QMouseEvent *e ) m_tip->updateTip( m_focus->file(), m_tree ); emit mouseHover( m_focus->file()->fullPath() ); - //repaint required to update labels now before transparency is generated - repaint( false ); + //tqrepaint required to update labels now before transparency is generated + tqrepaint( false ); } - m_tip->moveTo( e->globalPos(), *this, ( p.y() < 0 ) ); //updates tooltip psuedo-tranparent background + m_tip->moveTo( e->globalPos(), *this, ( p.y() < 0 ) ); //updates tooltip psuedo-trantqparent background } else if( oldFocus && oldFocus->file() != m_tree ) { @@ -139,12 +139,12 @@ RadialMap::Widget::mouseMoveEvent( QMouseEvent *e ) m_tip->hide(); update(); - emit mouseHover( QString::null ); + emit mouseHover( TQString() ); } } void -RadialMap::Widget::mousePressEvent( QMouseEvent *e ) +RadialMap::Widget::mousePressEvent( TQMouseEvent *e ) { //m_tip is hidden already by event filter //m_focus is set correctly (I've been strict, I assure you it is correct!) @@ -184,12 +184,12 @@ RadialMap::Widget::mousePressEvent( QMouseEvent *e ) switch (popup.exec( e->globalPos(), 1 )) { case Konqueror: //KRun::runCommand will show an error message if there was trouble - KRun::runCommand( QString( "kfmclient openURL \"%1\"" ).arg( url.url() ) ); + KRun::runCommand( TQString( "kfmclient openURL \"%1\"" ).tqarg( url.url() ) ); break; case Konsole: // --workdir only works for local file paths - KRun::runCommand( QString( "konsole --workdir \"%1\"" ).arg( url.path() ) ); + KRun::runCommand( TQString( "konsole --workdir \"%1\"" ).tqarg( url.path() ) ); break; case Center: @@ -197,24 +197,24 @@ RadialMap::Widget::mousePressEvent( QMouseEvent *e ) goto section_two; case Copy: - QApplication::clipboard()->setData( new KURLDrag( KURL::List( url ) ) ); + TQApplication::tqclipboard()->setData( new KURLDrag( KURL::List( url ) ) ); break; case Delete: { const KURL url = Widget::url( m_focus->file() ); - const QString message = m_focus->file()->isDirectory() + const TQString message = m_focus->file()->isDirectory() ? i18n( "<qt>The directory at <i>'%1'</i> will be <b>recursively</b> and <b>permanently</b> deleted." ) : i18n( "<qt><i>'%1'</i> will be <b>permanently</b> deleted." ); const int userIntention = KMessageBox::warningContinueCancel( - this, message.arg( url.prettyURL() ), - QString::null, KGuiItem( i18n("&Delete"), "editdelete" ) ); + this, message.tqarg( url.prettyURL() ), + TQString(), KGuiItem( i18n("&Delete"), "editdelete" ) ); if (userIntention == KMessageBox::Continue) { KIO::Job *job = KIO::del( url ); job->setWindow( this ); - connect( job, SIGNAL(result( KIO::Job* )), SLOT(deleteJobFinished( KIO::Job* )) ); - QApplication::setOverrideCursor( KCursor::workingCursor() ); + connect( job, TQT_SIGNAL(result( KIO::Job* )), TQT_SLOT(deleteJobFinished( KIO::Job* )) ); + TQApplication::setOverrideCursor( KCursor::workingCursor() ); } } @@ -226,7 +226,7 @@ RadialMap::Widget::mousePressEvent( QMouseEvent *e ) else { // not right mouse button section_two: - const QRect rect( e->x() - 20, e->y() - 20, 40, 40 ); + const TQRect rect( e->x() - 20, e->y() - 20, 40, 40 ); m_tip->hide(); // user expects this @@ -248,16 +248,16 @@ RadialMap::Widget::mousePressEvent( QMouseEvent *e ) void RadialMap::Widget::deleteJobFinished( KIO::Job *job ) { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); if( !job->error() ) - invalidate(); + tqinvalidate(); else job->showErrorDialog( this ); } #include "debug.h" void -RadialMap::Widget::dropEvent( QDropEvent *e ) +RadialMap::Widget::dropEvent( TQDropEvent *e ) { DEBUG_ANNOUNCE @@ -267,7 +267,7 @@ RadialMap::Widget::dropEvent( QDropEvent *e ) } void -RadialMap::Widget::dragEnterEvent( QDragEnterEvent *e ) +RadialMap::Widget::dragEnterEvent( TQDragEnterEvent *e ) { DEBUG_ANNOUNCE |