From f0296ef9e1f94e23c00d6f490e565d1dc768416d Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 26 May 2011 00:38:19 +0000 Subject: [PATCH] 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/app/historyAction.cpp | 18 ++--- src/app/historyAction.h | 19 ++--- src/app/mainWindow.cpp | 82 ++++++++++----------- src/app/mainWindow.h | 3 +- src/part/Config.cpp | 4 +- src/part/Config.h | 4 +- src/part/dialog.ui | 96 ++++++++++++------------ src/part/fileTree.cpp | 14 ++-- src/part/fileTree.h | 28 +++---- src/part/localLister.cpp | 50 ++++++------- src/part/localLister.h | 14 ++-- src/part/part.cpp | 82 ++++++++++----------- src/part/part.h | 5 +- src/part/progressBox.cpp | 22 +++--- src/part/progressBox.h | 11 +-- src/part/radialMap/builder.cpp | 14 ++-- src/part/radialMap/labels.cpp | 36 ++++----- src/part/radialMap/map.cpp | 62 ++++++++-------- src/part/radialMap/radialMap.h | 10 +-- src/part/radialMap/segmentTip.cpp | 76 +++++++++---------- src/part/radialMap/segmentTip.h | 12 +-- src/part/radialMap/widget.cpp | 42 +++++------ src/part/radialMap/widget.h | 43 +++++------ src/part/radialMap/widgetEvents.cpp | 62 ++++++++-------- src/part/remoteLister.cpp | 48 ++++++------ src/part/remoteLister.h | 3 +- src/part/scan.cpp | 32 ++++---- src/part/scan.h | 13 ++-- src/part/settingsDialog.cpp | 64 ++++++++-------- src/part/settingsDialog.h | 11 +-- src/part/summaryWidget.cpp | 110 ++++++++++++++-------------- src/part/summaryWidget.h | 7 +- 32 files changed, 553 insertions(+), 544 deletions(-) diff --git a/src/app/historyAction.cpp b/src/app/historyAction.cpp index bf715cb..0013cfe 100644 --- a/src/app/historyAction.cpp +++ b/src/app/historyAction.cpp @@ -9,7 +9,7 @@ inline -HistoryAction::HistoryAction( const QString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name ) +HistoryAction::HistoryAction( const TQString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name ) : KAction( text, icon, cut, 0, 0, ac, name ) , m_text( text ) { @@ -18,7 +18,7 @@ HistoryAction::HistoryAction( const QString &text, const char *icon, const KShor } void -HistoryAction::push( const QString &path ) +HistoryAction::push( const TQString &path ) { if( !path.isEmpty() && m_list.last() != path ) { @@ -28,10 +28,10 @@ HistoryAction::push( const QString &path ) } } -QString +TQString HistoryAction::pop() { - const QString s = m_list.last(); + const TQString s = m_list.last(); m_list.pop_back(); setActionMenuTextOnly( this, m_list.last() ); setEnabled(); @@ -40,14 +40,14 @@ HistoryAction::pop() -HistoryCollection::HistoryCollection( KActionCollection *ac, QObject *parent, const char *name ) - : QObject( parent, name ) +HistoryCollection::HistoryCollection( KActionCollection *ac, TQObject *tqparent, const char *name ) + : TQObject( tqparent, name ) , m_b( new HistoryAction( i18n( "Back" ), "back", KStdAccel::back(), ac, "go_back" ) ) , m_f( new HistoryAction( i18n( "Forward" ), "forward", KStdAccel::forward(), ac, "go_forward" ) ) , m_receiver( 0 ) { - connect( m_b, SIGNAL(activated()), SLOT(pop()) ); - connect( m_f, SIGNAL(activated()), SLOT(pop()) ); + connect( m_b, TQT_SIGNAL(activated()), TQT_SLOT(pop()) ); + connect( m_f, TQT_SIGNAL(activated()), TQT_SLOT(pop()) ); } void @@ -70,7 +70,7 @@ void HistoryCollection::pop() //slot { KURL url; - const QString path = ((HistoryAction*)sender())->pop(); //FIXME here we remove the constness + const TQString path = ((HistoryAction*)sender())->pop(); //FIXME here we remove the constness url.setPath( path ); m_receiver = (sender() == m_b) ? m_f : m_b; diff --git a/src/app/historyAction.h b/src/app/historyAction.h index 773093c..dbbf19e 100644 --- a/src/app/historyAction.h +++ b/src/app/historyAction.h @@ -6,18 +6,18 @@ #include #include -#include +#include class KConfig; /// defined in mainWindow.cpp -void setActionMenuTextOnly( KAction *a, QString const &suffix ); +void setActionMenuTextOnly( KAction *a, TQString const &suffix ); class HistoryAction : KAction { - HistoryAction( const QString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name ); + HistoryAction( const TQString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name ); friend class HistoryCollection; @@ -29,20 +29,21 @@ public: private: void setText(); - void push( const QString &path ); - QString pop(); + void push( const TQString &path ); + TQString pop(); - const QString m_text; - QStringList m_list; + const TQString m_text; + TQStringList m_list; }; -class HistoryCollection : public QObject +class HistoryCollection : public TQObject { Q_OBJECT + TQ_OBJECT public: - HistoryCollection( KActionCollection *ac, QObject *parent, const char *name ); + HistoryCollection( KActionCollection *ac, TQObject *tqparent, const char *name ); void save( KConfig *config ); void restore( KConfig *config ); diff --git a/src/app/mainWindow.cpp b/src/app/mainWindow.cpp index 155ece0..7370784 100644 --- a/src/app/mainWindow.cpp +++ b/src/app/mainWindow.cpp @@ -22,9 +22,9 @@ #include #include #include //locationbar -#include -#include -#include +#include +#include +#include @@ -40,10 +40,10 @@ MainWindow::MainWindow() KMessageBox::error( this, i18n("KDE could not find the Filelight Part, or the Filelight Part could not be started. Did you make install?") ); //exit() seems to not exist inside the std namespace for some users! using namespace std; - exit( 1 ); //don't use QApplication::exit() - it causes a crash + exit( 1 ); //don't use TQApplication::exit() - it causes a crash } - m_part = (Part *)factory->create( this, "part", "KParts::ReadOnlyPart" ); + m_part = (Part *)factory->create( TQT_TQOBJECT(this), "part", "KParts::ReadOnlyPart" ); setCentralWidget( m_part->widget() ); setStandardToolBarMenuEnabled( true ); @@ -52,18 +52,18 @@ MainWindow::MainWindow() stateChanged( "scan_failed" ); //bah! doesn't affect the parts' actions, should I add them to the actionCollection here? - QObjectList *buttons = toolBar()->queryList( "KToolBarButton" ); + TQObjectList *buttons = toolBar()->queryList( "KToolBarButton" ); if (buttons->isEmpty()) KMessageBox::error( this, i18n("Filelight is not installed properly, consequently its menus and toolbars will appear reduced or even empty") ); delete buttons; - connect( m_part, SIGNAL(started( KIO::Job* )), SLOT(scanStarted()) ); - connect( m_part, SIGNAL(completed()), SLOT(scanCompleted()) ); - connect( m_part, SIGNAL(canceled( const QString& )), SLOT(scanFailed()) ); + connect( m_part, TQT_SIGNAL(started( KIO::Job* )), TQT_SLOT(scanStarted()) ); + connect( m_part, TQT_SIGNAL(completed()), TQT_SLOT(scanCompleted()) ); + connect( m_part, TQT_SIGNAL(canceled( const TQString& )), TQT_SLOT(scanFailed()) ); //TODO test these - connect( m_part, SIGNAL(canceled( const QString& )), m_histories, SLOT(stop()) ); - connect( BrowserExtension::childObject( m_part ), SIGNAL(openURLNotify()), SLOT(urlAboutToChange()) ); + connect( m_part, TQT_SIGNAL(canceled( const TQString& )), m_histories, TQT_SLOT(stop()) ); + connect( BrowserExtension::childObject( m_part ), TQT_SIGNAL(openURLNotify()), TQT_SLOT(urlAboutToChange()) ); KConfig* const config = KGlobal::config(); config->setGroup( "general" ); @@ -79,39 +79,39 @@ MainWindow::setupActions() //singleton function m_combo = new KHistoryCombo( this, "history_combo" ); m_combo->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) ); m_combo->setAutoDeleteCompletionObject( true ); - m_combo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + m_combo->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); m_combo->setDuplicatesEnabled( false ); - KStdAction::open( this, SLOT(slotScanDirectory()), ac, "scan_directory" ); - KStdAction::quit( this, SLOT(close()), ac ); - KStdAction::up( this, SLOT(slotUp()), ac ); - KStdAction::configureToolbars(this, SLOT(configToolbars()), ac); - KStdAction::keyBindings(this, SLOT(configKeys()), ac); + KStdAction::open( TQT_TQOBJECT(this), TQT_SLOT(slotScanDirectory()), ac, "scan_directory" ); + KStdAction::quit( TQT_TQOBJECT(this), TQT_SLOT(close()), ac ); + KStdAction::up( TQT_TQOBJECT(this), TQT_SLOT(slotUp()), ac ); + KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(configToolbars()), ac); + KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(configKeys()), ac); - new KAction( i18n( "Scan &Home Directory" ), "folder_home", CTRL+Key_Home, this, SLOT(slotScanHomeDirectory()), ac, "scan_home" ); - new KAction( i18n( "Scan &Root Directory" ), "folder_red", 0, this, SLOT(slotScanRootDirectory()), ac, "scan_root" ); - new KAction( i18n( "Rescan" ), "reload", KStdAccel::reload(), m_part, SLOT(rescan()), ac, "scan_rescan" ); - new KAction( i18n( "Stop" ), "stop", Qt::Key_Escape, this, SLOT(slotAbortScan()), ac, "scan_stop" ); - new KAction( i18n( "Clear Location Bar" ), KApplication::reverseLayout() ? "clear_left" : "locationbar_erase", 0, m_combo, SLOT(clearEdit()), ac, "clear_location" ); - new KAction( i18n( "Go" ), "key_enter", 0, m_combo, SIGNAL(returnPressed()), ac, "go" ); + new KAction( i18n( "Scan &Home Directory" ), "folder_home", CTRL+Key_Home, TQT_TQOBJECT(this), TQT_SLOT(slotScanHomeDirectory()), ac, "scan_home" ); + new KAction( i18n( "Scan &Root Directory" ), "folder_red", 0, TQT_TQOBJECT(this), TQT_SLOT(slotScanRootDirectory()), ac, "scan_root" ); + new KAction( i18n( "Rescan" ), "reload", KStdAccel::reload(), TQT_TQOBJECT(m_part), TQT_SLOT(rescan()), ac, "scan_rescan" ); + new KAction( i18n( "Stop" ), "stop", TQt::Key_Escape, TQT_TQOBJECT(this), TQT_SLOT(slotAbortScan()), ac, "scan_stop" ); + new KAction( i18n( "Clear Location Bar" ), KApplication::reverseLayout() ? "clear_left" : "locationbar_erase", 0, TQT_TQOBJECT(m_combo), TQT_SLOT(clearEdit()), ac, "clear_location" ); + new KAction( i18n( "Go" ), "key_enter", 0, TQT_TQOBJECT(m_combo), TQT_SIGNAL(returnPressed()), ac, "go" ); KWidgetAction *combo = new KWidgetAction( m_combo, i18n( "Location Bar" ), 0, 0, 0, ac, "location_bar" ); m_recentScans = new KRecentFilesAction( i18n( "&Recent Scans" ), 0, ac, "scan_recent", 8 ); - m_histories = new HistoryCollection( ac, this, "history_collection" ); + m_histories = new HistoryCollection( ac, TQT_TQOBJECT(this), "history_collection" ); ac->action( "scan_directory" )->setText( i18n( "&Scan Directory..." ) ); m_recentScans->loadEntries( KGlobal::config() ); combo->setAutoSized( true ); //FIXME what does this do? - connect( m_recentScans, SIGNAL(urlSelected( const KURL& )), SLOT(slotScanUrl( const KURL& )) ); - connect( m_combo, SIGNAL(returnPressed()), SLOT(slotComboScan()) ); - connect( m_histories, SIGNAL(activated( const KURL& )), SLOT(slotScanUrl( const KURL& )) ); + connect( m_recentScans, TQT_SIGNAL(urlSelected( const KURL& )), TQT_SLOT(slotScanUrl( const KURL& )) ); + connect( m_combo, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotComboScan()) ); + connect( m_histories, TQT_SIGNAL(activated( const KURL& )), TQT_SLOT(slotScanUrl( const KURL& )) ); } bool MainWindow::queryExit() { - if( !m_part ) //apparently std::exit() still calls this function, and abort() causes a crash.. + if( !m_part ) //aptqparently std::exit() still calls this function, and abort() causes a crash.. return true; KConfig* const config = KGlobal::config(); @@ -157,13 +157,13 @@ inline void MainWindow::slotUp() { slotScanUrl( m_part->url().upU inline void MainWindow::slotComboScan() { - const QString path = KShell::tildeExpand(m_combo->lineEdit()->text()); + const TQString path = KShell::tildeExpand(m_combo->lineEdit()->text()); if (slotScanPath( path )) m_combo->addToHistory( path ); } inline bool -MainWindow::slotScanPath( const QString &path ) +MainWindow::slotScanPath( const TQString &path ) { return slotScanUrl( KURL::fromPathOrURL( path ) ); } @@ -198,7 +198,7 @@ inline void MainWindow::scanFailed() { stateChanged( "scan_failed" ); - setActionMenuTextOnly( action( "go_up" ), QString::null ); + setActionMenuTextOnly( action( "go_up" ), TQString() ); m_combo->lineEdit()->clear(); } @@ -214,7 +214,7 @@ MainWindow::scanCompleted() if ( url.path( 1 ) == "/") { goUp->setEnabled( false ); - setActionMenuTextOnly( goUp, QString() ); + setActionMenuTextOnly( goUp, TQString() ); } else setActionMenuTextOnly( goUp, url.upURL().path( 1 ) ); @@ -247,7 +247,7 @@ void MainWindow::readProperties( KConfig *config ) //virtual { m_histories->restore( config ); - slotScanPath( config->readEntry( "currentMap", QString::null ) ); + slotScanPath( config->readEntry( "currentMap", TQString() ) ); } } //namespace Filelight @@ -256,23 +256,23 @@ MainWindow::readProperties( KConfig *config ) //virtual /// declared in historyAction.h -void setActionMenuTextOnly( KAction *a, QString const &suffix ) +void setActionMenuTextOnly( KAction *a, TQString const &suffix ) { - QString const menu_text = suffix.isEmpty() + TQString const menu_text = suffix.isEmpty() ? a->text() - : i18n( "&Up: /home/mxcl", "%1: %2" ).arg( a->text(), suffix ); + : i18n( "&Up: /home/mxcl", "%1: %2" ).tqarg( a->text(), suffix ); for (int i = 0; i < a->containerCount(); ++i) { - QWidget *w = a->container( i ); + TQWidget *w = a->container( i ); int const id = a->itemId( i ); - if (w->inherits( "QPopupMenu" )) - static_cast(w)->changeItem( id, menu_text ); + if (w->inherits( TQPOPUPMENU_OBJECT_NAME_STRING )) + static_cast(w)->changeItem( id, menu_text ); else if (w->inherits( "KToolBar" )) { - QWidget *button = static_cast(w)->getWidget( id ); + TQWidget *button = static_cast(w)->getWidget( id ); if (button->inherits( "KToolBarButton" )) - QToolTip::add( button, suffix ); + TQToolTip::add( button, suffix ); } } } diff --git a/src/app/mainWindow.h b/src/app/mainWindow.h index 87001c8..bef82d1 100644 --- a/src/app/mainWindow.h +++ b/src/app/mainWindow.h @@ -36,6 +36,7 @@ class Part; class MainWindow : public KParts::MainWindow { Q_OBJECT + TQ_OBJECT public: MainWindow(); @@ -49,7 +50,7 @@ class MainWindow : public KParts::MainWindow void slotScanHomeDirectory(); void slotScanRootDirectory(); bool slotScanUrl( const KURL& ); - bool slotScanPath( const QString& ); + bool slotScanPath( const TQString& ); void slotAbortScan(); void configToolbars(); diff --git a/src/part/Config.cpp b/src/part/Config.cpp index 8d2f6b8..f940480 100644 --- a/src/part/Config.cpp +++ b/src/part/Config.cpp @@ -14,7 +14,7 @@ uint Config::antiAliasFactor; uint Config::minFontPitch; uint Config::defaultRingDepth; Filelight::MapScheme Config::scheme; -QStringList Config::skipList; +TQStringList Config::skipList; inline KConfig& @@ -37,7 +37,7 @@ Filelight::Config::read() showSmallFiles = config.readBoolEntry( "showSmallFiles", false ); contrast = config.readNumEntry( "contrast", 75 ); antiAliasFactor = config.readNumEntry( "antiAliasFactor", 2 ); - minFontPitch = config.readNumEntry( "minFontPitch", QFont().pointSize() - 3); + minFontPitch = config.readNumEntry( "minFontPitch", TQFont().pointSize() - 3); scheme = (MapScheme) config.readNumEntry( "scheme", 0 ); skipList = config.readPathListEntry( "skipList" ); diff --git a/src/part/Config.h b/src/part/Config.h index dffaa95..7aad62a 100644 --- a/src/part/Config.h +++ b/src/part/Config.h @@ -2,7 +2,7 @@ #ifndef Config_H #define Config_H -#include +#include class KConfig; @@ -32,7 +32,7 @@ namespace Filelight static uint defaultRingDepth; static MapScheme scheme; - static QStringList skipList; + static TQStringList skipList; }; } diff --git a/src/part/dialog.ui b/src/part/dialog.ui index 2c1d788..a9d56cc 100644 --- a/src/part/dialog.ui +++ b/src/part/dialog.ui @@ -1,10 +1,10 @@ Dialog - + Dialog - + 0 0 @@ -19,14 +19,14 @@ unnamed - + tabWidget false - + Widget2 @@ -37,7 +37,7 @@ unnamed - + textLabel1 @@ -59,7 +59,7 @@ m_listBox - + m_listBox @@ -70,9 +70,9 @@ Filelight will not scan these directories unless you specifically request them. - + - layout4 + tqlayout4 @@ -88,14 +88,14 @@ Expanding - + 180 21 - + m_removeButton @@ -109,7 +109,7 @@ false - + m_addButton @@ -129,7 +129,7 @@ line1 - + 0 15 @@ -151,9 +151,9 @@ Horizontal - + - layout7 + tqlayout7 @@ -169,27 +169,27 @@ Fixed - + 16 50 - + dontScanRemoteMounts false - + 0 0 - + 32767 32767 @@ -208,7 +208,7 @@ Prevents scanning of filesystems that are not on this computer, e.g. NFS or Samba mounts. - + scanAcrossMounts @@ -219,7 +219,7 @@ Allows scans to enter directories that are part of other filesystems. For example, when unchecked, this will usually prevent the contents of <b>/mnt</b> from being scanned if you scan <b>/</b>. - + dontScanRemovableMedia @@ -240,7 +240,7 @@ - + Widget3 @@ -251,7 +251,7 @@ unnamed - + groupBox1 @@ -262,7 +262,7 @@ unnamed - + colourSchemeGroup @@ -275,15 +275,15 @@ - + - layout10 + tqlayout10 unnamed - + textLabel3 @@ -297,7 +297,7 @@ contrastSlider - + contrastSlider @@ -318,7 +318,7 @@ - + useAntialiasing @@ -329,9 +329,9 @@ Anti-aliasing the filemap makes it clearer and prettier, unfortunately it also makes rendering very slow. - + - layout10 + tqlayout10 @@ -340,7 +340,7 @@ 0 - + varyLabelFontSizes @@ -354,9 +354,9 @@ The font size of exploded labels can be varied relative to the depth of the directories they represent. This helps you spot the important labels more easily. Set a sensible minimum font size. - + - layout9 + tqlayout9 @@ -372,14 +372,14 @@ Fixed - + 20 20 - + textLabel2 @@ -414,7 +414,7 @@ 0 - + 80 0 @@ -434,7 +434,7 @@ - + showSmallFiles @@ -448,15 +448,15 @@ - + - layout6 + tqlayout6 unnamed - + m_resetButton @@ -480,14 +480,14 @@ Expanding - + 120 30 - + m_closeButton @@ -504,8 +504,8 @@ - QVButtonGroup -
qvbuttongroup.h
+ TQVButtonGroup +
tqvbuttongroup.h
-1 -1 @@ -561,14 +561,14 @@ dontScanRemoteMounts dontScanRemovableMedia - + toggleDontScanRemovableMedia(bool) toggleDontScanRemoteMounts(bool) toggleScanAcrossMounts(bool) - - + + - qvbuttongroup.h + tqvbuttongroup.h knuminput.h
diff --git a/src/part/fileTree.cpp b/src/part/fileTree.cpp index f459d50..fc2a4c9 100644 --- a/src/part/fileTree.cpp +++ b/src/part/fileTree.cpp @@ -4,7 +4,7 @@ #include "fileTree.h" #include #include -#include +#include //static definitions @@ -12,33 +12,33 @@ const uint File::DENOMINATOR[4] = { 1<<0, 1<<10, 1<<20, 1<<30 }; static const char PREFIX[4] = { 'K', 'M', 'G', 'T' }; -QString +TQString File::fullPath( const Directory *root /*= 0*/ ) const { - QString path; + TQString path; if( root == this ) root = 0; //prevent returning empty string when there is something we could return - for( const Directory *d = (Directory*)this; d != root && d; d = d->parent() ) + for( const Directory *d = (Directory*)this; d != root && d; d = d->tqparent() ) path.prepend( d->name() ); return path; } -QString +TQString File::humanReadableSize( UnitPrefix key /*= mega*/ ) const //FIXME inline { return humanReadableSize( m_size, key ); } -QString +TQString File::humanReadableSize( uint size, UnitPrefix key /*= mega*/ ) //static { if( size == 0 ) return "0 B"; - QString s; + TQString s; double prettySize = (double)size / (double)DENOMINATOR[key]; const KLocale &locale = *KGlobal::locale(); diff --git a/src/part/fileTree.h b/src/part/fileTree.h index 25ac6fb..eb0cad2 100644 --- a/src/part/fileTree.h +++ b/src/part/fileTree.h @@ -4,8 +4,8 @@ #ifndef FILETREE_H #define FILETREE_H -#include //qstrdup -#include //decodeName() +#include //qstrdup +#include //decodeName() #include @@ -153,7 +153,7 @@ private: class Directory; -class QString; +class TQString; class File { @@ -168,21 +168,21 @@ public: File( const char *name, FileSize size ) : m_parent( 0 ), m_name( qstrdup( name ) ), m_size( size ) {} virtual ~File() { delete [] m_name; } - const Directory *parent() const { return m_parent; } + const Directory *tqparent() const { return m_parent; } const char *name8Bit() const { return m_name; } const FileSize size() const { return m_size; } - QString name() const { return QFile::decodeName( m_name ); } + TQString name() const { return TQFile::decodeName( m_name ); } virtual bool isDirectory() const { return false; } - QString fullPath( const Directory* = 0 ) const; - QString humanReadableSize( UnitPrefix key = mega ) const; + TQString fullPath( const Directory* = 0 ) const; + TQString humanReadableSize( UnitPrefix key = mega ) const; public: - static QString humanReadableSize( uint size, UnitPrefix Key = mega ); + static TQString humanReadableSize( uint size, UnitPrefix Key = mega ); protected: - File( const char *name, FileSize size, Directory *parent ) : m_parent( parent ), m_name( qstrdup( name ) ), m_size( size ) {} + File( const char *name, FileSize size, Directory *tqparent ) : m_parent( tqparent ), m_name( qstrdup( name ) ), m_size( size ) {} Directory *m_parent; //0 if this is treeRoot char *m_name; @@ -197,9 +197,9 @@ private: class Directory : public Chain, public File { public: - Directory( const char *name ) : File( name, 0 ), m_children( 0 ) {} //DON'T pass the full path! + Directory( const char *name ) : File( name, 0 ), m_tqchildren( 0 ) {} //DON'T pass the full path! - uint children() const { return m_children; } + uint tqchildren() const { return m_tqchildren; } virtual bool isDirectory() const { return true; } ///appends a Directory @@ -209,7 +209,7 @@ public: delete [] d->m_name; d->m_name = qstrdup( name ); } //directories that had a fullpath copy just their names this way - m_children += d->children(); //doesn't include the dir itself + m_tqchildren += d->tqchildren(); //doesn't include the dir itself d->m_parent = this; append( (File*)d ); //will add 1 to filecount for the dir itself } @@ -223,12 +223,12 @@ public: private: void append( File *p ) { - m_children++; + m_tqchildren++; m_size += p->size(); Chain::append( p ); } - uint m_children; + uint m_tqchildren; private: Directory( const Directory& ); //undefined diff --git a/src/part/localLister.cpp b/src/part/localLister.cpp index 6bf7945..363b093 100644 --- a/src/part/localLister.cpp +++ b/src/part/localLister.cpp @@ -10,8 +10,8 @@ #ifdef HAVE_MNTENT_H #include #endif -#include //postEvent() -#include +#include //postEvent() +#include #include "scan.h" #include #include @@ -19,23 +19,23 @@ namespace Filelight { - QStringList LocalLister::s_remoteMounts; - QStringList LocalLister::s_localMounts; + TQStringList LocalLister::s_remoteMounts; + TQStringList LocalLister::s_localMounts; - LocalLister::LocalLister( const QString &path, Chain *cachedTrees, QObject *parent ) - : QThread() + LocalLister::LocalLister( const TQString &path, Chain *cachedTrees, TQObject *tqparent ) + : TQThread() , m_path( path ) , m_trees( cachedTrees ) - , m_parent( parent ) + , m_parent( tqparent ) { //add empty directories for any mount points that are in the path //TODO empty directories is not ideal as adds to fileCount incorrectly - QStringList list( Config::skipList ); + TQStringList list( Config::skipList ); if( !Config::scanAcrossMounts ) list += s_localMounts; if( !Config::scanRemoteMounts ) list += s_remoteMounts; - for( QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it ) + for( TQStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it ) if( (*it).startsWith( path ) ) //prevent scanning of these directories m_trees->append( new Directory( (*it).local8Bit() ) ); @@ -47,7 +47,7 @@ namespace Filelight LocalLister::run() { //recursively scan the requested path - const QCString path = QFile::encodeName( m_path ); + const TQCString path = TQFile::encodeName( m_path ); Directory *tree = scan( path, path ); //delete the list of trees useful for this scan, @@ -61,9 +61,9 @@ namespace Filelight tree = 0; } - QCustomEvent *e = new QCustomEvent( 1000 ); + TQCustomEvent *e = new TQCustomEvent( 1000 ); e->setData( tree ); - QApplication::postEvent( m_parent, e ); + TQApplication::postEvent( m_parent, e ); } // from system.h in GNU coreutils package @@ -127,7 +127,7 @@ namespace Filelight #include static void - outputError( QCString path ) + outputError( TQCString path ) { ///show error message that stat or opendir may give @@ -160,7 +160,7 @@ namespace Filelight } Directory* - LocalLister::scan( const QCString &path, const QCString &dirname ) + LocalLister::scan( const TQCString &path, const TQCString &dirname ) { Directory *cwd = new Directory( dirname ); DIR *dir = opendir( path ); @@ -180,7 +180,7 @@ namespace Filelight if( qstrcmp( ent->d_name, "." ) == 0 || qstrcmp( ent->d_name, ".." ) == 0 ) continue; - QCString new_path = path; new_path += ent->d_name; + TQCString new_path = path; new_path += ent->d_name; //get file information if( lstat( new_path, &statbuf ) == -1 ) { @@ -204,7 +204,7 @@ namespace Filelight else if( S_ISDIR( statbuf.st_mode ) ) //directory { Directory *d = 0; - QCString new_dirname = ent->d_name; + TQCString new_dirname = ent->d_name; new_dirname += '/'; new_path += '/'; @@ -216,7 +216,7 @@ namespace Filelight { debug() << "Tree pre-completed: " << (*it)->name() << "\n"; d = it.remove(); - ScanManager::s_files += d->children(); + ScanManager::s_files += d->tqchildren(); //**** ideally don't have this redundant extra somehow cwd->append( d, new_dirname ); } @@ -251,7 +251,7 @@ namespace Filelight #ifdef HAVE_MNTENT_H struct mntent *mnt_ent; #endif - QString str; + TQString str; #ifdef HAVE_MNTENT_H @@ -267,7 +267,7 @@ namespace Filelight #define FS_TYPE fstab_ent->fs_vfstype // fs-type #define FS_MNTOPS fstab_ent->fs_mntops // mount-options - QStringList remoteFsTypes; + TQStringList remoteFsTypes; remoteFsTypes << "smbfs" ; #ifdef MNTTYPE_NFS remoteFsTypes << MNTTYPE_NFS; @@ -278,11 +278,11 @@ namespace Filelight while( (fstab_ent = getfsent()) != NULL ) { - str = QString( FS_FILE ); + str = TQString( FS_FILE ); if( str == "/" ) continue; str += '/'; - if( remoteFsTypes.contains( FS_TYPE ) ) + if( remoteFsTypes.tqcontains( FS_TYPE ) ) s_remoteMounts.append( str ); //**** NO! can't be sure won't have trailing slash, need to do a check first dummy!! else @@ -310,15 +310,15 @@ namespace Filelight { bool b = false; - str = QString( FS_FILE ); + str = TQString( FS_FILE ); if( str == "/" ) continue; str += "/"; - if( remoteFsTypes.contains( FS_TYPE ) ) - if( b = !s_remoteMounts.contains( str ) ) + if( remoteFsTypes.tqcontains( FS_TYPE ) ) + if( b = !s_remoteMounts.tqcontains( str ) ) s_remoteMounts.append( str ); //**** NO! can't be sure won't have trailing slash, need to do a check first dummy!! - else if( b = !s_localMounts.contains( str ) ) + else if( b = !s_localMounts.tqcontains( str ) ) s_localMounts.append( str ); //**** NO! can't be sure won't have trailing slash, need to do a check first dummy!! if( b ) kdDebug() << "MTAB: " << FS_TYPE << "\n"; diff --git a/src/part/localLister.h b/src/part/localLister.h index 5070e14..d9c8d84 100644 --- a/src/part/localLister.h +++ b/src/part/localLister.h @@ -4,31 +4,31 @@ #ifndef LOCALLISTER_H #define LOCALLISTER_H -#include +#include class Directory; template class Chain; namespace Filelight { - class LocalLister : public QThread + class LocalLister : public TQThread { public: - LocalLister( const QString &path, Chain *cachedTrees, QObject *parent ); + LocalLister( const TQString &path, Chain *cachedTrees, TQObject *tqparent ); static bool readMounts(); private: - QString m_path; + TQString m_path; Chain *m_trees; - QObject *m_parent; + TQObject *m_parent; private: virtual void run(); - Directory *scan( const QCString&, const QCString& ); + Directory *scan( const TQCString&, const TQCString& ); private: - static QStringList s_localMounts, s_remoteMounts; //TODO namespace + static TQStringList s_localMounts, s_remoteMounts; //TODO namespace }; } diff --git a/src/part/part.cpp b/src/part/part.cpp index 9a4742a..c399800 100644 --- a/src/part/part.cpp +++ b/src/part/part.cpp @@ -20,9 +20,9 @@ #include #include #include -#include //encodeName() -#include //postInit() hack -#include +#include //encodeName() +#include //postInit() hack +#include #include //access() @@ -33,46 +33,46 @@ typedef KParts::GenericFactory Factory; K_EXPORT_COMPONENT_FACTORY( libfilelight, Filelight::Factory ) -BrowserExtension::BrowserExtension( Part *parent, const char *name ) - : KParts::BrowserExtension( parent, name ) +BrowserExtension::BrowserExtension( Part *tqparent, const char *name ) + : KParts::BrowserExtension( tqparent, name ) {} -Part::Part( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const QStringList& ) - : ReadOnlyPart( parent, name ) +Part::Part( TQWidget *tqparentWidget, const char *widgetName, TQObject *tqparent, const char *name, const TQStringList& ) + : ReadOnlyPart( tqparent, name ) , m_ext( new BrowserExtension( this ) ) , m_statusbar( new StatusBarExtension( this ) ) , m_map( 0 ) , m_manager( new ScanManager( this ) ) , m_started( false ) { - QPixmap::setDefaultOptimization( QPixmap::BestOptim ); + TQPixmap::setDefaultOptimization( TQPixmap::BestOptim ); Config::read(); setInstance( Factory::instance() ); - setWidget( new QVBox( parentWidget, widgetName ) ); + setWidget( new TQVBox( tqparentWidget, widgetName ) ); setXMLFile( "filelight_partui.rc" ); m_map = new RadialMap::Widget( widget() ); m_map->hide(); - KStdAction::zoomIn( m_map, SLOT(zoomIn()), actionCollection() ); - KStdAction::zoomOut( m_map, SLOT(zoomOut()), actionCollection() ); - KStdAction::preferences( this, SLOT(configFilelight()), actionCollection(), "configure_filelight" )->setText( i18n( "Configure Filelight..." ) ); + KStdAction::zoomIn( TQT_TQOBJECT(m_map), TQT_SLOT(zoomIn()), actionCollection() ); + KStdAction::zoomOut( TQT_TQOBJECT(m_map), TQT_SLOT(zoomOut()), actionCollection() ); + KStdAction::preferences( this, TQT_SLOT(configFilelight()), actionCollection(), "configure_filelight" )->setText( i18n( "Configure Filelight..." ) ); - connect( m_map, SIGNAL(created( const Directory* )), SIGNAL(completed()) ); - connect( m_map, SIGNAL(created( const Directory* )), SLOT(mapChanged( const Directory* )) ); - connect( m_map, SIGNAL(activated( const KURL& )), SLOT(updateURL( const KURL& )) ); + connect( m_map, TQT_SIGNAL(created( const Directory* )), TQT_SIGNAL(completed()) ); + connect( m_map, TQT_SIGNAL(created( const Directory* )), TQT_SLOT(mapChanged( const Directory* )) ); + connect( m_map, TQT_SIGNAL(activated( const KURL& )), TQT_SLOT(updateURL( const KURL& )) ); // TODO make better system - connect( m_map, SIGNAL(giveMeTreeFor( const KURL& )), SLOT(updateURL( const KURL& )) ); - connect( m_map, SIGNAL(giveMeTreeFor( const KURL& )), SLOT(openURL( const KURL& )) ); + connect( m_map, TQT_SIGNAL(giveMeTreeFor( const KURL& )), TQT_SLOT(updateURL( const KURL& )) ); + connect( m_map, TQT_SIGNAL(giveMeTreeFor( const KURL& )), TQT_SLOT(openURL( const KURL& )) ); - connect( m_manager, SIGNAL(completed( Directory* )), SLOT(scanCompleted( Directory* )) ); - connect( m_manager, SIGNAL(aboutToEmptyCache()), m_map, SLOT(invalidate()) ); + connect( m_manager, TQT_SIGNAL(completed( Directory* )), TQT_SLOT(scanCompleted( Directory* )) ); + connect( m_manager, TQT_SIGNAL(aboutToEmptyCache()), m_map, TQT_SLOT(tqinvalidate()) ); - QTimer::singleShot( 0, this, SLOT(postInit()) ); + TQTimer::singleShot( 0, this, TQT_SLOT(postInit()) ); } void @@ -80,8 +80,8 @@ Part::postInit() { if( m_url.isEmpty() ) //if url is not empty openURL() has been called immediately after ctor, which happens { - QWidget *summary = new SummaryWidget( widget(), "summaryWidget" ); - connect( summary, SIGNAL(activated( const KURL& )), SLOT(openURL( const KURL& )) ); + TQWidget *summary = new SummaryWidget( widget(), "summaryWidget" ); + connect( summary, TQT_SIGNAL(activated( const KURL& )), TQT_SLOT(openURL( const KURL& )) ); summary->show(); //FIXME KXMLGUI is b0rked, it should allow us to set this @@ -99,14 +99,14 @@ Part::openURL( const KURL &u ) //TODO everyone hates dialogs, instead render the text in big fonts on the Map //TODO should have an empty KURL until scan is confirmed successful - //TODO probably should set caption to QString::null while map is unusable + //TODO probably should set caption to TQString() while map is unusable #define KMSG( s ) KMessageBox::information( widget(), s ) KURL url = u; url.cleanPath( true ); - const QString path = url.path( 1 ); - const QCString path8bit = QFile::encodeName( path ); + const TQString path = url.path( 1 ); + const TQCString path8bit = TQFile::encodeName( path ); const bool isLocal = url.protocol() == "file"; if( url.isEmpty() ) @@ -119,15 +119,15 @@ Part::openURL( const KURL &u ) } else if( path[0] != '/' ) { - KMSG( i18n( "Filelight only accepts absolute paths, eg. /%1" ).arg( path ) ); + KMSG( i18n( "Filelight only accepts absolute paths, eg. /%1" ).tqarg( path ) ); } else if( isLocal && access( path8bit, F_OK ) != 0 ) //stat( path, &statbuf ) == 0 { - KMSG( i18n( "Directory not found: %1" ).arg( path ) ); + KMSG( i18n( "Directory not found: %1" ).tqarg( path ) ); } else if( isLocal && access( path8bit, R_OK | X_OK ) != 0 ) { - KMSG( i18n( "Unable to enter: %1\nYou do not have access rights to this location." ).arg( path ) ); + KMSG( i18n( "Unable to enter: %1\nYou do not have access rights to this location." ).tqarg( path ) ); } else { @@ -165,10 +165,10 @@ Part::updateURL( const KURL &u ) void Part::configFilelight() { - QWidget *dialog = new SettingsDialog( widget(), "settings_dialog" ); + TQWidget *dialog = new SettingsDialog( widget(), "settings_dialog" ); - connect( dialog, SIGNAL(canvasIsDirty( int )), m_map, SLOT(refresh( int )) ); - connect( dialog, SIGNAL(mapIsInvalid()), m_manager, SLOT(emptyCache()) ); + connect( dialog, TQT_SIGNAL(canvasIsDirty( int )), m_map, TQT_SLOT(refresh( int )) ); + connect( dialog, TQT_SIGNAL(mapIsInvalid()), m_manager, TQT_SLOT(emptyCache()) ); dialog->show(); //deletes itself } @@ -184,20 +184,20 @@ Part::start( const KURL &url ) { if( !m_started ) { m_statusbar->addStatusBarItem( new ProgressBox( statusBar(), this ), 0, true ); - connect( m_map, SIGNAL(mouseHover( const QString& )), statusBar(), SLOT(message( const QString& )) ); - connect( m_map, SIGNAL(created( const Directory* )), statusBar(), SLOT(clear()) ); + connect( m_map, TQT_SIGNAL(mouseHover( const TQString& )), statusBar(), TQT_SLOT(message( const TQString& )) ); + connect( m_map, TQT_SIGNAL(created( const Directory* )), statusBar(), TQT_SLOT(clear()) ); m_started = true; } if( m_manager->start( url ) ) { m_url = url; - const QString s = i18n( "Scanning: %1" ).arg( prettyURL() ); + const TQString s = i18n( "Scanning: %1" ).tqarg( prettyURL() ); stateChanged( "scan_started" ); emit started( 0 ); //as a Part, we have to do this emit setWindowCaption( s ); statusBar()->message( s ); - m_map->invalidate(); //to maintain ui consistency + m_map->tqinvalidate(); //to maintain ui consistency return true; } @@ -209,7 +209,7 @@ void Part::rescan() { //FIXME we have to empty the cache because otherwise rescan picks up the old tree.. - m_manager->emptyCache(); //causes canvas to invalidate + m_manager->emptyCache(); //causes canvas to tqinvalidate start( m_url ); } @@ -226,11 +226,11 @@ Part::scanCompleted( Directory *tree ) } else { stateChanged( "scan_failed" ); - emit canceled( i18n( "Scan failed: %1" ).arg( prettyURL() ) ); - emit setWindowCaption( QString::null ); + emit canceled( i18n( "Scan failed: %1" ).tqarg( prettyURL() ) ); + emit setWindowCaption( TQString() ); statusBar()->clear(); -// QTimer::singleShot( 2000, statusBar(), SLOT(clear()) ); +// TQTimer::singleShot( 2000, statusBar(), TQT_SLOT(clear()) ); m_url = KURL(); } @@ -243,10 +243,10 @@ Part::mapChanged( const Directory *tree ) emit setWindowCaption( prettyURL() ); - ProgressBox *progress = static_cast(statusBar()->child( "ProgressBox" )); + ProgressBox *progress = static_cast(TQT_TQWIDGET(statusBar()->child( "ProgressBox" ))); if( progress ) - progress->setText( tree->children() ); + progress->setText( tree->tqchildren() ); } } //namespace Filelight diff --git a/src/part/part.h b/src/part/part.h index 348b22b..92bb7e3 100644 --- a/src/part/part.h +++ b/src/part/part.h @@ -29,14 +29,15 @@ namespace Filelight class Part : public KParts::ReadOnlyPart { Q_OBJECT + TQ_OBJECT public: - Part( QWidget *, const char *, QObject *, const char *, const QStringList& ); + Part( TQWidget *, const char *, TQObject *, const char *, const TQStringList& ); virtual bool openFile() { return false; } //pure virtual in base class virtual bool closeURL(); - QString prettyURL() const { return m_url.protocol() == "file" ? m_url.path() : m_url.prettyURL(); } + TQString prettyURL() const { return m_url.protocol() == "file" ? m_url.path() : m_url.prettyURL(); } static KAboutData *createAboutData(); diff --git a/src/part/progressBox.cpp b/src/part/progressBox.cpp index 5bf205a..b608ae6 100644 --- a/src/part/progressBox.cpp +++ b/src/part/progressBox.cpp @@ -10,22 +10,22 @@ #include "progressBox.h" -ProgressBox::ProgressBox( QWidget *parent, QObject *part ) - : QLabel( parent, "ProgressBox" ) +ProgressBox::ProgressBox( TQWidget *tqparent, TQObject *part ) + : TQLabel( tqparent, "ProgressBox" ) { hide(); - setAlignment( Qt::AlignCenter ); + tqsetAlignment( TQt::AlignCenter ); setFont( KGlobalSettings::fixedFont() ); - setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ); + tqsetSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ); setText( 999999 ); - setMinimumWidth( sizeHint().width() ); + setMinimumWidth( tqsizeHint().width() ); - connect( &m_timer, SIGNAL(timeout()), SLOT(report()) ); - connect( part, SIGNAL(started( KIO::Job* )), SLOT(start()) ); - connect( part, SIGNAL(completed()), SLOT(stop()) ); - connect( part, SIGNAL(canceled( const QString& )), SLOT(halt()) ); + connect( &m_timer, TQT_SIGNAL(timeout()), TQT_SLOT(report()) ); + connect( part, TQT_SIGNAL(started( KIO::Job* )), TQT_SLOT(start()) ); + connect( part, TQT_SIGNAL(completed()), TQT_SLOT(stop()) ); + connect( part, TQT_SIGNAL(canceled( const TQString& )), TQT_SLOT(halt()) ); } void @@ -53,13 +53,13 @@ ProgressBox::halt() { // canceled by stop button m_timer.stop(); - QTimer::singleShot( 2000, this, SLOT(hide()) ); + TQTimer::singleShot( 2000, this, TQT_SLOT(hide()) ); } void ProgressBox::setText( int files ) { - QLabel::setText( i18n("%n File", "%n Files", files) ); + TQLabel::setText( i18n("%n File", "%n Files", files) ); } #include "progressBox.moc" diff --git a/src/part/progressBox.h b/src/part/progressBox.h index 17cc2a6..acd605c 100644 --- a/src/part/progressBox.h +++ b/src/part/progressBox.h @@ -4,18 +4,19 @@ #ifndef PROGRESSBOX_H #define PROGRESSBOX_H -#include -#include +#include +#include namespace KIO { class Job; } -class ProgressBox : public QLabel +class ProgressBox : public TQLabel { Q_OBJECT + TQ_OBJECT public: - ProgressBox( QWidget*, QObject* ); + ProgressBox( TQWidget*, TQObject* ); void setText( int ); @@ -26,7 +27,7 @@ public slots: void halt(); private: - QTimer m_timer; + TQTimer m_timer; }; #endif 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(*it)->children(); //need to add one to count the dir as well + hiddenFileCount += static_cast(*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 -#include -#include -#include -#include +#include +#include +#include +#include #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