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 /buildtools/pascal/pascalproject_part.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 'buildtools/pascal/pascalproject_part.cpp')
-rw-r--r-- | buildtools/pascal/pascalproject_part.cpp | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/buildtools/pascal/pascalproject_part.cpp b/buildtools/pascal/pascalproject_part.cpp index 3fe09420..2ed25fc0 100644 --- a/buildtools/pascal/pascalproject_part.cpp +++ b/buildtools/pascal/pascalproject_part.cpp @@ -10,13 +10,13 @@ ***************************************************************************/ #include "pascalproject_part.h" -#include <qdom.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qvaluestack.h> -#include <qregexp.h> -#include <qvbox.h> -#include <qlabel.h> +#include <tqdom.h> +#include <tqfileinfo.h> +#include <tqdir.h> +#include <tqvaluestack.h> +#include <tqregexp.h> +#include <tqvbox.h> +#include <tqlabel.h> #include <kiconloader.h> #include <klocale.h> @@ -52,7 +52,7 @@ typedef KDevGenericFactory<PascalProjectPart> PascalProjectFactory; static const KDevPluginInfo data("kdevpascalproject"); K_EXPORT_COMPONENT_FACTORY( libkdevpascalproject, PascalProjectFactory( data ) ) -PascalProjectPart::PascalProjectPart(QObject *parent, const char *name, const QStringList& ) +PascalProjectPart::PascalProjectPart(TQObject *parent, const char *name, const TQStringList& ) :KDevBuildTool(&data, parent, name ? name : "PascalProjectPart" ) { setInstance(PascalProjectFactory::instance()); @@ -60,27 +60,27 @@ PascalProjectPart::PascalProjectPart(QObject *parent, const char *name, const QS KAction *action; action = new KAction( i18n("&Build Project"), "make_kdevelop", Key_F8, - this, SLOT(slotBuild()), + this, TQT_SLOT(slotBuild()), actionCollection(), "build_build" ); action->setToolTip(i18n("Build project")); action->setWhatsThis(i18n("<b>Build project</b><p>Runs the compiler on a main source file of the project. " "The compiler and the main source file can be set in project settings, <b>Pascal Compiler</b> tab.")); action = new KAction( i18n("Execute Program"), "exec", 0, - this, SLOT(slotExecute()), + this, TQT_SLOT(slotExecute()), actionCollection(), "build_execute" ); action->setToolTip(i18n("Execute program")); action->setWhatsThis(i18n("<b>Execute program</b><p>Executes the main program specified in project settings, <b>Run options</b> tab. " "If nothing is set, the binary file with the same name as the main source file name is executed.")); - connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), - this, SLOT(projectConfigWidget(KDialogBase*)) ); + connect( core(), TQT_SIGNAL(projectConfigWidget(KDialogBase*)), + this, TQT_SLOT(projectConfigWidget(KDialogBase*)) ); - connect( core(), SIGNAL(configWidget(KDialogBase*)), - this, SLOT(configWidget(KDialogBase*)) ); + connect( core(), TQT_SIGNAL(configWidget(KDialogBase*)), + this, TQT_SLOT(configWidget(KDialogBase*)) ); // m_widget = new PascalProjectWidget(this); -// QWhatsThis::add(m_widget, i18n("WHAT DOES THIS PART DO?")); +// TQWhatsThis::add(m_widget, i18n("WHAT DOES THIS PART DO?")); // now you decide what should happen to the widget. Take a look at kdevcore.h // or at other plugins how to embed it. @@ -101,11 +101,11 @@ PascalProjectPart::~PascalProjectPart() * @todo This should really be merged with FileTreeWidget::matchesHidePattern() * and put in its own class. Currently this is repeated in scriptprojectpart.cpp, pascalproject_part.cpp, adaproject_part.cpp */ -static bool matchesPattern(const QString &fileName, const QStringList &patternList) +static bool matchesPattern(const TQString &fileName, const TQStringList &patternList) { - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for (it = patternList.begin(); it != patternList.end(); ++it) { - QRegExp re(*it, true, true); + TQRegExp re(*it, true, true); if (re.search(fileName) == 0 && re.matchedLength() == (int)fileName.length()) return true; } @@ -113,13 +113,13 @@ static bool matchesPattern(const QString &fileName, const QStringList &patternLi return false; } -void PascalProjectPart::openProject(const QString &dirName, const QString &projectName) +void PascalProjectPart::openProject(const TQString &dirName, const TQString &projectName) { m_buildDir = dirName; m_projectDir = dirName; m_projectName = projectName; - QDomDocument &dom = *projectDom(); + TQDomDocument &dom = *projectDom(); // Set the default directory radio to "executable" if (DomUtil::readEntry(dom, "/kdevpascalproject/run/directoryradio") == "" ) { DomUtil::writeEntry(dom, "/kdevpascalproject/run/directoryradio", "executable"); @@ -128,11 +128,11 @@ void PascalProjectPart::openProject(const QString &dirName, const QString &proje loadProjectConfig(); // Put all files from all subdirectories into file list - QValueStack<QString> s; + TQValueStack<TQString> s; int prefixlen = m_projectDir.length()+1; s.push(m_projectDir); - QStringList includepatternList; + TQStringList includepatternList; if ( languageSupport() ) { KMimeType::List list = languageSupport()->mimeTypes(); @@ -142,20 +142,20 @@ void PascalProjectPart::openProject(const QString &dirName, const QString &proje ++it; } } - QString excludepatterns = "*~"; - QStringList excludepatternList = QStringList::split(",", excludepatterns); + TQString excludepatterns = "*~"; + TQStringList excludepatternList = TQStringList::split(",", excludepatterns); - QDir dir; + TQDir dir; do { dir.setPath(s.pop()); kdDebug(9033) << "Examining: " << dir.path() << endl; const QFileInfoList *dirEntries = dir.entryInfoList(); - QPtrListIterator<QFileInfo> it(*dirEntries); + TQPtrListIterator<TQFileInfo> it(*dirEntries); for (; it.current(); ++it) { - QString fileName = it.current()->fileName(); + TQString fileName = it.current()->fileName(); if (fileName == "." || fileName == "..") continue; - QString path = it.current()->absFilePath(); + TQString path = it.current()->absFilePath(); if (it.current()->isDir()) { kdDebug(9033) << "Pushing: " << path << endl; s.push(path); @@ -195,9 +195,9 @@ DomUtil::PairList PascalProjectPart::runEnvironmentVars() const * if run/directoryradio == custom * The custom directory absolute path */ -QString PascalProjectPart::runDirectory() const +TQString PascalProjectPart::runDirectory() const { - QString cwd = defaultRunDirectory("kdevpascalproject"); + TQString cwd = defaultRunDirectory("kdevpascalproject"); if (cwd.isEmpty()) cwd = buildDirectory(); return cwd; @@ -213,15 +213,15 @@ QString PascalProjectPart::runDirectory() const * if run/directoryradio == custom or relative == false * The absolute path to executable */ -QString PascalProjectPart::mainProgram() const +TQString PascalProjectPart::mainProgram() const { - QDomDocument * dom = projectDom(); + TQDomDocument * dom = projectDom(); - if ( !dom ) return QString(); + if ( !dom ) return TQString(); - QString DomMainProgram = DomUtil::readEntry( *dom, "/kdevpascalproject/run/mainprogram"); + TQString DomMainProgram = DomUtil::readEntry( *dom, "/kdevpascalproject/run/mainprogram"); - if ( DomMainProgram.isEmpty() ) return QString(); + if ( DomMainProgram.isEmpty() ) return TQString(); if ( DomMainProgram.startsWith("/") ) // assume absolute path { @@ -232,63 +232,63 @@ QString PascalProjectPart::mainProgram() const return projectDirectory() + "/" + DomMainProgram; } - return QString(); + return TQString(); } -/** Retuns a QString with the debug command line arguments */ -QString PascalProjectPart::debugArguments() const +/** Retuns a TQString with the debug command line arguments */ +TQString PascalProjectPart::debugArguments() const { return DomUtil::readEntry(*projectDom(), "/kdevpascalproject/run/globaldebugarguments"); } -/** Retuns a QString with the run command line arguments */ -QString PascalProjectPart::runArguments() const +/** Retuns a TQString with the run command line arguments */ +TQString PascalProjectPart::runArguments() const { return DomUtil::readEntry(*projectDom(), "/kdevpascalproject/run/programargs"); } -QString PascalProjectPart::mainSource() const +TQString PascalProjectPart::mainSource() const { return projectDirectory() + "/" + m_mainSource; } -void PascalProjectPart::setMainSource(QString fullPath) +void PascalProjectPart::setMainSource(TQString fullPath) { - QString olddir = activeDirectory(); - m_mainSource = fullPath.replace(QRegExp(QString(projectDirectory() + QString("/"))),""); + TQString olddir = activeDirectory(); + m_mainSource = fullPath.replace(TQRegExp(TQString(projectDirectory() + TQString("/"))),""); emit activeDirectoryChanged( olddir, activeDirectory() ); } -QString PascalProjectPart::projectDirectory() const +TQString PascalProjectPart::projectDirectory() const { return m_projectDir; } -QString PascalProjectPart::projectName() const +TQString PascalProjectPart::projectName() const { return m_projectName; } -QString PascalProjectPart::activeDirectory() const +TQString PascalProjectPart::activeDirectory() const { - QFileInfo fi(mainSource()); - return fi.dirPath(true).replace(QRegExp(projectDirectory()),""); + TQFileInfo fi(mainSource()); + return fi.dirPath(true).replace(TQRegExp(projectDirectory()),""); } -QString PascalProjectPart::buildDirectory() const +TQString PascalProjectPart::buildDirectory() const { - QFileInfo fi(mainSource()); + TQFileInfo fi(mainSource()); return fi.dirPath(true); } -void PascalProjectPart::listOfFiles(QStringList &result, QString path) const +void PascalProjectPart::listOfFiles(TQStringList &result, TQString path) const { - QDir d(path); + TQDir d(path); if (!d.exists()) return; - QFileInfoList *entries = const_cast<QFileInfoList*>(d.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden)); - for (QFileInfo *it = entries->first(); it; it = entries->next()) + QFileInfoList *entries = const_cast<QFileInfoList*>(d.entryInfoList(TQDir::Dirs | TQDir::Files | TQDir::Hidden)); + for (TQFileInfo *it = entries->first(); it; it = entries->next()) { if ((it->isDir()) && (it->filePath() != path)) { @@ -303,9 +303,9 @@ void PascalProjectPart::listOfFiles(QStringList &result, QString path) const } } -QStringList PascalProjectPart::allFiles() const +TQStringList PascalProjectPart::allFiles() const { -// QStringList files; +// TQStringList files; // listOfFiles(files, projectDirectory()); @@ -313,19 +313,19 @@ QStringList PascalProjectPart::allFiles() const return m_sourceFiles; } -void PascalProjectPart::addFile(const QString& /*fileName*/) +void PascalProjectPart::addFile(const TQString& /*fileName*/) { } -void PascalProjectPart::addFiles(const QStringList& /*fileList*/) +void PascalProjectPart::addFiles(const TQStringList& /*fileList*/) { } -void PascalProjectPart::removeFile(const QString& /*fileName*/) +void PascalProjectPart::removeFile(const TQString& /*fileName*/) { } -void PascalProjectPart::removeFiles(const QStringList& /*fileList*/) +void PascalProjectPart::removeFiles(const TQStringList& /*fileList*/) { } @@ -334,7 +334,7 @@ void PascalProjectPart::slotBuild() if (partController()->saveAllFiles()==false) return; //user cancelled - QString cmdline = m_compilerExec + " " + m_compilerOpts + " "; + TQString cmdline = m_compilerExec + " " + m_compilerOpts + " "; if (cmdline.isEmpty()) { @@ -342,10 +342,10 @@ void PascalProjectPart::slotBuild() return; } - QFileInfo fi(mainSource()); + TQFileInfo fi(mainSource()); cmdline += fi.fileName(); - QString dircmd = "cd "; + TQString dircmd = "cd "; dircmd += KProcess::quote(buildDirectory()); dircmd += " && "; @@ -356,7 +356,7 @@ void PascalProjectPart::slotExecute() { partController()->saveAllFiles(); - QDomDocument &dom = *(projectDom()); + TQDomDocument &dom = *(projectDom()); bool runInTerminal = DomUtil::readBoolEntry(dom, "/kdevpascalproject/run/terminal", true); // Get the run environment variables pairs into the environstr string @@ -366,7 +366,7 @@ void PascalProjectPart::slotExecute() DomUtil::PairList envvars = DomUtil::readPairListEntry(*projectDom(), "/kdevpascalproject/run/envvars", "envvar", "name", "value"); - QString environstr; + TQString environstr; DomUtil::PairList::ConstIterator it; for (it = envvars.begin(); it != envvars.end(); ++it) { environstr += (*it).first; @@ -375,50 +375,50 @@ void PascalProjectPart::slotExecute() environstr += " "; } - QString program = mainProgram(); + TQString program = mainProgram(); program.prepend(environstr); program += " " + DomUtil::readEntry(*projectDom(), "/kdevpascalproject/run/programargs"); appFrontend()->startAppCommand(buildDirectory(), program, runInTerminal); } -void PascalProjectPart::changedFiles( const QStringList & fileList ) +void PascalProjectPart::changedFiles( const TQStringList & fileList ) { KDevProject::changedFiles(fileList); } -void PascalProjectPart::changedFile( const QString & fileName ) +void PascalProjectPart::changedFile( const TQString & fileName ) { KDevProject::changedFile(fileName); } void PascalProjectPart::projectConfigWidget( KDialogBase * dlg ) { - QVBox *vbox; + TQVBox *vbox; vbox = dlg->addVBoxPage(i18n("Pascal Compiler")); PascalProjectOptionsDlg *w = new PascalProjectOptionsDlg(this, vbox); - connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); - connect( dlg, SIGNAL(okClicked()), this, SLOT(loadProjectConfig()) ); + connect( dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(accept()) ); + connect( dlg, TQT_SIGNAL(okClicked()), this, TQT_SLOT(loadProjectConfig()) ); vbox = dlg->addVBoxPage(i18n("Run Options"), i18n("Run Options"), BarIcon( "make", KIcon::SizeMedium )); RunOptionsWidget *w3 = new RunOptionsWidget(*projectDom(), "/kdevpascalproject", buildDirectory(), vbox); - connect( dlg, SIGNAL(okClicked()), w3, SLOT(accept()) ); + connect( dlg, TQT_SIGNAL(okClicked()), w3, TQT_SLOT(accept()) ); } void PascalProjectPart::loadProjectConfig( ) { - QDomDocument &dom = *(projectDom()); + TQDomDocument &dom = *(projectDom()); - QString config = DomUtil::readEntry(dom, "/kdevpascalproject/general/useconfiguration", "default"); - m_mainSource = DomUtil::readEntry(dom, QString("/kdevpascalproject/configurations/") + config + QString("/mainsource") ); - m_compilerOpts = DomUtil::readEntry(dom, QString("/kdevpascalproject/configurations/") + config + QString("/compileroptions")); - m_compilerExec = DomUtil::readEntry(dom, QString("/kdevpascalproject/configurations/") + config + QString("/compilerexec")); + TQString config = DomUtil::readEntry(dom, "/kdevpascalproject/general/useconfiguration", "default"); + m_mainSource = DomUtil::readEntry(dom, TQString("/kdevpascalproject/configurations/") + config + TQString("/mainsource") ); + m_compilerOpts = DomUtil::readEntry(dom, TQString("/kdevpascalproject/configurations/") + config + TQString("/compileroptions")); + m_compilerExec = DomUtil::readEntry(dom, TQString("/kdevpascalproject/configurations/") + config + TQString("/compilerexec")); if (m_compilerExec.isEmpty()) { KTrader::OfferList offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Pascal'"); - QValueList<KService::Ptr>::ConstIterator it; + TQValueList<KService::Ptr>::ConstIterator it; for (it = offers.begin(); it != offers.end(); ++it) { if ((*it)->property("X-KDevelop-Default").toBool()) { m_compilerExec = (*it)->exec(); @@ -430,13 +430,13 @@ void PascalProjectPart::loadProjectConfig( ) void PascalProjectPart::configWidget( KDialogBase * dlg ) { - QVBox *vbox; + TQVBox *vbox; vbox = dlg->addVBoxPage(i18n("Pascal Compiler")); PascalGlobalOptionsDlg *w = new PascalGlobalOptionsDlg(this, vbox); - connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); + connect( dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(accept()) ); } -KDevCompilerOptions *PascalProjectPart::createCompilerOptions(const QString &name) +KDevCompilerOptions *PascalProjectPart::createCompilerOptions(const TQString &name) { KService::Ptr service = KService::serviceByDesktopName(name); if (!service) { @@ -444,20 +444,20 @@ KDevCompilerOptions *PascalProjectPart::createCompilerOptions(const QString &nam return 0; } - KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library())); + KLibFactory *factory = KLibLoader::self()->factory(TQFile::encodeName(service->library())); if (!factory) { - QString errorMessage = KLibLoader::self()->lastErrorMessage(); + TQString errorMessage = KLibLoader::self()->lastErrorMessage(); KMessageBox::error(0, i18n("There was an error loading the module %1.\n" "The diagnostics is:\n%2").arg(service->name()).arg(errorMessage)); exit(1); } - QStringList args; - QVariant prop = service->property("X-KDevelop-Args"); + TQStringList args; + TQVariant prop = service->property("X-KDevelop-Args"); if (prop.isValid()) - args = QStringList::split(" ", prop.toString()); + args = TQStringList::split(" ", prop.toString()); - QObject *obj = factory->create(this, service->name().latin1(), + TQObject *obj = factory->create(this, service->name().latin1(), "KDevCompilerOptions", args); if (!obj->inherits("KDevCompilerOptions")) { @@ -469,7 +469,7 @@ KDevCompilerOptions *PascalProjectPart::createCompilerOptions(const QString &nam return dlg; } -QString PascalProjectPart::defaultOptions( const QString compiler ) const +TQString PascalProjectPart::defaultOptions( const TQString compiler ) const { KConfig *config = KGlobal::config(); config->setGroup("Pascal Compiler"); @@ -482,12 +482,12 @@ QString PascalProjectPart::defaultOptions( const QString compiler ) const /*! \fn PascalProjectPart::distFiles() const */ -QStringList PascalProjectPart::distFiles() const +TQStringList PascalProjectPart::distFiles() const { - QStringList sourceList = allFiles(); + TQStringList sourceList = allFiles(); // Scan current source directory for any .pro files. - QString projectDir = projectDirectory(); - QDir dir(projectDir); - QStringList files = dir.entryList( "Makefile"); + TQString projectDir = projectDirectory(); + TQDir dir(projectDir); + TQStringList files = dir.entryList( "Makefile"); return sourceList + files; } |