summaryrefslogtreecommitdiffstats
path: root/kdirstat/kdirtreeview.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 21:28:42 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 21:28:42 +0000
commite8d62395de6c1b3844294c5b6c09428c315ac42a (patch)
treef94a43e157b5b4607f3a8d5b9b7be873d458fafa /kdirstat/kdirtreeview.h
parent1ed26cd2c4d896ae560dc7dddb570fe14ef573f3 (diff)
downloadkdirstat-e8d62395de6c1b3844294c5b6c09428c315ac42a.tar.gz
kdirstat-e8d62395de6c1b3844294c5b6c09428c315ac42a.zip
TQt4 port kdirstat
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdirstat@1239296 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdirstat/kdirtreeview.h')
-rw-r--r--kdirstat/kdirtreeview.h228
1 files changed, 110 insertions, 118 deletions
diff --git a/kdirstat/kdirtreeview.h b/kdirstat/kdirtreeview.h
index baeae6b..8e12113 100644
--- a/kdirstat/kdirtreeview.h
+++ b/kdirstat/kdirtreeview.h
@@ -12,11 +12,11 @@
#define KDirTreeView_h
-// Alternative parent class for KDirTreeView.
+// Alternative tqparent class for KDirTreeView.
//
// If you change this, don't forget to change the KDirTreeView class
// declaration also. Unfortunately there this 'define' can't be used -
-// it seems to confuse the 'moc' preprocessor.
+// it seems to confuse the 'tqmoc' preprocessor.
#define USE_KLISTVIEW 0
#define DEBUG_COUNTERS 10
@@ -27,17 +27,17 @@
#endif
-#include <qdatetime.h>
-#include <qlistview.h>
-#include <qpixmap.h>
+#include <tqdatetime.h>
+#include <tqlistview.h>
+#include <tqpixmap.h>
#include <klistview.h>
#include "kdirtree.h"
// Forward declarations
-class QWidget;
-class QTimer;
-class QPopupMenu;
+class TQWidget;
+class TQTimer;
+class TQPopupMenu;
class KPacManAnimation;
@@ -53,24 +53,25 @@ namespace KDirStat
#if USE_KLISTVIEW
# define KDirTreeViewParentClass KListView
#else
-# define KDirTreeViewParentClass QListView
+# define KDirTreeViewParentClass TQListView
#endif
class KDirTreeViewItem;
- class KDirTreeView: public QListView
+ class KDirTreeView: public TQListView
// Using
// class KDirTreeView: public KDirTreeViewParentClass
- // or some other 'ifdef' ... construct seems to confuse "moc".
+ // or some other 'ifdef' ... construct seems to confuse "tqmoc".
{
Q_OBJECT
+ TQ_OBJECT
public:
/**
* Default constructor.
**/
- KDirTreeView( QWidget * parent = 0 );
+ KDirTreeView( TQWidget * tqparent = 0 );
/**
* Destructor.
@@ -91,7 +92,7 @@ namespace KDirStat
/**
* Get the first child of this view or 0 if there is none.
* Use the child's next() method to get the next child.
- * Reimplemented from @ref QListView.
+ * Reimplemented from @ref TQListView.
**/
KDirTreeViewItem * firstChild() const
{ return (KDirTreeViewItem *) KDirTreeViewParentClass::firstChild(); }
@@ -135,22 +136,22 @@ namespace KDirStat
* Return the percentage bar fill color for the specified directory
* level (0..MaxInt). Wraps around every usedFillColors() colors.
**/
- const QColor & fillColor( int level ) const;
+ const TQColor & fillColor( int level ) const;
/**
* Very much like @ref fillColor(), but doesn't wrap around at @ref
* usedFillColors(), but at KDirTreeViewMaxFillColor.
**/
- const QColor & rawFillColor( int level ) const;
+ const TQColor & rawFillColor( int level ) const;
/**
* Set the fill color of percentage bars of the specified directory
* level (0..KDirTreeViewMaxFillColor-1).
*
- * Calling repaint() after setting all desired colors is the
+ * Calling tqrepaint() after setting all desired colors is the
* caller's responsibility.
**/
- void setFillColor( int level, const QColor &color );
+ void setFillColor( int level, const TQColor &color );
/**
* Set all tree colors to default values.
@@ -171,20 +172,20 @@ namespace KDirStat
/**
* Set the tree background color.
*
- * Calling repaint() after setting all desired colors is the
+ * Calling tqrepaint() after setting all desired colors is the
* caller's responsibility.
**/
- void setTreeBackground( const QColor &color );
+ void setTreeBackground( const TQColor &color );
/**
* Returns the tree background color.
**/
- const QColor & treeBackground() const { return _treeBackground; }
+ const TQColor & treeBackground() const { return _treeBackground; }
/**
* Returns the background color for percentage bars.
**/
- const QColor & percentageBarBackground() const { return _percentageBarBackground; }
+ const TQColor & percentageBarBackground() const { return _percentageBarBackground; }
/**
* (Try to) ensure good contrast between the tree background and the
@@ -192,7 +193,7 @@ namespace KDirStat
* inevitably be the case for a white background (which unfortunately
* is very common): The percentage bars use white and black for 3D
* borders - like any other widget. But other widgets normally can
- * assume their parent widget uses some more neutral color so white and
+ * assume their tqparent widget uses some more neutral color so white and
* black will result in at least some minimal contrast.
*
* This function automagically sets a reasonable default background
@@ -208,7 +209,7 @@ namespace KDirStat
/**
* Set the sort column.
*
- * Reimplemented from QListView so we can keep track of the sort column.
+ * Reimplemented from TQListView so we can keep track of the sort column.
**/
virtual void setSorting( int column, bool increasing = TRUE );
@@ -234,26 +235,26 @@ namespace KDirStat
int readJobsCol() const { return _readJobsCol; }
int sortCol() const { return _sortCol; }
- QPixmap openDirIcon() const { return _openDirIcon; }
- QPixmap closedDirIcon() const { return _closedDirIcon; }
- QPixmap openDotEntryIcon() const { return _openDotEntryIcon; }
- QPixmap closedDotEntryIcon() const { return _closedDotEntryIcon; }
- QPixmap unreadableDirIcon() const { return _unreadableDirIcon; }
- QPixmap mountPointIcon() const { return _mountPointIcon; }
- QPixmap fileIcon() const { return _fileIcon; }
- QPixmap symLinkIcon() const { return _symLinkIcon; }
- QPixmap blockDevIcon() const { return _blockDevIcon; }
- QPixmap charDevIcon() const { return _charDevIcon; }
- QPixmap fifoIcon() const { return _fifoIcon; }
- QPixmap stopIcon() const { return _stopIcon; }
- QPixmap workingIcon() const { return _workingIcon; }
- QPixmap readyIcon() const { return _readyIcon; }
+ TQPixmap openDirIcon() const { return _openDirIcon; }
+ TQPixmap closedDirIcon() const { return _closedDirIcon; }
+ TQPixmap openDotEntryIcon() const { return _openDotEntryIcon; }
+ TQPixmap closedDotEntryIcon() const { return _closedDotEntryIcon; }
+ TQPixmap unreadableDirIcon() const { return _unreadableDirIcon; }
+ TQPixmap mountPointIcon() const { return _mountPointIcon; }
+ TQPixmap fileIcon() const { return _fileIcon; }
+ TQPixmap symLinkIcon() const { return _symLinkIcon; }
+ TQPixmap blockDevIcon() const { return _blockDevIcon; }
+ TQPixmap charDevIcon() const { return _charDevIcon; }
+ TQPixmap fifoIcon() const { return _fifoIcon; }
+ TQPixmap stopIcon() const { return _stopIcon; }
+ TQPixmap workingIcon() const { return _workingIcon; }
+ TQPixmap readyIcon() const { return _readyIcon; }
/**
* Set function name of debug function #i
**/
- void setDebugFunc( int i, const QString & functionName );
+ void setDebugFunc( int i, const TQString & functionName );
/**
* Increase debug counter #i
@@ -289,15 +290,15 @@ namespace KDirStat
void clear();
/**
- * Select a (QListViewItem) item. Triggers selectionChanged() signals.
+ * Select a (TQListViewItem) item. Triggers selectionChanged() signals.
**/
- void selectItem( QListViewItem *item );
+ void selectItem( TQListViewItem *item );
/**
* Select an item. Triggers selectionChanged() signals.
* Overloaded for convenience.
**/
- void selectItem( KDirTreeViewItem *item ) { selectItem( (QListViewItem *) item ); }
+ void selectItem( KDirTreeViewItem *item ) { selectItem( (TQListViewItem *) item ); }
/**
* Select a KDirTree item. Used for connecting the @ref
@@ -349,9 +350,9 @@ namespace KDirStat
/**
* Returns the minimum recommended size for this widget.
- * Reimplemented from QWidget.
+ * Reimplemented from TQWidget.
**/
- virtual QSize minimumSizeHint() const { return QSize( 0, 0 ); }
+ virtual TQSize tqminimumSizeHint() const { return TQSize( 0, 0 ); }
protected slots:
@@ -396,16 +397,7 @@ namespace KDirStat
* Display progress information in the status bar. Automatically adds
* the elapsed time of a directory scan.
**/
- void sendProgressInfo( const QString & currentDir = "" );
-
-
-#if QT_VERSION < 300
- /**
- * "moc" doesnt't seem to handle default arguments well, so this is an
- * overloaded slot that uses the internally stored current directory.
- **/
- void sendProgressInfo();
-#endif
+ void sendProgressInfo( const TQString & currentDir = "" );
/**
* Set up everything prior to reading: Cyclic update timer, display
@@ -430,21 +422,21 @@ namespace KDirStat
* Pop up context menu (i.e. emit the contextMenu() signal) or open a
* small info popup with exact information, depending on 'column'.
**/
- void popupContextMenu ( QListViewItem * listViewItem,
- const QPoint & pos,
+ void popupContextMenu ( TQListViewItem * listViewItem,
+ const TQPoint & pos,
int column );
/**
* Pop up info window with exact byte size.
**/
- void popupContextSizeInfo ( const QPoint & pos,
+ void popupContextSizeInfo ( const TQPoint & pos,
KFileSize size );
/**
* Pop up info window with arbitrary one-line text.
**/
- void popupContextInfo ( const QPoint & pos,
- const QString & info );
+ void popupContextInfo ( const TQPoint & pos,
+ const TQString & info );
protected slots:
@@ -463,7 +455,7 @@ namespace KDirStat
* changes - typically when a new directory is being read. Connect to a
* status bar etc. to keep the user busy.
**/
- void progressInfo( const QString &infoLine );
+ void progressInfo( const TQString &infoLine );
/**
* Emitted when reading is started.
@@ -499,11 +491,11 @@ namespace KDirStat
*
* NOTE:
*
- * This is _not_ the same as @ref QListView::rightButtonClicked():
+ * This is _not_ the same as @ref TQListView::rightButtonClicked():
* The context menu may not open on a right click on every column,
* usually only in the nameCol().
**/
- void contextMenu( KDirTreeViewItem *item, const QPoint &pos );
+ void contextMenu( KDirTreeViewItem *item, const TQPoint &pos );
/**
* Emitted at user activity. Some interactive actions are assigned an
@@ -518,11 +510,11 @@ namespace KDirStat
protected:
KDirTree * _tree;
- QTimer * _updateTimer;
- QTime _stopWatch;
- QString _currentDir;
+ TQTimer * _updateTimer;
+ TQTime _stopWatch;
+ TQString _currentDir;
KDirTreeViewItem * _selection;
- QPopupMenu * _contextInfo;
+ TQPopupMenu * _contextInfo;
int _idContextInfo;
int _openLevel;
@@ -530,9 +522,9 @@ namespace KDirStat
bool _doPacManAnimation;
int _updateInterval; // millisec
int _usedFillColors;
- QColor _fillColor [ KDirTreeViewMaxFillColor ];
- QColor _treeBackground;
- QColor _percentageBarBackground;
+ TQColor _fillColor [ KDirTreeViewMaxFillColor ];
+ TQColor _treeBackground;
+ TQColor _percentageBarBackground;
// The various columns in which to display information
@@ -552,30 +544,30 @@ namespace KDirStat
int _sortCol;
int _debugCount[ DEBUG_COUNTERS ];
- QString _debugFunc [ DEBUG_COUNTERS ];
+ TQString _debugFunc [ DEBUG_COUNTERS ];
// The various icons
- QPixmap _openDirIcon;
- QPixmap _closedDirIcon;
- QPixmap _openDotEntryIcon;
- QPixmap _closedDotEntryIcon;
- QPixmap _unreadableDirIcon;
- QPixmap _mountPointIcon;
- QPixmap _fileIcon;
- QPixmap _symLinkIcon;
- QPixmap _blockDevIcon;
- QPixmap _charDevIcon;
- QPixmap _fifoIcon;
- QPixmap _stopIcon;
- QPixmap _workingIcon;
- QPixmap _readyIcon;
+ TQPixmap _openDirIcon;
+ TQPixmap _closedDirIcon;
+ TQPixmap _openDotEntryIcon;
+ TQPixmap _closedDotEntryIcon;
+ TQPixmap _unreadableDirIcon;
+ TQPixmap _mountPointIcon;
+ TQPixmap _fileIcon;
+ TQPixmap _symLinkIcon;
+ TQPixmap _blockDevIcon;
+ TQPixmap _charDevIcon;
+ TQPixmap _fifoIcon;
+ TQPixmap _stopIcon;
+ TQPixmap _workingIcon;
+ TQPixmap _readyIcon;
};
- class KDirTreeViewItem: public QListViewItem
+ class KDirTreeViewItem: public TQListViewItem
{
public:
/**
@@ -588,7 +580,7 @@ namespace KDirStat
* Constructor for all other items.
**/
KDirTreeViewItem ( KDirTreeView * view,
- KDirTreeViewItem * parent,
+ KDirTreeViewItem * tqparent,
KFileInfo * orig );
/**
@@ -638,9 +630,9 @@ namespace KDirStat
/**
- * Returns the parent view item or 0 if this is the root.
+ * Returns the tqparent view item or 0 if this is the root.
**/
- KDirTreeViewItem * parent() { return _parent; }
+ KDirTreeViewItem * tqparent() { return _parent; }
/**
* Returns the corresponding original item of the "real" (vs. view)
@@ -651,38 +643,38 @@ namespace KDirStat
/**
* Returns the first child of this item or 0 if there is none.
* Use the child's next() method to get the next child.
- * Reimplemented from @ref QListViewItem.
+ * Reimplemented from @ref TQListViewItem.
**/
KDirTreeViewItem * firstChild() const
- { return (KDirTreeViewItem *) QListViewItem::firstChild(); }
+ { return (KDirTreeViewItem *) TQListViewItem::firstChild(); }
/**
* Returns the next sibling of this item or 0 if there is none.
- * (Kind of) reimplemented from @ref QListViewItem.
+ * (Kind of) reimplemented from @ref TQListViewItem.
**/
KDirTreeViewItem * next() const
- { return (KDirTreeViewItem *) QListViewItem::nextSibling(); }
+ { return (KDirTreeViewItem *) TQListViewItem::nextSibling(); }
/**
* Comparison function used for sorting the list.
*
* Using this function is much more efficient than overwriting
- * QListViewItem::key() which operates on QStrings.
+ * TQListViewItem::key() which operates on TQStrings.
*
* Returns:
* -1 if this < other
* 0 if this == other
* +1 if this > other
*
- * Reimplemented from QListViewItem
+ * Reimplemented from TQListViewItem
**/
- virtual int compare( QListViewItem * other,
+ virtual int compare( TQListViewItem * other,
int col,
bool ascending ) const;
/**
* Perform any necessary pending updates when a branch is opened.
- * Reimplemented from @ref QListViewItem.
+ * Reimplemented from @ref TQListViewItem.
**/
virtual void setOpen( bool open );
@@ -716,7 +708,7 @@ namespace KDirStat
* Recursively return an ASCII representation of all open items from
* here on.
**/
- QString asciiDump();
+ TQString asciiDump();
protected:
@@ -728,8 +720,8 @@ namespace KDirStat
void setIcon();
/**
- * Remove dot entry if it doesn't have any children.
- * Reparent all of the dot entry's children if there are no
+ * Remove dot entry if it doesn't have any tqchildren.
+ * Retqparent all of the dot entry's tqchildren if there are no
* subdirectories on this level.
**/
void cleanupDotEntries();
@@ -747,28 +739,28 @@ namespace KDirStat
/**
- * Paint method. Reimplemented from @ref QListViewItem so different
+ * Paint method. Reimplemented from @ref TQListViewItem so different
* colors can be used - and of course for painting percentage bars.
*
- * Reimplemented from @ref QListViewItem.
+ * Reimplemented from @ref TQListViewItem.
**/
- virtual void paintCell ( QPainter * painter,
- const QColorGroup & colorGroup,
+ virtual void paintCell ( TQPainter * painter,
+ const TQColorGroup & tqcolorGroup,
int column,
int width,
- int alignment );
+ int tqalignment );
/**
- * Paint a percentage bar into a @ref QListViewItem cell.
+ * Paint a percentage bar into a @ref TQListViewItem cell.
* 'width' is the width of the entire cell.
* 'indent' is the number of pixels to indent the bar.
**/
void paintPercentageBar ( float percent,
- QPainter * painter,
+ TQPainter * painter,
int indent,
int width,
- const QColor & fillColor,
- const QColor & barBackground );
+ const TQColor & fillColor,
+ const TQColor & barBackground );
/**
* Generic comparison function.
@@ -787,7 +779,7 @@ namespace KDirStat
* Initializations common to all constructors.
**/
void init ( KDirTreeView * view,
- KDirTreeViewItem * parent,
+ KDirTreeViewItem * tqparent,
KFileInfo * orig );
protected:
@@ -833,19 +825,19 @@ namespace KDirStat
* Format a file size with all digits, yet human readable using the current
* locale's thousand separator, i.e. 12,345,678 rather than 12345678
**/
- QString formatSizeLong( KFileSize size );
+ TQString formatSizeLong( KFileSize size );
/**
- * Format a file size for use within a QListView::key() function:
+ * Format a file size for use within a TQListView::key() function:
* Right-justify and fill with leading zeroes.
**/
- QString hexKey( KFileSize size );
+ TQString hexKey( KFileSize size );
/**
* Format a millisecond granularity time human readable.
* Milliseconds will only be inluded if 'showMilliSeconds' is true.
**/
- QString formatTime ( long millisec,
+ TQString formatTime ( long millisec,
bool showMilliSeconds = false );
/**
@@ -854,31 +846,31 @@ namespace KDirStat
* Returns an empty string if 'suppressZero' is 'true' and the value of
* 'count' is 0.
**/
- QString formatCount( int count, bool suppressZero = false );
+ TQString formatCount( int count, bool suppressZero = false );
/**
* Format percentages.
**/
- QString formatPercent( float percent );
+ TQString formatPercent( float percent );
/**
* Format time and date human-readable as "yyyy-mm-dd hh:mm:ss"
* - unlike that ctime() crap that is really useless.
* See the source for more about why this format.
**/
- QString formatTimeDate( time_t rawTime );
+ TQString formatTimeDate( time_t rawTime );
/**
* Format time and date according to the current locale for those who
* really must have that brain-dead ctime() format.
**/
- QString localeTimeDate( time_t rawTime );
+ TQString localeTimeDate( time_t rawTime );
/**
* Return a color that contrasts to 'contrastColor'.
**/
- QColor contrastingColor ( const QColor &desiredColor,
- const QColor &contrastColor );
+ TQColor contrastingColor ( const TQColor &desiredColor,
+ const TQColor &contrastColor );
} // namespace KDirStat