Commit 5476bcf5 authored by Daniel Molkentin's avatar Daniel Molkentin

Find Qt installation by specification of qmake rather than a "Qt dir".

Rationale: The concept of a "Qt Dir" is dead ever since Qt can be
installed. Specifying the qmake location otoh makes it possible to
unambigously detect all parts of a Qt installation.
parent 267ef8ec
......@@ -62,10 +62,10 @@ bool DebuggingHelperLibrary::hasDebuggingHelperLibrary(const QString &qmakePath)
return !debuggingHelperLibrary(qmakePath).isNull();
}
QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath)
QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QString &qtInstallData)
{
const QChar slash = QLatin1Char('/');
const uint hash = qHash(qtpath);
const uint hash = qHash(qtInstallData);
QStringList directories;
directories
<< (qtInstallData + QLatin1String("/qtc-debugging-helper/"))
......@@ -76,12 +76,12 @@ QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QStr
QStringList DebuggingHelperLibrary::debuggingHelperLibraryLocations(const QString &qmakePath)
{
return debuggingHelperLibraryLocations(qtInstallDataDir(qmakePath), qtDir(qmakePath));
return debuggingHelperLibraryLocationsByInstallData(qtInstallDataDir(qmakePath));
}
QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qmakePath)
{
return debuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath));
return debuggingHelperLibraryByInstallData(qtInstallDataDir(qmakePath));
}
QString DebuggingHelperLibrary::qtInstallDataDir(const QString &qmakePath)
......@@ -113,17 +113,17 @@ static inline QString helperFilePath(const QString &directory)
#endif
}
QStringList DebuggingHelperLibrary::debuggingHelperLibraryLocations(const QString &qtInstallData, const QString &qtpath)
QStringList DebuggingHelperLibrary::debuggingHelperLibraryLocationsByInstallData(const QString &qtInstallData)
{
QStringList result;
foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath))
foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData))
result << QFileInfo(helperFilePath(directory)).filePath();
return result;
}
QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath)
QString DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(const QString &qtInstallData)
{
foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath)) {
foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData)) {
const QFileInfo fi(helperFilePath(directory));
if (fi.exists())
return fi.filePath();
......@@ -134,7 +134,7 @@ QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qtInstallD
QString DebuggingHelperLibrary::buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env)
{
QString errorMessage;
const QString directory = copyDebuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath), &errorMessage);
const QString directory = copyDebuggingHelperLibrary(qtInstallDataDir(qmakePath), &errorMessage);
if (directory.isEmpty())
return errorMessage;
return buildDebuggingHelperLibrary(directory, make, qmakePath, QString::null, env);
......@@ -171,14 +171,13 @@ static bool copyDebuggingHelperFiles(const QStringList &files,
}
QString DebuggingHelperLibrary::copyDebuggingHelperLibrary(const QString &qtInstallData,
const QString &qtdir,
QString *errorMessage)
{
// Locations to try:
// $QTDIR/qtc-debugging-helper
// $APPLICATION-DIR/qtc-debugging-helper/$hash
// $USERDIR/qtc-debugging-helper/$hash
const QStringList directories = DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData, qtdir);
const QStringList directories = DebuggingHelperLibrary::debuggingHelperLibraryDirectories(qtInstallData);
QStringList files;
files << QLatin1String("gdbmacros.cpp") << QLatin1String("gdbmacros_p.h") << QLatin1String("gdbmacros.h") << QLatin1String("gdbmacros.pro")
......@@ -241,13 +240,18 @@ QString DebuggingHelperLibrary::buildDebuggingHelperLibrary(const QString &direc
}
return output;
}
#include <QDebug>
QString DebuggingHelperLibrary::qtVersionForQMake(const QString &qmakePath)
{
QString binary = qmakePath.mid(qmakePath.lastIndexOf('/')+1);
qDebug() << qmakePath << binary;
if (!possibleQMakeCommands().contains(binary))
return QString();
QProcess qmake;
qmake.start(qmakePath, QStringList(QLatin1String("--version")));
if (!qmake.waitForFinished())
return false;
return QString::null;
QString output = qmake.readAllStandardOutput();
QRegExp regexp(QLatin1String("(QMake version|QMake version:)[\\s]*([\\d.]*)"), Qt::CaseInsensitive);
regexp.indexIn(output);
......
......@@ -51,20 +51,20 @@ public:
static bool hasDebuggingHelperLibrary(const QString &qmakePath);
static QString debuggingHelperLibrary(const QString &qmakePath);
static QString debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath);
static QString debuggingHelperLibraryByInstallData(const QString &qtInstallData);
static QString buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env);
static QString buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, const QString &qmakeCommand, const QString &mkspec, const Environment &env);
// Build the helpers and return the output log/errormessage.
static QStringList debuggingHelperLibraryLocations(const QString &qmakePath);
static QStringList debuggingHelperLibraryLocations(const QString &qtInstallData, const QString &qtpath);
static QStringList debuggingHelperLibraryLocationsByInstallData(const QString &qtInstallData);
// Copy the source files to a target location and return the chosen target location.
static QString copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir, QString *errorMessage);
static QString copyDebuggingHelperLibrary(const QString &qtInstallData, QString *errorMessage);
private:
static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath);
static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData);
static QString qtInstallDataDir(const QString &qmakePath);
static QString qtDir(const QString &qmakePath);
};
......
......@@ -50,15 +50,15 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W
{
QtVersionManager * vm = QtVersionManager::instance();
QString directory = QFileInfo(project->file()->fileName()).absolutePath();
QString importVersion = QtVersionManager::findQtVersionFromMakefile(directory);
QString importVersion = QtVersionManager::findQMakeBinaryFromMakefile(directory);
if (!importVersion.isNull()) {
// This also means we have a build in there
// First get the qt version
m_importVersion = vm->qtVersionForDirectory(importVersion);
m_importVersion = vm->qtVersionForQMakeBinary(importVersion);
// Okay does not yet exist, create
if (!m_importVersion) {
m_importVersion = new QtVersion(QFileInfo(importVersion).baseName(), importVersion);
m_importVersion = new QtVersion(importVersion);
m_temporaryVersion = true;
}
......@@ -209,7 +209,7 @@ void ProjectLoadWizard::setupImportPage(QtVersion *version, QtVersion::QmakeBuil
QVBoxLayout *importLayout = new QVBoxLayout(importPage);
importLabel = new QLabel(importPage);
QString versionString = version->name() + " (" + QDir::toNativeSeparators(version->path()) + ")";
QString versionString = version->name() + " (" + QDir::toNativeSeparators(version->qmakeCommand()) + ")";
QString buildConfigString = (buildConfig & QtVersion::BuildAll) ? QLatin1String("debug_and_release ") : QLatin1String("");
buildConfigString.append((buildConfig & QtVersion::DebugBuild) ? QLatin1String("debug") : QLatin1String("release"));
importLabel->setTextFormat(Qt::RichText);
......@@ -231,8 +231,8 @@ void ProjectLoadWizard::setupImportPage(QtVersion *version, QtVersion::QmakeBuil
import2Label = new QLabel(importPage);
import2Label->setTextFormat(Qt::RichText);
if (m_temporaryVersion)
import2Label->setText(tr("<b>Note:</b> Importing the settings will automatically add the Qt Version from:<br><b>%1</b> to the list of Qt versions.")
.arg(QDir::toNativeSeparators(m_importVersion->path())));
import2Label->setText(tr("<b>Note:</b> Importing the settings will automatically add the Qt Version identified by <br><b>%1</b> to the list of Qt versions.")
.arg(QDir::toNativeSeparators(m_importVersion->qmakeCommand())));
importLayout->addWidget(import2Label);
addPage(importPage);
}
......
......@@ -114,8 +114,8 @@ bool QMakeStep::init(const QString &name)
// Check wheter we need to run qmake
bool needToRunQMake = true;
if (QDir(workingDirectory).exists(QLatin1String("Makefile"))) {
QString qtPath = QtVersionManager::findQtVersionFromMakefile(workingDirectory);
if (qtVersion->path() == qtPath) {
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory);
if (qtVersion->qmakeCommand() == qmakePath) {
needToRunQMake = !m_pro->compareBuildConfigurationToImportFrom(name, workingDirectory);
}
}
......
......@@ -552,7 +552,7 @@ void S60DeviceRunControl::start()
m_targetName = rc->targetName();
m_baseFileName = rc->basePackageFilePath();
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
m_qtDir = project->qtVersion(project->activeBuildConfiguration())->path();
m_qtDir = project->qtVersion(project->activeBuildConfiguration())->versionInfo().value("QT_INSTALL_DATA");
m_useCustomSignature = (rc->signingMode() == S60DeviceRunConfiguration::SignCustom);
m_customSignaturePath = rc->customSignaturePath();
m_customKeyPath = rc->customKeyPath();
......
......@@ -124,7 +124,7 @@ void S60Manager::updateQtVersions()
}
if (deviceVersion) {
deviceVersion->setName(QString("%1 (Qt %2)").arg(device.id, deviceVersion->qtVersionString()));
deviceVersion->setPath(device.qt);
deviceVersion->setQMakeCommand(device.qt+"/bin/qmake.exe");
handledVersions.append(deviceVersion);
} else {
deviceVersion = new QtVersion(QString("%1 (Qt %2)").arg(device.id), device.qt,
......@@ -171,8 +171,9 @@ S60Devices::Device S60Manager::deviceForQtVersion(const Qt4ProjectManager::QtVer
deviceId = deviceIdFromDetectionSource(version->autodetectionSource());
if (deviceId.isEmpty()) { // it's not an s60 autodetected version
// have a look if we find the device root anyhow
if (QFile::exists(QString::fromLatin1("%1/epoc32").arg(version->path()))) {
device.epocRoot = version->path();
QString qtPath = version->versionInfo().value("QT_INSTALL_DATA");
if (QFile::exists(QString::fromLatin1("%1/epoc32").arg(qtPath))) {
device.epocRoot = qtPath;
device.toolsRoot = device.epocRoot;
device.qt = device.epocRoot;
device.isDefault = false;
......
......@@ -831,7 +831,7 @@ QString Qt4Project::qtDir(const QString &buildConfiguration) const
{
QtVersion *version = qtVersion(buildConfiguration);
if (version)
return version->path();
return version->versionInfo().value("QT_INSTALL_DATA");
return QString::null;
}
......@@ -1151,9 +1151,9 @@ bool Qt4Project::compareBuildConfigurationToImportFrom(const QString &buildConfi
{
QMakeStep *qs = qmakeStep();
if (QDir(workingDirectory).exists(QLatin1String("Makefile")) && qs) {
QString qtPath = QtVersionManager::findQtVersionFromMakefile(workingDirectory);
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory);
QtVersion *version = qtVersion(buildConfiguration);
if (version->path() == qtPath) {
if (version->qmakeCommand() == qmakePath) {
// same qtversion
QPair<QtVersion::QmakeBuildConfig, QStringList> result =
QtVersionManager::scanMakeFile(workingDirectory, version->defaultBuildConfig());
......
......@@ -257,12 +257,12 @@ void Qt4ProjectConfigWidget::updateImportLabel()
// we only show if we actually have a qmake and makestep
if (m_pro->qmakeStep() && m_pro->makeStep()) {
QString qtPath = QtVersionManager::findQtVersionFromMakefile(m_pro->buildDirectory(m_buildConfiguration));
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(m_pro->buildDirectory(m_buildConfiguration));
QtVersion *version = m_pro->qtVersion(m_buildConfiguration);
// check that there's a makefile
if (!qtPath.isEmpty()) {
// and that the makefile path is different from the current version
if (qtPath != (version ? version->path() : QString())) {
if (!qmakePath.isEmpty()) {
// and that the qmake path is different from the current version
if (qmakePath != (version ? version->qmakeCommand() : QString())) {
// import enable
visible = true;
} else {
......@@ -297,12 +297,12 @@ void Qt4ProjectConfigWidget::importLabelClicked()
return;
QString directory = m_pro->buildDirectory(m_buildConfiguration);
if (!directory.isEmpty()) {
QString qtPath = QtVersionManager::findQtVersionFromMakefile(directory);
if (!qtPath.isEmpty()) {
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(directory);
if (!qmakePath.isEmpty()) {
QtVersionManager *vm = QtVersionManager::instance();
QtVersion *version = vm->qtVersionForDirectory(qtPath);
QtVersion *version = vm->qtVersionForQMakeBinary(qmakePath);
if (!version) {
version = new QtVersion(QFileInfo(qtPath).baseName(), qtPath);
version = new QtVersion(qmakePath);
vm->addVersion(version);
}
......
......@@ -4,6 +4,7 @@
#include "qt4projectmanagerconstants.h"
#include "qtversionmanager.h"
#include <projectexplorer/debugginghelper.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
......@@ -102,7 +103,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
, m_debuggingHelperOkIcon(m_debuggingHelperOkPixmap)
, m_debuggingHelperErrorIcon(m_debuggingHelperErrorPixmap)
, m_specifyNameString(tr("<specify a name>"))
, m_specifyPathString(tr("<specify a path>"))
, m_specifyPathString(tr("<specify a qmake location>"))
, m_ui(new Internal::Ui::QtVersionManager())
, m_defaultVersion(versions.indexOf(defaultVersion))
{
......@@ -111,10 +112,10 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
m_versions.push_back(QSharedPointerQtVersion(new QtVersion(*version)));
m_ui->setupUi(this);
m_ui->qtPath->setExpectedKind(Core::Utils::PathChooser::Directory);
m_ui->qtPath->setPromptDialogTitle(tr("Select QTDIR"));
m_ui->qmakePath->setExpectedKind(Core::Utils::PathChooser::File);
m_ui->qmakePath->setPromptDialogTitle(tr("Select QMake Executable"));
m_ui->mingwPath->setExpectedKind(Core::Utils::PathChooser::Directory);
m_ui->qtPath->setPromptDialogTitle(tr("Select the Qt Directory"));
m_ui->mingwPath->setPromptDialogTitle(tr("Select the MinGW Directory"));
m_ui->mwcPath->setExpectedKind(Core::Utils::PathChooser::Directory);
m_ui->mwcPath->setPromptDialogTitle(tr("Select \"x86build\" Directory from Carbide Install"));
......@@ -136,7 +137,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
const QtVersion * const version = m_versions.at(i).data();
QTreeWidgetItem *item = new QTreeWidgetItem(version->isAutodetected()? autoItem : manualItem);
item->setText(0, version->name());
item->setText(1, QDir::toNativeSeparators(version->path()));
item->setText(1, QDir::toNativeSeparators(version->qmakeCommand()));
item->setData(0, Qt::UserRole, version->uniqueId());
if (version->isValid()) {
......@@ -155,8 +156,8 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
this, SLOT(updateCurrentQtName()));
connect(m_ui->qtPath, SIGNAL(changed(QString)),
this, SLOT(updateCurrentQtPath()));
connect(m_ui->qmakePath, SIGNAL(changed(QString)),
this, SLOT(updateCurrentQMakeLocation()));
connect(m_ui->mingwPath, SIGNAL(changed(QString)),
this, SLOT(updateCurrentMingwDirectory()));
#ifdef QTCREATOR_WITH_S60
......@@ -169,7 +170,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
connect(m_ui->delButton, SIGNAL(clicked()),
this, SLOT(removeQtDir()));
connect(m_ui->qtPath, SIGNAL(browsingFinished()),
connect(m_ui->qmakePath, SIGNAL(browsingFinished()),
this, SLOT(onQtBrowsed()));
connect(m_ui->mingwPath, SIGNAL(browsingFinished()),
this, SLOT(onMingwBrowsed()));
......@@ -284,14 +285,14 @@ void QtOptionsPageWidget::addQtDir()
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->qtdirList->topLevelItem(1));
item->setText(0, newVersion->name());
item->setText(1, QDir::toNativeSeparators(newVersion->path()));
item->setText(1, QDir::toNativeSeparators(newVersion->qmakeCommand()));
item->setData(0, Qt::UserRole, newVersion->uniqueId());
item->setData(2, Qt::DecorationRole, QIcon());
m_ui->qtdirList->setCurrentItem(item);
m_ui->nameEdit->setText(newVersion->name());
m_ui->qtPath->setPath(newVersion->path());
m_ui->qmakePath->setPath(newVersion->qmakeCommand());
m_ui->defaultCombo->addItem(newVersion->name());
m_ui->nameEdit->setFocus();
m_ui->nameEdit->selectAll();
......@@ -355,7 +356,7 @@ void QtOptionsPageWidget::updateState()
const bool isAutodetected = enabled && version->isAutodetected();
m_ui->delButton->setEnabled(enabled && !isAutodetected);
m_ui->nameEdit->setEnabled(enabled && !isAutodetected);
m_ui->qtPath->setEnabled(enabled && !isAutodetected);
m_ui->qmakePath->setEnabled(enabled && !isAutodetected);
m_ui->mingwPath->setEnabled(enabled);
const bool hasLog = enabled && !m_ui->qtdirList->currentItem()->data(2, Qt::UserRole).toString().isEmpty();
......@@ -433,10 +434,10 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
makeMingwVisible(false);
makeMWCVisible(false);
if (!m_versions.at(index)->isInstalled())
m_ui->errorLabel->setText(tr("The Qt Version %1 is not installed. Run make install")
.arg(QDir::toNativeSeparators(m_versions.at(index)->path())));
m_ui->errorLabel->setText(tr("The Qt Version identified by %1 is not installed. Run make install")
.arg(QDir::toNativeSeparators(m_versions.at(index)->qmakeCommand())));
else
m_ui->errorLabel->setText(tr("%1 is not a valid Qt directory").arg(QDir::toNativeSeparators(m_versions.at(index)->path())));
m_ui->errorLabel->setText(tr("%1 does not specify a valid Qt installation").arg(QDir::toNativeSeparators(m_versions.at(index)->qmakeCommand())));
} else { //ProjectExplorer::ToolChain::GCC
makeMSVCVisible(false);
makeMingwVisible(false);
......@@ -487,10 +488,10 @@ void QtOptionsPageWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem
int itemIndex = indexForTreeItem(item);
if (itemIndex >= 0) {
m_ui->nameEdit->setText(item->text(0));
m_ui->qtPath->setPath(item->text(1));
m_ui->qmakePath->setPath(item->text(1));
} else {
m_ui->nameEdit->clear();
m_ui->qtPath->setPath(QString()); // clear()
m_ui->qmakePath->setPath(QString()); // clear()
}
showEnvironmentPage(item);
updateState();
......@@ -498,15 +499,15 @@ void QtOptionsPageWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem
void QtOptionsPageWidget::onQtBrowsed()
{
const QString dir = m_ui->qtPath->path();
const QString dir = m_ui->qmakePath->path();
if (dir.isEmpty())
return;
updateCurrentQtPath();
updateCurrentQMakeLocation();
if (m_ui->nameEdit->text().isEmpty() || m_ui->nameEdit->text() == m_specifyNameString) {
QStringList dirSegments = dir.split(QDir::separator(), QString::SkipEmptyParts);
if (!dirSegments.isEmpty())
m_ui->nameEdit->setText(dirSegments.last());
QString name = ProjectExplorer::DebuggingHelperLibrary::qtVersionForQMake(QDir::cleanPath(dir));
if (!name.isEmpty())
m_ui->nameEdit->setText(name);
updateCurrentQtName();
}
updateState();
......@@ -587,7 +588,7 @@ void QtOptionsPageWidget::fixQtVersionName(int index)
}
}
void QtOptionsPageWidget::updateCurrentQtPath()
void QtOptionsPageWidget::updateCurrentQMakeLocation()
{
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
Q_ASSERT(currentItem);
......@@ -595,10 +596,10 @@ void QtOptionsPageWidget::updateCurrentQtPath()
if (currentItemIndex < 0)
return;
QtVersion *version = m_versions.at(currentItemIndex).data();
if (version->path() == m_ui->qtPath->path())
if (version->qmakeCommand() == m_ui->qmakePath->path())
return;
version->setPath(m_ui->qtPath->path());
currentItem->setText(1, QDir::toNativeSeparators(version->path()));
version->setQMakeCommand(m_ui->qmakePath->path());
currentItem->setText(1, QDir::toNativeSeparators(version->qmakeCommand()));
showEnvironmentPage(currentItem);
if (version->isValid()) {
......
......@@ -113,7 +113,7 @@ private slots:
void onMingwBrowsed();
void defaultChanged(int index);
void updateCurrentQtName();
void updateCurrentQtPath();
void updateCurrentQMakeLocation();
void updateCurrentMingwDirectory();
#ifdef QTCREATOR_WITH_S60
void updateCurrentMwcDirectory();
......
......@@ -102,8 +102,15 @@ QtVersionManager::QtVersionManager()
if (isAutodetected)
autodetectionSource = QLatin1String(PATH_AUTODETECTION_SOURCE);
}
QString qmakePath = s->value("QMakePath").toString();
if (qmakePath.isEmpty()) {
QString path = s->value("Path").toString();
if (!path.isEmpty())
qmakePath = + "/bin/qmake.exe";
}
QtVersion *version = new QtVersion(s->value("Name").toString(),
s->value("Path").toString(),
qmakePath,
id,
isAutodetected,
autodetectionSource);
......@@ -215,7 +222,9 @@ void QtVersionManager::writeVersionsIntoSettings()
const QtVersion *version = m_versions.at(i);
s->setArrayIndex(i);
s->setValue("Name", version->name());
s->setValue("Path", version->path());
// for downwards compat
s->setValue("Path", version->versionInfo().value("QT_INSTALL_DATA"));
s->setValue("QMakePath", version->qmakeCommand());
s->setValue("Id", version->uniqueId());
s->setValue("MingwDirectory", version->mingwDirectory());
s->setValue("msvcVersion", version->msvcVersion());
......@@ -249,8 +258,8 @@ QtVersion *QtVersionManager::version(int id) const
void QtVersionManager::addNewVersionsFromInstaller()
{
// Add new versions which may have been installed by the WB installer in the form:
// NewQtVersions="qt 4.3.2=c:\\qt\\qt432;qt embedded=c:\\qtembedded;"
// or NewQtVersions="qt 4.3.2=c:\\qt\\qt432=c:\\qtcreator\\mingw\\=prependToPath;
// NewQtVersions="qt 4.3.2=c:\\qt\\qt432\bin\qmake.exe;qt embedded=c:\\qtembedded;"
// or NewQtVersions="qt 4.3.2=c:\\qt\\qt432bin\qmake.exe=c:\\qtcreator\\mingw\\=prependToPath;
// Duplicate entries are not added, the first new version is set as default.
QSettings *settings = Core::ICore::instance()->settings();
......@@ -276,7 +285,7 @@ void QtVersionManager::addNewVersionsFromInstaller()
bool versionWasAlreadyInList = false;
foreach(const QtVersion * const it, m_versions) {
if (QDir(version->path()).canonicalPath() == QDir(it->path()).canonicalPath()) {
if (QDir(version->qmakeCommand()).canonicalPath() == QDir(it->qmakeCommand()).canonicalPath()) {
versionWasAlreadyInList = true;
break;
}
......@@ -304,19 +313,13 @@ void QtVersionManager::updateSystemVersion()
{
bool haveSystemVersion = false;
QString systemQMakePath = DebuggingHelperLibrary::findSystemQt(ProjectExplorer::Environment::systemEnvironment());
QString systemQtPath;
if (systemQMakePath.isNull()) {
systemQtPath = tr("<not found>");
} else {
QDir dir(QFileInfo(systemQMakePath).absoluteDir());
dir.cdUp();
systemQtPath = dir.absolutePath();
}
if (systemQMakePath.isNull())
systemQMakePath = tr("<not found>");
foreach (QtVersion *version, m_versions) {
if (version->isAutodetected()
&& version->autodetectionSource() == PATH_AUTODETECTION_SOURCE) {
version->setPath(systemQtPath);
version->setQMakeCommand(systemQMakePath);
version->setName(tr("Qt in PATH"));
haveSystemVersion = true;
}
......@@ -324,7 +327,7 @@ void QtVersionManager::updateSystemVersion()
if (haveSystemVersion)
return;
QtVersion *version = new QtVersion(tr("Qt in PATH"),
systemQtPath,
systemQMakePath,
getUniqueId(),
true,
PATH_AUTODETECTION_SOURCE);
......@@ -347,7 +350,7 @@ void QtVersionManager::setNewQtVersions(QList<QtVersion *> newVersions, int newD
bool versionPathsChanged = m_versions.size() != newVersions.size();
if (!versionPathsChanged) {
for (int i = 0; i < m_versions.size(); ++i) {
if (m_versions.at(i)->path() != newVersions.at(i)->path()) {
if (m_versions.at(i)->qmakeCommand() != newVersions.at(i)->qmakeCommand()) {
versionPathsChanged = true;
break;
}
......@@ -382,12 +385,14 @@ void QtVersionManager::setNewQtVersions(QList<QtVersion *> newVersions, int newD
/// QtVersion
///
QtVersion::QtVersion(const QString &name, const QString &path, int id,
QtVersion::QtVersion(const QString &name, const QString &qmakeCommand, int id,
bool isAutodetected, const QString &autodetectionSource)
: m_name(name),
m_isAutodetected(isAutodetected),
m_autodetectionSource(autodetectionSource),
m_hasDebuggingHelper(false),
m_mkspecUpToDate(false),
m_versionInfoUpToDate(false),
m_notInstalled(false),
m_defaultConfigIsDebug(true),
m_defaultConfigIsDebugAndRelease(true),
......@@ -399,20 +404,45 @@ QtVersion::QtVersion(const QString &name, const QString &path, int id,
m_id = getUniqueId();
else
m_id = id;
setPath(path);
setQMakeCommand(qmakeCommand);
}
QtVersion::QtVersion(const QString &name, const QString &path,
QtVersion::QtVersion(const QString &name, const QString &qmakeCommand,
bool isAutodetected, const QString &autodetectionSource)
: m_name(name),
m_isAutodetected(isAutodetected),
m_autodetectionSource(autodetectionSource),
m_hasDebuggingHelper(false),
m_mkspecUpToDate(false),
m_versionInfoUpToDate(false)
m_versionInfoUpToDate(false),
m_notInstalled(false),
m_defaultConfigIsDebug(true),
m_defaultConfigIsDebugAndRelease(true),
m_hasExamples(false),
m_hasDemos(false),
m_hasDocumentation(false)
{
m_id = getUniqueId();
setQMakeCommand(qmakeCommand);
}
QtVersion::QtVersion(const QString &qmakeCommand, bool isAutodetected, const QString &autodetectionSource)
: m_isAutodetected(isAutodetected),
m_autodetectionSource(autodetectionSource),
m_hasDebuggingHelper(false),
m_mkspecUpToDate(false),
m_versionInfoUpToDate(false),
m_notInstalled(false),
m_defaultConfigIsDebug(true),
m_defaultConfigIsDebugAndRelease(true),
m_hasExamples(false),
m_hasDemos(false),
m_hasDocumentation(false)
{
m_id = getUniqueId();
setPath(path);
setQMakeCommand(qmakeCommand);
m_name = qtVersionString();
}
QtVersion::~QtVersion()
......@@ -425,9 +455,9 @@ QString QtVersion::name() const
return m_name;
}
QString QtVersion::path() const
QString QtVersion::qmakeCommand() const