diff --git a/src/plugins/madde/maemotoolchain.cpp b/src/plugins/madde/maemotoolchain.cpp index 352ab40c9836da5a758d9f89a6bfaf819d838864..2a45cf88c56fce710245e6363fa05f0e8c854f70 100644 --- a/src/plugins/madde/maemotoolchain.cpp +++ b/src/plugins/madde/maemotoolchain.cpp @@ -314,7 +314,7 @@ QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::createToolChainList(c else if (v->supportsTargetId(Constants::MEEGO_DEVICE_TARGET_ID)) target = "Meego"; mTc->setDisplayName(tr("%1 GCC (%2)").arg(target).arg(MaemoGlobal::maddeRoot(mqv->qmakeCommand().toString()))); - mTc->setCompilerPath(MaemoGlobal::targetRoot(mqv->qmakeCommand().toString()) + QLatin1String("/bin/gcc")); + mTc->setCompilerCommand(Utils::FileName::fromString(MaemoGlobal::targetRoot(mqv->qmakeCommand().toString()) + QLatin1String("/bin/gcc"))); mTc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(mqv->qtAbis().at(0))); if (mTc->debuggerCommand().isEmpty()) mTc->setDebuggerCommand(Utils::FileName::fromString(MaemoGlobal::targetRoot(mqv->qmakeCommand().toString()) + QLatin1String("/bin/gdb"))); diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp index 16132315b820bf508a66e78507827d20806d2933..663d4a91d2f9b25bbbf42f932eb01fedfacd359f 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp @@ -135,6 +135,13 @@ void AbstractMsvcToolChain::setDebuggerCommand(const Utils::FileName &d) toolChainUpdated(); } +Utils::FileName AbstractMsvcToolChain::compilerCommand() const +{ + Utils::Environment env; + addToEnvironment(env); + return Utils::FileName::fromString(env.searchInPath("cl.exe")); +} + Utils::FileName AbstractMsvcToolChain::debuggerCommand() const { return m_debuggerCommand; diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.h b/src/plugins/projectexplorer/abstractmsvctoolchain.h index c5783ecaa8074b900595593bc261727104b9945a..2625b4ff838d26b3e8ef182cdc99f039041acd0e 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.h +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.h @@ -58,6 +58,7 @@ public: QString makeCommand() const; void setDebuggerCommand(const Utils::FileName &d); + Utils::FileName compilerCommand() const; Utils::FileName debuggerCommand() const; IOutputParser *outputParser() const; diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 8a14b46e3334b25a75025540ba274dbafba4c16f..ed07c7e018e22ecfe2af7988d3529f9aa8b5643c 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -64,9 +64,9 @@ static const char targetAbiKeyC[] = "ProjectExplorer.GccToolChain.TargetAbi"; static const char supportedAbisKeyC[] = "ProjectExplorer.GccToolChain.SupportedAbis"; static const char debuggerCommandKeyC[] = "ProjectExplorer.GccToolChain.Debugger"; -static QByteArray runGcc(const QString &gcc, const QStringList &arguments, const QStringList &env) +static QByteArray runGcc(const Utils::FileName &gcc, const QStringList &arguments, const QStringList &env) { - if (gcc.isEmpty() || !QFileInfo(gcc).isExecutable()) + if (gcc.isEmpty() || !gcc.toFileInfo().isExecutable()) return QByteArray(); QProcess cpp; @@ -75,27 +75,27 @@ static QByteArray runGcc(const QString &gcc, const QStringList &arguments, const environment.append(QLatin1String("LC_ALL=C")); cpp.setEnvironment(environment); - cpp.start(gcc, arguments); + cpp.start(gcc.toString(), arguments); if (!cpp.waitForStarted()) { - qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(gcc), + qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(gcc.toUserOutput()), qPrintable(cpp.errorString())); return QByteArray(); } cpp.closeWriteChannel(); if (!cpp.waitForFinished()) { Utils::SynchronousProcess::stopProcess(cpp); - qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(gcc)); + qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(gcc.toUserOutput())); return QByteArray(); } if (cpp.exitStatus() != QProcess::NormalExit) { - qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(gcc)); + qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(gcc.toUserOutput())); return QByteArray(); } return cpp.readAllStandardOutput() + '\n' + cpp.readAllStandardError(); } -static QByteArray gccPredefinedMacros(const QString &gcc, const QStringList &env) +static QByteArray gccPredefinedMacros(const Utils::FileName &gcc, const QStringList &env) { QStringList arguments; arguments << QLatin1String("-xc++") @@ -120,7 +120,7 @@ static QByteArray gccPredefinedMacros(const QString &gcc, const QStringList &env return predefinedMacros; } -static QList<HeaderPath> gccHeaderPathes(const QString &gcc, const QStringList &env) +static QList<HeaderPath> gccHeaderPathes(const Utils::FileName &gcc, const QStringList &env) { QList<HeaderPath> systemHeaderPaths; QStringList arguments; @@ -265,14 +265,14 @@ static QList<ProjectExplorer::Abi> guessGccAbi(const QString &m) return abiList; } -static QList<ProjectExplorer::Abi> guessGccAbi(const QString &path, const QStringList &env) +static QList<ProjectExplorer::Abi> guessGccAbi(const Utils::FileName &path, const QStringList &env) { QStringList arguments(QLatin1String("-dumpmachine")); QString machine = QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed(); return guessGccAbi(machine); } -static QString gccVersion(const QString &path, const QStringList &env) +static QString gccVersion(const Utils::FileName &path, const QStringList &env) { QStringList arguments(QLatin1String("-dumpversion")); return QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed(); @@ -293,7 +293,7 @@ GccToolChain::GccToolChain(const QString &id, bool autodetect) : GccToolChain::GccToolChain(const GccToolChain &tc) : ToolChain(tc), m_predefinedMacros(tc.predefinedMacros()), - m_compilerPath(tc.compilerPath()), + m_compilerCommand(tc.compilerPath()), m_debuggerCommand(tc.debuggerCommand()), m_targetAbi(tc.m_targetAbi), m_supportedAbis(tc.m_supportedAbis), @@ -323,7 +323,7 @@ QString GccToolChain::legacyId() const QString i = id(); i = i.left(i.indexOf(QLatin1Char(':'))); return QString::fromLatin1("%1:%2.%3.%4") - .arg(i).arg(m_compilerPath) + .arg(i).arg(m_compilerPath.toString()) .arg(m_targetAbi.toString()).arg(m_debuggerCommand.toString()); } @@ -393,7 +393,7 @@ QList<HeaderPath> GccToolChain::systemHeaderPaths() const void GccToolChain::addToEnvironment(Utils::Environment &env) const { if (!m_compilerPath.isEmpty()) - env.prependOrSetPath(QFileInfo(m_compilerPath).absolutePath()); + env.prependOrSetPath(m_compilerPath.toString()); } void GccToolChain::setDebuggerCommand(const Utils::FileName &d) @@ -422,7 +422,7 @@ Utils::FileName GccToolChain::mkspec() const return Utils::FileName::fromString(QLatin1String("macx-g++")); } - QList<Abi> gccAbiList = Abi::abisOfBinary(Utils::FileName::fromString(m_compilerPath)); + QList<Abi> gccAbiList = Abi::abisOfBinary(m_compilerPath); Abi gccAbi; if (!gccAbiList.isEmpty()) gccAbi = gccAbiList.first(); @@ -455,7 +455,7 @@ IOutputParser *GccToolChain::outputParser() const return new GccParser; } -void GccToolChain::setCompilerPath(const QString &path) +void GccToolChain::setCompilerCommand(const Utils::FileName &path) { if (path == m_compilerPath) return; @@ -481,7 +481,7 @@ void GccToolChain::setCompilerPath(const QString &path) toolChainUpdated(); } -QString GccToolChain::compilerPath() const +Utils::FileName GccToolChain::compilerCommand() const { return m_compilerPath; } @@ -494,7 +494,7 @@ ToolChain *GccToolChain::clone() const QVariantMap GccToolChain::toMap() const { QVariantMap data = ToolChain::toMap(); - data.insert(QLatin1String(compilerPathKeyC), m_compilerPath); + data.insert(QLatin1String(compilerPathKeyC), m_compilerPath.toString()); data.insert(QLatin1String(targetAbiKeyC), m_targetAbi.toString()); QStringList abiList; foreach (const ProjectExplorer::Abi &a, m_supportedAbis) @@ -509,7 +509,7 @@ bool GccToolChain::fromMap(const QVariantMap &data) if (!ToolChain::fromMap(data)) return false; - m_compilerPath = data.value(QLatin1String(compilerPathKeyC)).toString(); + m_compilerPath = Utils::FileName::fromString(data.value(QLatin1String(compilerPathKeyC)).toString()); m_targetAbi = Abi(data.value(QLatin1String(targetAbiKeyC)).toString()); QStringList abiList = data.value(QLatin1String(supportedAbisKeyC)).toStringList(); m_supportedAbis.clear(); @@ -626,7 +626,7 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QSt QList<ToolChain *> result; const Utils::Environment systemEnvironment = Utils::Environment::systemEnvironment(); - const QString compilerPath = systemEnvironment.searchInPath(compiler); + const Utils::FileName compilerPath = Utils::FileName::fromString(systemEnvironment.searchInPath(compiler)); if (compilerPath.isEmpty()) return result; @@ -652,7 +652,7 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QSt if (tc.isNull()) return result; - tc->setCompilerPath(compilerPath); + tc->setCompilerCommand(compilerPath); tc->setDebuggerCommand(debuggerPath); tc->setTargetAbi(abi); tc->setDisplayName(tc->defaultDisplayName()); // reset displayname @@ -701,10 +701,7 @@ void Internal::GccToolChainConfigWidget::apply() GccToolChain *tc = static_cast<GccToolChain *>(toolChain()); Q_ASSERT(tc); QString displayName = tc->displayName(); - QString path = m_compilerPath->path(); - if (path.isEmpty()) - path = m_compilerPath->rawPath(); - tc->setCompilerPath(path); + tc->setCompilerCommand(m_compilerPath->fileName()); tc->setTargetAbi(m_abiWidget->currentAbi()); tc->setDisplayName(displayName); // reset display name tc->setDebuggerCommand(debuggerCommand()); @@ -716,7 +713,7 @@ void Internal::GccToolChainConfigWidget::setFromToolchain() // subwidgets are not yet connected! bool blocked = blockSignals(true); GccToolChain *tc = static_cast<GccToolChain *>(toolChain()); - m_compilerPath->setPath(tc->compilerPath()); + m_compilerPath->setFileName(tc->compilerCommand()); m_abiWidget->setAbis(tc->supportedAbis(), tc->targetAbi()); if (!m_isReadOnly && !m_compilerPath->path().isEmpty()) m_abiWidget->setEnabled(true); @@ -728,7 +725,7 @@ bool Internal::GccToolChainConfigWidget::isDirty() const { GccToolChain *tc = static_cast<GccToolChain *>(toolChain()); Q_ASSERT(tc); - return m_compilerPath->path() != tc->compilerPath() + return m_compilerPath->fileName() != tc->compilerCommand() || m_abiWidget->currentAbi() != tc->targetAbi(); } @@ -742,11 +739,11 @@ void Internal::GccToolChainConfigWidget::makeReadOnly() void Internal::GccToolChainConfigWidget::handlePathChange() { - QString path = m_compilerPath->path(); + Utils::FileName path = m_compilerPath->fileName(); QList<Abi> abiList; bool haveCompiler = false; if (!path.isEmpty()) { - QFileInfo fi(path); + QFileInfo fi(path.toFileInfo()); haveCompiler = fi.isExecutable() && fi.isFile(); } if (haveCompiler) diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h index 1d81ef3b194eb8a28fec3f0881a99ef83f7416e7..7331636c425c2b8ef3e13164420be66701b732f6 100644 --- a/src/plugins/projectexplorer/gcctoolchain.h +++ b/src/plugins/projectexplorer/gcctoolchain.h @@ -81,8 +81,8 @@ public: bool operator ==(const ToolChain &) const; - void setCompilerPath(const QString &); - QString compilerPath() const; + void setCompilerCommand(const Utils::FileName &); + Utils::FileName compilerCommand() const; ToolChain *clone() const; @@ -103,7 +103,7 @@ private: void updateSupportedAbis() const; - QString m_compilerPath; + Utils::FileName m_compilerPath; Utils::FileName m_debuggerCommand; Abi m_targetAbi; diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h index a6a0564ed2626f3f6767fc51b289eadc18eecc0e..b9856ebad55283c517e4e7fd859041a66352fbde 100644 --- a/src/plugins/projectexplorer/toolchain.h +++ b/src/plugins/projectexplorer/toolchain.h @@ -90,6 +90,7 @@ public: virtual Utils::FileName mkspec() const = 0; + virtual Utils::FileName compilerCommand() const = 0; virtual Utils::FileName debuggerCommand() const = 0; virtual QString defaultMakeTarget() const; virtual IOutputParser *outputParser() const = 0; diff --git a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp index efe2784edb51506d13e4097d5bb8ff0f2c34c0d5..c60e5ab7d6190d3ed22e8c967071fce5a808216e 100644 --- a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.cpp @@ -44,7 +44,7 @@ namespace Qt4ProjectManager { namespace Internal { -static QString gcceVersion(const QString &command) +static QString gcceVersion(const Utils::FileName &command) { if (command.isEmpty()) return QString(); @@ -56,19 +56,19 @@ static QString gcceVersion(const QString &command) env.set(QLatin1String("LC_ALL"), QLatin1String("C")); //override current locale settings gxx.setEnvironment(env.toStringList()); gxx.setReadChannelMode(QProcess::MergedChannels); - gxx.start(command, arguments); + gxx.start(command.toString(), arguments); if (!gxx.waitForStarted()) { - qWarning("Cannot start '%s': %s", qPrintable(command), qPrintable(gxx.errorString())); + qWarning("Cannot start '%s': %s", qPrintable(command.toUserOutput()), qPrintable(gxx.errorString())); return QString(); } gxx.closeWriteChannel(); if (!gxx.waitForFinished()) { Utils::SynchronousProcess::stopProcess(gxx); - qWarning("Timeout running '%s'.", qPrintable(command)); + qWarning("Timeout running '%s'.", qPrintable(command.toUserOutput())); return QString(); } if (gxx.exitStatus() != QProcess::NormalExit) { - qWarning("'%s' crashed.", qPrintable(command)); + qWarning("'%s' crashed.", qPrintable(command.toUserOutput())); return QString(); } @@ -110,7 +110,7 @@ void GcceToolChain::addToEnvironment(Utils::Environment &env) const GccToolChain::addToEnvironment(env); if (m_gcceVersion.isEmpty()) - m_gcceVersion = gcceVersion(compilerPath()); + m_gcceVersion = gcceVersion(compilerCommand()); if (m_gcceVersion.isEmpty()) return; @@ -118,7 +118,7 @@ void GcceToolChain::addToEnvironment(Utils::Environment &env) const QString version = m_gcceVersion; env.set(QString::fromLatin1("SBS_GCCE") + version.remove(QLatin1Char('.')) + QLatin1String("BIN"), - QDir::toNativeSeparators(QFileInfo(compilerPath()).absolutePath())); + compilerCommand().toUserOutput()); // Required for SBS, which checks the version output from its tools // and gets confused by localized output. env.set(QLatin1String("LANG"), QString(QLatin1Char('C'))); @@ -143,10 +143,10 @@ QString GcceToolChain::defaultMakeTarget() const return QLatin1String("gcce"); } -void GcceToolChain::setCompilerPath(const QString &path) +void GcceToolChain::setCompilerCommand(const Utils::FileName &path) { m_gcceVersion.clear(); - GccToolChain::setCompilerPath(path); + GccToolChain::setCompilerCommand(path); } ProjectExplorer::ToolChain *GcceToolChain::clone() const @@ -185,19 +185,21 @@ QList<ProjectExplorer::ToolChain *> GcceToolChainFactory::autoDetect() QFileInfo fi(path + QLatin1String("/bin/arm-none-symbianelf-g++.exe")); if (fi.exists() && fi.isExecutable()) { GcceToolChain *tc = new GcceToolChain(false); - tc->setCompilerPath(fi.absoluteFilePath()); + tc->setCompilerCommand(Utils::FileName(fi)); tc->setDisplayName(tr("GCCE from Qt version")); tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi())); result.append(tc); } } - QString fullPath = Utils::Environment::systemEnvironment().searchInPath(QLatin1String("arm-none-symbianelf-gcc")); + Utils::FileName fullPath = + Utils::FileName::fromString(Utils::Environment::systemEnvironment() + .searchInPath(QLatin1String("arm-none-symbianelf-gcc"))); QString version = gcceVersion(fullPath); // If version is empty then this is not a GCC but e.g. bullseye! if (!fullPath.isEmpty() && !version.isEmpty()) { GcceToolChain *tc = new GcceToolChain(true); - tc->setCompilerPath(fullPath); + tc->setCompilerCommand(fullPath); tc->setDisplayName(tr("GCCE (%1)").arg(version)); tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi())); if (tc->targetAbi() == ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, diff --git a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.h b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.h index 844990fa9e4e275a469ee9fa639f67f26cb667d7..6bbc871ce6ffa8a0bba90d04e3006a1ac1652686 100644 --- a/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.h +++ b/src/plugins/qt4projectmanager/qt-s60/gccetoolchain.h @@ -54,7 +54,7 @@ public: Utils::FileName mkspec() const; QString defaultMakeTarget() const; - void setCompilerPath(const QString &); + void setCompilerCommand(const Utils::FileName &); ProjectExplorer::ToolChain *clone() const; diff --git a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp index 59cd590202cc29e5f277013d7a7eb1118d2b44ab..5856bcf4176c00dd649d2c5599f1b8bf2a6a0206 100644 --- a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.cpp @@ -102,31 +102,30 @@ RvctToolChain::RvctToolChain(bool autodetected) : RvctToolChain::RvctToolChain(const RvctToolChain &tc) : ToolChain(tc), - m_compilerPath(tc.m_compilerPath), + m_compilerCommand(tc.m_compilerCommand), m_environmentChanges(tc.m_environmentChanges), m_armVersion(tc.m_armVersion), m_debuggerCommand(tc.debuggerCommand()) { } -RvctToolChain::RvctVersion RvctToolChain::version(const QString &rvctPath) +RvctToolChain::RvctVersion RvctToolChain::version(const Utils::FileName &rvctPath) { RvctToolChain::RvctVersion v; QProcess armcc; - const QString binary = rvctPath; - armcc.start(binary, QStringList(QLatin1String("--version_number"))); + armcc.start(rvctPath.toString(), QStringList(QLatin1String("--version_number"))); if (!armcc.waitForStarted()) { - qWarning("Unable to run rvct binary '%s' when trying to determine version.", qPrintable(binary)); + qWarning("Unable to run rvct binary '%s' when trying to determine version.", qPrintable(rvctPath.toUserOutput())); return v; } armcc.closeWriteChannel(); if (!armcc.waitForFinished()) { Utils::SynchronousProcess::stopProcess(armcc); - qWarning("Timeout running rvct binary '%s' trying to determine version.", qPrintable(binary)); + qWarning("Timeout running rvct binary '%s' trying to determine version.", qPrintable(rvctPath.toUserOutput())); return v; } if (armcc.exitStatus() != QProcess::NormalExit) { - qWarning("A crash occurred when running rvct binary '%s' trying to determine version.", qPrintable(binary)); + qWarning("A crash occurred when running rvct binary '%s' trying to determine version.", qPrintable(rvctPath.toUserOutput())); return v; } QString versionLine = QString::fromLocal8Bit(armcc.readAllStandardOutput()); @@ -162,7 +161,7 @@ ProjectExplorer::Abi RvctToolChain::targetAbi() const bool RvctToolChain::isValid() const { - return !m_compilerPath.isEmpty(); + return !m_compilerCommand.isEmpty(); } QByteArray RvctToolChain::predefinedMacros() const @@ -197,11 +196,11 @@ QList<ProjectExplorer::HeaderPath> RvctToolChain::systemHeaderPaths() const void RvctToolChain::addToEnvironment(Utils::Environment &env) const { - if (m_compilerPath.isEmpty()) + if (m_compilerCommand.isEmpty()) return; if (m_version.isNull()) - setVersion(version(m_compilerPath)); + setVersion(version(m_compilerCommand)); if (m_version.isNull()) return; @@ -209,11 +208,11 @@ void RvctToolChain::addToEnvironment(Utils::Environment &env) const env.set(QLatin1String("QT_RVCT_VERSION"), QString::fromLatin1("%1.%2") .arg(m_version.majorVersion).arg(m_version.minorVersion)); - env.set(varName(QLatin1String("BIN")), QDir::toNativeSeparators(QFileInfo(m_compilerPath).absolutePath())); + env.set(varName(QLatin1String("BIN")), m_compilerCommand.toUserOutput()); // Add rvct to path and set locale to 'C' - if (!m_compilerPath.isEmpty()) - env.prependOrSetPath(QFileInfo(m_compilerPath).absolutePath()); + if (!m_compilerCommand.isEmpty()) + env.prependOrSetPath(m_compilerCommand.toString()); env.set(QLatin1String("LANG"), QString(QLatin1Char('C'))); } @@ -250,7 +249,7 @@ bool RvctToolChain::operator ==(const ToolChain &other) const if (!ToolChain::operator ==(other)) return false; const RvctToolChain *otherPtr = dynamic_cast<const RvctToolChain *>(&other); - return m_compilerPath == otherPtr->m_compilerPath + return m_compilerCommand == otherPtr->m_compilerCommand && m_environmentChanges == otherPtr->m_environmentChanges && m_armVersion == otherPtr->m_armVersion && m_debuggerCommand == otherPtr->m_debuggerCommand; @@ -269,19 +268,19 @@ QList<Utils::EnvironmentItem> RvctToolChain::environmentChanges() const return m_environmentChanges; } -void RvctToolChain::setCompilerPath(const QString &path) +void RvctToolChain::setCompilerCommand(const Utils::FileName &path) { - if (m_compilerPath == path) + if (m_compilerCommand == path) return; - m_compilerPath = path; + m_compilerCommand = path; m_version.reset(); toolChainUpdated(); } -QString RvctToolChain::compilerPath() const +Utils::FileName RvctToolChain::compilerCommand() const { - return m_compilerPath; + return m_compilerCommand; } void RvctToolChain::setDebuggerCommand(const Utils::FileName &d) @@ -332,7 +331,7 @@ ProjectExplorer::ToolChain *RvctToolChain::clone() const QVariantMap RvctToolChain::toMap() const { QVariantMap result = ToolChain::toMap(); - result.insert(QLatin1String(rvctPathKeyC), m_compilerPath); + result.insert(QLatin1String(rvctPathKeyC), m_compilerCommand.toString()); QVariantMap tmp; foreach (const Utils::EnvironmentItem &i, m_environmentChanges) tmp.insert(i.name, i.value); @@ -346,7 +345,7 @@ bool RvctToolChain::fromMap(const QVariantMap &data) { if (!ToolChain::fromMap(data)) return false; - m_compilerPath = data.value(QLatin1String(rvctPathKeyC)).toString(); + m_compilerCommand = Utils::FileName::fromString(data.value(QLatin1String(rvctPathKeyC)).toString()); m_environmentChanges.clear(); QVariantMap tmp = data.value(QLatin1String(rvctEnvironmentKeyC)).toMap(); @@ -360,7 +359,7 @@ bool RvctToolChain::fromMap(const QVariantMap &data) QString RvctToolChain::legacyId() const { const QChar dot = QLatin1Char('.'); - return QLatin1String(Constants::RVCT_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerPath + dot + return QLatin1String(Constants::RVCT_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerCommand.toString() + dot + armVersionString(m_armVersion) + dot + m_debuggerCommand.toString(); } @@ -394,7 +393,7 @@ RvctToolChainConfigWidget::RvctToolChainConfigWidget(RvctToolChain *tc) : connect(m_model, SIGNAL(userChangesChanged()), this, SLOT(emitDirty())); m_ui->compilerPath->setExpectedKind(Utils::PathChooser::ExistingCommand); - m_ui->compilerPath->setPath(tc->compilerPath()); + m_ui->compilerPath->setFileName(tc->compilerCommand()); connect(m_ui->compilerPath, SIGNAL(changed(QString)), this, SLOT(emitDirty())); m_ui->versionComboBox->setCurrentIndex(static_cast<int>(tc->armVersion())); connect(m_ui->versionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(emitDirty())); @@ -413,7 +412,7 @@ void RvctToolChainConfigWidget::apply() Q_ASSERT(tc); QList<Utils::EnvironmentItem> changes = environmentChanges(); - tc->setCompilerPath(m_ui->compilerPath->path()); + tc->setCompilerCommand(m_ui->compilerPath->fileName()); tc->setArmVersion(static_cast<RvctToolChain::ArmVersion>(m_ui->versionComboBox->currentIndex())); tc->setEnvironmentChanges(changes); tc->setDebuggerCommand(debuggerCommand()); @@ -428,7 +427,7 @@ void RvctToolChainConfigWidget::setFromToolChain() m_model->setBaseEnvironment(baseEnvironment(tc)); - m_ui->compilerPath->setPath(tc->compilerPath()); + m_ui->compilerPath->setFileName(tc->compilerCommand()); m_ui->versionComboBox->setCurrentIndex(static_cast<int>(tc->armVersion())); setDebuggerCommand(tc->debuggerCommand()); } @@ -438,7 +437,7 @@ bool RvctToolChainConfigWidget::isDirty() const RvctToolChain *tc = static_cast<RvctToolChain *>(toolChain()); Q_ASSERT(tc); - return tc->compilerPath() != m_ui->compilerPath->path() + return tc->compilerCommand() != m_ui->compilerPath->fileName() || tc->armVersion() != static_cast<RvctToolChain::ArmVersion>(m_ui->versionComboBox->currentIndex()) || tc->environmentChanges() != environmentChanges() || tc->debuggerCommand() != debuggerCommand(); @@ -517,11 +516,11 @@ QList<ProjectExplorer::ToolChain *> RvctToolChainFactory::autoDetect() QList<Utils::EnvironmentItem> changes = i.value(); changes.append(globalItems); - QString binary = QDir::fromNativeSeparators(valueOf(changes, QLatin1String("BIN"))); + Utils::FileName binary = Utils::FileName::fromUserInput(valueOf(changes, QLatin1String("BIN"))); if (binary.isEmpty()) continue; - binary = binary + QLatin1Char('/') + QLatin1String(RVCT_BINARY); - QFileInfo fi(binary); + binary.appendPath(QLatin1String(RVCT_BINARY)); + QFileInfo fi(binary.toFileInfo()); if (!fi.exists() || !fi.isExecutable()) continue; @@ -533,15 +532,16 @@ QList<ProjectExplorer::ToolChain *> RvctToolChainFactory::autoDetect() const QString name = tr("RVCT (%1 %2.%3 Build %4)"); RvctToolChain *tc = new RvctToolChain(true); - tc->setCompilerPath(binary); + tc->setCompilerCommand(binary); tc->setEnvironmentChanges(changes); tc->setDisplayName(name.arg(armVersionString(tc->armVersion())) .arg(v.majorVersion).arg(v.minorVersion).arg(v.build)); tc->setVersion(v); + tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi())); result.append(tc); tc = new RvctToolChain(true); - tc->setCompilerPath(binary); + tc->setCompilerCommand(binary); tc->setEnvironmentChanges(changes); tc->setArmVersion(RvctToolChain::ARMv6); tc->setDisplayName(name.arg(armVersionString(tc->armVersion())) diff --git a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h index 984496f8d25d3770d62853514e5e82b11077eaf9..28e002227af0f969b05a252eaf6d0a54985306c4 100644 --- a/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h +++ b/src/plugins/qt4projectmanager/qt-s60/rvcttoolchain.h @@ -77,7 +77,7 @@ public: int build; }; - static RvctVersion version(const QString &rvctPath); + static RvctVersion version(const Utils::FileName &rvctPath); enum ArmVersion { ARMv5, ARMv6 }; @@ -102,11 +102,11 @@ public: void setEnvironmentChanges(const QList<Utils::EnvironmentItem> &changes); QList<Utils::EnvironmentItem> environmentChanges() const; - void setCompilerPath(const QString &path); - QString compilerPath() const; + void setCompilerCommand(const Utils::FileName &path); + Utils::FileName compilerCommand() const; void setDebuggerCommand(const Utils::FileName &d); - virtual Utils::FileName debuggerCommand() const; + Utils::FileName debuggerCommand() const; void setArmVersion(ArmVersion); ArmVersion armVersion() const; @@ -126,7 +126,7 @@ private: QString varName(const QString &postFix) const; QList<ProjectExplorer::HeaderPath> m_systemHeaderPaths; - QString m_compilerPath; + Utils::FileName m_compilerCommand; QList<Utils::EnvironmentItem> m_environmentChanges; ArmVersion m_armVersion; mutable RvctVersion m_version; diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp index 1484ebf3f6881fd160847adb9462bda6df709eaa..ed98d12fe132d4b4768e78ff8047415d6bb97c56 100644 --- a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp @@ -70,17 +70,17 @@ static const char *const WINSCW_DEFAULT_SYSTEM_LIBRARIES[] = { 0 }; -static QString winscwRoot(const QString &path) +static Utils::FileName winscwRoot(const Utils::FileName &pathIn) { + Utils::FileName path = pathIn; if (path.isEmpty()) - return QString(); + return Utils::FileName(); - QDir dir(path); - dir.cdUp(); - dir.cdUp(); - dir.cdUp(); - dir.cd(QLatin1String("Symbian_Support")); - return dir.absolutePath(); + path = path.parentDir(); + path = path.parentDir(); + path = path.parentDir(); + path.appendPath(QLatin1String("Symbian_Support")); + return path; } static QString toNativePath(const QStringList &list) @@ -93,24 +93,24 @@ static QStringList fromNativePath(const QString &list) return QDir::fromNativeSeparators(list).split(QLatin1Char(';')); } -static QStringList detectIncludesFor(const QString path) +static QStringList detectIncludesFor(const Utils::FileName &path) { - QString root = winscwRoot(path); + Utils::FileName root = winscwRoot(path); QStringList result; for (int i = 0; WINSCW_DEFAULT_SYSTEM_INCLUDES[i] != 0; ++i) { - QDir dir(root + QLatin1String(WINSCW_DEFAULT_SYSTEM_INCLUDES[i])); + QDir dir(root.toString() + QLatin1String(WINSCW_DEFAULT_SYSTEM_INCLUDES[i])); if (dir.exists()) result.append(dir.absolutePath()); } return result; } -static QStringList detectLibrariesFor(const QString path) +static QStringList detectLibrariesFor(const Utils::FileName &path) { - QString root = winscwRoot(path); + Utils::FileName root = winscwRoot(path); QStringList result; for (int i = 0; WINSCW_DEFAULT_SYSTEM_LIBRARIES[i] != 0; ++i) { - QDir dir(root + QLatin1String(WINSCW_DEFAULT_SYSTEM_LIBRARIES[i])); + QDir dir(root.toString() + QLatin1String(WINSCW_DEFAULT_SYSTEM_LIBRARIES[i])); if (dir.exists()) result.append(dir.absolutePath()); } @@ -154,7 +154,7 @@ ProjectExplorer::Abi WinscwToolChain::targetAbi() const QString WinscwToolChain::legacyId() const { - return QLatin1String(Constants::WINSCW_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerPath; + return QLatin1String(Constants::WINSCW_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerPath.toString(); } bool WinscwToolChain::isValid() const @@ -162,7 +162,7 @@ bool WinscwToolChain::isValid() const if (m_compilerPath.isEmpty()) return false; - QFileInfo fi(m_compilerPath); + QFileInfo fi(m_compilerPath.toFileInfo()); return fi.exists() && fi.isExecutable(); } @@ -188,7 +188,7 @@ void WinscwToolChain::addToEnvironment(Utils::Environment &env) const env.set(QLatin1String("MWSYM2LIBRARIES"), toNativePath(m_systemLibraryPathes)); env.set(QLatin1String("MWSYM2LIBRARYFILES"), QLatin1String("MSL_All_MSE_Symbian_D.lib;gdi32.lib;user32.lib;kernel32.lib")); - env.prependOrSetPath(QFileInfo(m_compilerPath).absolutePath()); + env.prependOrSetPath(m_compilerPath.toString()); } @@ -246,7 +246,7 @@ ProjectExplorer::ToolChain *WinscwToolChain::clone() const QVariantMap WinscwToolChain::toMap() const { QVariantMap result = ToolChain::toMap(); - result.insert(QLatin1String(winscwCompilerPathKeyC), m_compilerPath); + result.insert(QLatin1String(winscwCompilerPathKeyC), m_compilerPath.toString()); const QString semicolon = QString(QLatin1Char(';')); result.insert(QLatin1String(winscwSystemIncludePathKeyC), m_systemIncludePathes.join(semicolon)); result.insert(QLatin1String(winscwSystemLibraryPathKeyC), m_systemLibraryPathes.join(semicolon)); @@ -257,7 +257,7 @@ bool WinscwToolChain::fromMap(const QVariantMap &data) { if (!ToolChain::fromMap(data)) return false; - m_compilerPath = data.value(QLatin1String(winscwCompilerPathKeyC)).toString(); + m_compilerPath = Utils::FileName::fromString(data.value(QLatin1String(winscwCompilerPathKeyC)).toString()); const QChar semicolon = QLatin1Char(';'); m_systemIncludePathes = data.value(QLatin1String(winscwSystemIncludePathKeyC)).toString().split(semicolon); m_systemLibraryPathes = data.value(QLatin1String(winscwSystemLibraryPathKeyC)).toString().split(semicolon); @@ -290,7 +290,7 @@ QStringList WinscwToolChain::systemLibraryPathes() const return m_systemLibraryPathes; } -void WinscwToolChain::setCompilerPath(const QString &path) +void WinscwToolChain::setCompilerCommand(const Utils::FileName &path) { if (m_compilerPath == path) return; @@ -299,7 +299,7 @@ void WinscwToolChain::setCompilerPath(const QString &path) toolChainUpdated(); } -QString WinscwToolChain::compilerPath() const +Utils::FileName WinscwToolChain::compilerCommand() const { return m_compilerPath; } @@ -332,7 +332,7 @@ void WinscwToolChainConfigWidget::apply() { WinscwToolChain *tc = static_cast<WinscwToolChain *>(toolChain()); Q_ASSERT(tc); - tc->setCompilerPath(m_ui->compilerPath->path()); + tc->setCompilerCommand(m_ui->compilerPath->fileName()); tc->setSystemIncludePathes(fromNativePath(m_ui->includeEdit->text())); tc->setSystemLibraryPathes(fromNativePath(m_ui->libraryEdit->text())); } @@ -341,7 +341,7 @@ void WinscwToolChainConfigWidget::discard() { WinscwToolChain *tc = static_cast<WinscwToolChain *>(toolChain()); Q_ASSERT(tc); - m_ui->compilerPath->setPath(tc->compilerPath()); + m_ui->compilerPath->setFileName(tc->compilerCommand()); m_ui->includeEdit->setText(toNativePath(tc->systemIncludePathes())); m_ui->libraryEdit->setText(toNativePath(tc->systemLibraryPathes())); } @@ -350,18 +350,17 @@ bool WinscwToolChainConfigWidget::isDirty() const { WinscwToolChain *tc = static_cast<WinscwToolChain *>(toolChain()); Q_ASSERT(tc); - return tc->compilerPath() != m_ui->compilerPath->path() + return tc->compilerCommand() != m_ui->compilerPath->fileName() || tc->systemIncludePathes() != fromNativePath(m_ui->includeEdit->text()) || tc->systemLibraryPathes() != fromNativePath(m_ui->libraryEdit->text()); } void WinscwToolChainConfigWidget::handleCompilerPathUpdate() { - QString path = m_ui->compilerPath->path(); + Utils::FileName path = m_ui->compilerPath->fileName(); if (path.isEmpty()) return; - QFileInfo fi(path); - if (!fi.exists()) + if (!path.toFileInfo().exists()) return; m_ui->includeEdit->setText(toNativePath(detectIncludesFor(path))); m_ui->libraryEdit->setText(toNativePath(detectLibrariesFor(path))); @@ -403,16 +402,16 @@ QList<ProjectExplorer::ToolChain *> WinscwToolChainFactory::autoDetect() QFileInfo fi(path + QLatin1String("/x86Build/Symbian_Tools/Command_Line_Tools/mwwinrc.exe")); if (fi.exists() && fi.isExecutable()) { WinscwToolChain *tc = new WinscwToolChain(false); - tc->setCompilerPath(fi.absoluteFilePath()); + tc->setCompilerCommand(Utils::FileName(fi)); tc->setDisplayName(tr("WINSCW from Qt version")); result.append(tc); } } - QString cc = Utils::Environment::systemEnvironment().searchInPath(QLatin1String("mwwinrc")); + Utils::FileName cc = Utils::FileName::fromString(Utils::Environment::systemEnvironment().searchInPath(QLatin1String("mwwinrc"))); if (!cc.isEmpty()) { WinscwToolChain *tc = new WinscwToolChain(true); - tc->setCompilerPath(cc); + tc->setCompilerCommand(cc); tc->setSystemIncludePathes(detectIncludesFor(cc)); tc->setSystemLibraryPathes(detectLibrariesFor(cc)); result.append(tc); diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h index 25a9e14135738c61f2ed73ea5bc675d8c3ed37ea..0b6859b3da5430c3a8e931f0a92d60984d375923 100644 --- a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h +++ b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.h @@ -64,6 +64,7 @@ public: void addToEnvironment(Utils::Environment &env) const; Utils::FileName mkspec() const; QString makeCommand() const; + Utils::FileName compilerCommand() const; Utils::FileName debuggerCommand() const; QString defaultMakeTarget() const; ProjectExplorer::IOutputParser *outputParser() const; @@ -82,15 +83,14 @@ public: void setSystemLibraryPathes(const QStringList &); QStringList systemLibraryPathes() const; - void setCompilerPath(const QString &); - QString compilerPath() const; + void setCompilerCommand(const Utils::FileName &); private: explicit WinscwToolChain(bool); QStringList m_systemIncludePathes; QStringList m_systemLibraryPathes; - QString m_compilerPath; + Utils::FileName m_compilerPath; friend class WinscwToolChainFactory; }; diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 6efe1405cc3cd95d900968f86e06f0d1df1ef55e..447d2cbd98bab5a7dafc1f94b5871787a865575f 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -413,7 +413,7 @@ bool QtVersionManager::legacyRestore() if (fi.exists() && fi.isExecutable()) { ProjectExplorer::MingwToolChain *tc = createToolChain<ProjectExplorer::MingwToolChain>(QLatin1String(ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID)); if (tc) { - tc->setCompilerPath(fi.absoluteFilePath()); + tc->setCompilerCommand(Utils::FileName(fi)); tc->setDisplayName(tr("MinGW from %1").arg(version->displayName())); // The debugger is set later in the autoDetect method of the MinGw tool chain factory // as the default debuggers are not yet registered.