From d6f8bbb45b267065a6907e71ff9c98bb6d161241 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:56:07 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../lib/parsers/autotools/autotools_yacc.cpp | 10 +-- buildtools/lib/parsers/autotools/autotoolsast.cpp | 24 +++---- buildtools/lib/parsers/autotools/autotoolsast.h | 44 ++++++------- .../lib/parsers/autotools/autotoolsdriver.cpp | 8 +-- buildtools/lib/parsers/autotools/autotoolsdriver.h | 6 +- buildtools/lib/parsers/autotools/tests/viewer.cpp | 74 +++++++++++----------- buildtools/lib/parsers/autotools/tests/viewer.h | 12 ++-- .../lib/parsers/autotools/tests/viewer_main.cpp | 4 +- 8 files changed, 91 insertions(+), 91 deletions(-) (limited to 'buildtools/lib/parsers/autotools') diff --git a/buildtools/lib/parsers/autotools/autotools_yacc.cpp b/buildtools/lib/parsers/autotools/autotools_yacc.cpp index 827cf4bc..93cdb733 100644 --- a/buildtools/lib/parsers/autotools/autotools_yacc.cpp +++ b/buildtools/lib/parsers/autotools/autotools_yacc.cpp @@ -150,7 +150,7 @@ noinst_HEADERS = foo.h #regognize me @fixme 1 shift/reduce conflict in "line_body" rule */ -#include +#include #include "autotoolsast.h" #define YYSTYPE_IS_DECLARED @@ -164,7 +164,7 @@ struct Result { Result(): node(0) {} /**Type of semantic value for simple grammar rules.*/ - QString value; + TQString value; /**Type of semantic value for grammar rules which are parts of AST.*/ AST *node; /**Type of semantic value for "multiline_values" grammar rule. @@ -183,7 +183,7 @@ struct Result { foo3.cpp foo4.cpp */ - QStringList values; + TQStringList values; }; typedef Result YYSTYPE; @@ -206,7 +206,7 @@ When a scope or function scope statement is parsed, the child ProjectAST is crea and pushed onto the stack. Therefore all statements which belong to the scope or function scope are added as childs to their direct parent (scope or function scope). */ -QValueStack projects; +TQValueStack projects; /** The current depth of AST node is stored here. @@ -1381,7 +1381,7 @@ yyreduce: { AssignmentAST *node = new AssignmentAST(); node->scopedID = yyvsp[-1].value; - node->values = QStringList(yyvsp[0].value); + node->values = TQStringList(yyvsp[0].value); yyval.node = node; ;} break; diff --git a/buildtools/lib/parsers/autotools/autotoolsast.cpp b/buildtools/lib/parsers/autotools/autotoolsast.cpp index 757f4699..ddcbddc3 100644 --- a/buildtools/lib/parsers/autotools/autotoolsast.cpp +++ b/buildtools/lib/parsers/autotools/autotoolsast.cpp @@ -28,7 +28,7 @@ namespace AutoTools { AST::~AST() { - for (QValueList::iterator it = m_children.begin(); it != m_children.end(); ++it) + for (TQValueList::iterator it = m_children.begin(); it != m_children.end(); ++it) { AST *node = *it; delete node; @@ -40,9 +40,9 @@ void AST::addChildAST(AST *node) m_children.append(node); } -void AST::writeBack(QString &buffer) +void AST::writeBack(TQString &buffer) { - for (QValueList::const_iterator it = m_children.constBegin(); + for (TQValueList::const_iterator it = m_children.constBegin(); it != m_children.constEnd(); ++it) { if (*it) @@ -50,9 +50,9 @@ void AST::writeBack(QString &buffer) } } -QString AST::indentation() +TQString AST::indentation() { - QString result; + TQString result; for (int i = 0; i < depth(); i++) result += '\t'; return result; @@ -63,14 +63,14 @@ bool AST::hasChildren() const return !m_children.isEmpty(); } -QValueList AST::children() const +TQValueList AST::children() const { return m_children; } //ProjectAST -void ProjectAST::writeBack(QString &buffer) +void ProjectAST::writeBack(TQString &buffer) { if ( isRule() ) buffer += scopedID; @@ -87,27 +87,27 @@ void ProjectAST::addChildAST(AST *node) AST::addChildAST(node); } -void AssignmentAST::writeBack(QString &buffer) +void AssignmentAST::writeBack(TQString &buffer) { buffer += indentation() + scopedID + " " + op + values.join(""); } -void AutomakeTargetAST::writeBack( QString& buffer ) +void AutomakeTargetAST::writeBack( TQString& buffer ) { buffer += target + ":" + deps.join(""); } -void ConditionAST::writeBack( QString& buffer ) +void ConditionAST::writeBack( TQString& buffer ) { buffer += indentation() + type + " " + conditionName; } -void NewLineAST::writeBack(QString &buffer) +void NewLineAST::writeBack(TQString &buffer) { buffer += "\n"; } -void CommentAST::writeBack(QString &buffer) +void CommentAST::writeBack(TQString &buffer) { buffer += indentation() + comment; } diff --git a/buildtools/lib/parsers/autotools/autotoolsast.h b/buildtools/lib/parsers/autotools/autotoolsast.h index 9c7ae66a..768e3e07 100644 --- a/buildtools/lib/parsers/autotools/autotoolsast.h +++ b/buildtools/lib/parsers/autotools/autotoolsast.h @@ -23,7 +23,7 @@ #ifndef AUTOTOOLSAST_H #define AUTOTOOLSAST_H -#include +#include /** @file autotools.h @@ -71,7 +71,7 @@ public: * This is a default implementation which iterates over child nodes * and calls writeBack for each child node. */ - virtual void writeBack(QString &buffer); + virtual void writeBack(TQString &buffer); /** @return The type of the node.*/ virtual NodeType nodeType() const { return m_nodeType; } @@ -83,7 +83,7 @@ public: int depth() const { return m_depth; } /** @return The indentation string based on node depth.*/ - virtual QString indentation(); + virtual TQString indentation(); //! \return true if this AST has children bool hasChildren() const; @@ -92,13 +92,13 @@ public: * Get the children of this ast * \return the list of this ast's childre */ - QValueList children() const; + TQValueList children() const; protected: NodeType m_nodeType; - QValueList m_children; + TQValueList m_children; private: int m_depth; @@ -135,7 +135,7 @@ public: /** Constructs a project node of given @p kind. */ ProjectAST(Kind kind = Project): AST(AST::ProjectAST), m_kind(kind) {} - virtual void writeBack(QString &buffer); + virtual void writeBack(TQString &buffer); virtual void addChildAST(AST *node); /** @return true if this node is a project.*/ @@ -150,16 +150,16 @@ public: bool isEmpty() const { return m_kind == Empty; } /**Scoped identifier (scope name or rule).*/ - QString scopedID; + TQString scopedID; /**Function arguments. Empty for other kinds of projects.*/ - QString args; + TQString args; /** The automake conditional has an else attached */ bool hasElse; /**List of statements.*/ - QValueList statements; + TQValueList statements; private: Kind m_kind; @@ -192,16 +192,16 @@ class AssignmentAST: public AST public: AssignmentAST(): AST(AST::AssignmentAST) {} - virtual void writeBack(QString &buffer); + virtual void writeBack(TQString &buffer); /**Scoped name of the variable.*/ - QString scopedID; + TQString scopedID; /**Operator.*/ - QString op; + TQString op; /**List of values.*/ - QStringList values; + TQStringList values; }; class AutomakeTargetAST : public AST @@ -209,13 +209,13 @@ class AutomakeTargetAST : public AST public: AutomakeTargetAST() : AST(AST::TargetAST) {} - virtual void writeBack( QString& buffer ); + virtual void writeBack( TQString& buffer ); /// The name of the target - QString target; + TQString target; /// The dependencies for the target, if any - QStringList deps; + TQStringList deps; }; class ConditionAST : public AST @@ -223,13 +223,13 @@ class ConditionAST : public AST public: ConditionAST() : AST( AST::MakefileConditionalAST ) {} - virtual void writeBack( QString& buffer ); + virtual void writeBack( TQString& buffer ); /// The keyword for the condition (if, else, endif) - QString type; + TQString type; /// The name of the condition - QString conditionName; + TQString conditionName; }; /** @@ -241,7 +241,7 @@ class NewLineAST: public AST public: NewLineAST(): AST(AST::NewLineAST) {} - virtual void writeBack(QString &buffer); + virtual void writeBack(TQString &buffer); }; @@ -255,10 +255,10 @@ class CommentAST: public AST public: CommentAST(): AST(AST::CommentAST) {} - virtual void writeBack(QString &buffer); + virtual void writeBack(TQString &buffer); /**Comment text.*/ - QString comment; + TQString comment; }; diff --git a/buildtools/lib/parsers/autotools/autotoolsdriver.cpp b/buildtools/lib/parsers/autotools/autotoolsdriver.cpp index a3d53151..05734c3f 100644 --- a/buildtools/lib/parsers/autotools/autotoolsdriver.cpp +++ b/buildtools/lib/parsers/autotools/autotoolsdriver.cpp @@ -24,13 +24,13 @@ #include "autotoolsast.h" #include -#include +#include #include extern FILE *yyin, *yyout; extern int yyparse(); //extern int yydebug; -extern QValueStack projects; +extern TQValueStack projects; namespace AutoTools { @@ -49,14 +49,14 @@ int Driver::parseFile(const char *fileName, ProjectAST **ast) return ret; } -int Driver::parseFile(QString fileName, ProjectAST **ast) +int Driver::parseFile(TQString fileName, ProjectAST **ast) { return parseFile(fileName.ascii(), ast); } int Driver::parseFile(KURL fileName, ProjectAST **ast) { - QString tmpFile; + TQString tmpFile; int ret = 0; if (KIO::NetAccess::download(fileName, tmpFile, 0)) ret = parseFile(tmpFile, ast); diff --git a/buildtools/lib/parsers/autotools/autotoolsdriver.h b/buildtools/lib/parsers/autotools/autotoolsdriver.h index 4e52c6ec..5f6ac7e7 100644 --- a/buildtools/lib/parsers/autotools/autotoolsdriver.h +++ b/buildtools/lib/parsers/autotools/autotoolsdriver.h @@ -23,7 +23,7 @@ #ifndef QMAKEQMAKEDRIVER_H #define QMAKEQMAKEDRIVER_H -#include +#include #include namespace AutoTools { @@ -49,14 +49,14 @@ public: * @return The result of parsing. Result is 0 on success and <> 0 on failure. */ static int parseFile(const char *fileName, ProjectAST **ast); - static int parseFile(QString fileName, ProjectAST **ast); + static int parseFile(TQString fileName, ProjectAST **ast); static int parseFile(KURL fileName, ProjectAST **ast); /* template static void walkAST(Op &op, const ProjectAST *ast) { // op(ast); - for (QValueList::const_iterator it = ast->statements.constBegin(); + for (TQValueList::const_iterator it = ast->statements.constBegin(); it != ast->statements.constEnd(); ++it) { const AST *child = *it; diff --git a/buildtools/lib/parsers/autotools/tests/viewer.cpp b/buildtools/lib/parsers/autotools/tests/viewer.cpp index 24d6aea4..0dc8e733 100644 --- a/buildtools/lib/parsers/autotools/tests/viewer.cpp +++ b/buildtools/lib/parsers/autotools/tests/viewer.cpp @@ -19,61 +19,61 @@ ***************************************************************************/ #include "viewer.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include using namespace AutoTools; -Viewer::Viewer(QWidget *parent, const char *name) +Viewer::Viewer(TQWidget *parent, const char *name) :ViewerBase(parent, name) { - if (QFile::exists(QDir::currentDirPath() + "/" + "qtlist")) + if (TQFile::exists(TQDir::currentDirPath() + "/" + "qtlist")) { - QFile f(QDir::currentDirPath() + "/" + "qtlist"); + TQFile f(TQDir::currentDirPath() + "/" + "qtlist"); f.open(IO_ReadOnly); - QTextStream str(&f); + TQTextStream str(&f); while (!str.eof()) files->insertItem(str.readLine()); } ast->setSorting(-1); - parentProject.push((QListViewItem*)0); + parentProject.push((TQListViewItem*)0); } void Viewer::addAll_clicked() { if (allLocation->text().isEmpty()) return; - QDir d(allLocation->text()); - QStringList l = d.entryList("*.am"); - for (QStringList::iterator it = l.begin(); it != l.end(); ++it) - (*it) = QDir::cleanDirPath(allLocation->text() + "/" + (*it)); + TQDir d(allLocation->text()); + TQStringList l = d.entryList("*.am"); + for (TQStringList::iterator it = l.begin(); it != l.end(); ++it) + (*it) = TQDir::cleanDirPath(allLocation->text() + "/" + (*it)); files->insertStringList(l); } void Viewer::choose_clicked() { - QString fileName = QFileDialog::getOpenFileName(QDir::currentDirPath(), "*.am", this); + TQString fileName = TQFileDialog::getOpenFileName(TQDir::currentDirPath(), "*.am", this); if (!fileName.isEmpty()) files->insertItem(fileName); } -void Viewer::files_currentChanged(QListBoxItem* item) +void Viewer::files_currentChanged(TQListBoxItem* item) { ast->clear(); - QFile f(item->text()); + TQFile f(item->text()); f.open(IO_ReadOnly); - QTextStream str(&f); + TQTextStream str(&f); source->setText(str.read()); f.close(); @@ -86,30 +86,30 @@ void Viewer::files_currentChanged(QListBoxItem* item) tabWidget2_selected("Source to be written back"); } -void Viewer::tabWidget2_selected(const QString& text) +void Viewer::tabWidget2_selected(const TQString& text) { if ((text == "Source to be written back") && projectAST) { - QString buffer; + TQString buffer; projectAST->writeBack(buffer); writeBack->setText(buffer); } } -void Viewer::processAST(ProjectAST *projectAST, QListViewItem *globAfter) +void Viewer::processAST(ProjectAST *projectAST, TQListViewItem *globAfter) { - QListViewItem *projectIt; + TQListViewItem *projectIt; if (!parentProject.top()) - projectIt = new QListViewItem(ast, "Project"); + projectIt = new TQListViewItem(ast, "Project"); else { if ( projectAST->isConditionalScope() || projectAST->isRule() ) - projectIt = new QListViewItem(parentProject.top(), globAfter, projectAST->scopedID); + projectIt = new TQListViewItem(parentProject.top(), globAfter, projectAST->scopedID); } projectIt->setOpen(true); - QListViewItem *after = 0; - for (QValueList::const_iterator it = projectAST->statements.constBegin(); + TQListViewItem *after = 0; + for (TQValueList::const_iterator it = projectAST->statements.constBegin(); it != projectAST->statements.constEnd(); ++it) { AST *ast = *it; @@ -118,7 +118,7 @@ void Viewer::processAST(ProjectAST *projectAST, QListViewItem *globAfter) switch (ast->nodeType()) { case AST::AssignmentAST: { AssignmentAST *assignmentAST = static_cast(ast); - QListViewItem *item = new QListViewItem(projectIt, after, + TQListViewItem *item = new TQListViewItem(projectIt, after, assignmentAST->scopedID, assignmentAST->op, assignmentAST->values.join("")); item->setMultiLinesEnabled(true); after = item; } @@ -127,25 +127,25 @@ void Viewer::processAST(ProjectAST *projectAST, QListViewItem *globAfter) case AST::TargetAST: { AutomakeTargetAST* ata = static_cast(ast); - QListViewItem* item = new QListViewItem(projectIt, after, - ata->target, QString::null, ata->deps.join("")); + TQListViewItem* item = new TQListViewItem(projectIt, after, + ata->target, TQString::null, ata->deps.join("")); after = item; } break; case AST::NewLineAST: -// after = new QListViewItem(projectIt, after, ""); +// after = new TQListViewItem(projectIt, after, ""); break; case AST::CommentAST: -// after = new QListViewItem(projectIt, after, ""); +// after = new TQListViewItem(projectIt, after, ""); break; case AST::MakefileConditionalAST: { ConditionAST* ata = static_cast(ast); - QListViewItem* item = new QListViewItem(projectIt, after, - ata->type, ata->conditionName, QString::null ); + TQListViewItem* item = new TQListViewItem(projectIt, after, + ata->type, ata->conditionName, TQString::null ); after = item; } case AST::ProjectAST: { diff --git a/buildtools/lib/parsers/autotools/tests/viewer.h b/buildtools/lib/parsers/autotools/tests/viewer.h index f46cec46..3b0443f7 100644 --- a/buildtools/lib/parsers/autotools/tests/viewer.h +++ b/buildtools/lib/parsers/autotools/tests/viewer.h @@ -20,7 +20,7 @@ #ifndef VIEWER_H #define VIEWER_H -#include +#include #include "viewerbase.h" @@ -31,16 +31,16 @@ class QListViewItem; class Viewer: public ViewerBase { Q_OBJECT public: - Viewer(QWidget *parent = 0, const char *name = 0); - void processAST(AutoTools::ProjectAST *projectAST, QListViewItem *globAfter = 0); + Viewer(TQWidget *parent = 0, const char *name = 0); + void processAST(AutoTools::ProjectAST *projectAST, TQListViewItem *globAfter = 0); public slots: - virtual void tabWidget2_selected(const QString&); - virtual void files_currentChanged(QListBoxItem*); + virtual void tabWidget2_selected(const TQString&); + virtual void files_currentChanged(TQListBoxItem*); virtual void choose_clicked(); virtual void addAll_clicked(); private: AutoTools::ProjectAST *projectAST; - QValueStack parentProject; + TQValueStack parentProject; }; #endif diff --git a/buildtools/lib/parsers/autotools/tests/viewer_main.cpp b/buildtools/lib/parsers/autotools/tests/viewer_main.cpp index 707a1364..380767a9 100644 --- a/buildtools/lib/parsers/autotools/tests/viewer_main.cpp +++ b/buildtools/lib/parsers/autotools/tests/viewer_main.cpp @@ -17,12 +17,12 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include +#include #include "viewer.h" int main(int argc, char **argv) { - QApplication app(argc, argv); + TQApplication app(argc, argv); Viewer viewer; app.setMainWidget(&viewer); -- cgit v1.2.1