diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /parts/texttools/texttoolswidget.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/texttools/texttoolswidget.cpp')
-rw-r--r-- | parts/texttools/texttoolswidget.cpp | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/parts/texttools/texttoolswidget.cpp b/parts/texttools/texttoolswidget.cpp index ff85d0f0..630609c5 100644 --- a/parts/texttools/texttoolswidget.cpp +++ b/parts/texttools/texttoolswidget.cpp @@ -11,9 +11,9 @@ #include "texttoolswidget.h" -#include <qheader.h> -#include <qregexp.h> -#include <qtimer.h> +#include <tqheader.h> +#include <tqregexp.h> +#include <tqtimer.h> #include <kdebug.h> #include <klocale.h> #include <kparts/part.h> @@ -30,52 +30,52 @@ class TextStructItem : public QListViewItem { public: - TextStructItem(QListView *parent) - : QListViewItem(parent) + TextStructItem(TQListView *parent) + : TQListViewItem(parent) {} - TextStructItem(QListViewItem *parent) - : QListViewItem(parent) + TextStructItem(TQListViewItem *parent) + : TQListViewItem(parent) { - QListViewItem *item = this; + TQListViewItem *item = this; while (item->nextSibling()) item = item->nextSibling(); if (item != this) moveItem(item); } - QString text(int) const + TQString text(int) const { - return extra.isNull()? tag : QString("%1: %2").arg(tag).arg(extra); + return extra.isNull()? tag : TQString("%1: %2").arg(tag).arg(extra); } TextStructItem *parentStructItem() { return static_cast<TextStructItem*>(parent()); } - QString tag; - QString extra; + TQString tag; + TQString extra; int pos; int endpos; }; -TextToolsWidget::TextToolsWidget(TextToolsPart *part, QWidget *parent, const char *name) +TextToolsWidget::TextToolsWidget(TextToolsPart *part, TQWidget *parent, const char *name) : KListView(parent, name) { - setResizeMode(QListView::LastColumn); + setResizeMode(TQListView::LastColumn); setSorting(-1); header()->hide(); - addColumn(QString::null); + addColumn(TQString::null); m_part = part; - m_timer = new QTimer(this); - connect( this, SIGNAL(mouseButtonPressed(int, QListViewItem*, const QPoint&, int)), - this, SLOT(slotItemPressed(int,QListViewItem*)) ); - // connect( this, SIGNAL(doubleClicked(QListViewItem*)), - // this, SLOT(slotItemPressed(int,QListViewItem*)) ); - connect( this, SIGNAL(returnPressed(QListViewItem*)), - this, SLOT(slotReturnPressed(QListViewItem*)) ); - connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), - this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) ); + m_timer = new TQTimer(this); + connect( this, TQT_SIGNAL(mouseButtonPressed(int, TQListViewItem*, const TQPoint&, int)), + this, TQT_SLOT(slotItemPressed(int,TQListViewItem*)) ); + // connect( this, TQT_SIGNAL(doubleClicked(TQListViewItem*)), + // this, TQT_SLOT(slotItemPressed(int,TQListViewItem*)) ); + connect( this, TQT_SIGNAL(returnPressed(TQListViewItem*)), + this, TQT_SLOT(slotReturnPressed(TQListViewItem*)) ); + connect( this, TQT_SIGNAL(contextMenu(KListView*, TQListViewItem*, const TQPoint&)), + this, TQT_SLOT(slotContextMenu(KListView*, TQListViewItem*, const TQPoint&)) ); } @@ -83,7 +83,7 @@ TextToolsWidget::~TextToolsWidget() {} -void TextToolsWidget::slotItemPressed(int button, QListViewItem *item) +void TextToolsWidget::slotItemPressed(int button, TQListViewItem *item) { if (!item) return; @@ -107,7 +107,7 @@ void TextToolsWidget::slotItemPressed(int button, QListViewItem *item) } if (pos == searchedEndpos) break; - QChar ch = m_cachedText[pos]; + TQChar ch = m_cachedText[pos]; if (ch == '\n') { ++endline; endcol = 0; @@ -119,7 +119,7 @@ void TextToolsWidget::slotItemPressed(int button, QListViewItem *item) KParts::Part *rwpart = dynamic_cast<KParts::Part*>(m_part->partController()->activePart()); - QWidget *view = m_part->partController()->activeWidget(); + TQWidget *view = m_part->partController()->activeWidget(); KTextEditor::ViewCursorInterface *cursorIface = dynamic_cast<KTextEditor::ViewCursorInterface*>(view); @@ -142,13 +142,13 @@ void TextToolsWidget::slotItemPressed(int button, QListViewItem *item) } -void TextToolsWidget::slotReturnPressed(QListViewItem *item) +void TextToolsWidget::slotReturnPressed(TQListViewItem *item) { slotItemPressed(LeftButton, item); } -void TextToolsWidget::slotContextMenu(KListView *, QListViewItem *item, const QPoint &) +void TextToolsWidget::slotContextMenu(KListView *, TQListViewItem *item, const TQPoint &) { if (!item) return; @@ -165,14 +165,14 @@ void TextToolsWidget::stop() disconnect( m_timer ); m_relevantTags.clear(); m_emptyTags.clear(); - m_cachedText = QString::null; + m_cachedText = TQString::null; } void TextToolsWidget::setMode(Mode mode, KParts::Part *part) { - connect( part, SIGNAL(textChanged()), - this, SLOT(startTimer()) ); + connect( part, TQT_SIGNAL(textChanged()), + this, TQT_SLOT(startTimer()) ); m_editIface = dynamic_cast<KTextEditor::EditInterface*>(part); switch (mode) { @@ -181,18 +181,18 @@ void TextToolsWidget::setMode(Mode mode, KParts::Part *part) << "table" << "tr"; m_emptyTags << "br" << "hr" << "img" << "input" << "p" << "meta"; - connect( m_timer, SIGNAL(timeout()), - this, SLOT(parseXML()) ); + connect( m_timer, TQT_SIGNAL(timeout()), + this, TQT_SLOT(parseXML()) ); break; case Docbook: m_relevantTags << "chapter" << "sect1" << "sect2" << "para" << "formalpara"; - connect( m_timer, SIGNAL(timeout()), - this, SLOT(parseXML()) ); + connect( m_timer, TQT_SIGNAL(timeout()), + this, TQT_SLOT(parseXML()) ); break; case LaTeX: - connect( m_timer, SIGNAL(timeout()), - this, SLOT(parseLaTeX()) ); + connect( m_timer, TQT_SIGNAL(timeout()), + this, TQT_SLOT(parseLaTeX()) ); break; default: ; } @@ -212,7 +212,7 @@ void TextToolsWidget::parseXML() { kdDebug(9030) << "Starting to parse XML" << endl; clear(); - QString text = m_editIface->text(); + TQString text = m_editIface->text(); m_cachedText = text; TextStructItem *currentItem = new TextStructItem(this); @@ -222,18 +222,18 @@ void TextToolsWidget::parseXML() int len = text.length(); for (int pos=0; pos+1 < len; ++pos) { - QChar ch1 = text[pos]; - QChar ch2 = text[pos+1]; + TQChar ch1 = text[pos]; + TQChar ch2 = text[pos+1]; if (ch1 == '<' && ch2 == '?') { // PHP and other similar stuff - QString tag; + TQString tag; int endpos = pos+2; bool foundspace = false; while (endpos+1 < len) { - QChar ch3 = text[endpos]; - QChar ch4 = text[endpos+1]; + TQChar ch3 = text[endpos]; + TQChar ch4 = text[endpos+1]; if ((ch3 == ' ' || ch3 == '\t' || ch3 == '\n') && !foundspace) { tag = text.mid(pos+2, endpos-pos-2).lower(); foundspace = true; @@ -255,11 +255,11 @@ void TextToolsWidget::parseXML() } else if (ch1 == '<' && ch2 == '!') { // Processing instructions like !DOCTYPE - QString tag; + TQString tag; int endpos = pos+2; bool foundspace = false; while (endpos+1 < len) { - QChar ch3 = text[endpos]; + TQChar ch3 = text[endpos]; if ((ch3 == ' ' || ch3 == '\t' || ch3 == '\n') && !foundspace) { tag = text.mid(pos+2, endpos-pos-2).lower(); foundspace = true; @@ -280,10 +280,10 @@ void TextToolsWidget::parseXML() } else if (ch1 == '<' && ch2 == '/') { - QString tag; + TQString tag; int endpos = pos+2; while (endpos < len) { - QChar ch3 = text[endpos]; + TQChar ch3 = text[endpos]; if (ch3 == '>') { tag = text.mid(pos+2, endpos-pos-2).lower(); break; @@ -310,11 +310,11 @@ void TextToolsWidget::parseXML() } else if (ch1 == '<') { - QString tag; + TQString tag; int endpos = pos+1; bool foundspace = false; while (endpos < len) { - QChar ch3 = text[endpos]; + TQChar ch3 = text[endpos]; if ((ch3 == ' ' || ch3 == '\t' || ch3 == '\n') && !foundspace) { tag = text.mid(pos+1, endpos-pos-1).lower(); foundspace = true; @@ -347,7 +347,7 @@ void TextToolsWidget::parseXML() } // firstChild()->setOpen(true); - QListViewItemIterator it(this); + TQListViewItemIterator it(this); for (; it.current(); ++it) it.current()->setOpen(true); } @@ -357,7 +357,7 @@ void TextToolsWidget::parseLaTeX() { kdDebug(9030) << "Starting to parse LaTeX" << endl; clear(); - QString text = m_editIface->text(); + TQString text = m_editIface->text(); m_cachedText = text; TextStructItem *currentItem = new TextStructItem(this); @@ -365,16 +365,16 @@ void TextToolsWidget::parseLaTeX() currentItem->pos = -1; currentItem->endpos = -1; - QString hierarchyLevels = "Root,chapter,section,subsection,subsubsection"; - QRegExp re("\n[ \t]*s*\\\\(chapter|section|subsection|subsubsection)\\{([^}]*)\\}"); + TQString hierarchyLevels = "Root,chapter,section,subsection,subsubsection"; + TQRegExp re("\n[ \t]*s*\\\\(chapter|section|subsection|subsubsection)\\{([^}]*)\\}"); int pos=0; for (;;) { pos = re.search(text, pos); if (pos == -1) break; - QString tag = re.cap(1); - QString title = re.cap(2); + TQString tag = re.cap(1); + TQString title = re.cap(2); kdDebug(9030) << "Match with " << tag << " and title " << title << endl; int level = hierarchyLevels.find(tag); while (currentItem->parent() && level <= hierarchyLevels.find(currentItem->tag)) @@ -392,7 +392,7 @@ void TextToolsWidget::parseLaTeX() pos = pos+re.matchedLength(); } - QListViewItemIterator it(this); + TQListViewItemIterator it(this); for (; it.current(); ++it) it.current()->setOpen(true); } |