diff options
Diffstat (limited to 'src/plugins/qtsupport')
32 files changed, 541 insertions, 513 deletions
diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index b52ccef155..988c5d9777 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -47,6 +47,8 @@ #include <utils/persistentsettings.h> #include <utils/environment.h> +#include <utils/hostosinfo.h> +#include <utils/qtcassert.h> #include <utils/synchronousprocess.h> #include <QDir> @@ -57,6 +59,7 @@ using namespace QtSupport; using namespace QtSupport::Internal; +using namespace Utils; static const char QTVERSIONID[] = "Id"; static const char QTVERSIONNAME[] = "Name"; @@ -163,7 +166,7 @@ int BaseQtVersion::getUniqueId() return QtVersionManager::instance()->getUniqueId(); } -BaseQtVersion::BaseQtVersion(const Utils::FileName &qmakeCommand, bool isAutodetected, const QString &autodetectionSource) +BaseQtVersion::BaseQtVersion(const FileName &qmakeCommand, bool isAutodetected, const QString &autodetectionSource) : m_id(getUniqueId()), m_isAutodetected(isAutodetected), m_autodetectionSource(autodetectionSource), @@ -183,7 +186,6 @@ BaseQtVersion::BaseQtVersion(const Utils::FileName &qmakeCommand, bool isAutodet m_qmakeIsExecutable(true) { ctor(qmakeCommand); - setDisplayName(defaultDisplayName(qtVersionString(), qmakeCommand, false)); } BaseQtVersion::BaseQtVersion() @@ -203,10 +205,10 @@ BaseQtVersion::BaseQtVersion() m_hasDocumentation(false), m_qmakeIsExecutable(true) { - ctor(Utils::FileName()); + ctor(FileName()); } -void BaseQtVersion::ctor(const Utils::FileName &qmakePath) +void BaseQtVersion::ctor(const FileName &qmakePath) { m_qmakeCommand = qmakePath; m_designerCommand.clear(); @@ -224,7 +226,7 @@ BaseQtVersion::~BaseQtVersion() { } -QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Utils::FileName &qmakePath, +QString BaseQtVersion::defaultDisplayName(const QString &versionString, const FileName &qmakePath, bool fromPath) { QString location; @@ -266,12 +268,10 @@ Core::FeatureSet BaseQtVersion::availableFeatures() const features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK); features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK_1); } - if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 1)) { + if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 1)) features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK_1_1); - } - if (qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0)) { + if (qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0)) features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK_2); - } return features; } @@ -317,12 +317,47 @@ QList<ProjectExplorer::Task> BaseQtVersion::validateKit(const ProjectExplorer::K version->displayName(), qtAbiString); result << ProjectExplorer::Task(ProjectExplorer::Task::Error, - message, Utils::FileName(), -1, + message, FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); } // Abi mismatch return result; } +FileName BaseQtVersion::headerPath() const +{ + return Utils::FileName::fromUserInput(qmakeProperty("QT_INSTALL_HEADERS")); +} + +FileName BaseQtVersion::libraryPath() const +{ + return Utils::FileName::fromUserInput(qmakeProperty("QT_INSTALL_LIBS")); +} + +FileName BaseQtVersion::binPath() const +{ + return Utils::FileName::fromUserInput(qmakeProperty("QT_HOST_BINS")); +} + +Utils::FileName QtSupport::BaseQtVersion::mkspecsPath() const +{ + Utils::FileName result = Utils::FileName::fromUserInput(qmakeProperty("QT_HOST_DATA")); + if (result.isEmpty()) + result = Utils::FileName::fromUserInput(qmakeProperty("QMAKE_MKSPECS")); + else + result.appendPath(QLatin1String("mkspecs")); + return result; +} + +QString QtSupport::BaseQtVersion::qtNamespace() const +{ + return qmakeProperty("QT_NAMESPACE"); +} + +QString QtSupport::BaseQtVersion::qtLibInfix() const +{ + return qmakeProperty("QT_LIBINFIX"); +} + void BaseQtVersion::setId(int id) { m_id = id; @@ -340,7 +375,7 @@ void BaseQtVersion::fromMap(const QVariantMap &map) QString string = map.value(QLatin1String(QTVERSIONQMAKEPATH)).toString(); if (string.startsWith(QLatin1Char('~'))) string.remove(0, 1).prepend(QDir::homePath()); - ctor(Utils::FileName::fromString(string)); + ctor(FileName::fromString(string)); } QVariantMap BaseQtVersion::toMap() const @@ -399,9 +434,9 @@ QStringList BaseQtVersion::warningReason() const return ret; } -ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const Utils::FileName &ms) const +ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const FileName &ms) const { - const Utils::FileName spec = ms.isEmpty() ? mkspec() : ms; + const FileName spec = ms.isEmpty() ? mkspec() : ms; QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains(); ProjectExplorer::ToolChain *possibleTc = 0; foreach (ProjectExplorer::ToolChain *tc, tcList) { @@ -415,7 +450,7 @@ ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const Utils::FileN return possibleTc; } -Utils::FileName BaseQtVersion::qmakeCommand() const +FileName BaseQtVersion::qmakeCommand() const { return m_qmakeCommand; } @@ -570,10 +605,10 @@ void BaseQtVersion::updateSourcePath() const } } } - m_sourcePath = Utils::FileName::fromUserInput(sourcePath); + m_sourcePath = FileName::fromUserInput(sourcePath); } -Utils::FileName BaseQtVersion::sourcePath() const +FileName BaseQtVersion::sourcePath() const { updateSourcePath(); return m_sourcePath; @@ -652,46 +687,43 @@ QString BaseQtVersion::findQtBinary(Binaries binary) const QStringList possibleCommands; switch (binary) { case QmlScene: { -#if defined(Q_OS_WIN) - possibleCommands << QLatin1String("qmlscene.exe"); -#else - possibleCommands << QLatin1String("qmlscene"); -#endif + if (HostOsInfo::isWindowsHost()) + possibleCommands << QLatin1String("qmlscene.exe"); + else + possibleCommands << QLatin1String("qmlscene"); } case QmlViewer: { -#if defined(Q_OS_WIN) - possibleCommands << QLatin1String("qmlviewer.exe"); -#elif defined(Q_OS_MAC) - possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer"); -#else - possibleCommands << QLatin1String("qmlviewer"); -#endif + if (HostOsInfo::isWindowsHost()) + possibleCommands << QLatin1String("qmlviewer.exe"); + else if (HostOsInfo::isMacHost()) + possibleCommands << QLatin1String("QMLViewer.app/Contents/MacOS/QMLViewer"); + else + possibleCommands << QLatin1String("qmlviewer"); } break; case Designer: -#if defined(Q_OS_WIN) - possibleCommands << QLatin1String("designer.exe"); -#elif defined(Q_OS_MAC) - possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer"); -#else - possibleCommands << QLatin1String("designer"); -#endif + if (HostOsInfo::isWindowsHost()) + possibleCommands << QLatin1String("designer.exe"); + else if (HostOsInfo::isMacHost()) + possibleCommands << QLatin1String("Designer.app/Contents/MacOS/Designer"); + else + possibleCommands << QLatin1String("designer"); break; case Linguist: -#if defined(Q_OS_WIN) - possibleCommands << QLatin1String("linguist.exe"); -#elif defined(Q_OS_MAC) - possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist"); -#else - possibleCommands << QLatin1String("linguist"); -#endif + if (HostOsInfo::isWindowsHost()) + possibleCommands << QLatin1String("linguist.exe"); + else if (HostOsInfo::isMacHost()) + possibleCommands << QLatin1String("Linguist.app/Contents/MacOS/Linguist"); + else + possibleCommands << QLatin1String("linguist"); break; case Uic: -#ifdef Q_OS_WIN - possibleCommands << QLatin1String("uic.exe"); -#else - possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4") << QLatin1String("uic"); -#endif + if (HostOsInfo::isWindowsHost()) { + possibleCommands << QLatin1String("uic.exe"); + } else { + possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4") + << QLatin1String("uic"); + } break; default: Q_ASSERT(false); @@ -726,13 +758,13 @@ void BaseQtVersion::updateMkspec() const if (m_mkspecFullPath.isEmpty()) return; - Utils::FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo()); + FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo()); if (m_mkspec.isChildOf(baseMkspecDir)) { m_mkspec = m_mkspec.relativeChildPath(baseMkspecDir); // qDebug() << "Setting mkspec to"<<mkspec; } else { - Utils::FileName sourceMkSpecPath = sourcePath().appendPath(QLatin1String("mkspecs")); + FileName sourceMkSpecPath = sourcePath().appendPath(QLatin1String("mkspecs")); if (m_mkspec.isChildOf(sourceMkSpecPath)) { m_mkspec = m_mkspec.relativeChildPath(sourceMkSpecPath); } else { @@ -750,7 +782,7 @@ void BaseQtVersion::ensureMkSpecParsed() const if (mkspecPath().isEmpty()) return; - QMakeGlobals option; + ProFileGlobals option; option.setProperties(versionInfo()); ProMessageHandler msgHandler(true); ProFileCacheManager::instance()->incRefCount(); @@ -783,22 +815,22 @@ void BaseQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const m_mkspecValues.insert(declarativeBins, evaluator->value(declarativeBins)); } -Utils::FileName BaseQtVersion::mkspec() const +FileName BaseQtVersion::mkspec() const { updateMkspec(); return m_mkspec; } -Utils::FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const +FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const { Utils::FileName versionSpec = mkspec(); if (!tc) return versionSpec; - const QList<Utils::FileName> tcSpecList = tc->suggestedMkspecList(); + const QList<FileName> tcSpecList = tc->suggestedMkspecList(); if (tcSpecList.contains(versionSpec)) return versionSpec; - foreach (const Utils::FileName &tcSpec, tcSpecList) { + foreach (const FileName &tcSpec, tcSpecList) { if (hasMkspec(tcSpec)) return tcSpec; } @@ -806,13 +838,13 @@ Utils::FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const return versionSpec; } -Utils::FileName BaseQtVersion::mkspecPath() const +FileName BaseQtVersion::mkspecPath() const { updateMkspec(); return m_mkspecFullPath; } -bool BaseQtVersion::hasMkspec(const Utils::FileName &spec) const +bool BaseQtVersion::hasMkspec(const FileName &spec) const { updateVersionInfo(); QFileInfo fi; @@ -867,8 +899,11 @@ void BaseQtVersion::updateVersionInfo() const m_hasQmlDebuggingLibrary = false; m_hasQmlObserver = false; - if (!queryQMakeVariables(qmakeCommand(), &m_versionInfo, &m_qmakeIsExecutable)) + if (!queryQMakeVariables(qmakeCommand(), qmakeRunEnvironment(), &m_versionInfo)) { + m_qmakeIsExecutable = false; return; + } + m_qmakeIsExecutable = true; const QString qtInstallData = qmakeProperty("QT_INSTALL_DATA"); const QString qtInstallBins = qmakeProperty("QT_INSTALL_BINS"); @@ -966,12 +1001,11 @@ QString BaseQtVersion::demosPath() const QString BaseQtVersion::frameworkInstallPath() const { -#ifdef Q_OS_MAC - updateVersionInfo(); - return m_versionInfo.value(QLatin1String("QT_INSTALL_LIBS")); -#else + if (HostOsInfo::isMacHost()) { + updateVersionInfo(); + return m_versionInfo.value(QLatin1String("QT_INSTALL_LIBS")); + } return QString(); -#endif } bool BaseQtVersion::hasExamples() const @@ -994,13 +1028,23 @@ QList<ProjectExplorer::HeaderPath> BaseQtVersion::systemHeaderPathes(const Proje return result; } -void BaseQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const +void BaseQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Environment &env) const { Q_UNUSED(k); env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(qmakeProperty("QT_HOST_DATA"))); env.prependOrSetPath(qmakeProperty("QT_HOST_BINS")); } +// Some Qt versions may require environment settings for qmake to work +// +// One such example is Blackberry which for some reason decided to always use the same +// qmake and use environment variables embedded in their mkspecs to make that point to +// the different Qt installations. +Utils::Environment BaseQtVersion::qmakeRunEnvironment() const +{ + return Utils::Environment::systemEnvironment(); +} + bool BaseQtVersion::hasGdbDebuggingHelper() const { updateVersionInfo(); @@ -1038,10 +1082,10 @@ bool BaseQtVersion::hasQmlObserver() const return m_hasQmlObserver; } -Utils::Environment BaseQtVersion::qmlToolsEnvironment() const +Environment BaseQtVersion::qmlToolsEnvironment() const { // FIXME: This seems broken! - Utils::Environment environment = Utils::Environment::systemEnvironment(); + Environment environment = Environment::systemEnvironment(); #if 0 // FIXME: Fix this! addToEnvironment(environment); #endif @@ -1127,7 +1171,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF if (!isValid()) { //: %1: Reason for being invalid const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The Qt version is invalid: %1").arg(invalidReason()); - results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, Utils::FileName(), -1, + results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); } @@ -1137,7 +1181,7 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF //: %1: Path to qmake executable const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The qmake command \"%1\" was not found or is not executable.").arg(qmakeCommand().toUserOutput()); - results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, Utils::FileName(), -1, + results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); } @@ -1148,13 +1192,13 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF if ((tmpBuildDir.startsWith(sourcePath)) && (tmpBuildDir != sourcePath)) { const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "Qmake does not support build directories below the source directory."); - results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, Utils::FileName(), -1, + results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); } else if (tmpBuildDir.count(slash) != sourcePath.count(slash) && qtVersion() < QtVersionNumber(4,8, 0)) { const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The build directory needs to be at the same level as the source directory."); - results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, Utils::FileName(), -1, + results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, FileName(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); } @@ -1169,25 +1213,16 @@ BaseQtVersion::reportIssues(const QString &proFile, const QString &buildDir) con return results; } -ProjectExplorer::IOutputParser *BaseQtVersion::createOutputParser() const -{ - return new ProjectExplorer::GnuMakeParser; -} - QtConfigWidget *BaseQtVersion::createConfigurationWidget() const { return 0; } -bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo) +static QByteArray runQmakeQuery(const FileName &binary, const Environment &env, + QString *error) { - bool qmakeIsExecutable; - return BaseQtVersion::queryQMakeVariables(binary, versionInfo, &qmakeIsExecutable); -} + QTC_ASSERT(error, return QByteArray()); -static QByteArray runQmakeQuery(const Utils::FileName &binary, const Utils::Environment &env, - bool *isExecutable) -{ const int timeOutMS = 30000; // Might be slow on some machines. QProcess process; @@ -1195,38 +1230,40 @@ static QByteArray runQmakeQuery(const Utils::FileName &binary, const Utils::Envi process.start(binary.toString(), QStringList(QLatin1String("-query")), QIODevice::ReadOnly); if (!process.waitForStarted()) { - qWarning("Cannot start '%s': %s", qPrintable(binary.toUserOutput()), qPrintable(process.errorString())); - *isExecutable = false; + *error = QCoreApplication::translate("QtVersion", "Cannot start '%1': %2").arg(binary.toUserOutput()).arg(process.errorString()); return QByteArray(); } if (!process.waitForFinished(timeOutMS)) { - Utils::SynchronousProcess::stopProcess(process); - *isExecutable = true; - qWarning("Timeout running '%s' (%dms).", qPrintable(binary.toUserOutput()), timeOutMS); + SynchronousProcess::stopProcess(process); + *error = QCoreApplication::translate("QtVersion", "Timeout running '%1' (%2ms).").arg(binary.toUserOutput()).arg(timeOutMS); return QByteArray(); } if (process.exitStatus() != QProcess::NormalExit) { - qWarning("'%s' crashed.", qPrintable(binary.toUserOutput())); - *isExecutable = false; + *error = QCoreApplication::translate("QtVersion", "'%1' crashed.").arg(binary.toUserOutput()); return QByteArray(); } - *isExecutable = true; + error->clear(); return process.readAllStandardOutput(); } -bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo, - bool *qmakeIsExecutable) +bool BaseQtVersion::queryQMakeVariables(const FileName &binary, const Environment &env, + QHash<QString, QString> *versionInfo, QString *error) { + QString tmp; + if (!error) + error = &tmp; + const QFileInfo qmake = binary.toFileInfo(); - *qmakeIsExecutable = qmake.exists() && qmake.isExecutable() && !qmake.isDir(); - if (!*qmakeIsExecutable) + if (!qmake.exists() || !qmake.isExecutable() || qmake.isDir()) { + *error = QCoreApplication::translate("QtVersion", "qmake '%1' is not a executable").arg(binary.toUserOutput()); return false; + } QByteArray output; - output = runQmakeQuery(binary, Utils::Environment::systemEnvironment(), qmakeIsExecutable); + output = runQmakeQuery(binary, env, error); - if (output.isNull() && !*qmakeIsExecutable) { + if (output.isNull() && !error->isEmpty()) { // Note: Don't rerun if we were able to execute the binary before. // Try running qmake with all kinds of tool chains set up in the environment. @@ -1237,10 +1274,10 @@ bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QSt foreach (ProjectExplorer::ToolChain *tc, tcList) { if (!abiList.contains(tc->targetAbi())) continue; - Utils::Environment env = Utils::Environment::systemEnvironment(); - tc->addToEnvironment(env); - output = runQmakeQuery(binary, env, qmakeIsExecutable); - if (*qmakeIsExecutable) + Environment realEnv = env; + tc->addToEnvironment(realEnv); + output = runQmakeQuery(binary, realEnv, error); + if (error->isEmpty()) break; } } @@ -1278,19 +1315,19 @@ bool BaseQtVersion::queryQMakeVariables(const Utils::FileName &binary, QHash<QSt return true; } -Utils::FileName BaseQtVersion::mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo) +FileName BaseQtVersion::mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo) { QString dataDir = qmakeProperty(versionInfo, "QT_HOST_DATA"); if (dataDir.isEmpty()) - return Utils::FileName(); - return Utils::FileName::fromUserInput(dataDir + QLatin1String("/mkspecs")); + return FileName(); + return FileName::fromUserInput(dataDir + QLatin1String("/mkspecs")); } -Utils::FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo) +FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo) { - Utils::FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo); + FileName baseMkspecDir = mkspecDirectoryFromVersionInfo(versionInfo); if (baseMkspecDir.isEmpty()) - return Utils::FileName(); + return FileName(); bool qt5 = false; QString theSpec = qmakeProperty(versionInfo, "QMAKE_XSPEC"); @@ -1299,67 +1336,66 @@ Utils::FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QStrin else qt5 = true; - Utils::FileName mkspecFullPath = baseMkspecDir; + FileName mkspecFullPath = baseMkspecDir; mkspecFullPath.appendPath(theSpec); // qDebug() << "default mkspec is located at" << mkspecFullPath; -#ifdef Q_OS_WIN - if (!qt5) { - QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf")); - if (f2.exists() && f2.open(QIODevice::ReadOnly)) { - while (!f2.atEnd()) { - QByteArray line = f2.readLine(); - if (line.startsWith("QMAKESPEC_ORIGINAL")) { - const QList<QByteArray> &temp = line.split('='); - if (temp.size() == 2) { - QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData()); - // We sometimes get a mix of different slash styles here... - possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/')); - if (QFileInfo(possibleFullPath).exists()) // Only if the path exists - mkspecFullPath = Utils::FileName::fromUserInput(possibleFullPath); + if (HostOsInfo::isWindowsHost()) { + if (!qt5) { + QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf")); + if (f2.exists() && f2.open(QIODevice::ReadOnly)) { + while (!f2.atEnd()) { + QByteArray line = f2.readLine(); + if (line.startsWith("QMAKESPEC_ORIGINAL")) { + const QList<QByteArray> &temp = line.split('='); + if (temp.size() == 2) { + QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData()); + // We sometimes get a mix of different slash styles here... + possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/')); + if (QFileInfo(possibleFullPath).exists()) // Only if the path exists + mkspecFullPath = FileName::fromUserInput(possibleFullPath); + } + break; } - break; } + f2.close(); } - f2.close(); } - } -#else -# ifdef Q_OS_MAC - QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf")); - if (f2.exists() && f2.open(QIODevice::ReadOnly)) { - while (!f2.atEnd()) { - QByteArray line = f2.readLine(); - if (line.startsWith("MAKEFILE_GENERATOR")) { - const QList<QByteArray> &temp = line.split('='); - if (temp.size() == 2) { - const QByteArray &value = temp.at(1); - if (value.contains("XCODE")) { - // we don't want to generate xcode projects... -// qDebug() << "default mkspec is xcode, falling back to g++"; - return baseMkspecDir.appendPath(QLatin1String("macx-g++")); + } else { + if (HostOsInfo::isMacHost()) { + QFile f2(mkspecFullPath.toString() + QLatin1String("/qmake.conf")); + if (f2.exists() && f2.open(QIODevice::ReadOnly)) { + while (!f2.atEnd()) { + QByteArray line = f2.readLine(); + if (line.startsWith("MAKEFILE_GENERATOR")) { + const QList<QByteArray> &temp = line.split('='); + if (temp.size() == 2) { + const QByteArray &value = temp.at(1); + if (value.contains("XCODE")) { + // we don't want to generate xcode projects... + // qDebug() << "default mkspec is xcode, falling back to g++"; + return baseMkspecDir.appendPath(QLatin1String("macx-g++")); + } + } + break; } } - break; + f2.close(); } } - f2.close(); - } -# endif - if (!qt5) { - //resolve mkspec link - QString rspec = mkspecFullPath.toFileInfo().readLink(); - if (!rspec.isEmpty()) - mkspecFullPath = Utils::FileName::fromUserInput( - QDir(baseMkspecDir.toString()).absoluteFilePath(rspec)); + if (!qt5) { + //resolve mkspec link + QString rspec = mkspecFullPath.toFileInfo().readLink(); + if (!rspec.isEmpty()) + mkspecFullPath = FileName::fromUserInput( + QDir(baseMkspecDir.toString()).absoluteFilePath(rspec)); + } } -#endif - return mkspecFullPath; } -Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString) +FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString) { QStringList dirs; dirs << qmakeProperty(versionInfo, "QT_INSTALL_LIBS") @@ -1377,7 +1413,7 @@ Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionI && file.startsWith(QLatin1String("QtCore")) && file.endsWith(QLatin1String(".framework"))) { // handle Framework - Utils::FileName lib(info); + FileName lib(info); lib.appendPath(file.left(file.lastIndexOf(QLatin1Char('.')))); return lib; } @@ -1393,18 +1429,18 @@ Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionI || file.endsWith(QString::fromLatin1(".so.") + versionString) || file.endsWith(QLatin1String(".so")) || file.endsWith(QLatin1Char('.') + versionString + QLatin1String(".dylib"))) - return Utils::FileName(info); + return FileName(info); } } } } // Return path to first static library found: if (!staticLibs.isEmpty()) - return Utils::FileName(staticLibs.at(0)); - return Utils::FileName(); + return FileName(staticLibs.at(0)); + return FileName(); } -QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const Utils::FileName &coreLibrary) +QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const FileName &coreLibrary) { return ProjectExplorer::Abi::abisOfBinary(coreLibrary); } diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index dc9eb03891..f9f9cf76cd 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -131,6 +131,7 @@ public: static QString qmakeProperty(const QHash<QString,QString> &versionInfo, const QByteArray &name); QString qmakeProperty(const QByteArray &name) const; virtual void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const; + virtual Utils::Environment qmakeRunEnvironment() const; virtual Utils::FileName sourcePath() const; // used by QtUiCodeModelSupport @@ -185,14 +186,11 @@ public: /// warnings and finally info items. QList<ProjectExplorer::Task> reportIssues(const QString &proFile, const QString &buildDir) const; - virtual ProjectExplorer::IOutputParser *createOutputParser() const; - - static bool queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo); - static bool queryQMakeVariables(const Utils::FileName &binary, QHash<QString, QString> *versionInfo, bool *qmakeIsExecutable); + static bool queryQMakeVariables(const Utils::FileName &binary, const Utils::Environment &env, + QHash<QString, QString> *versionInfo, QString *error = 0); static Utils::FileName mkspecDirectoryFromVersionInfo(const QHash<QString, QString> &versionInfo); static Utils::FileName mkspecFromVersionInfo(const QHash<QString, QString> &versionInfo); - virtual bool supportsBinaryDebuggingHelper() const; virtual QString gdbDebuggingHelperLibrary() const; virtual QString qmlDebuggingHelperLibrary(bool debugVersion) const; @@ -221,6 +219,14 @@ public: virtual QList<ProjectExplorer::Task> validateKit(const ProjectExplorer::Kit *k); + Utils::FileName headerPath() const; + Utils::FileName libraryPath() const; + Utils::FileName binPath() const; + Utils::FileName mkspecsPath() const; + + QString qtNamespace() const; + QString qtLibInfix() const; + protected: BaseQtVersion(); BaseQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString()); diff --git a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp index 84c5f100dd..0104e3849f 100644 --- a/src/plugins/qtsupport/customexecutablerunconfiguration.cpp +++ b/src/plugins/qtsupport/customexecutablerunconfiguration.cpp @@ -54,29 +54,22 @@ using namespace QtSupport; using namespace QtSupport::Internal; namespace { -const char * const CUSTOM_EXECUTABLE_ID("ProjectExplorer.CustomExecutableRunConfiguration"); +const char CUSTOM_EXECUTABLE_ID[] = "ProjectExplorer.CustomExecutableRunConfiguration"; -const char * const EXECUTABLE_KEY("ProjectExplorer.CustomExecutableRunConfiguration.Executable"); -const char * const ARGUMENTS_KEY("ProjectExplorer.CustomExecutableRunConfiguration.Arguments"); -const char * const WORKING_DIRECTORY_KEY("ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory"); -const char * const USE_TERMINAL_KEY("ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal"); -const char * const USER_ENVIRONMENT_CHANGES_KEY("ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"); -const char * const BASE_ENVIRONMENT_BASE_KEY("ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase"); +const char EXECUTABLE_KEY[] = "ProjectExplorer.CustomExecutableRunConfiguration.Executable"; +const char ARGUMENTS_KEY[] = "ProjectExplorer.CustomExecutableRunConfiguration.Arguments"; +const char WORKING_DIRECTORY_KEY[] = "ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory"; +const char USE_TERMINAL_KEY[] = "ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal"; +const char USER_ENVIRONMENT_CHANGES_KEY[] = "ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"; +const char BASE_ENVIRONMENT_BASE_KEY[] = "ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase"; } void CustomExecutableRunConfiguration::ctor() { setDefaultDisplayName(defaultDisplayName()); - connect(target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), - this, SLOT(activeBuildConfigurationChanged())); - - m_lastActiveBuildConfiguration = activeBuildConfiguration(); - - if (m_lastActiveBuildConfiguration) { - connect(m_lastActiveBuildConfiguration, SIGNAL(environmentChanged()), - this, SIGNAL(baseEnvironmentChanged())); - } + connect(target(), SIGNAL(environmentChanged()), + this, SIGNAL(baseEnvironmentChanged())); } CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(ProjectExplorer::Target *parent) : @@ -106,19 +99,6 @@ CustomExecutableRunConfiguration::~CustomExecutableRunConfiguration() { } -void CustomExecutableRunConfiguration::activeBuildConfigurationChanged() -{ - if (m_lastActiveBuildConfiguration) { - disconnect(m_lastActiveBuildConfiguration, SIGNAL(environmentChanged()), - this, SIGNAL(baseEnvironmentChanged())); - } - m_lastActiveBuildConfiguration = activeBuildConfiguration(); - if (m_lastActiveBuildConfiguration) { - connect(m_lastActiveBuildConfiguration, SIGNAL(environmentChanged()), - this, SIGNAL(baseEnvironmentChanged())); - } -} - // Dialog embedding the CustomExecutableConfigurationWidget // prompting the user to complete the configuration. class CustomExecutableDialog : public QDialog @@ -280,6 +260,8 @@ Utils::Environment CustomExecutableRunConfiguration::baseEnvironment() const } else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::BuildEnvironmentBase) { if (activeBuildConfiguration()) env = activeBuildConfiguration()->environment(); + else + env = Utils::Environment::systemEnvironment(); // fall back } return env; } diff --git a/src/plugins/qtsupport/customexecutablerunconfiguration.h b/src/plugins/qtsupport/customexecutablerunconfiguration.h index d277cdf796..bf2f35cce2 100644 --- a/src/plugins/qtsupport/customexecutablerunconfiguration.h +++ b/src/plugins/qtsupport/customexecutablerunconfiguration.h @@ -32,7 +32,7 @@ #include "qtsupport_global.h" -#include <projectexplorer/applicationrunconfiguration.h> +#include <projectexplorer/localapplicationrunconfiguration.h> #include <utils/environment.h> @@ -87,9 +87,6 @@ signals: void baseEnvironmentChanged(); void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &diff); -private slots: - void activeBuildConfigurationChanged(); - protected: CustomExecutableRunConfiguration(ProjectExplorer::Target *parent, CustomExecutableRunConfiguration *source); @@ -127,7 +124,6 @@ private: QString m_userName; QList<Utils::EnvironmentItem> m_userEnvironmentChanges; BaseEnvironmentBase m_baseEnvironmentBase; - ProjectExplorer::BuildConfiguration *m_lastActiveBuildConfiguration; }; class CustomExecutableRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory diff --git a/src/plugins/qtsupport/debugginghelper.cpp b/src/plugins/qtsupport/debugginghelper.cpp index c48ca69e71..4085b3e9f1 100644 --- a/src/plugins/qtsupport/debugginghelper.cpp +++ b/src/plugins/qtsupport/debugginghelper.cpp @@ -99,7 +99,7 @@ QString DebuggingHelperLibrary::copy(const QString &qtInstallData, const QStringList directories = DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData); // Try to find a writeable directory. - foreach(const QString &directory, directories) + foreach (const QString &directory, directories) if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { errorMessage->clear(); return directory; diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.cpp b/src/plugins/qtsupport/debugginghelperbuildtask.cpp index b7042fa16c..3442dd1d46 100644 --- a/src/plugins/qtsupport/debugginghelperbuildtask.cpp +++ b/src/plugins/qtsupport/debugginghelperbuildtask.cpp @@ -224,9 +224,8 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu } log(output, error); - if (!success) { + if (!success) return false; - } } future.setProgressValue(4); @@ -247,9 +246,8 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu success = false; } log(output, error); - if (!success) { + if (!success) return false; - } } future.setProgressValue(5); return true; diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 9f9e392ea2..2c0f7a3468 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -29,28 +29,23 @@ #include "exampleslistmodel.h" -#include <QFile> +#include <QDebug> #include <QDir> +#include <QFile> #include <QUrl> #include <QXmlStreamReader> -#include <QDebug> - -#include <coreplugin/icore.h> #include <coreplugin/helpmanager.h> +#include <coreplugin/icore.h> +#include <projectexplorer/kitmanager.h> +#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtversionmanager.h> +#include <utils/environment.h> #include <utils/qtcassert.h> -#include <utils/environment.h> -#include <projectexplorer/kitmanager.h> -#include <qtsupport/qtkitinformation.h> #include <algorithm> -using QtSupport::QtVersionManager; -using QtSupport::BaseQtVersion; - namespace QtSupport { - namespace Internal { ExamplesListModel::ExamplesListModel(QObject *parent) : @@ -85,7 +80,7 @@ ExamplesListModel::ExamplesListModel(QObject *parent) : SLOT(handleQtVersionsChanged())); } -static inline QString fixStringForTags(const QString &string) +static QString fixStringForTags(const QString &string) { QString returnString = string; returnString.remove(QLatin1String("<i>")); @@ -95,7 +90,7 @@ static inline QString fixStringForTags(const QString &string) return returnString; } -static inline QStringList trimStringList(const QStringList &stringlist) +static QStringList trimStringList(const QStringList &stringlist) { QStringList returnList; foreach (const QString &string, stringlist) @@ -112,7 +107,7 @@ static QString relativeOrInstallPath(const QString &path, const QString &manifes const QString installResolvedPath = installPath + slash + path; if (QFile::exists(relativeResolvedPath)) return relativeResolvedPath; - else if (QFile::exists(installResolvedPath)) + if (QFile::exists(installResolvedPath)) return installResolvedPath; // doesn't exist, just return relative return relativeResolvedPath; @@ -151,11 +146,9 @@ static bool isValidExampleOrDemo(ExampleItem &item) return ok || debugExamples(); } -QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader *reader, - const QString &projectsOffset, - const QString &examplesInstallPath) +void ExamplesListModel::parseExamples(QXmlStreamReader *reader, + const QString &projectsOffset, const QString &examplesInstallPath) { - QList<ExampleItem> examples; ExampleItem item; const QChar slash = QLatin1Char('/'); while (!reader->atEnd()) { @@ -175,7 +168,7 @@ QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader *reader, item.filesToOpen.append(relativeOrInstallPath(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement), projectsOffset, examplesInstallPath)); } else if (reader->name() == QLatin1String("description")) { - item.description = fixStringForTags(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); + item.description = fixStringForTags(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); } else if (reader->name() == QLatin1String("dependency")) { item.dependencies.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement)); } else if (reader->name() == QLatin1String("tags")) { @@ -188,23 +181,20 @@ QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader *reader, case QXmlStreamReader::EndElement: if (reader->name() == QLatin1String("example")) { if (isValidExampleOrDemo(item)) - examples.append(item); + m_exampleItems.append(item); } else if (reader->name() == QLatin1String("examples")) { - return examples; + return; } break; default: // nothing break; } } - return examples; } -QList<ExampleItem> ExamplesListModel::parseDemos(QXmlStreamReader *reader, - const QString &projectsOffset, - const QString &demosInstallPath) +void ExamplesListModel::parseDemos(QXmlStreamReader *reader, + const QString &projectsOffset, const QString &demosInstallPath) { - QList<ExampleItem> demos; ExampleItem item; const QChar slash = QLatin1Char('/'); while (!reader->atEnd()) { @@ -234,21 +224,19 @@ QList<ExampleItem> ExamplesListModel::parseDemos(QXmlStreamReader *reader, case QXmlStreamReader::EndElement: if (reader->name() == QLatin1String("demo")) { if (isValidExampleOrDemo(item)) - demos.append(item); + m_exampleItems.append(item); } else if (reader->name() == QLatin1String("demos")) { - return demos; + return; } break; default: // nothing break; } } - return demos; } -QList<ExampleItem> ExamplesListModel::parseTutorials(QXmlStreamReader* reader, const QString& projectsOffset) +void ExamplesListModel::parseTutorials(QXmlStreamReader *reader, const QString &projectsOffset) { - QList<ExampleItem> tutorials; ExampleItem item; const QChar slash = QLatin1Char('/'); while (!reader->atEnd()) { @@ -285,16 +273,14 @@ QList<ExampleItem> ExamplesListModel::parseTutorials(QXmlStreamReader* reader, c break; case QXmlStreamReader::EndElement: if (reader->name() == QLatin1String("tutorial")) - tutorials.append(item); + m_exampleItems.append(item); else if (reader->name() == QLatin1String("tutorials")) - return tutorials; + return; break; default: // nothing break; } } - - return tutorials; } void ExamplesListModel::handleQtVersionsChanged() @@ -305,15 +291,20 @@ void ExamplesListModel::handleQtVersionsChanged() void ExamplesListModel::updateExamples() { - clear(); QString examplesInstallPath; QString demosInstallPath; QString examplesFallback; QString demosFallback; QString sourceFallback; - foreach (const QString &exampleSource, - exampleSources(&examplesInstallPath, &demosInstallPath, - &examplesFallback, &demosFallback, &sourceFallback)) { + + QStringList sources = exampleSources(&examplesInstallPath, &demosInstallPath, + &examplesFallback, &demosFallback, &sourceFallback); + + beginResetModel(); + m_tags.clear(); + m_exampleItems.clear(); + + foreach (const QString &exampleSource, sources) { QFile exampleFile(exampleSource); if (!exampleFile.open(QIODevice::ReadOnly)) { if (debugExamples()) @@ -345,11 +336,11 @@ void ExamplesListModel::updateExamples() switch (reader.readNext()) { case QXmlStreamReader::StartElement: if (reader.name() == QLatin1String("examples")) - addItems(parseExamples(&reader, examplesDir.path(), examplesInstallPath)); + parseExamples(&reader, examplesDir.path(), examplesInstallPath); else if (reader.name() == QLatin1String("demos")) - addItems(parseDemos(&reader, demosDir.path(), demosInstallPath)); + parseDemos(&reader, demosDir.path(), demosInstallPath); else if (reader.name() == QLatin1String("tutorials")) - addItems(parseTutorials(&reader, examplesDir.path())); + parseTutorials(&reader, examplesDir.path()); break; default: // nothing break; @@ -358,6 +349,7 @@ void ExamplesListModel::updateExamples() if (reader.hasError() && debugExamples()) qWarning() << QString::fromLatin1("ERROR: Could not parse file as XML document ('%1')").arg(exampleSource); } + endResetModel(); m_tags.sort(); m_tags.erase(std::unique(m_tags.begin(), m_tags.end()), m_tags.end()); @@ -476,40 +468,21 @@ QStringList ExamplesListModel::exampleSources(QString *examplesInstallPath, QStr return sources; } -void ExamplesListModel::clear() -{ - if (exampleItems.count() > 0) { - beginRemoveRows(QModelIndex(), 0, exampleItems.size()-1); - exampleItems.clear(); - endRemoveRows(); - } - m_tags.clear(); -} - -void ExamplesListModel::addItems(const QList<ExampleItem> &newItems) -{ - if (newItems.isEmpty()) - return; - beginInsertRows(QModelIndex(), exampleItems.size(), exampleItems.size() - 1 + newItems.size()); - exampleItems.append(newItems); - endInsertRows(); -} - int ExamplesListModel::rowCount(const QModelIndex &) const { ensureInitialized(); - return exampleItems.size(); + return m_exampleItems.size(); } QVariant ExamplesListModel::data(const QModelIndex &index, int role) const { ensureInitialized(); - if (!index.isValid() || index.row()+1 > exampleItems.count()) { + if (!index.isValid() || index.row()+1 > m_exampleItems.count()) { qDebug() << Q_FUNC_INFO << "invalid index requested"; return QVariant(); } - ExampleItem item = exampleItems.at(index.row()); + ExampleItem item = m_exampleItems.at(index.row()); switch (role) { case Qt::DisplayRole: // for search only @@ -548,7 +521,6 @@ QVariant ExamplesListModel::data(const QModelIndex &index, int role) const qDebug() << Q_FUNC_INFO << "role type not supported"; return QVariant(); } - } QStringList ExamplesListModel::tags() const @@ -590,12 +562,11 @@ void ExamplesListModelFilter::updateFilter() } } -bool containsSubString(const QStringList& list, const QString& substr, Qt::CaseSensitivity cs) +bool containsSubString(const QStringList &list, const QString &substr, Qt::CaseSensitivity cs) { - foreach (const QString &elem, list) { + foreach (const QString &elem, list) if (elem.contains(substr, cs)) return true; - } return false; } @@ -617,10 +588,9 @@ bool ExamplesListModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex const QStringList tags = sourceModel()->index(sourceRow, 0, sourceParent).data(Tags).toStringList(); if (!m_filterTags.isEmpty()) { - foreach(const QString &tag, m_filterTags) { + foreach (const QString &tag, m_filterTags) if (!tags.contains(tag, Qt::CaseInsensitive)) return false; - } return true; } @@ -628,8 +598,7 @@ bool ExamplesListModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex const QString description = sourceModel()->index(sourceRow, 0, sourceParent).data(Description).toString(); const QString name = sourceModel()->index(sourceRow, 0, sourceParent).data(Name).toString(); - - foreach(const QString &subString, m_searchString) { + foreach (const QString &subString, m_searchString) { bool wordMatch = false; wordMatch |= (bool)name.contains(subString, Qt::CaseInsensitive); if (wordMatch) @@ -643,11 +612,7 @@ bool ExamplesListModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex } } - bool ok = QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); - if (!ok) - return false; - - return true; + return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); } int ExamplesListModelFilter::rowCount(const QModelIndex &parent) const @@ -685,7 +650,8 @@ void ExamplesListModelFilter::timerEvent(QTimerEvent *timerEvent) } } -struct SearchStringLexer { +struct SearchStringLexer +{ QString code; const QChar *codePtr; QChar yychar; diff --git a/src/plugins/qtsupport/exampleslistmodel.h b/src/plugins/qtsupport/exampleslistmodel.h index 1dcf164c21..0611212082 100644 --- a/src/plugins/qtsupport/exampleslistmodel.h +++ b/src/plugins/qtsupport/exampleslistmodel.h @@ -31,20 +31,27 @@ #define EXAMPLESLISTMODEL_H #include <QAbstractListModel> +#include <QSortFilterProxyModel> #include <QStringList> #include <QXmlStreamReader> -#include <QSortFilterProxyModel> namespace QtSupport { namespace Internal { -enum ExampleRoles { Name=Qt::UserRole, ProjectPath, Description, ImageUrl, - DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode, - Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms }; +enum ExampleRoles +{ + Name = Qt::UserRole, ProjectPath, Description, ImageUrl, + DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode, + Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms +}; -enum InstructionalType { Example=0, Demo, Tutorial }; +enum InstructionalType +{ + Example = 0, Demo, Tutorial +}; -struct ExampleItem { +struct ExampleItem +{ ExampleItem(): difficulty(0), isVideo(false) {} InstructionalType type; QString name; @@ -63,24 +70,21 @@ struct ExampleItem { QStringList platforms; }; -class ExamplesListModel : public QAbstractListModel { +class ExamplesListModel : public QAbstractListModel +{ Q_OBJECT + public: explicit ExamplesListModel(QObject *parent); - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QStringList tags() const; - - void ensureInitialized() const; - void beginReset() - { beginResetModel(); } - - void endReset() - { endResetModel(); } + void beginReset() { beginResetModel(); } + void endReset() { endResetModel(); } signals: void tagsUpdated(); @@ -91,25 +95,26 @@ public slots: void helpInitialized(); private: - void addItems(const QList<ExampleItem> &items); - QList<ExampleItem> parseExamples(QXmlStreamReader *reader, const QString &projectsOffset, + void parseExamples(QXmlStreamReader *reader, const QString &projectsOffset, const QString &examplesInstallPath); - QList<ExampleItem> parseDemos(QXmlStreamReader *reader, const QString &projectsOffset, + void parseDemos(QXmlStreamReader *reader, const QString &projectsOffset, const QString &demosInstallPath); - QList<ExampleItem> parseTutorials(QXmlStreamReader *reader, const QString &projectsOffset); - void clear(); + void parseTutorials(QXmlStreamReader *reader, const QString &projectsOffset); QStringList exampleSources(QString *examplesInstallPath, QString *demosInstallPath, QString *examplesFallback, QString *demosFallback, QString *sourceFallback); - QList<ExampleItem> exampleItems; + + QList<ExampleItem> m_exampleItems; QStringList m_tags; bool m_updateOnQtVersionsChanged; bool m_initialized; bool m_helpInitialized; }; -class ExamplesListModelFilter : public QSortFilterProxyModel { +class ExamplesListModelFilter : public QSortFilterProxyModel +{ Q_OBJECT + public: Q_PROPERTY(bool showTutorialsOnly READ showTutorialsOnly WRITE setShowTutorialsOnly NOTIFY showTutorialsOnlyChanged) Q_PROPERTY(QStringList filterTags READ filterTags WRITE setFilterTags NOTIFY filterTagsChanged) @@ -119,15 +124,15 @@ public: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; - bool showTutorialsOnly() {return m_showTutorialsOnly;} + bool showTutorialsOnly() { return m_showTutorialsOnly; } QStringList filterTags() const { return m_filterTags; } QStringList searchStrings() const { return m_searchString; } - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; public slots: - void setFilterTags(const QStringList& arg) + void setFilterTags(const QStringList &arg) { if (m_filterTags != arg) { m_filterTags = arg; @@ -136,7 +141,7 @@ public slots: } void updateFilter(); - void setSearchStrings(const QStringList& arg) + void setSearchStrings(const QStringList &arg) { if (m_searchString != arg) { m_searchString = arg; @@ -145,20 +150,16 @@ public slots: } } - void parseSearchString(const QString& arg); + void parseSearchString(const QString &arg); void setShowTutorialsOnly(bool showTutorialsOnly); signals: void showTutorialsOnlyChanged(); - - void filterTagsChanged(const QStringList& arg); - - void searchStrings(const QStringList& arg); - -protected: - void timerEvent(QTimerEvent *event); + void filterTagsChanged(const QStringList &arg); + void searchStrings(const QStringList &arg); private: + void timerEvent(QTimerEvent *event); void delayedUpdateFilter(); bool m_showTutorialsOnly; diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index 9cd065bf73..24ead38f09 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -55,7 +55,7 @@ #include <QMutex> #include <QThread> #include <QMutexLocker> -#include <QWeakPointer> +#include <QPointer> #include <QWaitCondition> #include <QDir> #include <QBuffer> @@ -75,20 +75,23 @@ #include <QDeclarativeContext> #include <QDesktopServices> +using namespace Utils; + namespace QtSupport { namespace Internal { const char C_FALLBACK_ROOT[] = "ProjectsFallbackRoot"; -QWeakPointer<ExamplesListModel> &examplesModelStatic() +QPointer<ExamplesListModel> &examplesModelStatic() { - static QWeakPointer<ExamplesListModel> s_examplesModel; + static QPointer<ExamplesListModel> s_examplesModel; return s_examplesModel; } class Fetcher : public QObject { Q_OBJECT + public: Fetcher() : QObject(), m_shutdown(false) { @@ -179,7 +182,7 @@ public: Q_UNUSED(size) QMutexLocker lock(&m_mutex); - QUrl url = QUrl::fromEncoded(id.toAscii()); + QUrl url = QUrl::fromEncoded(id.toLatin1()); if (!m_fetcher.asynchronousFetchData(url)) return QImage(); @@ -351,9 +354,9 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI .arg(nativeProjectDir)); lay->addWidget(descrLbl, 0, 0, 1, 2); QLabel *txt = new QLabel(tr("&Location:")); - Utils::PathChooser *chooser = new Utils::PathChooser; + PathChooser *chooser = new PathChooser; txt->setBuddy(chooser); - chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); + chooser->setExpectedKind(PathChooser::ExistingDirectory); QSettings *settings = Core::ICore::settings(); chooser->setPath(settings->value(QString::fromLatin1(C_FALLBACK_ROOT), Core::DocumentManager::projectsDirectory()).toString()); @@ -382,15 +385,18 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI } else { QString error; QString targetDir = destBaseDir + QLatin1Char('/') + exampleDirName; - if (Utils::FileUtils::copyRecursively(projectDir, targetDir, &error)) { + if (FileUtils::copyRecursively(FileName::fromString(projectDir), + FileName::fromString(targetDir), &error)) { // set vars to new location const QStringList::Iterator end = filesToOpen.end(); for (QStringList::Iterator it = filesToOpen.begin(); it != end; ++it) it->replace(projectDir, targetDir); foreach (const QString &dependency, dependencies) { - QString dirName = QDir(dependency).dirName(); - if (!Utils::FileUtils::copyRecursively(dependency, targetDir + QDir::separator()+ dirName, &error)) { + FileName targetFile = FileName::fromString(targetDir); + targetFile.appendPath(QDir(dependency).dirName()); + if (!FileUtils::copyRecursively(FileName::fromString(dependency), targetFile, + &error)) { QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Copy Project"), error); // do not fail, just warn; } diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.h b/src/plugins/qtsupport/gettingstartedwelcomepage.h index 8adddcef9a..4149816b38 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.h +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.h @@ -65,6 +65,7 @@ private: class ExamplesWelcomePage : public Utils::IWelcomePage { Q_OBJECT + public: ExamplesWelcomePage(); diff --git a/src/plugins/qtsupport/profilereader.cpp b/src/plugins/qtsupport/profilereader.cpp index cc4878cef0..7b242f4a30 100644 --- a/src/plugins/qtsupport/profilereader.cpp +++ b/src/plugins/qtsupport/profilereader.cpp @@ -39,8 +39,10 @@ using namespace QtSupport; static QString format(const QString &fileName, int lineNo, const QString &msg) { - if (lineNo) + if (lineNo > 0) return QString::fromLatin1("%1(%2): %3").arg(fileName, QString::number(lineNo), msg); + else if (lineNo) + return QString::fromLatin1("%1: %3").arg(fileName, msg); else return msg; } @@ -65,7 +67,7 @@ void ProMessageHandler::fileMessage(const QString &) } -ProFileReader::ProFileReader(QMakeGlobals *option) +ProFileReader::ProFileReader(ProFileGlobals *option) : QMakeParser(ProFileCacheManager::instance()->cache(), this) , ProFileEvaluator(option, this, this) , m_ignoreLevel(0) diff --git a/src/plugins/qtsupport/profilereader.h b/src/plugins/qtsupport/profilereader.h index 73e76711e9..8e01262786 100644 --- a/src/plugins/qtsupport/profilereader.h +++ b/src/plugins/qtsupport/profilereader.h @@ -70,7 +70,7 @@ class QTSUPPORT_EXPORT ProFileReader : public ProMessageHandler, public QMakePar Q_OBJECT public: - ProFileReader(QMakeGlobals *option); + ProFileReader(ProFileGlobals *option); ~ProFileReader(); QList<ProFile*> includeFiles() const; diff --git a/src/plugins/qtsupport/qmldebugginglibrary.cpp b/src/plugins/qtsupport/qmldebugginglibrary.cpp index a28520e54e..ea19d76c24 100644 --- a/src/plugins/qtsupport/qmldebugginglibrary.cpp +++ b/src/plugins/qtsupport/qmldebugginglibrary.cpp @@ -100,11 +100,10 @@ QString QmlDebuggingLibrary::copy(const QString &qtInstallData, QString *errorMe // Try to find a writeable directory. foreach (const QString &directory, directories) { - if (!mkpath(directory, errorMessage)) { + if (!mkpath(directory, errorMessage)) continue; - } else { + else errorMessage->clear(); - } if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) @@ -124,9 +123,8 @@ QStringList QmlDebuggingLibrary::recursiveFileList(const QDir &dir, const QStrin QStringList files; QString _prefix = prefix; - if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) { + if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) _prefix = _prefix + QLatin1Char('/'); - } foreach (const QString &fileName, dir.entryList(QDir::Files)) { files << _prefix + fileName; } diff --git a/src/plugins/qtsupport/qmldumptool.cpp b/src/plugins/qtsupport/qmldumptool.cpp index 845c8982d2..9921878e73 100644 --- a/src/plugins/qtsupport/qmldumptool.cpp +++ b/src/plugins/qtsupport/qmldumptool.cpp @@ -41,6 +41,7 @@ #include <projectexplorer/runconfiguration.h> #include <utils/runextensions.h> #include <qmljs/qmljsmodelmanagerinterface.h> +#include <utils/hostosinfo.h> #include <utils/qtcassert.h> #include <QDesktopServices> #include <QCoreApplication> @@ -120,9 +121,8 @@ private slots: } } - if (m_failed) { + if (m_failed) qWarning("%s", qPrintable(errorMessage)); - } // update qmldump path for all the project QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance(); @@ -244,9 +244,8 @@ static QStringList sourceFileNames() files << QLatin1String("main.cpp") << QLatin1String("qmldump.pro") << QLatin1String("qmlstreamwriter.cpp") << QLatin1String("qmlstreamwriter.h") << QLatin1String("LICENSE.LGPL") << QLatin1String("LGPL_EXCEPTION.TXT"); -#ifdef Q_OS_MAC - files << QLatin1String("Info.plist"); -#endif + if (Utils::HostOsInfo::isMacHost()) + files << QLatin1String("Info.plist"); return files; } @@ -275,7 +274,7 @@ QStringList QmlDumpTool::locationsByInstallData(const QString &qtInstallData, bo QStringList result; QFileInfo fileInfo; const QStringList binFilenames = validBinaryFilenames(debugDump); - foreach(const QString &directory, installDirectories(qtInstallData)) { + foreach (const QString &directory, installDirectories(qtInstallData)) { if (getHelperFileInfoFor(binFilenames, directory, &fileInfo)) result << fileInfo.filePath(); } @@ -294,10 +293,9 @@ QString QmlDumpTool::copy(const QString &qtInstallData, QString *errorMessage) const QStringList directories = QmlDumpTool::installDirectories(qtInstallData); // Try to find a writeable directory. - foreach(const QString &directory, directories) { - if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { + foreach (const QString &directory, directories) { + if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) return directory; - } } *errorMessage = QCoreApplication::translate("ProjectExplorer::QmlDumpTool", "qmldump could not be built in any of the directories:\n- %1\n\nReason: %2") diff --git a/src/plugins/qtsupport/qtkitconfigwidget.cpp b/src/plugins/qtsupport/qtkitconfigwidget.cpp index 0575e70371..7d4167edc4 100644 --- a/src/plugins/qtsupport/qtkitconfigwidget.cpp +++ b/src/plugins/qtsupport/qtkitconfigwidget.cpp @@ -45,34 +45,21 @@ namespace QtSupport { namespace Internal { -QtKitConfigWidget::QtKitConfigWidget(ProjectExplorer::Kit *k, QWidget *parent) : - ProjectExplorer::KitConfigWidget(parent), - m_kit(k), - m_combo(new QComboBox), - m_manageButton(new QPushButton(this)) +QtKitConfigWidget::QtKitConfigWidget(ProjectExplorer::Kit *k) : + KitConfigWidget(k) { - setToolTip(tr("The Qt library to use for all projects using this kit.<br>" - "A Qt version is required for qmake-based projects and optional when using other build systems.")); - QHBoxLayout *layout = new QHBoxLayout(this); - layout->setMargin(0); - - m_combo->setContentsMargins(0, 0, 0, 0); - m_combo->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); - layout->addWidget(m_combo); - - m_manageButton->setContentsMargins(0, 0, 0, 0); - m_manageButton->setText(tr("Manage...")); + m_combo = new QComboBox; + m_combo->addItem(tr("None"), -1); QtVersionManager *mgr = QtVersionManager::instance(); - - // initially populate combobox: - m_combo->addItem(tr("None"), -1); QList<BaseQtVersion *> versions = mgr->validVersions(); QList<int> versionIds; foreach (BaseQtVersion *v, versions) versionIds.append(v->uniqueId()); versionsChanged(versionIds, QList<int>(), QList<int>()); + m_manageButton = new QPushButton(tr("Manage...")); + refresh(); connect(m_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(currentWasChanged(int))); @@ -87,6 +74,13 @@ QString QtKitConfigWidget::displayName() const return tr("Qt version:"); } +QString QtKitConfigWidget::toolTip() const +{ + return tr("The Qt library to use for all projects using this kit.<br>" + "A Qt version is required for qmake-based projects " + "and optional when using other build systems."); +} + void QtKitConfigWidget::makeReadOnly() { m_combo->setEnabled(false); @@ -97,6 +91,11 @@ void QtKitConfigWidget::refresh() m_combo->setCurrentIndex(findQtVersion(QtKitInformation::qtVersionId(m_kit))); } +QWidget *QtKitConfigWidget::mainWidget() const +{ + return m_combo; +} + QWidget *QtKitConfigWidget::buttonWidget() const { return m_manageButton; @@ -129,8 +128,8 @@ void QtKitConfigWidget::versionsChanged(const QList<int> &added, const QList<int void QtKitConfigWidget::manageQtVersions() { - Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY), - QLatin1String(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID)); + Core::ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, + Constants::QTVERSION_SETTINGS_PAGE_ID); } void QtKitConfigWidget::currentWasChanged(int idx) diff --git a/src/plugins/qtsupport/qtkitconfigwidget.h b/src/plugins/qtsupport/qtkitconfigwidget.h index b28f5fb945..4e5b3476d1 100644 --- a/src/plugins/qtsupport/qtkitconfigwidget.h +++ b/src/plugins/qtsupport/qtkitconfigwidget.h @@ -32,14 +32,12 @@ #include <projectexplorer/kitconfigwidget.h> -QT_FORWARD_DECLARE_CLASS(QComboBox) -QT_FORWARD_DECLARE_CLASS(QPushButton) - -namespace ProjectExplorer { class Kit; } +QT_BEGIN_NAMESPACE +class QComboBox; +class QPushButton; +QT_END_NAMESPACE namespace QtSupport { -class BaseQtVersion; - namespace Internal { class QtKitConfigWidget : public ProjectExplorer::KitConfigWidget @@ -47,14 +45,16 @@ class QtKitConfigWidget : public ProjectExplorer::KitConfigWidget Q_OBJECT public: - explicit QtKitConfigWidget(ProjectExplorer::Kit *k, QWidget *parent = 0); + explicit QtKitConfigWidget(ProjectExplorer::Kit *k); QString displayName() const; void makeReadOnly(); void refresh(); + QWidget *mainWidget() const; QWidget *buttonWidget() const; + QString toolTip() const; private slots: void versionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed); @@ -64,7 +64,6 @@ private slots: private: int findQtVersion(const int id) const; - ProjectExplorer::Kit *m_kit; QComboBox *m_combo; QPushButton *m_manageButton; }; diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index ab6641c6e1..a4643a838f 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -32,6 +32,7 @@ #include "qtkitconfigwidget.h" #include "qtsupportconstants.h" #include "qtversionmanager.h" +#include "qtparser.h" #include <utils/environment.h> @@ -126,6 +127,13 @@ void QtKitInformation::addToEnvironment(const ProjectExplorer::Kit *k, Utils::En version->addToEnvironment(k, env); } +ProjectExplorer::IOutputParser *QtKitInformation::createOutputParser(const ProjectExplorer::Kit *k) const +{ + if (qtVersion(k)) + return new QtParser; + return 0; +} + int QtKitInformation::qtVersionId(const ProjectExplorer::Kit *k) { if (!k) diff --git a/src/plugins/qtsupport/qtkitinformation.h b/src/plugins/qtsupport/qtkitinformation.h index 3b364d0302..5efca50a59 100644 --- a/src/plugins/qtsupport/qtkitinformation.h +++ b/src/plugins/qtsupport/qtkitinformation.h @@ -32,10 +32,10 @@ #include "qtsupport_global.h" -#include <projectexplorer/kitinformation.h> - #include "baseqtversion.h" +#include <projectexplorer/kitinformation.h> + namespace QtSupport { class QTSUPPORT_EXPORT QtKitInformation : public ProjectExplorer::KitInformation @@ -61,11 +61,13 @@ public: ItemList toUserOutput(ProjectExplorer::Kit *k) const; void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const; + ProjectExplorer::IOutputParser *createOutputParser(const ProjectExplorer::Kit *k) const; static int qtVersionId(const ProjectExplorer::Kit *k); static void setQtVersionId(ProjectExplorer::Kit *k, const int id); static BaseQtVersion *qtVersion(const ProjectExplorer::Kit *k); static void setQtVersion(ProjectExplorer::Kit *k, const BaseQtVersion *v); + private slots: void qtVersionsChanged(const QList<int> &addedIds, const QList<int> &removedIds, @@ -87,8 +89,8 @@ class QTSUPPORT_EXPORT QtVersionKitMatcher : public ProjectExplorer::KitMatcher { public: explicit QtVersionKitMatcher(const Core::FeatureSet &required = Core::FeatureSet(), - const QtVersionNumber &min = QtVersionNumber(0, 0, 0), - const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) : + const QtVersionNumber &min = QtVersionNumber(0, 0, 0), + const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) : m_min(min), m_max(max), m_features(required) { } diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index f0baf28164..948359f1fa 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -48,6 +48,7 @@ #include <projectexplorer/toolchainmanager.h> #include <projectexplorer/toolchain.h> #include <projectexplorer/projectexplorerconstants.h> +#include <utils/hostosinfo.h> #include <utils/runextensions.h> #include <QDir> @@ -61,6 +62,7 @@ enum ModelRoles { VersionIdRole = Qt::UserRole, ToolChainIdRole, BuildLogRole, B using namespace QtSupport; using namespace QtSupport::Internal; +using namespace Utils; /// // QtOptionsPage @@ -69,9 +71,9 @@ using namespace QtSupport::Internal; QtOptionsPage::QtOptionsPage() : m_widget(0) { - setId(QLatin1String(Constants::QTVERSION_SETTINGS_PAGE_ID)); + setId(Constants::QTVERSION_SETTINGS_PAGE_ID); setDisplayName(QCoreApplication::translate("Qt4ProjectManager", Constants::QTVERSION_SETTINGS_PAGE_NAME)); - setCategory(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY)); + setCategory(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY); setDisplayCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_TR_CATEGORY)); setCategoryIcon(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON)); @@ -129,14 +131,14 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent) connect(m_infoBrowser, SIGNAL(anchorClicked(QUrl)), this, SLOT(infoAnchorClicked(QUrl))); m_ui->infoWidget->setWidget(m_infoBrowser); connect(m_ui->infoWidget, SIGNAL(expanded(bool)), - this, SLOT(handleInfoWidgetExpanded(bool))); + this, SLOT(setInfoWidgetVisibility())); m_ui->versionInfoWidget->setWidget(versionInfoWidget); m_ui->versionInfoWidget->setState(Utils::DetailsWidget::NoSummary); m_ui->debuggingHelperWidget->setWidget(debuggingHelperDetailsWidget); connect(m_ui->debuggingHelperWidget, SIGNAL(expanded(bool)), - this, SLOT(handleDebuggingHelperExpanded(bool))); + this, SLOT(setInfoWidgetVisibility())); // setup parent items for auto-detected and manual versions m_ui->qtdirList->header()->setResizeMode(QHeaderView::ResizeToContents); @@ -334,16 +336,12 @@ void QtOptionsPageWidget::qtVersionsDumpUpdated(const Utils::FileName &qmakeComm } } -void QtOptionsPageWidget::handleInfoWidgetExpanded(bool expanded) +void QtOptionsPageWidget::setInfoWidgetVisibility() { - m_ui->versionInfoWidget->setVisible(!expanded); - m_ui->debuggingHelperWidget->setVisible(!expanded); -} - -void QtOptionsPageWidget::handleDebuggingHelperExpanded(bool expanded) -{ - m_ui->versionInfoWidget->setVisible(!expanded); - m_ui->infoWidget->setVisible(!expanded); + m_ui->versionInfoWidget->setVisible((m_ui->infoWidget->state() == DetailsWidget::Collapsed) + && (m_ui->debuggingHelperWidget->state() == DetailsWidget::Collapsed)); + m_ui->infoWidget->setVisible(m_ui->debuggingHelperWidget->state() == DetailsWidget::Collapsed); + m_ui->debuggingHelperWidget->setVisible(m_ui->infoWidget->state() == DetailsWidget::Collapsed); } void QtOptionsPageWidget::infoAnchorClicked(const QUrl &url) @@ -616,16 +614,14 @@ static QString filterForQmakeFileDialog() for (int i = 0; i < commands.size(); ++i) { if (i) filter += QLatin1Char(' '); -#ifdef Q_OS_MAC - // work around QTBUG-7739 that prohibits filters that don't start with * - filter += QLatin1Char('*'); -#endif + if (Utils::HostOsInfo::isMacHost()) + // work around QTBUG-7739 that prohibits filters that don't start with * + filter += QLatin1Char('*'); filter += commands.at(i); -#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) - // kde bug, we need at least one wildcard character - // see QTCREATORBUG-7771 - filter += QLatin1Char('*'); -#endif + if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()) + // kde bug, we need at least one wildcard character + // see QTCREATORBUG-7771 + filter += QLatin1Char('*'); } filter += QLatin1Char(')'); return filter; @@ -635,23 +631,30 @@ void QtOptionsPageWidget::addQtDir() { Utils::FileName qtVersion = Utils::FileName::fromString( QFileDialog::getOpenFileName(this, - tr("Select a qmake executable"), + tr("Select a qmake Executable"), QString(), filterForQmakeFileDialog(), 0, QFileDialog::DontResolveSymlinks)); if (qtVersion.isNull()) return; - BaseQtVersion *version = QtVersionManager::instance()->qtVersionForQMakeBinary(qtVersion); + BaseQtVersion *version = 0; + foreach (BaseQtVersion *v, m_versions) { + if (v->qmakeCommand() == qtVersion) { + version = v; + break; + } + } if (version) { // Already exist - QMessageBox::warning(this, tr("Qt known"), + QMessageBox::warning(this, tr("Qt Version Already Known"), tr("This Qt version was already registered as \"%1\".") .arg(version->displayName())); return; } - version = QtVersionFactory::createQtVersionFromQMakePath(qtVersion); + QString error; + version = QtVersionFactory::createQtVersionFromQMakePath(qtVersion, false, QString(), &error); if (version) { m_versions.append(version); @@ -664,6 +667,10 @@ void QtOptionsPageWidget::addQtDir() m_ui->qtdirList->setCurrentItem(item); // should update the rest of the ui m_versionUi->nameEdit->setFocus(); m_versionUi->nameEdit->selectAll(); + } else { + QMessageBox::warning(this, tr("Qmake not Executable"), + tr("The qmake executable %1 could not be added: %2").arg(qtVersion.toUserOutput()).arg(error)); + return; } updateCleanUpButton(); } @@ -703,7 +710,7 @@ void QtOptionsPageWidget::editPath() if (current->type() != version->type()) { // not the same type, error out QMessageBox::critical(this, tr("Incompatible Qt Versions"), - tr("The Qt version selected must be for the same device type."), + tr("The Qt version selected must match the device type."), QMessageBox::Ok); delete version; return; @@ -790,11 +797,10 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() gdbHelperText = QDir::toNativeSeparators(version->gdbDebuggingHelperLibrary()); gdbHelperTextFlags = Qt::TextSelectableByMouse; } else { - if (canBuildGdbHelper) { + if (canBuildGdbHelper) gdbHelperText = tr("<i>Not yet built.</i>"); - } else { + else gdbHelperText = tr("<i>Not needed.</i>"); - } } m_debuggingHelperUi->gdbHelperStatus->setText(gdbHelperText); m_debuggingHelperUi->gdbHelperStatus->setTextInteractionFlags(gdbHelperTextFlags); @@ -909,8 +915,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() m_debuggingHelperUi->rebuildButton->setEnabled(canBuild && !isBuilding); m_debuggingHelperUi->toolChainComboBox->setEnabled(canBuild && !isBuilding); - - m_ui->debuggingHelperWidget->setVisible(true); + setInfoWidgetVisibility(); } } @@ -958,12 +963,12 @@ void QtOptionsPageWidget::updateDescriptionLabel() if (version) { m_infoBrowser->setHtml(version->toHtml(true)); - m_ui->versionInfoWidget->setVisible(true); - m_ui->infoWidget->setVisible(true); + setInfoWidgetVisibility(); } else { m_infoBrowser->setHtml(QString()); m_ui->versionInfoWidget->setVisible(false); m_ui->infoWidget->setVisible(false); + m_ui->debuggingHelperWidget->setVisible(false); } } @@ -986,9 +991,8 @@ QTreeWidgetItem *QtOptionsPageWidget::treeItemForIndex(int index) const QTreeWidgetItem *toplevelItem = m_ui->qtdirList->topLevelItem(i); for (int j = 0; j < toplevelItem->childCount(); ++j) { QTreeWidgetItem *item = toplevelItem->child(j); - if (item->data(0, VersionIdRole).toInt() == uniqueId) { + if (item->data(0, VersionIdRole).toInt() == uniqueId) return item; - } } } return 0; diff --git a/src/plugins/qtsupport/qtoptionspage.h b/src/plugins/qtsupport/qtoptionspage.h index f1bf7744c9..2e68d391f7 100644 --- a/src/plugins/qtsupport/qtoptionspage.h +++ b/src/plugins/qtsupport/qtoptionspage.h @@ -118,8 +118,7 @@ private slots: void selectedToolChainChanged(int index); void qtVersionsDumpUpdated(const Utils::FileName &qmakeCommand); - void handleInfoWidgetExpanded(bool expanded); - void handleDebuggingHelperExpanded(bool expanded); + void setInfoWidgetVisibility(); void infoAnchorClicked(const QUrl &); private: diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp index fb61ef0f1b..bd590ab88c 100644 --- a/src/plugins/qtsupport/qtoutputformatter.cpp +++ b/src/plugins/qtsupport/qtoutputformatter.cpp @@ -43,8 +43,7 @@ using namespace QtSupport; QtOutputFormatter::QtOutputFormatter(ProjectExplorer::Project *project) : OutputFormatter() - , m_qmlError(QLatin1String("^(?:\\[Qt Message\\] )?" // '[Qt Message] ' prefix (optional, on Symbian) - "(file:///.+" // file url + , m_qmlError(QLatin1String("^(file:///.+" // file url ":\\d+" // colon, line "(?::\\d+)?)" // colon, column (optional) ":")) // colon @@ -54,7 +53,7 @@ QtOutputFormatter::QtOutputFormatter(ProjectExplorer::Project *project) , m_qtTestFail(QLatin1String("^ Loc: \\[(.*)\\]")) , m_project(project) { - if(project) { + if (project) { m_projectFinder.setProjectFiles(project->files(Project::ExcludeGeneratedFiles)); m_projectFinder.setProjectDirectory(project->projectDirectory()); diff --git a/src/plugins/qtsupport/qtoutputformatter.h b/src/plugins/qtsupport/qtoutputformatter.h index 0ec98e7b81..e53d141f0c 100644 --- a/src/plugins/qtsupport/qtoutputformatter.h +++ b/src/plugins/qtsupport/qtoutputformatter.h @@ -36,7 +36,7 @@ #include <utils/fileinprojectfinder.h> #include <QRegExp> -#include <QWeakPointer> +#include <QPointer> QT_FORWARD_DECLARE_CLASS(QTextCursor) @@ -80,7 +80,7 @@ private: mutable QRegExp m_qtAssert; mutable QRegExp m_qtAssertX; mutable QRegExp m_qtTestFail; - QWeakPointer<ProjectExplorer::Project> m_project; + QPointer<ProjectExplorer::Project> m_project; QString m_lastLine; Utils::FileInProjectFinder m_projectFinder; }; diff --git a/src/plugins/qtsupport/qtparser.cpp b/src/plugins/qtsupport/qtparser.cpp index b76e5d6431..5acf924945 100644 --- a/src/plugins/qtsupport/qtparser.cpp +++ b/src/plugins/qtsupport/qtparser.cpp @@ -41,7 +41,7 @@ using ProjectExplorer::Task; #define FILE_PATTERN "^(([A-Za-z]:)?[^:]+\\.[^:]+)" QtParser::QtParser() : - m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+)\\)?:\\s(Warning|Error):\\s(.+)$")) + m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+)\\)?:\\s([Ww]arning|[Ee]rror):\\s(.+)$")) { setObjectName(QLatin1String("QtParser")); m_mocRegExp.setMinimal(true); @@ -60,7 +60,7 @@ void QtParser::stdError(const QString &line) Utils::FileName::fromUserInput(m_mocRegExp.cap(1)) /* filename */, lineno, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)); - if (m_mocRegExp.cap(4) == QLatin1String("Warning")) + if (m_mocRegExp.cap(4).compare(QLatin1String("Warning"), Qt::CaseInsensitive) == 0) task.type = Task::Warning; emit addTask(task); return; @@ -116,6 +116,15 @@ void QtSupportPlugin::testQtOutputParser_data() "../../scriptbug/main.cpp:22: instantiated from here\n") << QList<ProjectExplorer::Task>() << QString(); + QTest::newRow("qdoc warning") + << QString::fromLatin1("/home/user/dev/qt5/qtscript/src/script/api/qscriptengine.cpp:295: warning: Can't create link to 'Object Trees & Ownership'") + << OutputParserTester::STDERR + << QString() << QString() + << (QList<ProjectExplorer::Task>() << Task(Task::Warning, + QLatin1String("Can't create link to 'Object Trees & Ownership'"), + Utils::FileName::fromUserInput(QLatin1String("/home/user/dev/qt5/qtscript/src/script/api/qscriptengine.cpp")), 295, + Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))) + << QString(); QTest::newRow("moc warning") << QString::fromLatin1("..\\untitled\\errorfile.h:0: Warning: No relevant classes found. No output generated.") << OutputParserTester::STDERR diff --git a/src/plugins/qtsupport/qtsupport.pri b/src/plugins/qtsupport/qtsupport.pri index a419733faf..e4de26c4ca 100644 --- a/src/plugins/qtsupport/qtsupport.pri +++ b/src/plugins/qtsupport/qtsupport.pri @@ -5,3 +5,4 @@ DEFINES *= QMAKE_AS_LIBRARY DEFINES *= PROPARSER_THREAD_SAFE DEFINES *= PROEVALUATOR_THREAD_SAFE DEFINES *= PROEVALUATOR_CUMULATIVE +DEFINES *= PROEVALUATOR_SETENV diff --git a/src/plugins/qtsupport/qtsupport.pro b/src/plugins/qtsupport/qtsupport.pro index c1a2ad0be6..8a5799316b 100644 --- a/src/plugins/qtsupport/qtsupport.pro +++ b/src/plugins/qtsupport/qtsupport.pro @@ -7,7 +7,7 @@ include(../../qtcreatorplugin.pri) include(qtsupport_dependencies.pri) DEFINES += \ QMAKE_AS_LIBRARY QMAKE_LIBRARY \ - PROPARSER_THREAD_SAFE PROEVALUATOR_THREAD_SAFE PROEVALUATOR_CUMULATIVE + PROPARSER_THREAD_SAFE PROEVALUATOR_THREAD_SAFE PROEVALUATOR_CUMULATIVE PROEVALUATOR_SETENV include(../../shared/proparser/proparser.pri) HEADERS += \ @@ -61,6 +61,3 @@ FORMS += \ qtversioninfo.ui \ debugginghelper.ui \ qtversionmanager.ui \ - - -DEFINES += QT_NO_CAST_FROM_ASCII diff --git a/src/plugins/qtsupport/qtsupport.qbs b/src/plugins/qtsupport/qtsupport.qbs index e8aed6c497..cc30200f0f 100644 --- a/src/plugins/qtsupport/qtsupport.qbs +++ b/src/plugins/qtsupport/qtsupport.qbs @@ -12,101 +12,102 @@ QtcPlugin { Depends { name: "QmlJS" } Depends { name: "cpp" } - cpp.includePaths: [ - ".", + cpp.includePaths: base.concat([ "../../shared", - "../../shared/proparser", - "..", - "../../libs", - buildDirectory - ] - cpp.defines: { - return base.concat([ - "QT_NO_CAST_FROM_ASCII", - "QT_NO_CAST_TO_ASCII", - "QMAKE_AS_LIBRARY", - "QMAKE_LIBRARY", - "PROPARSER_THREAD_SAFE", - "PROEVALUATOR_THREAD_SAFE", - "PROEVALUATOR_CUMULATIVE", - "QMAKE_BUILTIN_PRFS" - ]) + "../../shared/proparser" + ]) + + cpp.defines: base.concat([ + "QMAKE_AS_LIBRARY", + "QMAKE_LIBRARY", + "PROPARSER_THREAD_SAFE", + "PROEVALUATOR_THREAD_SAFE", + "PROEVALUATOR_CUMULATIVE", + "QMAKE_BUILTIN_PRFS", + "PROEVALUATOR_SETENV" + ]) + + Group { + prefix: "../../shared/proparser/" + files: [ + "ioutils.cpp", + "ioutils.h", + "profileevaluator.cpp", + "profileevaluator.h", + "proitems.cpp", + "proitems.h", + "proparser.qrc", + "prowriter.cpp", + "prowriter.h", + "qmake_global.h", + "qmakebuiltins.cpp", + "qmakeevaluator.cpp", + "qmakeevaluator.h", + "qmakeevaluator_p.h", + "qmakeglobals.cpp", + "qmakeglobals.h", + "qmakeparser.cpp", + "qmakeparser.h", + ] } files: [ - "../../shared/proparser/qmakebuiltins.cpp", - "../../shared/proparser/qmakeevaluator.cpp", - "../../shared/proparser/qmakeevaluator.h", - "../../shared/proparser/qmakeevaluator_p.h", - "../../shared/proparser/qmakeglobals.cpp", - "../../shared/proparser/qmakeglobals.h", - "../../shared/proparser/qmakeparser.cpp", - "../../shared/proparser/qmakeparser.h", - "../../shared/proparser/qmake_global.h", - "../../shared/proparser/profileevaluator.cpp", - "../../shared/proparser/profileevaluator.h", - "../../shared/proparser/proitems.cpp", - "../../shared/proparser/proitems.h", - "../../shared/proparser/prowriter.cpp", - "../../shared/proparser/prowriter.h", - "../../shared/proparser/proparser.qrc", - "../../shared/proparser/ioutils.h", - "../../shared/proparser/ioutils.cpp", - "qtversioninfo.ui", - "qtversionmanager.ui", + "baseqtversion.cpp", "baseqtversion.h", + "customexecutableconfigurationwidget.cpp", + "customexecutableconfigurationwidget.h", + "customexecutablerunconfiguration.cpp", + "customexecutablerunconfiguration.h", "debugginghelper.cpp", "debugginghelper.h", "debugginghelper.ui", + "debugginghelperbuildtask.cpp", "debugginghelperbuildtask.h", + "exampleslistmodel.cpp", "exampleslistmodel.h", + "gettingstartedwelcomepage.cpp", "gettingstartedwelcomepage.h", "profilereader.cpp", "profilereader.h", + "qmldebugginglibrary.cpp", "qmldebugginglibrary.h", + "qmldumptool.cpp", "qmldumptool.h", + "qmlobservertool.cpp", "qmlobservertool.h", - "qtoptionspage.h", - "qtoutputformatter.cpp", - "qtoutputformatter.h", - "qtparser.h", "qtkitconfigwidget.cpp", "qtkitconfigwidget.h", "qtkitinformation.cpp", "qtkitinformation.h", + "qtoptionspage.cpp", + "qtoptionspage.h", + "qtoutputformatter.cpp", + "qtoutputformatter.h", + "qtparser.cpp", + "qtparser.h", "qtsupport_global.h", "qtsupportconstants.h", "qtsupportplugin.cpp", "qtsupportplugin.h", + "qtversionfactory.cpp", "qtversionfactory.h", + "qtversioninfo.ui", + "qtversionmanager.cpp", "qtversionmanager.h", + "qtversionmanager.ui", "screenshotcropper.cpp", "screenshotcropper.h", "showbuildlog.ui", - "baseqtversion.cpp", - "customexecutableconfigurationwidget.cpp", - "customexecutableconfigurationwidget.h", - "customexecutablerunconfiguration.cpp", - "customexecutablerunconfiguration.h", - "debugginghelperbuildtask.cpp", - "exampleslistmodel.cpp", - "gettingstartedwelcomepage.cpp", - "qmldebugginglibrary.cpp", - "qmldumptool.cpp", - "qmlobservertool.cpp", - "qtoptionspage.cpp", - "qtparser.cpp", - "qtversionfactory.cpp", - "qtversionmanager.cpp" ] ProductModule { Depends { name: "cpp" } - cpp.includePaths: [ "../../shared" ] + cpp.includePaths: "../../shared" cpp.defines: [ "QMAKE_AS_LIBRARY", "PROEVALUATOR_THREAD_SAFE", - "QMAKE_BUILTIN_PRFS" + "QMAKE_BUILTIN_PRFS", + "PROEVALUATOR_SETENV" ] } } diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp index 780af44f3c..cedb477348 100644 --- a/src/plugins/qtsupport/qtsupportplugin.cpp +++ b/src/plugins/qtsupport/qtsupportplugin.cpp @@ -38,12 +38,19 @@ #include "gettingstartedwelcomepage.h" +#include <coreplugin/variablemanager.h> #include <extensionsystem/pluginmanager.h> #include <projectexplorer/kitmanager.h> +#include <projectexplorer/project.h> +#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/target.h> #include <QtPlugin> #include <QMenu> +static const char kHostBins[] = "CurrentProject:QT_HOST_BINS"; +static const char kInstallBins[] = "CurrentProject:QT_INSTALL_BINS"; + using namespace QtSupport; using namespace QtSupport::Internal; @@ -81,6 +88,15 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes void QtSupportPlugin::extensionsInitialized() { + Core::VariableManager *vm = Core::VariableManager::instance(); + vm->registerVariable(kHostBins, + tr("Full path to the host bin directory of the current project's Qt version.")); + vm->registerVariable(kInstallBins, + tr("Full path to the target bin directory of the current project's Qt version." + " You probably want %1 instead.").arg(QString::fromLatin1(kHostBins))); + connect(vm, SIGNAL(variableUpdateRequested(QByteArray)), + this, SLOT(updateVariable(QByteArray))); + QtVersionManager::instance()->extensionsInitialized(); ProjectExplorer::KitManager::instance()->registerKitInformation(new QtKitInformation); } @@ -90,4 +106,25 @@ bool QtSupportPlugin::delayedInitialize() return QtVersionManager::instance()->delayedInitialize(); } +void QtSupportPlugin::updateVariable(const QByteArray &variable) +{ + if (variable != kHostBins && variable != kInstallBins) + return; + + ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::currentProject(); + if (!project || !project->activeTarget()) { + Core::VariableManager::instance()->remove(variable); + return; + } + + const BaseQtVersion *qtVersion = QtKitInformation::qtVersion(project->activeTarget()->kit()); + if (!qtVersion) { + Core::VariableManager::instance()->remove(variable); + return; + } + + QString value = qtVersion->qmakeProperty(variable == kHostBins ? "QT_HOST_BINS" : "QT_INSTALL_BINS"); + Core::VariableManager::instance()->insert(variable, value); +} + Q_EXPORT_PLUGIN(QtSupportPlugin) diff --git a/src/plugins/qtsupport/qtsupportplugin.h b/src/plugins/qtsupport/qtsupportplugin.h index 58c008458d..29ffe16ee2 100644 --- a/src/plugins/qtsupport/qtsupportplugin.h +++ b/src/plugins/qtsupport/qtsupportplugin.h @@ -49,6 +49,8 @@ public: bool delayedInitialize(); private slots: + void updateVariable(const QByteArray &variable); + #ifdef WITH_TESTS void testQtOutputParser_data(); void testQtOutputParser(); diff --git a/src/plugins/qtsupport/qtversionfactory.cpp b/src/plugins/qtsupport/qtversionfactory.cpp index 5300868fd0..eb34c054c8 100644 --- a/src/plugins/qtsupport/qtversionfactory.cpp +++ b/src/plugins/qtsupport/qtversionfactory.cpp @@ -33,6 +33,8 @@ #include "baseqtversion.h" #include <extensionsystem/pluginmanager.h> +#include <utils/environment.h> + #include <QSettings> using namespace QtSupport; @@ -54,15 +56,15 @@ bool sortByPriority(QtVersionFactory *a, QtVersionFactory *b) return a->priority() > b->priority(); } -BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileName &qmakePath, bool isAutoDetected, const QString &autoDetectionSource) +BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileName &qmakePath, bool isAutoDetected, const QString &autoDetectionSource, QString *error) { QHash<QString, QString> versionInfo; - bool success = BaseQtVersion::queryQMakeVariables(qmakePath, &versionInfo); - if (!success) + Utils::Environment env = Utils::Environment::systemEnvironment(); + if (!BaseQtVersion::queryQMakeVariables(qmakePath, env, &versionInfo, error)) return 0; Utils::FileName mkspec = BaseQtVersion::mkspecFromVersionInfo(versionInfo); - QMakeGlobals globals; + ProFileGlobals globals; globals.setProperties(versionInfo); ProMessageHandler msgHandler(true); ProFileCacheManager::instance()->incRefCount(); @@ -81,5 +83,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN } } ProFileCacheManager::instance()->decRefCount(); + if (error) + *error = tr("No factory found for qmake: '%1'").arg(qmakePath.toUserOutput()); return 0; } diff --git a/src/plugins/qtsupport/qtversionfactory.h b/src/plugins/qtsupport/qtversionfactory.h index 459fbb0f70..bf4329d7f7 100644 --- a/src/plugins/qtsupport/qtversionfactory.h +++ b/src/plugins/qtsupport/qtversionfactory.h @@ -62,7 +62,7 @@ public: virtual int priority() const = 0; virtual BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected = false, const QString &autoDetectionSource = QString()) = 0; - static BaseQtVersion *createQtVersionFromQMakePath(const Utils::FileName &qmakePath, bool isAutoDetected = false, const QString &autoDetectionSource = QString()); + static BaseQtVersion *createQtVersionFromQMakePath(const Utils::FileName &qmakePath, bool isAutoDetected = false, const QString &autoDetectionSource = QString(), QString *error = 0); }; } // namespace QtSupport diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 442aaa9e18..6c83b053f4 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -475,20 +475,6 @@ bool QtVersionManager::isValidId(int id) const return m_versions.contains(id); } -QString QtVersionManager::popPendingMwcUpdate() -{ - if (m_pendingMwcUpdates.isEmpty()) - return QString(); - return m_pendingMwcUpdates.takeFirst(); -} - -QString QtVersionManager::popPendingGcceUpdate() -{ - if (m_pendingGcceUpdates.isEmpty()) - return QString(); - return m_pendingGcceUpdates.takeFirst(); -} - Core::FeatureSet QtVersionManager::availableFeatures(const QString &platformName) const { Core::FeatureSet features; @@ -650,7 +636,7 @@ BaseQtVersion *QtVersionManager::qtVersionForQMakeBinary(const Utils::FileName & void dumpQMakeAssignments(const QList<QMakeAssignment> &list) { - foreach(const QMakeAssignment &qa, list) { + foreach (const QMakeAssignment &qa, list) { qDebug()<<qa.variable<<qa.op<<qa.value; } } @@ -706,11 +692,11 @@ QPair<BaseQtVersion::QmakeBuildConfigs, QString> QtVersionManager::scanMakeFile( if (debug) dumpQMakeAssignments(assignments); - foreach(const QMakeAssignment &qa, assignments) + foreach (const QMakeAssignment &qa, assignments) Utils::QtcProcess::addArg(&result2, qa.variable + qa.op + qa.value); if (!afterAssignments.isEmpty()) { Utils::QtcProcess::addArg(&result2, QLatin1String("-after")); - foreach(const QMakeAssignment &qa, afterAssignments) + foreach (const QMakeAssignment &qa, afterAssignments) Utils::QtcProcess::addArg(&result2, qa.variable + qa.op + qa.value); } } @@ -805,11 +791,11 @@ BaseQtVersion::QmakeBuildConfigs QtVersionManager::qmakeBuildConfigFromCmdArgs(Q BaseQtVersion::QmakeBuildConfigs result = defaultBuildConfig; QList<QMakeAssignment> oldAssignments = *assignments; assignments->clear(); - foreach(const QMakeAssignment &qa, oldAssignments) { + foreach (const QMakeAssignment &qa, oldAssignments) { if (qa.variable == QLatin1String("CONFIG")) { QStringList values = qa.value.split(QLatin1Char(' ')); QStringList newValues; - foreach(const QString &value, values) { + foreach (const QString &value, values) { if (value == QLatin1String("debug")) { if (qa.op == QLatin1String("+=")) result = result | BaseQtVersion::DebugBuild; diff --git a/src/plugins/qtsupport/qtversionmanager.h b/src/plugins/qtsupport/qtversionmanager.h index 5f184128b4..6df5262597 100644 --- a/src/plugins/qtsupport/qtversionmanager.h +++ b/src/plugins/qtsupport/qtversionmanager.h @@ -91,10 +91,6 @@ public: static Utils::FileName findQMakeBinaryFromMakefile(const QString &directory); bool isValidId(int id) const; - // Compatibility with pre-2.2: - QString popPendingMwcUpdate(); - QString popPendingGcceUpdate(); - Core::FeatureSet availableFeatures(const QString &platformName) const; QStringList availablePlatforms() const; QString displayNameForPlatform(const QString &string) const; @@ -122,7 +118,6 @@ private: static BaseQtVersion::QmakeBuildConfigs qmakeBuildConfigFromCmdArgs(QList<QMakeAssignment> *assignments, BaseQtVersion::QmakeBuildConfigs defaultBuildConfig); bool restoreQtVersions(); - bool legacyRestore(); void findSystemQt(); void saveQtVersions(); void updateDocumentation(); @@ -140,10 +135,6 @@ private: // managed by QtProjectManagerPlugin static QtVersionManager *m_self; - // Compatibility with pre-2.2: - QStringList m_pendingMwcUpdates; - QStringList m_pendingGcceUpdates; - Utils::FileSystemWatcher *m_configFileWatcher; QTimer *m_fileWatcherTimer; Utils::PersistentSettingsWriter *m_writer; |