diff options
Diffstat (limited to 'konq-plugins/fsview/treemap.cpp')
-rw-r--r-- | konq-plugins/fsview/treemap.cpp | 338 |
1 files changed, 169 insertions, 169 deletions
diff --git a/konq-plugins/fsview/treemap.cpp b/konq-plugins/fsview/treemap.cpp index 8de5c01..5a42c75 100644 --- a/konq-plugins/fsview/treemap.cpp +++ b/konq-plugins/fsview/treemap.cpp @@ -18,16 +18,16 @@ /* * A Widget for visualizing hierarchical metrics as areas. - * The API is similar to QListView. + * The API is similar to TQListView. */ #include <math.h> -#include <qpainter.h> -#include <qtooltip.h> -#include <qregexp.h> -#include <qstyle.h> -#include <qpopupmenu.h> +#include <tqpainter.h> +#include <tqtooltip.h> +#include <tqregexp.h> +#include <tqstyle.h> +#include <tqpopupmenu.h> #include <klocale.h> #include <kconfig.h> @@ -56,7 +56,7 @@ StoredDrawParams::StoredDrawParams() // field array has size 0 } -StoredDrawParams::StoredDrawParams(QColor c, +StoredDrawParams::StoredDrawParams(TQColor c, bool selected, bool current) { _backColor = c; @@ -69,18 +69,18 @@ StoredDrawParams::StoredDrawParams(QColor c, // field array has size 0 } -QString StoredDrawParams::text(int f) const +TQString StoredDrawParams::text(int f) const { if ((f<0) || (f >= (int)_field.size())) - return QString::null; + return TQString::null; return _field[f].text; } -QPixmap StoredDrawParams::pixmap(int f) const +TQPixmap StoredDrawParams::pixmap(int f) const { if ((f<0) || (f >= (int)_field.size())) - return QPixmap(); + return TQPixmap(); return _field[f].pix; } @@ -101,10 +101,10 @@ int StoredDrawParams::maxLines(int f) const return _field[f].maxLines; } -const QFont& StoredDrawParams::font() const +const TQFont& StoredDrawParams::font() const { - static QFont* f = 0; - if (!f) f = new QFont(QApplication::font()); + static TQFont* f = 0; + if (!f) f = new TQFont(TQApplication::font()); return *f; } @@ -124,7 +124,7 @@ void StoredDrawParams::ensureField(int f) } -void StoredDrawParams::setField(int f, const QString& t, QPixmap pm, +void StoredDrawParams::setField(int f, const TQString& t, TQPixmap pm, Position p, int maxLines) { if (f<0 || f>=MAX_FIELD) return; @@ -136,7 +136,7 @@ void StoredDrawParams::setField(int f, const QString& t, QPixmap pm, _field[f].maxLines = maxLines; } -void StoredDrawParams::setText(int f, const QString& t) +void StoredDrawParams::setText(int f, const TQString& t) { if (f<0 || f>=MAX_FIELD) return; ensureField(f); @@ -144,7 +144,7 @@ void StoredDrawParams::setText(int f, const QString& t) _field[f].text = t; } -void StoredDrawParams::setPixmap(int f, const QPixmap& pm) +void StoredDrawParams::setPixmap(int f, const TQPixmap& pm) { if (f<0 || f>=MAX_FIELD) return; ensureField(f); @@ -174,7 +174,7 @@ void StoredDrawParams::setMaxLines(int f, int m) // RectDrawing // -RectDrawing::RectDrawing(QRect r) +RectDrawing::RectDrawing(TQRect r) { _fm = 0; _dp = 0; @@ -203,7 +203,7 @@ void RectDrawing::setDrawParams(DrawParams* dp) _dp = dp; } -void RectDrawing::setRect(QRect r) +void RectDrawing::setRect(TQRect r) { _rect = r; @@ -217,7 +217,7 @@ void RectDrawing::setRect(QRect r) _fontHeight = 0; } -QRect RectDrawing::remainingRect(DrawParams* dp) +TQRect RectDrawing::remainingRect(DrawParams* dp) { if (!dp) dp = drawParams(); @@ -242,19 +242,19 @@ QRect RectDrawing::remainingRect(DrawParams* dp) } -void RectDrawing::drawBack(QPainter* p, DrawParams* dp) +void RectDrawing::drawBack(TQPainter* p, DrawParams* dp) { if (!dp) dp = drawParams(); if (_rect.width()<=0 || _rect.height()<=0) return; - QRect r = _rect; - QColor normal = dp->backColor(); + TQRect r = _rect; + TQColor normal = dp->backColor(); if (dp->selected()) normal = normal.light(); bool isCurrent = dp->current(); // 3D raised/sunken frame effect... - QColor high = normal.light(); - QColor low = normal.dark(); + TQColor high = normal.light(); + TQColor low = normal.dark(); p->setPen( isCurrent ? low:high); p->drawLine(r.left(), r.top(), r.right(), r.top()); p->drawLine(r.left(), r.top(), r.left(), r.bottom()); @@ -269,7 +269,7 @@ void RectDrawing::drawBack(QPainter* p, DrawParams* dp) bool goDark = qGray(normal.rgb())>128; int rBase, gBase, bBase; normal.rgb(&rBase, &gBase, &bBase); - p->setBrush(QBrush::NoBrush); + p->setBrush(TQBrush::NoBrush); // shade parameters: int d = 7; @@ -290,7 +290,7 @@ void RectDrawing::drawBack(QPainter* p, DrawParams* dp) int gDiff = goDark ? -gBase/d : (255-gBase)/d; int bDiff = goDark ? -bBase/d : (255-bBase)/d; - QColor shadeColor; + TQColor shadeColor; while (factor<.95) { shadeColor.setRgb((int)(rBase+factor*rDiff+.5), (int)(gBase+factor*gDiff+.5), @@ -329,22 +329,22 @@ void RectDrawing::drawBack(QPainter* p, DrawParams* dp) } // fill inside - p->setPen(QPen::NoPen); + p->setPen(TQPen::NoPen); p->setBrush(normal); p->drawRect(r); } -bool RectDrawing::drawField(QPainter* p, int f, DrawParams* dp) +bool RectDrawing::drawField(TQPainter* p, int f, DrawParams* dp) { if (!dp) dp = drawParams(); if (!_fm) { - _fm = new QFontMetrics(dp->font()); + _fm = new TQFontMetrics(dp->font()); _fontHeight = _fm->height(); } - QRect r = _rect; + TQRect r = _rect; if (0) kdDebug(90100) << "DrawField: Rect " << r.x() << "/" << r.y() << " - " << r.width() << "x" << r.height() << endl; @@ -484,9 +484,9 @@ bool RectDrawing::drawField(QPainter* p, int f, DrawParams* dp) // get text and pixmap now, only if we need to, because it is possible // that they are calculated on demand (and this can take some time) - QString name = dp->text(f); + TQString name = dp->text(f); if (name.isEmpty()) return 0; - QPixmap pix = dp->pixmap(f); + TQPixmap pix = dp->pixmap(f); // check if pixmap can be drawn int pixW = pix.width(); @@ -548,14 +548,14 @@ bool RectDrawing::drawField(QPainter* p, int f, DrawParams* dp) * If the text is to be written at the bottom, we start with the * end of the string (so everything is reverted) */ - QString remaining; + TQString remaining; int origLines = lines; while (lines>0) { if (w>width && lines>1) { int lastBreakPos = name.length(), lastWidth = w; int len = name.length(); - QChar::Category caOld, ca; + TQChar::Category caOld, ca; if (!isBottom) { // start with comparing categories of last 2 chars @@ -565,8 +565,8 @@ bool RectDrawing::drawField(QPainter* p, int f, DrawParams* dp) ca = name[len-1].category(); if (ca != caOld) { // "Aa" has no break between... - if (ca == QChar::Letter_Uppercase && - caOld == QChar::Letter_Lowercase) { + if (ca == TQChar::Letter_Uppercase && + caOld == TQChar::Letter_Lowercase) { caOld = ca; continue; } @@ -580,7 +580,7 @@ bool RectDrawing::drawField(QPainter* p, int f, DrawParams* dp) w = lastWidth; remaining = name.mid(lastBreakPos); // remove space on break point - if (name[lastBreakPos-1].category() == QChar::Separator_Space) + if (name[lastBreakPos-1].category() == TQChar::Separator_Space) name = name.left(lastBreakPos-1); else name = name.left(lastBreakPos); @@ -594,8 +594,8 @@ bool RectDrawing::drawField(QPainter* p, int f, DrawParams* dp) if (ca != caOld) { // "Aa" has no break between... - if (caOld == QChar::Letter_Uppercase && - ca == QChar::Letter_Lowercase) { + if (caOld == TQChar::Letter_Uppercase && + ca == TQChar::Letter_Lowercase) { caOld = ca; continue; } @@ -609,14 +609,14 @@ bool RectDrawing::drawField(QPainter* p, int f, DrawParams* dp) w = lastWidth; remaining = name.left(l-lastBreakPos); // remove space on break point - if (name[l-lastBreakPos].category() == QChar::Separator_Space) + if (name[l-lastBreakPos].category() == TQChar::Separator_Space) name = name.right(lastBreakPos-1); else name = name.right(lastBreakPos); } } else - remaining = QString::null; + remaining = TQString::null; /* truncate and add ... if needed */ if (w>width) { @@ -776,8 +776,8 @@ TreeMapItem::TreeMapItem(TreeMapItem* parent, double value) TreeMapItem::TreeMapItem(TreeMapItem* parent, double value, - QString text1, QString text2, - QString text3, QString text4) + TQString text1, TQString text2, + TQString text3, TQString text4) { _value = value; _parent = parent; @@ -861,13 +861,13 @@ void TreeMapItem::refresh() } -QStringList TreeMapItem::path(int textNo) const +TQStringList TreeMapItem::path(int textNo) const { - QStringList list(text(textNo)); + TQStringList list(text(textNo)); TreeMapItem* i = _parent; while (i) { - QString text = i->text(textNo); + TQString text = i->text(textNo); if (!text.isEmpty()) list.prepend(i->text(textNo)); i = i->_parent; @@ -934,7 +934,7 @@ DrawParams::Position TreeMapItem::position(int f) const } // use widget font -const QFont& TreeMapItem::font() const +const TQFont& TreeMapItem::font() const { return _widget->currentFont(); } @@ -1013,7 +1013,7 @@ TreeMapItemList* TreeMapItem::children() void TreeMapItem::clearItemRect() { - _rect = QRect(); + _rect = TQRect(); clearFreeRects(); } @@ -1022,13 +1022,13 @@ void TreeMapItem::clearFreeRects() if (_freeRects) _freeRects->clear(); } -void TreeMapItem::addFreeRect(const QRect& r) +void TreeMapItem::addFreeRect(const TQRect& r) { // don't add invalid rects if ((r.width() < 1) || (r.height() < 1)) return; if (!_freeRects) { - _freeRects = new QPtrList<QRect>; + _freeRects = new TQPtrList<TQRect>; _freeRects->setAutoDelete(true); } @@ -1036,9 +1036,9 @@ void TreeMapItem::addFreeRect(const QRect& r) << r.x() << "/" << r.y() << "-" << r.width() << "x" << r.height() << ")" << endl; - QRect* last = _freeRects->last(); + TQRect* last = _freeRects->last(); if (!last) { - _freeRects->append(new QRect(r)); + _freeRects->append(new TQRect(r)); return; } @@ -1060,7 +1060,7 @@ void TreeMapItem::addFreeRect(const QRect& r) } if (!replaced) { - _freeRects->append(new QRect(r)); + _freeRects->append(new TQRect(r)); return; } @@ -1075,13 +1075,13 @@ void TreeMapItem::addFreeRect(const QRect& r) class TreeMapTip: public QToolTip { public: - TreeMapTip( QWidget* p ):QToolTip(p) {} + TreeMapTip( TQWidget* p ):TQToolTip(p) {} protected: - void maybeTip( const QPoint & ); + void maybeTip( const TQPoint & ); }; -void TreeMapTip::maybeTip( const QPoint& pos ) +void TreeMapTip::maybeTip( const TQPoint& pos ) { if ( !parentWidget()->inherits( "TreeMapWidget" ) ) return; @@ -1089,9 +1089,9 @@ void TreeMapTip::maybeTip( const QPoint& pos ) TreeMapWidget* p = (TreeMapWidget*)parentWidget(); TreeMapItem* i; i = p->item(pos.x(), pos.y()); - QPtrList<QRect>* rList = i ? i->freeRects() : 0; + TQPtrList<TQRect>* rList = i ? i->freeRects() : 0; if (rList) { - QRect* r; + TQRect* r; for(r=rList->first();r;r=rList->next()) if (r->contains(pos)) tip(*r, p->tipString(i)); @@ -1103,8 +1103,8 @@ void TreeMapTip::maybeTip( const QPoint& pos ) // TreeMapWidget TreeMapWidget::TreeMapWidget(TreeMapItem* base, - QWidget* parent, const char* name) - : QWidget(parent, name) + TQWidget* parent, const char* name) + : TQWidget(parent, name) { _base = base; _base->setWidget(this); @@ -1140,7 +1140,7 @@ TreeMapWidget::TreeMapWidget(TreeMapItem* base, _needsRefresh = _base; setBackgroundMode(Qt::NoBackground); - setFocusPolicy(QWidget::StrongFocus); + setFocusPolicy(TQWidget::StrongFocus); _tip = new TreeMapTip(this); } @@ -1148,7 +1148,7 @@ TreeMapWidget::~TreeMapWidget() { } -const QFont& TreeMapWidget::currentFont() const +const TQFont& TreeMapWidget::currentFont() const { return _font; } @@ -1166,7 +1166,7 @@ TreeMapItem::SplitMode TreeMapWidget::splitMode() const return _splitMode; } -bool TreeMapWidget::setSplitMode(QString mode) +bool TreeMapWidget::setSplitMode(TQString mode) { if (mode == "Bisection") setSplitMode(TreeMapItem::Bisection); else if (mode == "Columns") setSplitMode(TreeMapItem::Columns); @@ -1182,9 +1182,9 @@ bool TreeMapWidget::setSplitMode(QString mode) return true; } -QString TreeMapWidget::splitModeString() const +TQString TreeMapWidget::splitModeString() const { - QString mode; + TQString mode; switch(splitMode()) { case TreeMapItem::Bisection: mode = "Bisection"; break; case TreeMapItem::Columns: mode = "Columns"; break; @@ -1250,14 +1250,14 @@ void TreeMapWidget::setMaxDrawingDepth(int d) redraw(); } -QString TreeMapWidget::defaultFieldType(int f) const +TQString TreeMapWidget::defaultFieldType(int f) const { return i18n("Text %1").arg(f+1); } -QString TreeMapWidget::defaultFieldStop(int) const +TQString TreeMapWidget::defaultFieldStop(int) const { - return QString(); + return TQString(); } bool TreeMapWidget::defaultFieldVisible(int f) const @@ -1302,7 +1302,7 @@ bool TreeMapWidget::resizeAttr(int size) return true; } -void TreeMapWidget::setFieldType(int f, QString type) +void TreeMapWidget::setFieldType(int f, TQString type) { if (((int)_attr.size() < f+1) && (type == defaultFieldType(f))) return; @@ -1311,13 +1311,13 @@ void TreeMapWidget::setFieldType(int f, QString type) // no need to redraw: the type string is not visible in the TreeMap } -QString TreeMapWidget::fieldType(int f) const +TQString TreeMapWidget::fieldType(int f) const { if (f<0 || (int)_attr.size()<f+1) return defaultFieldType(f); return _attr[f].type; } -void TreeMapWidget::setFieldStop(int f, QString stop) +void TreeMapWidget::setFieldStop(int f, TQString stop) { if (((int)_attr.size() < f+1) && (stop == defaultFieldStop(f))) return; @@ -1327,7 +1327,7 @@ void TreeMapWidget::setFieldStop(int f, QString stop) } } -QString TreeMapWidget::fieldStop(int f) const +TQString TreeMapWidget::fieldStop(int f) const { if (f<0 || (int)_attr.size()<f+1) return defaultFieldStop(f); return _attr[f].stop; @@ -1390,7 +1390,7 @@ DrawParams::Position TreeMapWidget::fieldPosition(int f) const return _attr[f].pos; } -void TreeMapWidget::setFieldPosition(int f, QString pos) +void TreeMapWidget::setFieldPosition(int f, TQString pos) { if (pos == "TopLeft") setFieldPosition(f, DrawParams::TopLeft); @@ -1408,17 +1408,17 @@ void TreeMapWidget::setFieldPosition(int f, QString pos) setFieldPosition(f, DrawParams::Default); } -QString TreeMapWidget::fieldPositionString(int f) const +TQString TreeMapWidget::fieldPositionString(int f) const { TreeMapItem::Position pos = fieldPosition(f); - if (pos == DrawParams::TopLeft) return QString("TopLeft"); - if (pos == DrawParams::TopCenter) return QString("TopCenter"); - if (pos == DrawParams::TopRight) return QString("TopRight"); - if (pos == DrawParams::BottomLeft) return QString("BottomLeft"); - if (pos == DrawParams::BottomCenter) return QString("BottomCenter"); - if (pos == DrawParams::BottomRight) return QString("BottomRight"); - if (pos == DrawParams::Default) return QString("Default"); - return QString("unknown"); + if (pos == DrawParams::TopLeft) return TQString("TopLeft"); + if (pos == DrawParams::TopCenter) return TQString("TopCenter"); + if (pos == DrawParams::TopRight) return TQString("TopRight"); + if (pos == DrawParams::BottomLeft) return TQString("BottomLeft"); + if (pos == DrawParams::BottomCenter) return TQString("BottomCenter"); + if (pos == DrawParams::BottomRight) return TQString("BottomRight"); + if (pos == DrawParams::Default) return TQString("Default"); + return TQString("unknown"); } void TreeMapWidget::setMinimalArea(int area) @@ -1453,9 +1453,9 @@ void TreeMapWidget::deletingItem(TreeMapItem* i) } -QString TreeMapWidget::tipString(TreeMapItem* i) const +TQString TreeMapWidget::tipString(TreeMapItem* i) const { - QString tip, itemTip; + TQString tip, itemTip; while (i) { if (!i->text(0).isEmpty()) { @@ -1572,7 +1572,7 @@ void TreeMapWidget::setSelected(TreeMapItem* item, bool selected) redraw(changed); if (0) kdDebug(90100) << (selected ? "S":"Des") << "elected Item " - << (item ? item->path(0).join("") : QString("(null)")) + << (item ? item->path(0).join("") : TQString("(null)")) << " (depth " << (item ? item->depth() : -1) << ")" << endl; } @@ -1764,16 +1764,16 @@ TreeMapItem* TreeMapWidget::setTmpRangeSelection(TreeMapItem* i1, return changed; } -void TreeMapWidget::contextMenuEvent( QContextMenuEvent* e ) +void TreeMapWidget::contextMenuEvent( TQContextMenuEvent* e ) { //kdDebug(90100) << "TreeMapWidget::contextMenuEvent" << endl; - if ( receivers( SIGNAL(contextMenuRequested(TreeMapItem*, const QPoint &)) ) ) + if ( receivers( TQT_SIGNAL(contextMenuRequested(TreeMapItem*, const TQPoint &)) ) ) e->accept(); - if ( e->reason() == QContextMenuEvent::Keyboard ) { - QRect r = (_current) ? _current->itemRect() : _base->itemRect(); - QPoint p = QPoint(r.left() + r.width()/2, r.top() + r.height()/2); + if ( e->reason() == TQContextMenuEvent::Keyboard ) { + TQRect r = (_current) ? _current->itemRect() : _base->itemRect(); + TQPoint p = TQPoint(r.left() + r.width()/2, r.top() + r.height()/2); emit contextMenuRequested(_current, p); } else { @@ -1783,7 +1783,7 @@ void TreeMapWidget::contextMenuEvent( QContextMenuEvent* e ) } -void TreeMapWidget::mousePressEvent( QMouseEvent* e ) +void TreeMapWidget::mousePressEvent( TQMouseEvent* e ) { //kdDebug(90100) << "TreeMapWidget::mousePressEvent" << endl; @@ -1851,7 +1851,7 @@ void TreeMapWidget::mousePressEvent( QMouseEvent* e ) } } -void TreeMapWidget::mouseMoveEvent( QMouseEvent* e ) +void TreeMapWidget::mouseMoveEvent( TQMouseEvent* e ) { //kdDebug(90100) << "TreeMapWidget::mouseMoveEvent" << endl; @@ -1894,7 +1894,7 @@ void TreeMapWidget::mouseMoveEvent( QMouseEvent* e ) redraw(changed); } -void TreeMapWidget::mouseReleaseEvent( QMouseEvent* ) +void TreeMapWidget::mouseReleaseEvent( TQMouseEvent* ) { //kdDebug(90100) << "TreeMapWidget::mouseReleaseEvent" << endl; @@ -1924,7 +1924,7 @@ void TreeMapWidget::mouseReleaseEvent( QMouseEvent* ) } -void TreeMapWidget::mouseDoubleClickEvent( QMouseEvent* e ) +void TreeMapWidget::mouseDoubleClickEvent( TQMouseEvent* e ) { TreeMapItem* over = item(e->x(), e->y()); @@ -1943,7 +1943,7 @@ int nextVisible(TreeMapItem* i) while (idx < (int)p->children()->count()-1) { idx++; - QRect r = p->children()->at(idx)->itemRect(); + TQRect r = p->children()->at(idx)->itemRect(); if (r.width()>1 && r.height()>1) return idx; } @@ -1961,7 +1961,7 @@ int prevVisible(TreeMapItem* i) while (idx > 0) { idx--; - QRect r = p->children()->at(idx)->itemRect(); + TQRect r = p->children()->at(idx)->itemRect(); if (r.width()>1 && r.height()>1) return idx; } @@ -1971,7 +1971,7 @@ int prevVisible(TreeMapItem* i) -void TreeMapWidget::keyPressEvent( QKeyEvent* e ) +void TreeMapWidget::keyPressEvent( TQKeyEvent* e ) { if (e->key() == Key_Escape && _pressed) { @@ -2085,24 +2085,24 @@ void TreeMapWidget::keyPressEvent( QKeyEvent* e ) } } -void TreeMapWidget::fontChange( const QFont& ) +void TreeMapWidget::fontChange( const TQFont& ) { redraw(); } -void TreeMapWidget::resizeEvent( QResizeEvent * ) +void TreeMapWidget::resizeEvent( TQResizeEvent * ) { // this automatically redraws (as size is changed) drawTreeMap(); } -void TreeMapWidget::paintEvent( QPaintEvent * ) +void TreeMapWidget::paintEvent( TQPaintEvent * ) { drawTreeMap(); } -void TreeMapWidget::showEvent( QShowEvent * ) +void TreeMapWidget::showEvent( TQShowEvent * ) { // refresh only if needed drawTreeMap(); @@ -2125,14 +2125,14 @@ void TreeMapWidget::drawTreeMap() if (_needsRefresh == _base) { // redraw whole widget - _pixmap = QPixmap(size()); + _pixmap = TQPixmap(size()); _pixmap.fill(backgroundColor()); } - QPainter p(&_pixmap); + TQPainter p(&_pixmap); if (_needsRefresh == _base) { p.setPen(black); - p.drawRect(QRect(2, 2, QWidget::width()-4, QWidget::height()-4)); - _base->setItemRect(QRect(3, 3, QWidget::width()-6, QWidget::height()-6)); + p.drawRect(TQRect(2, 2, TQWidget::width()-4, TQWidget::height()-4)); + _base->setItemRect(TQRect(3, 3, TQWidget::width()-6, TQWidget::height()-6)); } else { // only subitem @@ -2148,12 +2148,12 @@ void TreeMapWidget::drawTreeMap() } bitBlt( this, 0, 0, &_pixmap, 0, 0, - QWidget::width(), QWidget::height(), CopyROP, true); + TQWidget::width(), TQWidget::height(), CopyROP, true); if (hasFocus()) { - QPainter p(this); - style().drawPrimitive( QStyle::PE_FocusRect, &p, - QRect(0, 0, QWidget::width(), QWidget::height()), + TQPainter p(this); + style().drawPrimitive( TQStyle::PE_FocusRect, &p, + TQRect(0, 0, TQWidget::width(), TQWidget::height()), colorGroup() ); } } @@ -2177,7 +2177,7 @@ void TreeMapWidget::redraw(TreeMapItem* i) } } -void TreeMapWidget::drawItem(QPainter* p, +void TreeMapWidget::drawItem(TQPainter* p, TreeMapItem* item) { bool isSelected = false; @@ -2206,7 +2206,7 @@ void TreeMapWidget::drawItem(QPainter* p, } -bool TreeMapWidget::horizontal(TreeMapItem* i, const QRect& r) +bool TreeMapWidget::horizontal(TreeMapItem* i, const TQRect& r) { switch(i->splitMode()) { case TreeMapItem::HAlternate: @@ -2227,7 +2227,7 @@ bool TreeMapWidget::horizontal(TreeMapItem* i, const QRect& r) /** * Draw TreeMapItems recursive, starting from item */ -void TreeMapWidget::drawItems(QPainter* p, +void TreeMapWidget::drawItems(TQPainter* p, TreeMapItem* item) { if (DEBUG_DRAWING) @@ -2240,9 +2240,9 @@ void TreeMapWidget::drawItems(QPainter* p, drawItem(p, item); item->clearFreeRects(); - QRect origRect = item->itemRect(); + TQRect origRect = item->itemRect(); int bw = item->borderWidth(); - QRect r = QRect(origRect.x()+bw, origRect.y()+bw, + TQRect r = TQRect(origRect.x()+bw, origRect.y()+bw, origRect.width()-2*bw, origRect.height()-2*bw); TreeMapItemList* list = item->children(); @@ -2266,7 +2266,7 @@ void TreeMapWidget::drawItems(QPainter* p, // stop drawing if stopAtText is reached if (!stopDrawing) for (int no=0;no<(int)_attr.size();no++) { - QString stopAt = fieldStop(no); + TQString stopAt = fieldStop(no); if (!stopAt.isEmpty() && (item->text(no) == stopAt)) { stopDrawing = true; break; @@ -2320,7 +2320,7 @@ void TreeMapWidget::drawItems(QPainter* p, << i->value() << endl; } - QRect orig = r; + TQRect orig = r; // if we have space for text... if ((r.height() >= _fontHeight) && (r.width() >= _fontHeight)) { @@ -2337,12 +2337,12 @@ void TreeMapWidget::drawItems(QPainter* p, if (orig.x() == r.x()) { // Strings on top - item->addFreeRect(QRect(orig.x(), orig.y(), + item->addFreeRect(TQRect(orig.x(), orig.y(), orig.width(), orig.height()-r.height())); } else { // Strings on the left - item->addFreeRect(QRect(orig.x(), orig.y(), + item->addFreeRect(TQRect(orig.x(), orig.y(), orig.width()-r.width(), orig.height())); } @@ -2389,7 +2389,7 @@ void TreeMapWidget::drawItems(QPainter* p, self / user_sum + .5); if (self_length > 0) { // take space for self cost - QRect sr = r; + TQRect sr = r; if (rotate) { sr.setWidth( self_length ); r.setRect(r.x()+sr.width(), r.y(), r.width()-sr.width(), r.height()); @@ -2450,7 +2450,7 @@ void TreeMapWidget::drawItems(QPainter* p, // we always split horizontally int nextPos = (int)((double)r.width() * valSum / user_sum); - QRect firstRect = QRect(r.x(), r.y(), nextPos, r.height()); + TQRect firstRect = TQRect(r.x(), r.y(), nextPos, r.height()); if (nextPos < _visibleWidth) { if (item->sorting(0) == -1) { @@ -2501,7 +2501,7 @@ void TreeMapWidget::drawItems(QPainter* p, // we always split horizontally int nextPos = (int)((double)r.height() * valSum / user_sum); - QRect firstRect = QRect(r.x(), r.y(), r.width(), nextPos); + TQRect firstRect = TQRect(r.x(), r.y(), r.width(), nextPos); if (nextPos < _visibleWidth) { if (item->sorting(0) == -1) { @@ -2538,7 +2538,7 @@ void TreeMapWidget::drawItems(QPainter* p, } // fills area with a pattern if to small to draw children -void TreeMapWidget::drawFill(TreeMapItem* i, QPainter* p, QRect& r) +void TreeMapWidget::drawFill(TreeMapItem* i, TQPainter* p, TQRect& r) { p->setBrush(Qt::Dense4Pattern); p->setPen(Qt::NoPen); @@ -2547,7 +2547,7 @@ void TreeMapWidget::drawFill(TreeMapItem* i, QPainter* p, QRect& r) } // fills area with a pattern if to small to draw children -void TreeMapWidget::drawFill(TreeMapItem* i, QPainter* p, QRect& r, +void TreeMapWidget::drawFill(TreeMapItem* i, TQPainter* p, TQRect& r, TreeMapItemListIterator it, int len, bool goBack) { if (DEBUG_DRAWING) @@ -2577,8 +2577,8 @@ void TreeMapWidget::drawFill(TreeMapItem* i, QPainter* p, QRect& r, } // returns false if rect gets to small -bool TreeMapWidget::drawItemArray(QPainter* p, TreeMapItem* item, - QRect& r, double user_sum, +bool TreeMapWidget::drawItemArray(TQPainter* p, TreeMapItem* item, + TQRect& r, double user_sum, TreeMapItemListIterator it, int len, bool goBack) { @@ -2618,14 +2618,14 @@ bool TreeMapWidget::drawItemArray(QPainter* p, TreeMapItem* item, if (r.width() > r.height()) { int halfPos = (int)((double)r.width() * valSum / user_sum); - QRect firstRect = QRect(r.x(), r.y(), halfPos, r.height()); + TQRect firstRect = TQRect(r.x(), r.y(), halfPos, r.height()); drawOn = drawItemArray(p, item, firstRect, valSum, first, len-lenLeft, goBack); r.setRect(r.x()+halfPos, r.y(), r.width()-halfPos, r.height()); } else { int halfPos = (int)((double)r.height() * valSum / user_sum); - QRect firstRect = QRect(r.x(), r.y(), r.width(), halfPos); + TQRect firstRect = TQRect(r.x(), r.y(), r.width(), halfPos); drawOn = drawItemArray(p, item, firstRect, valSum, first, len-lenLeft, goBack); r.setRect(r.x(), r.y()+halfPos, r.width(), r.height()-halfPos); @@ -2694,7 +2694,7 @@ bool TreeMapWidget::drawItemArray(QPainter* p, TreeMapItem* item, return false; } - QRect currRect = r; + TQRect currRect = r; if (hor) currRect.setWidth(nextPos); @@ -2769,13 +2769,13 @@ void TreeMapWidget::splitActivated(int id) } -void TreeMapWidget::addSplitDirectionItems(QPopupMenu* popup, int id) +void TreeMapWidget::addSplitDirectionItems(TQPopupMenu* popup, int id) { _splitID = id; popup->setCheckable(true); - connect(popup, SIGNAL(activated(int)), - this, SLOT(splitActivated(int))); + connect(popup, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(splitActivated(int))); popup->insertItem(i18n("Recursive Bisection"), id); popup->insertItem(i18n("Columns"), id+1); @@ -2824,21 +2824,21 @@ void TreeMapWidget::visualizationActivated(int id) else if ((id%10) == 8) setFieldPosition(f, DrawParams::BottomRight); } -void TreeMapWidget::addVisualizationItems(QPopupMenu* popup, int id) +void TreeMapWidget::addVisualizationItems(TQPopupMenu* popup, int id) { _visID = id; popup->setCheckable(true); - QPopupMenu* bpopup = new QPopupMenu(); + TQPopupMenu* bpopup = new TQPopupMenu(); bpopup->setCheckable(true); - connect(popup, SIGNAL(activated(int)), - this, SLOT(visualizationActivated(int))); - connect(bpopup, SIGNAL(activated(int)), - this, SLOT(visualizationActivated(int))); + connect(popup, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(visualizationActivated(int))); + connect(bpopup, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(visualizationActivated(int))); - QPopupMenu* spopup = new QPopupMenu(); + TQPopupMenu* spopup = new TQPopupMenu(); addSplitDirectionItems(spopup, id+100); popup->insertItem(i18n("Nesting"), spopup, id); @@ -2864,10 +2864,10 @@ void TreeMapWidget::addVisualizationItems(QPopupMenu* popup, int id) popup->insertSeparator(); int f; - QPopupMenu* tpopup; + TQPopupMenu* tpopup; id += 20; for (f=0;f<(int)_attr.size();f++, id+=10) { - tpopup = new QPopupMenu(); + tpopup = new TQPopupMenu(); tpopup->setCheckable(true); popup->insertItem(_attr[f].type, tpopup, id); tpopup->insertItem(i18n("Visible"), id+1); @@ -2896,8 +2896,8 @@ void TreeMapWidget::addVisualizationItems(QPopupMenu* popup, int id) tpopup->setItemChecked(id+7,_attr[f].pos == DrawParams::BottomCenter); tpopup->setItemChecked(id+8,_attr[f].pos == DrawParams::BottomRight); - connect(tpopup, SIGNAL(activated(int)), - this, SLOT(visualizationActivated(int))); + connect(tpopup, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(visualizationActivated(int))); } } @@ -2913,7 +2913,7 @@ void TreeMapWidget::selectionActivated(int id) setSelected(i, true); } -void TreeMapWidget::addSelectionItems(QPopupMenu* popup, +void TreeMapWidget::addSelectionItems(TQPopupMenu* popup, int id, TreeMapItem* i) { if (!i) return; @@ -2921,11 +2921,11 @@ void TreeMapWidget::addSelectionItems(QPopupMenu* popup, _selectionID = id; _menuItem = i; - connect(popup, SIGNAL(activated(int)), - this, SLOT(selectionActivated(int))); + connect(popup, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(selectionActivated(int))); while (i) { - QString name = i->text(0); + TQString name = i->text(0); if (name.isEmpty()) break; popup->insertItem(i->text(0), id++); i = i->parent(); @@ -2934,7 +2934,7 @@ void TreeMapWidget::addSelectionItems(QPopupMenu* popup, void TreeMapWidget::fieldStopActivated(int id) { - if (id == _fieldStopID) setFieldStop(0, QString::null); + if (id == _fieldStopID) setFieldStop(0, TQString::null); else { TreeMapItem* i = _menuItem; id -= _fieldStopID+1; @@ -2947,13 +2947,13 @@ void TreeMapWidget::fieldStopActivated(int id) } } -void TreeMapWidget::addFieldStopItems(QPopupMenu* popup, +void TreeMapWidget::addFieldStopItems(TQPopupMenu* popup, int id, TreeMapItem* i) { _fieldStopID = id; - connect(popup, SIGNAL(activated(int)), - this, SLOT(fieldStopActivated(int))); + connect(popup, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(fieldStopActivated(int))); popup->insertItem(i18n("No %1 Limit").arg(fieldType(0)), id); popup->setItemChecked(id, fieldStop(0).isEmpty()); @@ -2964,7 +2964,7 @@ void TreeMapWidget::addFieldStopItems(QPopupMenu* popup, while (i) { id++; - QString name = i->text(0); + TQString name = i->text(0); if (name.isEmpty()) break; popup->insertItem(i->text(0), id); if (fieldStop(0) == i->text(0)) { @@ -2996,14 +2996,14 @@ void TreeMapWidget::areaStopActivated(int id) else if (id == _areaStopID+6) setMinimalArea(minimalArea()/2); } -void TreeMapWidget::addAreaStopItems(QPopupMenu* popup, +void TreeMapWidget::addAreaStopItems(TQPopupMenu* popup, int id, TreeMapItem* i) { _areaStopID = id; _menuItem = i; - connect(popup, SIGNAL(activated(int)), - this, SLOT(areaStopActivated(int))); + connect(popup, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(areaStopActivated(int))); bool foundArea = false; @@ -3061,14 +3061,14 @@ void TreeMapWidget::depthStopActivated(int id) else if (id == _depthStopID+6) setMaxDrawingDepth(6); } -void TreeMapWidget::addDepthStopItems(QPopupMenu* popup, +void TreeMapWidget::addDepthStopItems(TQPopupMenu* popup, int id, TreeMapItem* i) { _depthStopID = id; _menuItem = i; - connect(popup, SIGNAL(activated(int)), - this, SLOT(depthStopActivated(int))); + connect(popup, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(depthStopActivated(int))); bool foundDepth = false; @@ -3117,7 +3117,7 @@ void TreeMapWidget::addDepthStopItems(QPopupMenu* popup, * Option saving/restoring */ -void TreeMapWidget::saveOptions(KConfigGroup* config, QString prefix) +void TreeMapWidget::saveOptions(KConfigGroup* config, TQString prefix) { config->writeEntry(prefix+"Nesting", splitModeString()); config->writeEntry(prefix+"AllowRotation", allowRotation()); @@ -3130,23 +3130,23 @@ void TreeMapWidget::saveOptions(KConfigGroup* config, QString prefix) int f, fCount = _attr.size(); config->writeEntry(prefix+"FieldCount", fCount); for (f=0;f<fCount;f++) { - config->writeEntry(QString(prefix+"FieldVisible%1").arg(f), + config->writeEntry(TQString(prefix+"FieldVisible%1").arg(f), _attr[f].visible); - config->writeEntry(QString(prefix+"FieldForced%1").arg(f), + config->writeEntry(TQString(prefix+"FieldForced%1").arg(f), _attr[f].forced); - config->writeEntry(QString(prefix+"FieldStop%1").arg(f), + config->writeEntry(TQString(prefix+"FieldStop%1").arg(f), _attr[f].stop); - config->writeEntry(QString(prefix+"FieldPosition%1").arg(f), + config->writeEntry(TQString(prefix+"FieldPosition%1").arg(f), fieldPositionString(f)); } } -void TreeMapWidget::restoreOptions(KConfigGroup* config, QString prefix) +void TreeMapWidget::restoreOptions(KConfigGroup* config, TQString prefix) { bool enabled; int num; - QString str; + TQString str; str = config->readEntry(prefix+"Nesting"); if (!str.isEmpty()) setSplitMode(str); @@ -3180,18 +3180,18 @@ void TreeMapWidget::restoreOptions(KConfigGroup* config, QString prefix) int f; for (f=0;f<num;f++) { - str = QString(prefix+"FieldVisible%1").arg(f); + str = TQString(prefix+"FieldVisible%1").arg(f); if (config->hasKey(str)) setFieldVisible(f, config->readBoolEntry(str)); - str = QString(prefix+"FieldForced%1").arg(f); + str = TQString(prefix+"FieldForced%1").arg(f); if (config->hasKey(str)) setFieldForced(f, config->readBoolEntry(str)); - str = config->readEntry(QString(prefix+"FieldStop%1").arg(f)); + str = config->readEntry(TQString(prefix+"FieldStop%1").arg(f)); setFieldStop(f, str); - str = config->readEntry(QString(prefix+"FieldPosition%1").arg(f)); + str = config->readEntry(TQString(prefix+"FieldPosition%1").arg(f)); if (!str.isEmpty()) setFieldPosition(f, str); } } |