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 /src/projectmanager.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 'src/projectmanager.cpp')
-rw-r--r-- | src/projectmanager.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/src/projectmanager.cpp b/src/projectmanager.cpp index 3b06340f..87893a50 100644 --- a/src/projectmanager.cpp +++ b/src/projectmanager.cpp @@ -1,12 +1,12 @@ -#include <qfile.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qdom.h> -#include <qstringlist.h> -#include <qptrlist.h> -#include <qvbox.h> -#include <qsize.h> -#include <qtimer.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqdir.h> +#include <tqdom.h> +#include <tqstringlist.h> +#include <tqptrlist.h> +#include <tqvbox.h> +#include <tqsize.h> +#include <tqtimer.h> class QDomDocument; @@ -52,15 +52,15 @@ class QDomDocument; #include "projectmanager.h" -QString ProjectInfo::sessionFile() const +TQString ProjectInfo::sessionFile() const { - QString sf = m_projectURL.path(-1); + TQString sf = m_projectURL.path(-1); sf.truncate(sf.length() - 8); // without ".kdevelop" sf += "kdevses"; // suffix for a KDevelop session file return sf; } -QString ProjectManager::projectDirectory( const QString& path, bool absolute ) { +TQString ProjectManager::projectDirectory( const TQString& path, bool absolute ) { if(absolute) return path; KURL url(ProjectManager::getInstance()->projectFile(), path); @@ -94,14 +94,14 @@ void ProjectManager::createActions( KActionCollection* ac ) KAction *action; action = new KAction(i18n("&Open Project..."), "project_open", 0, - this, SLOT(slotOpenProject()), + this, TQT_SLOT(slotOpenProject()), ac, "project_open"); action->setToolTip( i18n("Open project")); action->setWhatsThis(i18n("<b>Open project</b><p>Opens a KDevelop3 or KDevelop2 project.")); m_openRecentProjectAction = new KRecentFilesAction(i18n("Open &Recent Project"), 0, - this, SLOT(loadProject(const KURL &)), + this, TQT_SLOT(loadProject(const KURL &)), ac, "project_open_recent"); m_openRecentProjectAction->setToolTip(i18n("Open recent project")); m_openRecentProjectAction->setWhatsThis(i18n("<b>Open recent project</b><p>Opens recently opened project.")); @@ -109,14 +109,14 @@ void ProjectManager::createActions( KActionCollection* ac ) m_closeProjectAction = new KAction(i18n("C&lose Project"), "fileclose",0, - this, SLOT(closeProject()), + this, TQT_SLOT(closeProject()), ac, "project_close"); m_closeProjectAction->setEnabled(false); m_closeProjectAction->setToolTip(i18n("Close project")); m_closeProjectAction->setWhatsThis(i18n("<b>Close project</b><p>Closes the current project.")); m_projectOptionsAction = new KAction(i18n("Project &Options"), "configure", 0, - this, SLOT(slotProjectOptions()), + this, TQT_SLOT(slotProjectOptions()), ac, "project_options" ); m_projectOptionsAction->setToolTip(i18n("Project options")); m_projectOptionsAction->setWhatsThis(i18n("<b>Project options</b><p>Lets you customize project options.")); @@ -127,7 +127,7 @@ void ProjectManager::slotOpenProject() { KConfig *config = kapp->config(); config->setGroup("General Options"); - QString defaultProjectsDir = config->readPathEntry("DefaultProjectsDir", QDir::homeDirPath()+"/"); + TQString defaultProjectsDir = config->readPathEntry("DefaultProjectsDir", TQDir::homeDirPath()+"/"); KURL url = KFileDialog::getOpenURL(defaultProjectsDir, i18n("*.kdevelop|KDevelop 3 Project Files\n" @@ -149,9 +149,9 @@ void ProjectManager::slotProjectOptions() KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, TopLevel::getInstance()->main(), "project options dialog"); - QVBox *box = dlg.addVBoxPage( i18n("General"), i18n("General"), BarIcon( "kdevelop", KIcon::SizeMedium ) ); + TQVBox *box = dlg.addVBoxPage( i18n("General"), i18n("General"), BarIcon( "kdevelop", KIcon::SizeMedium ) ); GeneralInfoWidget *g = new GeneralInfoWidget(*API::getInstance()->projectDom(), box, "general informations widget"); - connect (&dlg, SIGNAL(okClicked()), g, SLOT(accept())); + connect (&dlg, TQT_SIGNAL(okClicked()), g, TQT_SLOT(accept())); KConfig *config = kapp->config(); config->setGroup("Project Settings Dialog"); @@ -191,7 +191,7 @@ void ProjectManager::loadDefaultProject() { KConfig *config = kapp->config(); config->setGroup("General Options"); - QString project = config->readPathEntry("Last Project"); + TQString project = config->readPathEntry("Last Project"); bool readProject = config->readBoolEntry("Read Last Project On Startup", true); if (!project.isEmpty() && readProject) { @@ -208,8 +208,8 @@ bool ProjectManager::loadProject(const KURL &projectURL) if (url.isLocalFile()) { - QDir dir(url.path()); - QString can_path = dir.canonicalPath(); + TQDir dir(url.path()); + TQString can_path = dir.canonicalPath(); //if the directory doesn't exist, the returned string is null which confuses the user later on. so better short-cut here if(can_path.isNull()) return false; @@ -221,7 +221,7 @@ bool ProjectManager::loadProject(const KURL &projectURL) if( projectLoaded() && url.path() == projectFile().path() ) { if (KMessageBox::questionYesNo(TopLevel::getInstance()->main(), - i18n("Are you sure you want to reopen the current project?"), QString::null, i18n("Reopen"), i18n("Do Not Reopen")) == KMessageBox::No) + i18n("Are you sure you want to reopen the current project?"), TQString::null, i18n("Reopen"), i18n("Do Not Reopen")) == KMessageBox::No) return false; } @@ -239,7 +239,7 @@ bool ProjectManager::loadProject(const KURL &projectURL) m_info = new ProjectInfo; m_info->m_projectURL = url; - QTimer::singleShot( 0, this, SLOT(slotLoadProject()) ); + TQTimer::singleShot( 0, this, TQT_SLOT(slotLoadProject()) ); // no one cares about this value return true; @@ -352,14 +352,14 @@ bool ProjectManager::closeProject( bool exiting ) bool ProjectManager::loadProjectFile() { - QString path; + TQString path; if (!KIO::NetAccess::download(m_info->m_projectURL, path, 0)) { KMessageBox::sorry(TopLevel::getInstance()->main(), i18n("Could not read project file: %1").arg(m_info->m_projectURL.prettyURL())); return false; } - QFile fin(path); + TQFile fin(path); if (!fin.open(IO_ReadOnly)) { KMessageBox::sorry(TopLevel::getInstance()->main(), @@ -368,7 +368,7 @@ bool ProjectManager::loadProjectFile() } int errorLine, errorCol; - QString errorMsg; + TQString errorMsg; if (!m_info->m_document.setContent(&fin, &errorMsg, &errorLine, &errorCol)) { KMessageBox::sorry(TopLevel::getInstance()->main(), @@ -401,17 +401,17 @@ bool ProjectManager::saveProjectFile() Q_ASSERT( API::getInstance()->projectDom() ); if (m_info->m_projectURL.isLocalFile()) { - QFile fout(m_info->m_projectURL.path()); + TQFile fout(m_info->m_projectURL.path()); if( !fout.open(IO_WriteOnly) ) { KMessageBox::sorry(TopLevel::getInstance()->main(), i18n("Could not write the project file.")); return false; } - QTextStream stream(&fout); + TQTextStream stream(&fout); API::getInstance()->projectDom()->save(stream, 2); fout.close(); } else { - KTempFile fout(QString::fromLatin1("kdevelop3")); + KTempFile fout(TQString::fromLatin1("kdevelop3")); fout.setAutoDelete(true); if (fout.status() != 0) { KMessageBox::sorry(TopLevel::getInstance()->main(), i18n("Could not write the project file.")); @@ -425,18 +425,18 @@ bool ProjectManager::saveProjectFile() return true; } -static QString getAttribute(QDomElement elem, QString attr) +static TQString getAttribute(TQDomElement elem, TQString attr) { - QDomElement el = elem.namedItem(attr).toElement(); + TQDomElement el = elem.namedItem(attr).toElement(); return el.firstChild().toText().data(); } -static void getAttributeList(QDomElement elem, QString attr, QString tag, QStringList &list) +static void getAttributeList(TQDomElement elem, TQString attr, TQString tag, TQStringList &list) { list.clear(); - QDomElement el = elem.namedItem(attr).toElement(); - QDomElement item = el.firstChild().toElement(); + TQDomElement el = elem.namedItem(attr).toElement(); + TQDomElement item = el.firstChild().toElement(); while (!item.isNull()) { if (item.tagName() == tag) @@ -447,8 +447,8 @@ static void getAttributeList(QDomElement elem, QString attr, QString tag, QStrin void ProjectManager::getGeneralInfo() { - QDomElement docEl = m_info->m_document.documentElement(); - QDomElement generalEl = docEl.namedItem("general").toElement(); + TQDomElement docEl = m_info->m_document.documentElement(); + TQDomElement generalEl = docEl.namedItem("general").toElement(); m_info->m_projectPlugin = getAttribute(generalEl, "projectmanagement"); m_info->m_vcsPlugin = getAttribute(generalEl, "versioncontrol"); @@ -457,8 +457,8 @@ void ProjectManager::getGeneralInfo() if( m_info->m_projectName.isEmpty() ) { m_info->m_projectName = m_info->m_projectURL.filename(); - m_info->m_projectName = m_info->m_projectName.left(m_info->m_projectName.length()-QString(".kdevelop").length()); - QDomElement prjname = m_info->m_document.createElement("projectname"); + m_info->m_projectName = m_info->m_projectName.left(m_info->m_projectName.length()-TQString(".kdevelop").length()); + TQDomElement prjname = m_info->m_document.createElement("projectname"); prjname.appendChild( m_info->m_document.createTextNode( m_info->m_projectName) ); generalEl.appendChild( prjname ); } @@ -468,7 +468,7 @@ void ProjectManager::getGeneralInfo() //FIXME: adymo: workaround for those project templates without "profile" element // m_info->m_profileName = getAttribute(generalEl, "profile"); - QDomElement el = generalEl.namedItem("profile").toElement(); + TQDomElement el = generalEl.namedItem("profile").toElement(); if (el.isNull()) // m_info->m_profileName = profileByAttributes(m_info->m_language, m_info->m_keywords); m_info->m_profileName = Settings::profileByAttributes(m_info->m_language, m_info->m_keywords); @@ -502,10 +502,10 @@ bool ProjectManager::loadProjectPart() API::getInstance()->setProject( projectPart ); - QDomDocument& dom = *API::getInstance()->projectDom(); - QString path = DomUtil::readEntry(dom,"/general/projectdirectory", "."); + TQDomDocument& dom = *API::getInstance()->projectDom(); + TQString path = DomUtil::readEntry(dom,"/general/projectdirectory", "."); bool absolute = DomUtil::readBoolEntry(dom,"/general/absoluteprojectpath",false); - QString projectDir = projectDirectory( path, absolute ); + TQString projectDir = projectDirectory( path, absolute ); kdDebug(9000) << "projectDir: " << projectDir << " projectName: " << m_info->m_projectName << endl; projectPart->openProject(projectDir, m_info->m_projectName); @@ -525,7 +525,7 @@ void ProjectManager::unloadProjectPart() API::getInstance()->setProject(0); } -bool ProjectManager::loadLanguageSupport(const QString& lang) +bool ProjectManager::loadLanguageSupport(const TQString& lang) { kdDebug(9000) << "Looking for language support for " << lang << endl; @@ -536,8 +536,8 @@ bool ProjectManager::loadLanguageSupport(const QString& lang) } KTrader::OfferList languageSupportOffers = - KTrader::self()->query(QString::fromLatin1("KDevelop/LanguageSupport"), - QString::fromLatin1("[X-KDevelop-Language] == '%1' and [X-KDevelop-Version] == %2").arg(lang).arg(KDEVELOP_PLUGIN_VERSION)); + KTrader::self()->query(TQString::fromLatin1("KDevelop/LanguageSupport"), + TQString::fromLatin1("[X-KDevelop-Language] == '%1' and [X-KDevelop-Version] == %2").arg(lang).arg(KDEVELOP_PLUGIN_VERSION)); if (languageSupportOffers.isEmpty()) { KMessageBox::sorry(TopLevel::getInstance()->main(), @@ -594,9 +594,9 @@ KURL ProjectManager::projectFile() const return m_info->m_projectURL; } -QString ProjectManager::projectName() const +TQString ProjectManager::projectName() const { - if (!m_info) return QString(); + if (!m_info) return TQString(); return m_info->m_projectName; } @@ -618,34 +618,34 @@ bool ProjectManager::loadKDevelop2Project( const KURL & url ) return false; } - QString cmd = KGlobal::dirs()->findExe( "kdevprj2kdevelop" ); + TQString cmd = KGlobal::dirs()->findExe( "kdevprj2kdevelop" ); if (cmd.isEmpty()) { KMessageBox::sorry(0, i18n("You do not have 'kdevprj2kdevelop' installed.")); return false; } - QFileInfo fileInfo( url.path() ); + TQFileInfo fileInfo( url.path() ); KShellProcess proc( "/bin/sh" ); proc.setWorkingDirectory( fileInfo.dirPath(true) ); proc << "perl" << cmd << KShellProcess::quote( url.path() ); proc.start( KProcess::Block ); - QString projectFile = fileInfo.dirPath( true ) + "/" + fileInfo.baseName() + ".kdevelop"; + TQString projectFile = fileInfo.dirPath( true ) + "/" + fileInfo.baseName() + ".kdevelop"; return loadProject( KURL(projectFile) ); } -// QString ProjectManager::profileByAttributes(const QString &language, const QStringList &keywords) +// TQString ProjectManager::profileByAttributes(const TQString &language, const TQStringList &keywords) // { // KConfig config(locate("data", "kdevelop/profiles/projectprofiles")); // config.setGroup(language); // -// QStringList profileKeywords = QStringList::split("/", "Empty"); +// TQStringList profileKeywords = TQStringList::split("/", "Empty"); // if (config.hasKey("Keywords")) // profileKeywords = config.readListEntry("Keywords"); // // int idx = 0; -// for (QStringList::const_iterator it = profileKeywords.constBegin(); +// for (TQStringList::const_iterator it = profileKeywords.constBegin(); // it != profileKeywords.constEnd(); ++it) // { // if (keywords.contains(*it)) @@ -655,7 +655,7 @@ bool ProjectManager::loadKDevelop2Project( const KURL & url ) // } // } // -// QStringList profiles; +// TQStringList profiles; // if (config.hasKey("Profiles")) // { // profiles = config.readListEntry("Profiles"); |