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/distpart/specsupport.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/distpart/specsupport.cpp')
-rw-r--r-- | parts/distpart/specsupport.cpp | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/parts/distpart/specsupport.cpp b/parts/distpart/specsupport.cpp index e3ca8a65..ab4d684f 100644 --- a/parts/distpart/specsupport.cpp +++ b/parts/distpart/specsupport.cpp @@ -27,25 +27,25 @@ #include <kfiledialog.h> #include <klocale.h> #include <kprocess.h> -#include <qfile.h> -#include <qdir.h> -#include <qerrormessage.h> -#include <qregexp.h> -#include <qpushbutton.h> -//#include <qvbox.h> -#include <qgroupbox.h> -#include <qtabwidget.h> -#include <qmessagebox.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqerrormessage.h> +#include <tqregexp.h> +#include <tqpushbutton.h> +//#include <tqvbox.h> +#include <tqgroupbox.h> +#include <tqtabwidget.h> +#include <tqmessagebox.h> /// \FIXME This is at least the fifth place in the kdevelop code something like this exists -QString QRegExp_escape(const QString& str ) +TQString QRegExp_escape(const TQString& str ) { #if QT_VERSION >= 0x030100 - return QRegExp::escape(str); + return TQRegExp::escape(str); #else // this block is copyrighted by Trolltech AS (GPL) static const char meta[] = "$()*+.?[\\]^{|}"; - QString quoted = str; + TQString quoted = str; int i = 0; while ( i < (int) quoted.length() ) { @@ -60,21 +60,21 @@ QString QRegExp_escape(const QString& str ) SpecSupport::SpecSupport(DistpartPart *part) : packageBase(), m_part(part) { dir = ""; -// srcPackagePushButton = new QPushButton(i18n("Src Package"),area()); -// buildAllPushButton = new QPushButton(i18n("Src/Binary Packages"),area()); -// exportSPECPushButton = new QPushButton(i18n("Export SPEC File"),area()); -// importSPECPushButton = new QPushButton(i18n("Import SPEC File"),area()); +// srcPackagePushButton = new TQPushButton(i18n("Src Package"),area()); +// buildAllPushButton = new TQPushButton(i18n("Src/Binary Packages"),area()); +// exportSPECPushButton = new TQPushButton(i18n("Export SPEC File"),area()); +// importSPECPushButton = new TQPushButton(i18n("Import SPEC File"),area()); // // // -// connect(buildAllPushButton, SIGNAL(clicked()), -// this, SLOT(slotbuildAllPushButtonPressed())); -// connect(exportSPECPushButton, SIGNAL(clicked()), -// this, SLOT(slotexportSPECPushButtonPressed())); -// connect(importSPECPushButton, SIGNAL(clicked()), -// this, SLOT(slotimportSPECPushButtonPressed())); -// connect(srcPackagePushButton, SIGNAL(clicked()), -// this, SLOT(slotsrcPackagePushButtonPressed())); +// connect(buildAllPushButton, TQT_SIGNAL(clicked()), +// this, TQT_SLOT(slotbuildAllPushButtonPressed())); +// connect(exportSPECPushButton, TQT_SIGNAL(clicked()), +// this, TQT_SLOT(slotexportSPECPushButtonPressed())); +// connect(importSPECPushButton, TQT_SIGNAL(clicked()), +// this, TQT_SLOT(slotimportSPECPushButtonPressed())); +// connect(srcPackagePushButton, TQT_SIGNAL(clicked()), +// this, TQT_SLOT(slotsrcPackagePushButtonPressed())); parseDotRpmmacros(); } @@ -82,14 +82,14 @@ SpecSupport::SpecSupport(DistpartPart *part) : packageBase(), m_part(part) { SpecSupport::~SpecSupport() { } -// QPushButton* buildAllPushButton; +// TQPushButton* buildAllPushButton; void SpecSupport::slotbuildAllPushButtonPressed() { - QMap<QString,QString>::Iterator it; - QFile file1(dir + "/" + getAppSource()); - QFile file2(*(map.find("_sourcedir")) + "/" + getAppSource()); + TQMap<TQString,TQString>::Iterator it; + TQFile file1(dir + "/" + getAppSource()); + TQFile file2(*(map.find("_sourcedir")) + "/" + getAppSource()); if (!file2.exists()) { if (!file1.exists()) { - QMessageBox::critical(0 ,i18n("Error"),i18n("You need to create a source archive first.")); + TQMessageBox::critical(0 ,i18n("Error"),i18n("You need to create a source archive first.")); return; } else @@ -102,15 +102,15 @@ void SpecSupport::slotbuildAllPushButtonPressed() { " && rpmbuild -ba " + m_part->project()->projectName() + ".spec"); } -// QPushButton* exportSPECPushButton; +// TQPushButton* exportSPECPushButton; void SpecSupport::slotexportSPECPushButtonPressed() { - QMap<QString,QString>::Iterator it; - QString specname = ((it = map.find("_specdir")) != map.end()) ? (*it) : (m_part->project()->projectDirectory()); + TQMap<TQString,TQString>::Iterator it; + TQString specname = ((it = map.find("_specdir")) != map.end()) ? (*it) : (m_part->project()->projectDirectory()); specname += ("/" + m_part->project()->projectName() + ".spec"); - QFile file(specname); + TQFile file(specname); if(file.open(IO_WriteOnly)) { - QTextStream stream(&file); + TQTextStream stream(&file); stream << generatePackage(); file.close(); } else { @@ -118,26 +118,26 @@ void SpecSupport::slotexportSPECPushButtonPressed() { } } -QString SpecSupport::getInfo(QString s, QString motif) { - QRegExp re(motif + "[ \t]*([^ \t].*[^ \t])[ \t]*"); +TQString SpecSupport::getInfo(TQString s, TQString motif) { + TQRegExp re(motif + "[ \t]*([^ \t].*[^ \t])[ \t]*"); if (re.exactMatch(s)) return re.cap(1); - return QString::null; + return TQString::null; } -// QPushButton* importSPECPushButton; +// TQPushButton* importSPECPushButton; void SpecSupport::slotimportSPECPushButtonPressed() { - QString fileName = KFileDialog::getOpenFileName(dir,"*.spec"); + TQString fileName = KFileDialog::getOpenFileName(dir,"*.spec"); if( fileName.isEmpty()) return; - QFile file(fileName); + TQFile file(fileName); if(file.open(IO_ReadOnly)) { - QTextStream stream(&file); + TQTextStream stream(&file); while (!stream.atEnd()) { - QString s = stream.readLine(); - QString info; + TQString s = stream.readLine(); + TQString info; if (!(info = getInfo(s,"Name:")).isEmpty()) setAppName(info); else if (!(info = getInfo(s,"Version:")).isEmpty()) @@ -155,18 +155,18 @@ void SpecSupport::slotimportSPECPushButtonPressed() { else if (!(info = getInfo(s,"Packager:")).isEmpty()) setAppPackager(info); else if (s.startsWith("%description")) { - QString desc; + TQString desc; while (!stream.atEnd()) { - QString str = stream.readLine(); + TQString str = stream.readLine(); if (str.startsWith("%")) break; else desc += str + "\n"; } setAppDescription(desc); } else if (s.startsWith("%changelog")) { - QString change; + TQString change; while (!stream.atEnd()) { - QString str = stream.readLine(); + TQString str = stream.readLine(); if (str.startsWith("%")) break; else change += str + "\n"; } @@ -177,18 +177,18 @@ void SpecSupport::slotimportSPECPushButtonPressed() { } void SpecSupport::slotAddFileButtonPressed(){ -QString filename = KFileDialog::getOpenFileName (); +TQString filename = KFileDialog::getOpenFileName (); } -// QPushButton* srcPackagePushButton; +// TQPushButton* srcPackagePushButton; void SpecSupport::slotsrcPackagePushButtonPressed() { - QMap<QString,QString>::Iterator it; + TQMap<TQString,TQString>::Iterator it; - QFile file1(dir + "/" + getAppSource()); - QFile file2(*(map.find("_sourcedir")) + "/" + getAppSource()); + TQFile file1(dir + "/" + getAppSource()); + TQFile file2(*(map.find("_sourcedir")) + "/" + getAppSource()); if (!file2.exists()) { if (!file1.exists()) { - QMessageBox::critical(0,i18n("Error"),i18n("You need to create a source archive first.")); + TQMessageBox::critical(0,i18n("Error"),i18n("You need to create a source archive first.")); return; } else @@ -202,15 +202,15 @@ void SpecSupport::slotsrcPackagePushButtonPressed() { } void SpecSupport::parseDotRpmmacros() { - QFile dotfile(QDir::homeDirPath() + "/.rpmmacros"); + TQFile dotfile(TQDir::homeDirPath() + "/.rpmmacros"); if (!dotfile.open(IO_ReadOnly)) { -// QErrorMessage * msg = new QErrorMessage(this); +// TQErrorMessage * msg = new TQErrorMessage(this); // msg->message("It seems you don't have a ~/.rpmmacros\nYou may experience problems building packages.\n"); // msg->exec(); return; } - QTextStream stream(&dotfile); + TQTextStream stream(&dotfile); // Perhaps will it appear as a necessity to parse the global rpm config file? @@ -219,14 +219,14 @@ void SpecSupport::parseDotRpmmacros() { // .rpmmacros parsing : while (!stream.atEnd()) { - QString s = stream.readLine(); - QRegExp re("%([^ \t]*)[ \t][ \t]*([^\t]*)$"); + TQString s = stream.readLine(); + TQRegExp re("%([^ \t]*)[ \t][ \t]*([^\t]*)$"); if(re.exactMatch(s)) { - QRegExp subst("%\\{([^%]*)\\}"); - QString value = re.cap(2).stripWhiteSpace(); + TQRegExp subst("%\\{([^%]*)\\}"); + TQString value = re.cap(2).stripWhiteSpace(); while(subst.search(value) != -1) { - value.replace(QRegExp("%\\{"+ QRegExp_escape( subst.cap(1) ) +"\\}"),*map.find(subst.cap(1))); + value.replace(TQRegExp("%\\{"+ QRegExp_escape( subst.cap(1) ) +"\\}"),*map.find(subst.cap(1))); } map.insert(re.cap(1),value); } @@ -243,18 +243,18 @@ void SpecSupport::parseDotRpmmacros() { createRpmDirectoryFromMacro("_srcrpmdir"); } -bool SpecSupport::createRpmDirectoryFromMacro(const QString & name) { - QMap<QString,QString>::Iterator it; +bool SpecSupport::createRpmDirectoryFromMacro(const TQString & name) { + TQMap<TQString,TQString>::Iterator it; if((it = map.find(name)) != map.end()) { - QDir dir(*it); + TQDir dir(*it); if (!dir.exists()) return dir.mkdir(*it); } return false; } -QString SpecSupport::generatePackage( ) +TQString SpecSupport::generatePackage( ) { - QString spec; + TQString spec; spec += "# This spec file was generated by KDevelop \n"; spec += "# Please report any problem to KDevelop Team <kdevelop-devel@kdevelop.org> \n"; spec += "# Thanks to Matthias Saou for his explanations on http://freshrpms.net/docs/fight.html\n\n"; |