diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
commit | 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch) | |
tree | b95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/libgui/text_editor.cpp | |
parent | b79a2c28534cf09987eeeba3077fff9236df182a (diff) | |
download | piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip |
TQt4 port piklab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/libgui/text_editor.cpp')
-rw-r--r-- | src/libgui/text_editor.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/libgui/text_editor.cpp b/src/libgui/text_editor.cpp index aecbc99..eb9d16f 100644 --- a/src/libgui/text_editor.cpp +++ b/src/libgui/text_editor.cpp @@ -9,9 +9,9 @@ ***************************************************************************/ #include "text_editor.h" -#include <qfile.h> -#include <qtextedit.h> -#include <qlayout.h> +#include <tqfile.h> +#include <tqtextedit.h> +#include <tqlayout.h> #include <klibloader.h> #include <kpopupmenu.h> @@ -37,33 +37,33 @@ const TextEditor::MarkTypeData TextEditor::MARK_TYPE_DATA[Breakpoint::Nb_MarkTyp { KTextEditor::MarkInterface::Error, "piklab_breakpoint_invalid" } }; -QPixmap TextEditor::pixmap(Breakpoint::MarkType type) +TQPixmap TextEditor::pixmap(Breakpoint::MarkType type) { return SmallIcon(MARK_TYPE_DATA[type].pixmap); } -TextEditor::TextEditor(bool withDebugger, QWidget *parent, const char *name) - : Editor(parent, name), _view(0) +TextEditor::TextEditor(bool withDebugger, TQWidget *tqparent, const char *name) + : Editor(tqparent, name), _view(0) { KLibFactory *factory = KLibLoader::self()->factory("libkatepart"); if ( factory==0 ) qFatal("Could not find katepart"); - _document = static_cast<Kate::Document *>(factory->create(this, "kate", "KTextEditor::Document")); + _document = static_cast<Kate::Document *>(factory->create(TQT_TQOBJECT(this), "kate", "KTextEditor::Document")); _oldModified = _document->isModified(); _oldReadOnly = !_document->isReadWrite(); - QVBoxLayout *top = new QVBoxLayout(this, 0, 10); - _split = new QSplitter(this); - _split->setFrameStyle(QFrame::TabWidgetPanel | QFrame::Sunken); + TQVBoxLayout *top = new TQVBoxLayout(this, 0, 10); + _split = new TQSplitter(this); + _split->setFrameStyle(TQFrame::TabWidgetPanel | TQFrame::Sunken); top->addWidget(_split); - connect(_document, SIGNAL(hlChanged()), SLOT(highlightChanged())); + connect(_document, TQT_SIGNAL(hlChanged()), TQT_SLOT(highlightChanged())); setAcceptDrops(true); addView(); for (uint i=0; i<Breakpoint::Nb_MarkTypes; i++) _document->setPixmap(KTextEditor::MarkInterface::MarkTypes(MARK_TYPE_DATA[i].type), pixmap(Breakpoint::MarkType(i))); - if (withDebugger) QTimer::singleShot(0, this, SLOT(addToDebugManager())); + if (withDebugger) TQTimer::singleShot(0, this, TQT_SLOT(addToDebugManager())); } bool TextEditor::open(const PURL::Url &url) @@ -80,10 +80,10 @@ void TextEditor::addToDebugManager() static_cast<Debugger::GuiManager *>(Debugger::manager)->addTextEditor(*this); } -bool TextEditor::eventFilter(QObject *, QEvent *e) +bool TextEditor::eventFilter(TQObject *, TQEvent *e) { - if ( e->type()==QEvent::KeyPress ) { - if ( static_cast<QKeyEvent *>(e)->key()==Key_Escape ) return true; + if ( e->type()==TQEvent::KeyPress ) { + if ( TQT_TQKEYEVENT(e)->key()==Key_Escape ) return true; } return false; } @@ -93,10 +93,10 @@ void TextEditor::addView() KTextEditor::View *v = _document->createView(_split); if ( _view==0 ) _view = static_cast<Kate::View *>(v); Q_ASSERT(v); - connect(v, SIGNAL(gotFocus(Kate::View *)), SLOT(gotFocus(Kate::View *))); - connect(v, SIGNAL(cursorPositionChanged()), SLOT(statusChanged())); - connect(v, SIGNAL(dropEventPass(QDropEvent *)), SIGNAL(dropEventPass(QDropEvent *))); - connect(v, SIGNAL(newStatus()), SLOT(statusChanged())); + connect(v, TQT_SIGNAL(gotFocus(Kate::View *)), TQT_SLOT(gotFocus(Kate::View *))); + connect(v, TQT_SIGNAL(cursorPositionChanged()), TQT_SLOT(statusChanged())); + connect(v, TQT_SIGNAL(dropEventPass(TQDropEvent *)), TQT_SIGNAL(dropEventPass(TQDropEvent *))); + connect(v, TQT_SIGNAL(newtqStatus()), TQT_SLOT(statusChanged())); v->show(); v->setFocus(); v->child(0, "KateViewInternal")->installEventFilter(this); @@ -104,8 +104,8 @@ void TextEditor::addView() pmi->installPopup(&Main::popup("ktexteditor_popup")); // dispatch available space between views - QValueList<int> list = _split->sizes(); - QValueList<int>::Iterator it; + TQValueList<int> list = _split->sizes(); + TQValueList<int>::Iterator it; int sum = 0; for (it = list.begin(); it!= list.end(); ++it) sum += *it; sum /= list.size(); @@ -167,7 +167,7 @@ void TextEditor::statusChanged() { uint line, col; _view->cursorPosition(&line, &col) ; - QString text = i18n("Line: %1 Col: %2").arg(line+1).arg(col+1); + TQString text = i18n("Line: %1 Col: %2").tqarg(line+1).tqarg(col+1); if( isReadOnly() ) text += " " + i18n("R/O"); emit statusTextChanged(" " + text + " "); if ( isReadOnly()!=_oldReadOnly || isModified()!=_oldModified ) emit guiChanged(); @@ -178,7 +178,7 @@ void TextEditor::statusChanged() Breakpoint::updateActions(&data); } -uint TextEditor::highlightMode(const QString &name) const +uint TextEditor::highlightMode(const TQString &name) const { uint mode = 0; for (; mode<_document->hlModeCount(); mode++) @@ -213,8 +213,8 @@ void TextEditor::setMark(uint line, Breakpoint::MarkType type) void TextEditor::clearMarks(uint type) { - QPtrList<KTextEditor::Mark> marks = _document->marks(); - QPtrListIterator<KTextEditor::Mark> it(marks); + TQPtrList<KTextEditor::Mark> marks = _document->marks(); + TQPtrListIterator<KTextEditor::Mark> it(marks); for (; it.current(); ++it) if ( it.current()->type==type ) _document->removeMark(it.current()->line, it.current()->type); } @@ -224,20 +224,20 @@ void TextEditor::clearBreakpointMarks() for (uint i=0; i<Breakpoint::Nb_MarkTypes; i++) clearMarks(MARK_TYPE_DATA[i].type); } -QValueList<uint> TextEditor::bookmarkLines() const +TQValueList<uint> TextEditor::bookmarkLines() const { - QValueList<uint> lines; - QPtrList<KTextEditor::Mark> marks = _document->marks(); - QPtrListIterator<KTextEditor::Mark> it(marks); + TQValueList<uint> lines; + TQPtrList<KTextEditor::Mark> marks = _document->marks(); + TQPtrListIterator<KTextEditor::Mark> it(marks); for (; it.current(); ++it) if ( it.current()->type==KTextEditor::MarkInterface::Bookmark ) lines.append(it.current()->line); return lines; } -void TextEditor::setBookmarkLines(const QValueList<uint> &lines) +void TextEditor::setBookmarkLines(const TQValueList<uint> &lines) { clearMarks(KTextEditor::MarkInterface::Bookmark); - QValueList<uint>::const_iterator it; + TQValueList<uint>::const_iterator it; for (it=lines.begin(); it!=lines.end(); ++it) _document->setMark(*it, KTextEditor::MarkInterface::Bookmark); } @@ -251,8 +251,8 @@ void TextEditor::slotChangedText() //Found in the descript Qstringlist. - QString currentword; - QString testval; + TQString currentword; + TQString testval; Kate::View *v = currentView(); currentword = v->currentTextLine(); @@ -260,7 +260,7 @@ void TextEditor::slotChangedText() currentword = currentword.simplifyWhiteSpace(); currentword = currentword.upper(); - for ( QStringList::Iterator it = descript.begin(); it != descript.end(); ++it ) + for ( TQStringList::Iterator it = descript.begin(); it != descript.end(); ++it ) { testval = *it; if(testval.startsWith(currentword.left(5))) @@ -321,12 +321,12 @@ void TextEditor::populateList() #endif //----------------------------------------------------------------------------- -SimpleTextEditor::SimpleTextEditor(bool withDebugger, PURL::FileType type, QWidget *parent, const char *name) - : TextEditor(withDebugger, parent, name), _type(type), _file(_sview) +SimpleTextEditor::SimpleTextEditor(bool withDebugger, PURL::FileType type, TQWidget *tqparent, const char *name) + : TextEditor(withDebugger, tqparent, name), _type(type), _file(_sview) {} -SimpleTextEditor::SimpleTextEditor(bool withDebugger, QWidget *parent, const char *name) - : TextEditor(withDebugger, parent, name), _type(PURL::Nb_FileTypes), _file(_sview) +SimpleTextEditor::SimpleTextEditor(bool withDebugger, TQWidget *tqparent, const char *name) + : TextEditor(withDebugger, tqparent, name), _type(PURL::Nb_FileTypes), _file(_sview) {} bool SimpleTextEditor::open(const PURL::Url &url) @@ -335,7 +335,7 @@ bool SimpleTextEditor::open(const PURL::Url &url) return TextEditor::open(url); } -bool SimpleTextEditor::setText(const QString &text) +bool SimpleTextEditor::setText(const TQString &text) { _file.openForWrite(); _file.appendText(text); |