diff options
Diffstat (limited to 'parts/classview/digraphview.cpp')
-rw-r--r-- | parts/classview/digraphview.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/parts/classview/digraphview.cpp b/parts/classview/digraphview.cpp index b566757f..8bb8e963 100644 --- a/parts/classview/digraphview.cpp +++ b/parts/classview/digraphview.cpp @@ -13,10 +13,10 @@ #include <math.h> #include <stdlib.h> -#include <qapplication.h> -#include <qpainter.h> -#include <qpaintdevicemetrics.h> -#include <qtextstream.h> +#include <tqapplication.h> +#include <tqpainter.h> +#include <tqpaintdevicemetrics.h> +#include <tqtextstream.h> #include <kglobal.h> #include <klocale.h> #include <kmessagebox.h> @@ -33,22 +33,22 @@ struct DigraphNode int y; int w; int h; - QString name; + TQString name; }; struct DigraphEdge { - QPointArray points; + TQPointArray points; }; -DigraphView::DigraphView(QWidget *parent, const char *name) - : QScrollView(parent, name, WRepaintNoErase|WStaticContents|WResizeNoErase) +DigraphView::DigraphView(TQWidget *parent, const char *name) + : TQScrollView(parent, name, WRepaintNoErase|WStaticContents|WResizeNoErase) { viewport()->setBackgroundMode(PaletteBase); - QPaintDeviceMetrics m(this); + TQPaintDeviceMetrics m(this); xscale = m.logicalDpiX(); yscale = m.logicalDpiY(); @@ -86,7 +86,7 @@ void DigraphView::setRenderedExtent(double w, double h) } -void DigraphView::addRenderedNode(const QString &name, +void DigraphView::addRenderedNode(const TQString &name, double x, double y, double w, double h) { DigraphNode *node = new DigraphNode; @@ -99,8 +99,8 @@ void DigraphView::addRenderedNode(const QString &name, } -void DigraphView::addRenderedEdge(const QString &/*name1*/, const QString &/*name2*/, - QMemArray<double> coords) +void DigraphView::addRenderedEdge(const TQString &/*name1*/, const TQString &/*name2*/, + TQMemArray<double> coords) { if (coords.count() < 4) return; @@ -109,15 +109,15 @@ void DigraphView::addRenderedEdge(const QString &/*name1*/, const QString &/*nam edge->points.resize(coords.count()/2); for (uint i = 0; i < edge->points.count(); ++i) - edge->points[i] = QPoint(toXPixel(coords[2*i]), toYPixel(coords[2*i+1])); + edge->points[i] = TQPoint(toXPixel(coords[2*i]), toYPixel(coords[2*i+1])); edges.append(edge); } -void DigraphView::addEdge(const QString &name1, const QString &name2) +void DigraphView::addEdge(const TQString &name1, const TQString &name2) { - QString line; + TQString line; line = "\""; line += name1; line += "\" -> \""; @@ -139,9 +139,9 @@ void DigraphView::clear() } -void DigraphView::setSelected(const QString &name) +void DigraphView::setSelected(const TQString &name) { - QPtrListIterator<DigraphNode> it(nodes); + TQPtrListIterator<DigraphNode> it(nodes); for (; it.current(); ++it) { if (it.current()->name == name) { updateContents(selNode->x-selNode->w/2, selNode->y-selNode->h/2, @@ -155,21 +155,21 @@ void DigraphView::setSelected(const QString &name) } -void DigraphView::ensureVisible(const QString &name) +void DigraphView::ensureVisible(const TQString &name) { - QPtrListIterator<DigraphNode> it(nodes); + TQPtrListIterator<DigraphNode> it(nodes); for (; it.current(); ++it) { if (it.current()->name == name) { - QScrollView::ensureVisible((*it)->x, (*it)->y, (*it)->w, (*it)->h); + TQScrollView::ensureVisible((*it)->x, (*it)->y, (*it)->w, (*it)->h); return; } } } -QStringList DigraphView::splitLine(QString str) +TQStringList DigraphView::splitLine(TQString str) { - QStringList result; + TQStringList result; while (!str.isEmpty()) { if (str[0] == '"') { @@ -193,11 +193,11 @@ QStringList DigraphView::splitLine(QString str) } -void DigraphView::parseDotResults(const QStringList &list) +void DigraphView::parseDotResults(const TQStringList &list) { - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for (it = list.begin(); it != list.end(); ++it) { - QStringList tokens = splitLine(*it); + TQStringList tokens = splitLine(*it); if (tokens.count() == 0) continue; if (tokens[0] == "graph") { @@ -212,7 +212,7 @@ void DigraphView::parseDotResults(const QStringList &list) } else if (tokens[0] == "edge") { if (tokens.count() < 8) continue; - QMemArray<double> coords(tokens.count()-6); + TQMemArray<double> coords(tokens.count()-6); for (uint i=0; i != tokens.count()-6; ++i) coords[i] = tokens[i+4].toDouble(); addRenderedEdge(tokens[1], tokens[2], coords); @@ -221,22 +221,22 @@ void DigraphView::parseDotResults(const QStringList &list) } -void DigraphView::process( const QString& file, const QString& ext ) +void DigraphView::process( const TQString& file, const TQString& ext ) { - QString cmd = KGlobal::dirs()->findExe("dot"); + TQString cmd = KGlobal::dirs()->findExe("dot"); if (cmd.isEmpty()) { KMessageBox::sorry(0, i18n("You do not have 'dot' installed.\nIt can be downloaded from www.graphviz.org.")); return; } - QStringList results; + TQStringList results; KTempFile ifile, ofile; - QTextStream &is = *ifile.textStream(); + TQTextStream &is = *ifile.textStream(); is << "digraph G {" << endl; is << "rankdir=LR;" << endl; is << "node [shape=box,fontname=Helvetica,fontsize=12];" << endl; - QStringList::Iterator it; + TQStringList::Iterator it; for (it = inputs.begin(); it != inputs.end(); ++it) is << (*it) << endl; is << "}" << endl; @@ -245,8 +245,8 @@ void DigraphView::process( const QString& file, const QString& ext ) KProcess proc; if( !file.isEmpty() && !ext.isEmpty() ) { - proc << cmd << QString("-T")+ext << ifile.name() << "-o" << file; - kdDebug() << "Executing: " << cmd <<" "<<QString("-T")+ext <<" "<< ifile.name() << "-o"<<file << endl; + proc << cmd << TQString("-T")+ext << ifile.name() << "-o" << file; + kdDebug() << "Executing: " << cmd <<" "<<TQString("-T")+ext <<" "<< ifile.name() << "-o"<<file << endl; }else { proc << cmd << "-Tplain" << ifile.name() << "-o" << ofile.name(); @@ -258,7 +258,7 @@ void DigraphView::process( const QString& file, const QString& ext ) return; } - QTextStream &os = *ofile.textStream(); + TQTextStream &os = *ofile.textStream(); while (!os.atEnd()) results << os.readLine(); ofile.close(); @@ -271,61 +271,61 @@ void DigraphView::process( const QString& file, const QString& ext ) viewport()->update(); } -void DigraphView::drawContents(QPainter* p, int clipx, int clipy, int clipw, int cliph) +void DigraphView::drawContents(TQPainter* p, int clipx, int clipy, int clipw, int cliph) { - QRect clipRect(clipx, clipy, clipw, cliph); + TQRect clipRect(clipx, clipy, clipw, cliph); p->eraseRect(clipRect); p->setFont(KGlobalSettings::generalFont()); - QPtrListIterator<DigraphNode> it1(nodes); + TQPtrListIterator<DigraphNode> it1(nodes); for (; it1.current(); ++it1) { - QRect r((*it1)->x-(*it1)->w/2, (*it1)->y-(*it1)->h/2, (*it1)->w, (*it1)->h); + TQRect r((*it1)->x-(*it1)->w/2, (*it1)->y-(*it1)->h/2, (*it1)->w, (*it1)->h); if (r.intersects(clipRect)) { if (it1.current() == selNode) - p->fillRect(r, QBrush(lightGray, SolidPattern)); + p->fillRect(r, TQBrush(lightGray, SolidPattern)); else p->drawRect(r); p->drawText(r, AlignCenter, (*it1)->name); } } - p->setBrush(QBrush(black, SolidPattern)); - QPtrListIterator<DigraphEdge> it2(edges); + p->setBrush(TQBrush(black, SolidPattern)); + TQPtrListIterator<DigraphEdge> it2(edges); for (; it2.current(); ++it2) { int n = (*it2)->points.count(); for (int i=0; i+3 < n; i+=3) { - QPointArray a(4); - QPointArray &b = (*it2)->points; + TQPointArray a(4); + TQPointArray &b = (*it2)->points; for (int j=0; j<4; ++j) a.setPoint(j, b.point(i+j)); if (a.boundingRect().intersects(clipRect)) p->drawCubicBezier((*it2)->points, i); } - QPoint p1 = (*it2)->points[n-2]; - QPoint p2 = (*it2)->points[n-1]; - QPoint d = p1-p2; + TQPoint p1 = (*it2)->points[n-2]; + TQPoint p2 = (*it2)->points[n-1]; + TQPoint d = p1-p2; double l = sqrt(d.x()*d.x()+d.y()*d.y()); double d11 = (10.0)/l*d.x(); double d12 = (10.0)/l*d.y(); double d21 = -(3.0/l)*d.y(); double d22 = (3.0/l)*d.x(); - QPointArray triangle(3); - triangle[0] = p2 + QPoint((int)(d11+d21),(int)(d12+d22)); - triangle[1] = p2 + QPoint((int)(d11-d21),(int)(d12-d22)); + TQPointArray triangle(3); + triangle[0] = p2 + TQPoint((int)(d11+d21),(int)(d12+d22)); + triangle[1] = p2 + TQPoint((int)(d11-d21),(int)(d12-d22)); triangle[2] = p2; p->drawPolygon(triangle, true); } } -void DigraphView::contentsMousePressEvent(QMouseEvent *e) +void DigraphView::contentsMousePressEvent(TQMouseEvent *e) { - QPtrListIterator<DigraphNode> it1(nodes); + TQPtrListIterator<DigraphNode> it1(nodes); for (; it1.current(); ++it1) { - QRect r((*it1)->x-(*it1)->w/2, (*it1)->y-(*it1)->h/2, (*it1)->w, (*it1)->h); + TQRect r((*it1)->x-(*it1)->w/2, (*it1)->y-(*it1)->h/2, (*it1)->w, (*it1)->h); if (r.contains(e->pos())) { if (selNode) { - QRect oldr(selNode->x-selNode->w/2, selNode->y-selNode->h/2, + TQRect oldr(selNode->x-selNode->w/2, selNode->y-selNode->h/2, selNode->w, selNode->h); updateContents(oldr); } @@ -338,21 +338,21 @@ void DigraphView::contentsMousePressEvent(QMouseEvent *e) } -QSize DigraphView::sizeHint() const +TQSize DigraphView::sizeHint() const { if (width == -1) - return QSize(100, 100); // arbitrary + return TQSize(100, 100); // arbitrary - QSize dsize = KGlobalSettings::desktopGeometry(viewport()).size(); + TQSize dsize = KGlobalSettings::desktopGeometry(viewport()).size(); kdDebug(9003) << "sizehint for inheritance diagram" << dsize << " " << width << " " << height << endl; - return QSize(width, height).boundedTo(QSize(dsize.width()*2/3, dsize.height()*2/3)); + return TQSize(width, height).boundedTo(TQSize(dsize.width()*2/3, dsize.height()*2/3)); } #if 0 int main(int argc, char **argv) { - QApplication app(argc, argv); + TQApplication app(argc, argv); DigraphView *dw = new DigraphView(0, "dot widget"); dw->addEdge( "5th Edition", "6th Edition"); |