diff options
Diffstat (limited to 'languages/ruby/debugger/variablewidget.cpp')
-rw-r--r-- | languages/ruby/debugger/variablewidget.cpp | 200 |
1 files changed, 100 insertions, 100 deletions
diff --git a/languages/ruby/debugger/variablewidget.cpp b/languages/ruby/debugger/variablewidget.cpp index 0dbdce9a..fd323fd5 100644 --- a/languages/ruby/debugger/variablewidget.cpp +++ b/languages/ruby/debugger/variablewidget.cpp @@ -28,18 +28,18 @@ #include <klineedit.h> #include <kdeversion.h> -#include <qheader.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qhbox.h> -#include <qpainter.h> -#include <qpushbutton.h> -#include <qregexp.h> -#include <qcursor.h> +#include <tqheader.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqhbox.h> +#include <tqpainter.h> +#include <tqpushbutton.h> +#include <tqregexp.h> +#include <tqcursor.h> #include <klocale.h> -#include <qpoint.h> -#include <qclipboard.h> +#include <tqpoint.h> +#include <tqclipboard.h> #include <kapplication.h> // ************************************************************************** @@ -49,30 +49,30 @@ namespace RDBDebugger { -VariableWidget::VariableWidget(QWidget *parent, const char *name) - : QWidget(parent, name) +VariableWidget::VariableWidget(TQWidget *parent, const char *name) + : TQWidget(parent, name) { varTree_ = new VariableTree(this); - QLabel *label = new QLabel(i18n("E&xpression to watch:"), this); + TQLabel *label = new TQLabel(i18n("E&xpression to watch:"), this); - QHBox *watchEntry = new QHBox( this ); + TQHBox *watchEntry = new TQHBox( this ); watchVarEditor_ = new KHistoryCombo( watchEntry, "var-to-watch editor"); label->setBuddy(watchVarEditor_); - QPushButton *addButton = new QPushButton(i18n("&Add"), watchEntry ); + TQPushButton *addButton = new TQPushButton(i18n("&Add"), watchEntry ); addButton->adjustSize(); addButton->setFixedWidth(addButton->width()); - QBoxLayout * vbox = new QVBoxLayout(); + TQBoxLayout * vbox = new TQVBoxLayout(); vbox->addWidget( label ); vbox->addWidget( watchEntry ); - QVBoxLayout *topLayout = new QVBoxLayout(this, 2); + TQVBoxLayout *topLayout = new TQVBoxLayout(this, 2); topLayout->addWidget(varTree_, 10); topLayout->addLayout( vbox ); - connect( addButton, SIGNAL(clicked()), SLOT(slotAddWatchExpression()) ); - connect( watchVarEditor_, SIGNAL(returnPressed()), SLOT(slotAddWatchExpression()) ); + connect( addButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddWatchExpression()) ); + connect( watchVarEditor_, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotAddWatchExpression()) ); } @@ -80,7 +80,7 @@ VariableWidget::VariableWidget(QWidget *parent, const char *name) void VariableWidget::setEnabled(bool bEnabled) { - QWidget::setEnabled(bEnabled); + TQWidget::setEnabled(bEnabled); if (bEnabled && parentWidget() != 0) { varTree_->setColumnWidth(0, parentWidget()->width()/2); } @@ -89,7 +89,7 @@ void VariableWidget::setEnabled(bool bEnabled) void VariableWidget::slotAddWatchExpression() { - QString watchVar(watchVarEditor_->currentText()); + TQString watchVar(watchVarEditor_->currentText()); if (!watchVar.isEmpty()) { slotAddWatchExpression(watchVar); } @@ -97,7 +97,7 @@ void VariableWidget::slotAddWatchExpression() // ************************************************************************** -void VariableWidget::slotAddWatchExpression(const QString &ident) +void VariableWidget::slotAddWatchExpression(const TQString &ident) { if (!ident.isEmpty()) { watchVarEditor_->addToHistory(ident); @@ -108,17 +108,17 @@ void VariableWidget::slotAddWatchExpression(const QString &ident) // ************************************************************************** -void VariableWidget::focusInEvent(QFocusEvent */*e*/) +void VariableWidget::focusInEvent(TQFocusEvent */*e*/) { varTree_->setFocus(); } -void VariableWidget::restorePartialProjectSession(const QDomElement* el) +void VariableWidget::restorePartialProjectSession(const TQDomElement* el) { varTree_->watchRoot()->restorePartialProjectSession(el); } -void VariableWidget::savePartialProjectSession(QDomElement* el) +void VariableWidget::savePartialProjectSession(TQDomElement* el) { varTree_->watchRoot()->savePartialProjectSession(el); } @@ -129,7 +129,7 @@ void VariableWidget::savePartialProjectSession(QDomElement* el) VariableTree::VariableTree(VariableWidget *parent, const char *name) : KListView(parent, name), - QToolTip( viewport() ), + TQToolTip( viewport() ), activationId_(0), currentThread_(-1), selectedFrame_(0), @@ -140,16 +140,16 @@ VariableTree::VariableTree(VariableWidget *parent, const char *name) setAllColumnsShowFocus(true); setColumnWidthMode(0, Manual); setSorting(VAR_NAME_COLUMN); - QListView::setSelectionMode(QListView::Single); + TQListView::setSelectionMode(TQListView::Single); addColumn(i18n("Variable"), 100 ); addColumn(i18n("Value"), 100 ); - connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), - SLOT(slotContextMenu(KListView*, QListViewItem*)) ); + connect( this, TQT_SIGNAL(contextMenu(KListView*, TQListViewItem*, const TQPoint&)), + TQT_SLOT(slotContextMenu(KListView*, TQListViewItem*)) ); - connect( this, SIGNAL(pressed(QListViewItem*)), - this, SLOT(slotPressed(QListViewItem*)) ); + connect( this, TQT_SIGNAL(pressed(TQListViewItem*)), + this, TQT_SLOT(slotPressed(TQListViewItem*)) ); watchRoot_ = new WatchRoot(this); } @@ -164,9 +164,9 @@ VariableTree::~VariableTree() void VariableTree::clear() { - QListViewItem *sibling = firstChild(); + TQListViewItem *sibling = firstChild(); while (sibling != 0) { - QListViewItem * current = sibling; + TQListViewItem * current = sibling; sibling = sibling->nextSibling(); if (current->rtti() != RTTI_WATCH_ROOT) { delete current; @@ -180,7 +180,7 @@ void VariableTree::clear() // ************************************************************************** -void VariableTree::slotContextMenu(KListView *, QListViewItem *item) +void VariableTree::slotContextMenu(KListView *, TQListViewItem *item) { if (item == 0) return; @@ -196,14 +196,14 @@ void VariableTree::slotContextMenu(KListView *, QListViewItem *item) } int idCopyToClipboard = popup.insertItem( i18n("Copy to Clipboard") ); - int res = popup.exec(QCursor::pos()); + int res = popup.exec(TQCursor::pos()); if (res == idRemoveWatch) { emit removeWatchExpression(((WatchVarItem*)item)->displayId()); delete item; } else if (res == idCopyToClipboard) { QClipboard *qb = KApplication::clipboard(); - QString text = "{ \"" + item->text( VAR_NAME_COLUMN ) + "\", " + + TQString text = "{ \"" + item->text( VAR_NAME_COLUMN ) + "\", " + "\"" + item->text( VALUE_COLUMN ) + "\" }"; qb->setText( text, QClipboard::Clipboard ); @@ -213,20 +213,20 @@ void VariableTree::slotContextMenu(KListView *, QListViewItem *item) /***************************************************************************/ -void VariableTree::setSelected(QListViewItem * item, bool selected) +void VariableTree::setSelected(TQListViewItem * item, bool selected) { // Save the last selected VarFrameRoot for slotPressed() to restore if (item->rtti() == RTTI_VAR_FRAME_ROOT && selected) { selectedFrame_ = (VarFrameRoot *) item; } - QListView::setSelected(item, selected); + TQListView::setSelected(item, selected); } /***************************************************************************/ // Makes sure that only VarFrameRoot items can be selected -void VariableTree::slotPressed(QListViewItem * item) +void VariableTree::slotPressed(TQListViewItem * item) { if (item == 0) { return; @@ -258,10 +258,10 @@ void VariableTree::slotPressed(QListViewItem * item) void VariableTree::prune() { - QListViewItem *child = firstChild(); + TQListViewItem *child = firstChild(); while (child != 0) { - QListViewItem *nextChild = child->nextSibling(); + TQListViewItem *nextChild = child->nextSibling(); // Only prune var frames, not the watch or global root if (child->rtti() == RTTI_VAR_FRAME_ROOT) { @@ -298,7 +298,7 @@ void VariableTree::nextActivationId() // // After that, any frames which aren't marked as active must have gone // out of scope and will end up pruned. -void VariableTree::slotFrameActive(int frameNo, int threadNo, const QString& frameName) +void VariableTree::slotFrameActive(int frameNo, int threadNo, const TQString& frameName) { VarFrameRoot * frame = findFrame(frameNo, threadNo); if (frameNo == 1) { @@ -319,7 +319,7 @@ void VariableTree::slotFrameActive(int frameNo, int threadNo, const QString& fra bool VariableTree::schedule() { - QListViewItem * child = firstChild(); + TQListViewItem * child = firstChild(); VarFrameRoot * frame = 0; while (child != 0) { @@ -328,8 +328,8 @@ bool VariableTree::schedule() Q_ASSERT( !frame->isWaitingForData() ); if (frame->needsVariables()) { - if (QApplication::overrideCursor() == 0) { - QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); + if (TQApplication::overrideCursor() == 0) { + TQApplication::setOverrideCursor(TQCursor(Qt::WaitCursor)); } // Tell the controller to fetch the variable values @@ -348,7 +348,7 @@ bool VariableTree::schedule() // All over, nothing left to fetch. // Return to frame 1, and prune the inactive items // from the variable tree.. - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); emit selectFrame(1, currentThread_); prune(); @@ -357,7 +357,7 @@ bool VariableTree::schedule() // ************************************************************************** -void VariableTree::slotAddWatchExpression(const QString &watchVar) +void VariableTree::slotAddWatchExpression(const TQString &watchVar) { new WatchVarItem(watchRoot(), watchVar, UNKNOWN_TYPE); emit addWatchExpression(watchVar, true); @@ -377,7 +377,7 @@ VarFrameRoot *VariableTree::findFrame(int frameNo, int threadNo) const { // frames only exist on the top level so we only need to // check the siblings - QListViewItem *sibling = firstChild(); + TQListViewItem *sibling = firstChild(); while (sibling != 0) { if ( sibling->rtti() == RTTI_VAR_FRAME_ROOT && ((VarFrameRoot*) sibling)->frameNo() == frameNo @@ -416,7 +416,7 @@ GlobalRoot *VariableTree::globalRoot() // so tell the controller about any already in the tree at start. void VariableTree::resetWatchVars() { - for (QListViewItem *child = watchRoot()->firstChild(); child != 0; child = child->nextSibling()) { + for (TQListViewItem *child = watchRoot()->firstChild(); child != 0; child = child->nextSibling()) { ((WatchVarItem*) child)->setDisplayId(-1); emit addWatchExpression(child->text(VAR_NAME_COLUMN), false); } @@ -424,11 +424,11 @@ void VariableTree::resetWatchVars() // ************************************************************************** -void VariableTree::maybeTip(const QPoint &p) +void VariableTree::maybeTip(const TQPoint &p) { VarItem * item = dynamic_cast<VarItem*>( itemAt(p) ); if (item != 0) { - QRect r = itemRect(item); + TQRect r = itemRect(item); if (r.isValid()) { tip(r, item->tipText()); } @@ -466,7 +466,7 @@ LazyFetchItem::~LazyFetchItem() // ************************************************************************** -void LazyFetchItem::paintCell(QPainter *p, const QColorGroup &cg, +void LazyFetchItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align) { if (p == 0) { @@ -475,19 +475,19 @@ void LazyFetchItem::paintCell(QPainter *p, const QColorGroup &cg, // make toplevel item (watch and frame items) names bold if (column == VAR_NAME_COLUMN && parent() == 0) { - QFont f = p->font(); + TQFont f = p->font(); f.setBold(true); p->setFont(f); } - QListViewItem::paintCell( p, cg, column, width, align ); + TQListViewItem::paintCell( p, cg, column, width, align ); } // ************************************************************************** -VarItem *LazyFetchItem::findItem(const QString &name) const +VarItem *LazyFetchItem::findItem(const TQString &name) const { - QListViewItem *child = firstChild(); + TQListViewItem *child = firstChild(); // Check the siblings on this branch while (child != 0) { @@ -505,7 +505,7 @@ VarItem *LazyFetchItem::findItem(const QString &name) const void LazyFetchItem::prune() { - QListViewItem *child = firstChild(); + TQListViewItem *child = firstChild(); while (child != 0) { LazyFetchItem *item = (LazyFetchItem*) child; @@ -526,9 +526,9 @@ void LazyFetchItem::prune() // ************************************************************************** // ************************************************************************** -VarItem::VarItem(LazyFetchItem *parent, const QString &varName, DataType dataType) +VarItem::VarItem(LazyFetchItem *parent, const TQString &varName, DataType dataType) : LazyFetchItem (parent), - cache_(QCString()), + cache_(TQCString()), dataType_(dataType), highlight_(false) { @@ -542,14 +542,14 @@ VarItem::VarItem(LazyFetchItem *parent, const QString &varName, DataType dataTyp // Matches either an array element or a string slice, // Order on the array index or the first number in the // range specifying the slice. - QRegExp arrayelement_re("\\[(\\d+)(\\.\\.\\d+)?\\]"); + TQRegExp arrayelement_re("\\[(\\d+)(\\.\\.\\d+)?\\]"); key_ = varName; if (arrayelement_re.search(varName) != -1) { key_.sprintf("%.6d", arrayelement_re.cap(1).toInt()); } else if (key_.startsWith("$")) { key_.prepend("1001"); // Global variable - } else if (QRegExp("^[A-Z]").search(varName) != -1) { + } else if (TQRegExp("^[A-Z]").search(varName) != -1) { key_.prepend("1002"); // Constant } else if (key_.startsWith("@@")) { key_.prepend("1003"); // Class variable @@ -568,7 +568,7 @@ VarItem::~VarItem() { } -QString VarItem::key(int /*column*/, bool /*ascending*/) const +TQString VarItem::key(int /*column*/, bool /*ascending*/) const { return key_; } @@ -580,10 +580,10 @@ QString VarItem::key(int /*column*/, bool /*ascending*/) const // For example, @foobar within instance obj is accessed as obj.foobar. // But don't strip off the @ for an instance variable with no path, // and leave a plain '@foobar' as it is. -QString VarItem::fullName() const +TQString VarItem::fullName() const { - QString itemName = text(VAR_NAME_COLUMN); - QString vPath(""); + TQString itemName = text(VAR_NAME_COLUMN); + TQString vPath(""); const VarItem *item = this; if (item->parent()->rtti() != RTTI_VAR_ITEM) { @@ -592,7 +592,7 @@ QString VarItem::fullName() const // This stops at the root item (FrameRoot or GlobalRoot) while (item->rtti() == RTTI_VAR_ITEM) { - QString itemName = item->text(VAR_NAME_COLUMN); + TQString itemName = item->text(VAR_NAME_COLUMN); if (vPath.startsWith("[")) { // If it's a Hash or an Array, then just insert the value. As @@ -609,15 +609,15 @@ QString VarItem::fullName() const } // Change 'self.@foobar' to '@foobar' - vPath.replace(QRegExp("^self\\.@"), "@"); + vPath.replace(TQRegExp("^self\\.@"), "@"); // Use instance_variable_get() to access any '@var's in the middle of a path - QRegExp re_instance_var("\\.(@[^\\[.]+)"); + TQRegExp re_instance_var("\\.(@[^\\[.]+)"); int pos = re_instance_var.search(vPath); while (pos != -1) { vPath.replace( pos, re_instance_var.matchedLength(), - QString(".instance_variable_get(:") + re_instance_var.cap(1) + ")" ); + TQString(".instance_variable_get(:") + re_instance_var.cap(1) + ")" ); pos = re_instance_var.search(vPath, pos); } @@ -626,7 +626,7 @@ QString VarItem::fullName() const // ************************************************************************** -void VarItem::setText(int column, const QString &data) +void VarItem::setText(int column, const TQString &data) { setActivationId(); @@ -634,7 +634,7 @@ void VarItem::setText(int column, const QString &data) highlight_ = (!text(VALUE_COLUMN).isEmpty() && text(VALUE_COLUMN) != data); } - QListViewItem::setText(column, data); + TQListViewItem::setText(column, data); repaint(); } @@ -650,7 +650,7 @@ void VarItem::expandValue(char *buf) void VarItem::setOpen(bool open) { - QListViewItem::setOpen(open); + TQListViewItem::setOpen(open); Q_ASSERT( dataType_ == REFERENCE_TYPE || dataType_ == ARRAY_TYPE @@ -692,7 +692,7 @@ void VarItem::setDataType(DataType dataType) // ************************************************************************** // Overridden to highlight the changed items -void VarItem::paintCell(QPainter *p, const QColorGroup &cg, +void VarItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align) { if (p == 0) { @@ -703,37 +703,37 @@ void VarItem::paintCell(QPainter *p, const QColorGroup &cg, // Show color values as colors, and make the text color the same // as the base color if (dataType_ == COLOR_TYPE) { - QRegExp color_re("\\s(#.*)>"); + TQRegExp color_re("\\s(#.*)>"); if (color_re.search(text(column)) != -1) { - QColorGroup color_cg( cg.foreground(), cg.background(), + TQColorGroup color_cg( cg.foreground(), cg.background(), cg.light(), cg.dark(), cg.mid(), - QColor(color_re.cap(1)), QColor(color_re.cap(1)) ); - QListViewItem::paintCell(p, color_cg, column, width, align); + TQColor(color_re.cap(1)), TQColor(color_re.cap(1)) ); + TQListViewItem::paintCell(p, color_cg, column, width, align); return; } } // Highlight recently changed items in red if (highlight_) { - QColorGroup hl_cg( cg.foreground(), cg.background(), + TQColorGroup hl_cg( cg.foreground(), cg.background(), cg.light(), cg.dark(), cg.mid(), red, cg.base() ); - QListViewItem::paintCell(p, hl_cg, column, width, align); + TQListViewItem::paintCell(p, hl_cg, column, width, align); return; } } - QListViewItem::paintCell(p, cg, column, width, align); + TQListViewItem::paintCell(p, cg, column, width, align); return; } // ************************************************************************** -QString VarItem::tipText() const +TQString VarItem::tipText() const { const unsigned int MAX_TOOLTIP_SIZE = 70; - QString tip = text(VALUE_COLUMN); + TQString tip = text(VALUE_COLUMN); if (tip.length() < MAX_TOOLTIP_SIZE) { return tip; @@ -789,7 +789,7 @@ void VarFrameRoot::setLocals() void VarFrameRoot::setOpen(bool open) { bool localsViewChanged = (isOpen() != open); - QListViewItem::setOpen(open); + TQListViewItem::setOpen(open); if (localsViewChanged) { ((VariableTree*)listView())->selectFrame(frameNo_, threadNo_); @@ -798,7 +798,7 @@ void VarFrameRoot::setOpen(bool open) return; } -void VarFrameRoot::setFrameName(const QString &frameName) +void VarFrameRoot::setFrameName(const TQString &frameName) { setText(VAR_NAME_COLUMN, frameName); setText(VALUE_COLUMN, ""); @@ -858,7 +858,7 @@ void GlobalRoot::setGlobals(char * globals) void GlobalRoot::setOpen(bool open) { bool globalsViewChanged = (isOpen() != open); - QListViewItem::setOpen(open); + TQListViewItem::setOpen(open); if (globalsViewChanged) { ((VariableTree*)listView())->setFetchGlobals(isOpen()); @@ -872,7 +872,7 @@ void GlobalRoot::setOpen(bool open) // ************************************************************************** // ************************************************************************** -WatchVarItem::WatchVarItem( LazyFetchItem *parent, const QString &varName, DataType dataType, int displayId ) +WatchVarItem::WatchVarItem( LazyFetchItem *parent, const TQString &varName, DataType dataType, int displayId ) : VarItem(parent, varName, dataType), displayId_(displayId) { @@ -923,10 +923,10 @@ WatchRoot::~WatchRoot() // display id void WatchRoot::setWatchExpression(char * buf, char * expression) { - QString expr(expression); - QRegExp display_re("^(\\d+):\\s([^\n]+)\n"); + TQString expr(expression); + TQRegExp display_re("^(\\d+):\\s([^\n]+)\n"); - for ( QListViewItem *child = firstChild(); + for ( TQListViewItem *child = firstChild(); child != 0; child = child->nextSibling() ) { @@ -946,9 +946,9 @@ void WatchRoot::setWatchExpression(char * buf, char * expression) // After a program pause, this updates the new value of a Watch item // expr is the thing = value part of "1: a = 1", id is the display number -void WatchRoot::updateWatchExpression(int id, const QString& expr) +void WatchRoot::updateWatchExpression(int id, const TQString& expr) { - for ( QListViewItem *child = firstChild(); + for ( TQListViewItem *child = firstChild(); child != 0; child = child->nextSibling() ) { @@ -963,20 +963,20 @@ void WatchRoot::updateWatchExpression(int id, const QString& expr) } } -void WatchRoot::savePartialProjectSession(QDomElement* el) +void WatchRoot::savePartialProjectSession(TQDomElement* el) { - QDomDocument domDoc = el->ownerDocument(); + TQDomDocument domDoc = el->ownerDocument(); if (domDoc.isNull()) { return; } - QDomElement watchEl = domDoc.createElement("watchExpressions"); + TQDomElement watchEl = domDoc.createElement("watchExpressions"); - for ( QListViewItem *child = firstChild(); + for ( TQListViewItem *child = firstChild(); child != 0; child = child->nextSibling() ) { - QDomElement subEl = domDoc.createElement("el"); + TQDomElement subEl = domDoc.createElement("el"); subEl.appendChild(domDoc.createTextNode(child->text(VAR_NAME_COLUMN))); watchEl.appendChild(subEl); } @@ -988,15 +988,15 @@ void WatchRoot::savePartialProjectSession(QDomElement* el) return; } -void WatchRoot::restorePartialProjectSession(const QDomElement* el) +void WatchRoot::restorePartialProjectSession(const TQDomElement* el) { - QDomDocument domDoc = el->ownerDocument(); + TQDomDocument domDoc = el->ownerDocument(); if (domDoc.isNull()) { return; } - QDomElement watchEl = el->namedItem("watchExpressions").toElement(); - QDomElement subEl = watchEl.firstChild().toElement(); + TQDomElement watchEl = el->namedItem("watchExpressions").toElement(); + TQDomElement subEl = watchEl.firstChild().toElement(); while (!subEl.isNull()) { new WatchVarItem(this, subEl.firstChild().toText().data(), UNKNOWN_TYPE); |