From f0296ef9e1f94e23c00d6f490e565d1dc768416d Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 26 May 2011 00:38:19 +0000 Subject: 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 --- src/part/summaryWidget.cpp | 110 ++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'src/part/summaryWidget.cpp') diff --git a/src/part/summaryWidget.cpp b/src/part/summaryWidget.cpp index 0e3a140..afa047e 100644 --- a/src/part/summaryWidget.cpp +++ b/src/part/summaryWidget.cpp @@ -8,10 +8,10 @@ #include //MyRadialMap::mousePressEvent() #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "radialMap/radialMap.h" #include "radialMap/widget.h" #include "summaryWidget.h" @@ -23,10 +23,10 @@ static Filelight::MapScheme oldScheme; struct Disk { - QString device; - QString type; - QString mount; - QString icon; + TQString device; + TQString type; + TQString mount; + TQString icon; int size; int used; @@ -36,7 +36,7 @@ struct Disk }; -struct DiskList : QValueList +struct DiskList : TQValueList { DiskList(); }; @@ -45,11 +45,11 @@ struct DiskList : QValueList class MyRadialMap : public RadialMap::Widget { public: - MyRadialMap( QWidget *parent ) - : RadialMap::Widget( parent ) + MyRadialMap( TQWidget *tqparent ) + : RadialMap::Widget( tqparent ) {} - virtual void setCursor( const QCursor &c ) + virtual void setCursor( const TQCursor &c ) { if( focusSegment() && focusSegment()->file()->name() == "Used" ) RadialMap::Widget::setCursor( c ); @@ -57,7 +57,7 @@ public: unsetCursor(); } - virtual void mousePressEvent( QMouseEvent *e ) + virtual void mousePressEvent( TQMouseEvent *e ) { const RadialMap::Segment *segment = focusSegment(); @@ -67,7 +67,7 @@ public: //and clicks to the used segment else if( segment && segment->file()->name() == "Used" ) { - const QRect rect( e->x() - 20, e->y() - 20, 40, 40 ); + const TQRect rect( e->x() - 20, e->y() - 20, 40, 40 ); KIconEffect::visualActivate( this, rect ); emit activated( url() ); } @@ -76,17 +76,17 @@ public: -SummaryWidget::SummaryWidget( QWidget *parent, const char *name ) - : QWidget( parent, name ) +SummaryWidget::SummaryWidget( TQWidget *tqparent, const char *name ) + : TQWidget( tqparent, name ) { - qApp->setOverrideCursor( KCursor::waitCursor() ); + tqApp->setOverrideCursor( KCursor::waitCursor() ); - setPaletteBackgroundColor( Qt::white ); - (new QGridLayout( this, 1, 2 ))->setAutoAdd( true ); + setPaletteBackgroundColor( TQt::white ); + (new TQGridLayout( this, 1, 2 ))->setAutoAdd( true ); createDiskMaps(); - qApp->restoreOverrideCursor(); + tqApp->restoreOverrideCursor(); } SummaryWidget::~SummaryWidget() @@ -99,8 +99,8 @@ SummaryWidget::createDiskMaps() { DiskList disks; - const QCString free = i18n( "Free" ).local8Bit(); - const QCString used = i18n( "Used" ).local8Bit(); + const TQCString free = i18n( "Free" ).local8Bit(); + const TQCString used = i18n( "Used" ).local8Bit(); KIconLoader loader; @@ -114,19 +114,19 @@ SummaryWidget::createDiskMaps() if (disk.free == 0 && disk.used == 0) continue; - QWidget *box = new QVBox( this ); + TQWidget *box = new TQVBox( this ); RadialMap::Widget *map = new MyRadialMap( box ); - QString text; QTextOStream( &text ) + TQString text; TQTextOStream( &text ) << "" << "  " << disk.mount << " " << "(" << disk.device << ")"; - QLabel *label = new QLabel( text, box ); - label->setAlignment( Qt::AlignCenter ); - label->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum ); + TQLabel *label = new TQLabel( text, box ); + label->tqsetAlignment( TQt::AlignCenter ); + label->tqsetSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Maximum ); - box->show(); // will show its children too + box->show(); // will show its tqchildren too Directory *tree = new Directory( disk.mount.local8Bit() ); tree->append( free, disk.free ); @@ -134,7 +134,7 @@ SummaryWidget::createDiskMaps() map->create( tree ); //must be done when visible - connect( map, SIGNAL(activated( const KURL& )), SIGNAL(activated( const KURL& )) ); + connect( map, TQT_SIGNAL(activated( const KURL& )), TQT_SIGNAL(activated( const KURL& )) ); } } @@ -162,46 +162,46 @@ DiskList::DiskList() buffer[ N ] = '\0'; pclose( df ); - QString output = QString::fromLocal8Bit( buffer ); - QTextStream t( &output, IO_ReadOnly ); - QString const BLANK( QChar(' ') ); + TQString output = TQString::fromLocal8Bit( buffer ); + TQTextStream t( &output, IO_ReadOnly ); + TQString const BLANK( TQChar(' ') ); while (!t.atEnd()) { - QString s = t.readLine(); + TQString s = t.readLine(); s = s.simplifyWhiteSpace(); if (s.isEmpty()) continue; - if (s.find( BLANK ) < 0) // devicename was too long, rest in next line + if (s.tqfind( BLANK ) < 0) // devicename was too long, rest in next line if (!t.eof()) { // just appends the next line - QString v = t.readLine(); + TQString v = t.readLine(); s = s.append( v.latin1() ); s = s.simplifyWhiteSpace(); } Disk disk; - disk.device = s.left( s.find( BLANK ) ); - s = s.remove( 0, s.find( BLANK ) + 1 ); + disk.device = s.left( s.tqfind( BLANK ) ); + s = s.remove( 0, s.tqfind( BLANK ) + 1 ); #ifndef NO_FS_TYPE - disk.type = s.left( s.find( BLANK ) ); - s = s.remove( 0, s.find( BLANK ) + 1 ); + disk.type = s.left( s.tqfind( BLANK ) ); + s = s.remove( 0, s.tqfind( BLANK ) + 1 ); #endif - int n = s.find( BLANK ); + int n = s.tqfind( BLANK ); disk.size = s.left( n ).toInt(); s = s.remove( 0, n + 1 ); - n = s.find( BLANK ); + n = s.tqfind( BLANK ); disk.used = s.left( n ).toInt(); s = s.remove( 0, n + 1 ); - n = s.find( BLANK ); + n = s.tqfind( BLANK ); disk.free = s.left( n ).toInt(); s = s.remove( 0, n + 1 ); - s = s.remove( 0, s.find( BLANK ) + 1 ); // delete the capacity 94% + s = s.remove( 0, s.tqfind( BLANK ) + 1 ); // delete the capacity 94% disk.mount = s; disk.guessIconName(); @@ -214,21 +214,21 @@ DiskList::DiskList() void Disk::guessIconName() { - if( mount.contains( "cdrom", false ) ) icon = "cdrom"; - else if( device.contains( "cdrom", false ) ) icon = "cdrom"; - else if( mount.contains( "writer", false ) ) icon = "cdwriter"; - else if( device.contains( "writer", false ) ) icon = "cdwriter"; - else if( mount.contains( "mo", false ) ) icon = "mo"; - else if( device.contains( "mo", false ) ) icon = "mo"; - else if( device.contains( "fd", false ) ) { - if( device.contains( "360", false ) ) icon = "5floppy"; - if( device.contains( "1200", false ) ) icon = "5floppy"; + if( mount.tqcontains( "cdrom", false ) ) icon = "cdrom"; + else if( device.tqcontains( "cdrom", false ) ) icon = "cdrom"; + else if( mount.tqcontains( "writer", false ) ) icon = "cdwriter"; + else if( device.tqcontains( "writer", false ) ) icon = "cdwriter"; + else if( mount.tqcontains( "mo", false ) ) icon = "mo"; + else if( device.tqcontains( "mo", false ) ) icon = "mo"; + else if( device.tqcontains( "fd", false ) ) { + if( device.tqcontains( "360", false ) ) icon = "5floppy"; + if( device.tqcontains( "1200", false ) ) icon = "5floppy"; else icon = "3floppy"; } - else if( mount.contains( "floppy", false ) ) icon = "3floppy"; - else if( mount.contains( "zip", false ) ) icon = "zip"; - else if( type.contains( "nfs", false ) ) icon = "nfs"; + else if( mount.tqcontains( "floppy", false ) ) icon = "3floppy"; + else if( mount.tqcontains( "zip", false ) ) icon = "zip"; + else if( type.tqcontains( "nfs", false ) ) icon = "nfs"; else icon = "hdd"; -- cgit v1.2.1