diff options
Diffstat (limited to 'src/graphwidget.cpp')
-rw-r--r-- | src/graphwidget.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/src/graphwidget.cpp b/src/graphwidget.cpp index 00ca733..2481f59 100644 --- a/src/graphwidget.cpp +++ b/src/graphwidget.cpp @@ -27,9 +27,9 @@ #include <math.h> #include <stdlib.h> -#include <qfile.h> -#include <qpainter.h> -#include <qtooltip.h> +#include <ntqfile.h> +#include <ntqpainter.h> +#include <ntqtooltip.h> #include <klocale.h> #include <kmessagebox.h> #include "graphwidget.h" @@ -51,14 +51,14 @@ const char TMP_TMPL[] = "/tmp/kscope_dot.XXXXXX"; * items are neither rectangular nor is their position known in advance. * @author Elad Lahav */ -class GraphTip : public QToolTip +class GraphTip : public TQToolTip { public: /** * Class constructor. * @param pWidget Owner graph widget */ - GraphTip(GraphWidget* pWidget) : QToolTip(pWidget->viewport()), + GraphTip(GraphWidget* pWidget) : TQToolTip(pWidget->viewport()), m_pGraphWidget(pWidget) {} /** @@ -73,13 +73,13 @@ protected: * the tool tip. * @param ptPos Current mouse position */ - virtual void maybeTip(const QPoint& ptPos) { - QString sText; - QRect rc; + virtual void maybeTip(const TQPoint& ptPos) { + TQString sText; + TQRect rc; // Display a tip, if required by the owner sText = m_pGraphWidget->getTip(ptPos, rc); - if (sText != QString::null) + if (sText != TQString::null) tip(rc, sText); } @@ -90,10 +90,10 @@ private: /** * Provides a menu separator with text. - * The separator is added with QMenuData::insertItem(QWidget*). + * The separator is added with TQMenuData::insertItem(TQWidget*). * @author Elad Lahav */ -class MenuLabel : public QLabel +class MenuLabel : public TQLabel { public: /** @@ -101,8 +101,8 @@ public: * @param sText The text to display * @param pParent The parent widget */ - MenuLabel(const QString& sText, QWidget* pParent) : - QLabel(sText, pParent) { + MenuLabel(const TQString& sText, TQWidget* pParent) : + TQLabel(sText, pParent) { // Set the appropriate visual properties setFrameShape(MenuBarPanel); setAlignment(AlignHCenter | AlignVCenter); @@ -117,8 +117,8 @@ ArrowInfo GraphWidget::s_ai; * @param pParent The parent widget * @param szName The widget's name */ -GraphWidget::GraphWidget(QWidget* pParent, const char* szName) : - QCanvasView(pParent, szName), +GraphWidget::GraphWidget(TQWidget* pParent, const char* szName) : + TQCanvasView(pParent, szName), m_progress(this), m_dot(this), m_dZoom(1.0), @@ -130,7 +130,7 @@ GraphWidget::GraphWidget(QWidget* pParent, const char* szName) : m_dictNodes.setAutoDelete(true); // Create a canvas - setCanvas(new QCanvas(this)); + setCanvas(new TQCanvas(this)); canvas()->setBackgroundColor(Config().getColor(KScopeConfig::GraphBack)); // Create a persistent Cscope process @@ -156,7 +156,7 @@ GraphWidget::GraphWidget(QWidget* pParent, const char* szName) : connect(&m_dot, SIGNAL(finished(uint)), this, SLOT(slotDotFinished())); // Create the node popup menu - m_pNodePopup = new QPopupMenu(this); + m_pNodePopup = new TQPopupMenu(this); m_pNodePopup->insertItem(new MenuLabel(i18n("<b>Called Functions</b>"), m_pNodePopup)); @@ -183,7 +183,7 @@ GraphWidget::GraphWidget(QWidget* pParent, const char* szName) : m_pNodePopup->insertItem(i18n("Remove"), this, SLOT(slotRemoveNode())); // Create the multi-call node popup menu - m_pMultiCallPopup = new QPopupMenu(this); + m_pMultiCallPopup = new TQPopupMenu(this); m_pMultiCallPopup->insertItem(i18n("List..."), this, SLOT(slotMultiCallDetails())); m_pMultiCallPopup->insertSeparator(); @@ -191,7 +191,7 @@ GraphWidget::GraphWidget(QWidget* pParent, const char* szName) : SLOT(slotRemoveNode())); // Create the edge menu - m_pEdgePopup = new QPopupMenu(this); + m_pEdgePopup = new TQPopupMenu(this); m_pEdgePopup->insertItem(i18n("Open Call"), this, SLOT(slotOpenCall())); (void)new GraphTip(this); @@ -211,7 +211,7 @@ GraphWidget::~GraphWidget() * strongly connected to the root). * @param sFunc The function name for the root node */ -void GraphWidget::setRoot(const QString& sFunc) +void GraphWidget::setRoot(const TQString& sFunc) { // Insert a new node to the graph addNode(sFunc); @@ -223,7 +223,7 @@ void GraphWidget::setRoot(const QString& sFunc) * @param sFunc The name of a function * @return The node corresponding to the given name */ -GraphNode* GraphWidget::addNode(const QString& sFunc, bool bMultiCall) +GraphNode* GraphWidget::addNode(const TQString& sFunc, bool bMultiCall) { GraphNode* pNode; @@ -267,9 +267,9 @@ void GraphWidget::addCall(const CallData& data) * @param bCalled true if the multiple calls are called from that function, * false if they are calling the function */ -void GraphWidget::addMultiCall(const QString& sFunc, bool bCalled) +void GraphWidget::addMultiCall(const TQString& sFunc, bool bCalled) { - QString sMulti; + TQString sMulti; GraphNode* pCaller, * pCallee; GraphEdge* pEdge; @@ -301,7 +301,7 @@ void GraphWidget::addMultiCall(const QString& sFunc, bool bCalled) */ void GraphWidget::draw() { - QWMatrix mtx; + TQWMatrix mtx; char szTempFile[TMP_TMPL_SIZE]; int nFd; FILE* pFile; @@ -328,7 +328,7 @@ void GraphWidget::draw() // Write the graph contents to the temporary file { - QTextStream str(pFile, IO_WriteOnly); + TQTextStream str(pFile, IO_WriteOnly); write(str, "graph", "--", false); } @@ -359,7 +359,7 @@ void GraphWidget::draw() void GraphWidget::save(FILE* pFile) { // Write the graph using the dot language - QTextStream str(pFile, IO_WriteOnly); + TQTextStream str(pFile, IO_WriteOnly); write(str, "digraph", "->", true); } @@ -367,15 +367,15 @@ void GraphWidget::save(FILE* pFile) * Exports a graph to a dot file. * @param sFile The full path of the file to export to */ -void GraphWidget::save(const QString& sFile) +void GraphWidget::save(const TQString& sFile) { - QFile file(sFile); + TQFile file(sFile); // Open/create the file if (!file.open(IO_WriteOnly)) return; - QTextStream str(&file); + TQTextStream str(&file); write(str, "digraph", "->", false); } @@ -385,7 +385,7 @@ void GraphWidget::save(const QString& sFile) */ void GraphWidget::zoom(bool bIn) { - QWMatrix mtx; + TQWMatrix mtx; // Set the new zoom factor if (bIn) @@ -414,7 +414,7 @@ void GraphWidget::setZoom(double dZoom) */ void GraphWidget::rotate() { - QString sDir; + TQString sDir; int i; // Get the current direction @@ -437,15 +437,15 @@ void GraphWidget::rotate() * NOTE: We currently return a tool tip for edges only * @param ptPos The position to query * @param rc Holds the tip's rectangle, upon return - * @return The tip's text, or QString::null if no tip is required + * @return The tip's text, or TQString::null if no tip is required */ -QString GraphWidget::getTip(const QPoint& ptPos, QRect& rc) +TQString GraphWidget::getTip(const TQPoint& ptPos, TQRect& rc) { - QPoint ptRealPos, ptTopLeft, ptBottomRight; - QCanvasItemList il; - QCanvasItemList::Iterator itr; + TQPoint ptRealPos, ptTopLeft, ptBottomRight; + TQCanvasItemList il; + TQCanvasItemList::Iterator itr; GraphEdge* pEdge; - QString sText, sFile, sLine; + TQString sText, sFile, sLine; ptRealPos = viewportToContents(ptPos); ptRealPos /= m_dZoom; @@ -461,7 +461,7 @@ QString GraphWidget::getTip(const QPoint& ptPos, QRect& rc) // No tip if no edge was found if (pEdge == NULL) - return QString::null; + return TQString::null; // Set the rectangle for the tip (the tip is closed when the mouse leaves // this area) @@ -472,7 +472,7 @@ QString GraphWidget::getTip(const QPoint& ptPos, QRect& rc) ptBottomRight *= m_dZoom; ptTopLeft = contentsToViewport(ptTopLeft); ptBottomRight = contentsToViewport(ptBottomRight); - rc = QRect(ptTopLeft, ptBottomRight); + rc = TQRect(ptTopLeft, ptBottomRight); // Create a tip for this edge return pEdge->getTip(); @@ -494,7 +494,7 @@ void GraphWidget::resize(int nWidth, int nHeight) * @param sFunc The function corresponding to the node to draw * @param rect The coordinates of the node's rectangle */ -void GraphWidget::drawNode(const QString& sFunc, const QRect& rect) +void GraphWidget::drawNode(const TQString& sFunc, const TQRect& rect) { GraphNode* pNode; @@ -504,7 +504,7 @@ void GraphWidget::drawNode(const QString& sFunc, const QRect& rect) // Set the visual aspects of the node pNode->setRect(rect); pNode->setZ(2.0); - pNode->setPen(QPen(Qt::black)); + pNode->setPen(TQPen(TQt::black)); pNode->setFont(Config().getFont(KScopeConfig::Graph)); if (pNode->isMultiCall()) @@ -523,8 +523,8 @@ void GraphWidget::drawNode(const QString& sFunc, const QRect& rect) * @param sCallee Identifies the edge's tail node * @param arrCurve Control points for the edge's spline */ -void GraphWidget::drawEdge(const QString& sCaller, const QString& sCallee, - const QPointArray& arrCurve) +void GraphWidget::drawEdge(const TQString& sCaller, const TQString& sCallee, + const TQPointArray& arrCurve) { GraphNode* pCaller, * pCallee; GraphEdge* pEdge; @@ -537,8 +537,8 @@ void GraphWidget::drawEdge(const QString& sCaller, const QString& sCallee, // Set the visual aspects of the edge pEdge->setPoints(arrCurve, s_ai); pEdge->setZ(1.0); - pEdge->setPen(QPen(Qt::black)); - pEdge->setBrush(QBrush(Qt::black)); + pEdge->setPen(TQPen(TQt::black)); + pEdge->setBrush(TQBrush(TQt::black)); // Draw the edge pEdge->show(); @@ -567,7 +567,7 @@ void GraphWidget::setArrowInfo(int nLength, int nDegrees) /** * Draws the contents of the canvas on this view. - * NOTE: This method is overriden to fix a strange bug in Qt that leaves + * NOTE: This method is overriden to fix a strange bug in TQt that leaves * a border around the canvas part of the view. It should be deleted once * this bug is fixed. * TODO: Is there a better way of erasing the border? @@ -577,16 +577,16 @@ void GraphWidget::setArrowInfo(int nLength, int nDegrees) * @param nWidth The width of the area to draw * @param nHeight The height of the area to draw */ -void GraphWidget::drawContents(QPainter* pPainter, int nX, int nY, +void GraphWidget::drawContents(TQPainter* pPainter, int nX, int nY, int nWidth, int nHeight) { // Draw the contents of the canvas - QCanvasView::drawContents(pPainter, nX, nY, nWidth, nHeight); + TQCanvasView::drawContents(pPainter, nX, nY, nWidth, nHeight); // Erase the canvas's area border if (canvas() != NULL) { - QRect rect = canvas()->rect(); - pPainter->setBrush(QBrush()); // Null brush + TQRect rect = canvas()->rect(); + pPainter->setBrush(TQBrush()); // Null brush pPainter->setPen(Config().getColor(KScopeConfig::GraphBack)); pPainter->drawRect(-1, -1, rect.width() + 2, rect.height() + 2); } @@ -596,12 +596,12 @@ void GraphWidget::drawContents(QPainter* pPainter, int nX, int nY, * Handles mouse clicks over the graph view. * @param pEvent Includes information on the mouse press event */ -void GraphWidget::contentsMousePressEvent(QMouseEvent* pEvent) +void GraphWidget::contentsMousePressEvent(TQMouseEvent* pEvent) { - QPoint ptRealPos; - QCanvasItemList il; - QCanvasItemList::Iterator itr; - QString sFunc; + TQPoint ptRealPos; + TQCanvasItemList il; + TQCanvasItemList::Iterator itr; + TQString sFunc; GraphNode* pNode; GraphEdge* pEdge; @@ -609,8 +609,8 @@ void GraphWidget::contentsMousePressEvent(QMouseEvent* pEvent) pEdge = NULL; // Handle right-clicks only - if (pEvent->button() != Qt::RightButton) { - QCanvasView::contentsMousePressEvent(pEvent); + if (pEvent->button() != TQt::RightButton) { + TQCanvasView::contentsMousePressEvent(pEvent); return; } @@ -638,7 +638,7 @@ void GraphWidget::contentsMousePressEvent(QMouseEvent* pEvent) } else { // Take the default action - QCanvasView::contentsMousePressEvent(pEvent); + TQCanvasView::contentsMousePressEvent(pEvent); } } @@ -653,11 +653,11 @@ void GraphWidget::contentsMousePressEvent(QMouseEvent* pEvent) * @param sEdge The edge connector ("--" or "->") * @param bWriteCall true to write call information, false otherwise */ -void GraphWidget::write(QTextStream& str, const QString& sType, - const QString& sEdge, bool bWriteCall) +void GraphWidget::write(TQTextStream& str, const TQString& sType, + const TQString& sEdge, bool bWriteCall) { - QFont font; - QDictIterator<GraphNode> itr(m_dictNodes); + TQFont font; + TQDictIterator<GraphNode> itr(m_dictNodes); GraphEdge* pEdge; Encoder enc; @@ -678,7 +678,7 @@ void GraphWidget::write(QTextStream& str, const QString& sType, << "fontcolor=\"" << Config().getColor(KScopeConfig::GraphText).name() << "\", " << "fontname=\"" << font.family() << "\", " - << "fontsize=" << QString::number(font.pointSize()) + << "fontsize=" << TQString::number(font.pointSize()) << "];\n"; // Iterate over all nodes @@ -687,7 +687,7 @@ void GraphWidget::write(QTextStream& str, const QString& sType, str << "\t" << itr.current()->getFunc() << ";\n"; // Iterate over all edges leaving this node - QDictIterator<GraphEdge> itrEdge(itr.current()->getOutEdges()); + TQDictIterator<GraphEdge> itrEdge(itr.current()->getOutEdges()); for (; itrEdge.current(); ++itrEdge) { pEdge = itrEdge.current(); str << "\t" << pEdge->getHead()->getFunc() << sEdge @@ -737,7 +737,7 @@ void GraphWidget::removeEdges(GraphNode* pNode, bool bOut) */ void GraphWidget::removeDisconnected(GraphNode* pNode) { - QDictIterator<GraphNode> itr(m_dictNodes); + TQDictIterator<GraphNode> itr(m_dictNodes); // Find all weakly connected components attached to this node pNode->dfs(); @@ -760,7 +760,7 @@ void GraphWidget::removeDisconnected(GraphNode* pNode) * @param pNode The node for which to show the menu * @param ptPos The position of the menu */ -void GraphWidget::showNodeMenu(GraphNode* pNode, const QPoint& ptPos) +void GraphWidget::showNodeMenu(GraphNode* pNode, const TQPoint& ptPos) { // Remember the node m_pMenuItem = pNode; @@ -778,7 +778,7 @@ void GraphWidget::showNodeMenu(GraphNode* pNode, const QPoint& ptPos) * @param pEdge The edge for which to show the menu * @param ptPos The position of the menu */ -void GraphWidget::showEdgeMenu(GraphEdge* pEdge, const QPoint& ptPos) +void GraphWidget::showEdgeMenu(GraphEdge* pEdge, const TQPoint& ptPos) { // Remember the edge m_pMenuItem = pEdge; @@ -796,7 +796,7 @@ void GraphWidget::slotDotFinished() { // Delete the temporary file if (m_sDrawFilePath != "") { - QFile::remove(m_sDrawFilePath); + TQFile::remove(m_sDrawFilePath); m_sDrawFilePath = ""; } @@ -820,7 +820,7 @@ void GraphWidget::slotDotFinished() void GraphWidget::slotDataReady(FrontendToken* pToken) { CallData data; - QString sFunc; + TQString sFunc; // Get the file name data.m_sFile = pToken->getData(); @@ -932,11 +932,11 @@ void GraphWidget::slotListCalled() if (pNode == NULL) return; - QueryViewDlg dlg(0, (QWidget*)parent()); + QueryViewDlg dlg(0, (TQWidget*)parent()); // Show the query view dialogue dlg.query(CscopeFrontend::Called, pNode->getFunc()); - if (dlg.exec() != QDialog::Accepted) + if (dlg.exec() != TQDialog::Accepted) return; // The OK button was clicked, replace current calls with the listed ones @@ -1018,11 +1018,11 @@ void GraphWidget::slotListCalling() if (pNode == NULL) return; - QueryViewDlg dlg(0, (QWidget*)parent()); + QueryViewDlg dlg(0, (TQWidget*)parent()); // Show the query view dialogue dlg.query(CscopeFrontend::Calling, pNode->getFunc()); - if (dlg.exec() != QDialog::Accepted) + if (dlg.exec() != TQDialog::Accepted) return; // The OK button was clicked, replace current calls with the listed ones @@ -1085,8 +1085,8 @@ void GraphWidget::slotFindDef() pDlg = new QueryViewDlg(QueryViewDlg::DestroyOnSelect, this); // Display a line when it is selected in the dialogue - connect(pDlg, SIGNAL(lineRequested(const QString&, uint)), this, - SIGNAL(lineRequested(const QString&, uint))); + connect(pDlg, SIGNAL(lineRequested(const TQString&, uint)), this, + SIGNAL(lineRequested(const TQString&, uint))); // Start the query pDlg->query(CscopeFrontend::Definition, pNode->getFunc()); @@ -1136,7 +1136,7 @@ void GraphWidget::slotMultiCallDetails() if (!pParent) return; - QueryViewDlg dlg(0, (QWidget*)parent()); + QueryViewDlg dlg(0, (TQWidget*)parent()); dlg.query(bCalled ? CscopeFrontend::Calling : CscopeFrontend::Called, pParent->getFunc()); @@ -1151,7 +1151,7 @@ void GraphWidget::slotMultiCallDetails() void GraphWidget::slotOpenCall() { GraphEdge* pEdge; - QString sFile, sLine; + TQString sFile, sLine; // Make sure the menu item is an edge pEdge = dynamic_cast<GraphEdge*>(m_pMenuItem); |