Commit 1d8e1760 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Fix targetsetuppage's shadowbuild dirs

 * Fix displayed shadow build location
 * Fix shadow build location used by newly set up shadow builds

Task-number: QTCREATORBUG-1599
Reviewed-by: dt
parent 881d8ef6
...@@ -229,10 +229,16 @@ QVariantMap Project::toMap() const ...@@ -229,10 +229,16 @@ QVariantMap Project::toMap() const
QString Project::projectDirectory() const QString Project::projectDirectory() const
{ {
QFileInfo info(file()->fileName()); return projectDirectory(file()->fileName());
}
QString Project::projectDirectory(const QString &proFile)
{
QFileInfo info(proFile);
return info.absoluteDir().path(); return info.absoluteDir().path();
} }
bool Project::fromMap(const QVariantMap &map) bool Project::fromMap(const QVariantMap &map)
{ {
if (map.contains(QLatin1String(EDITOR_SETTINGS_KEY))) { if (map.contains(QLatin1String(EDITOR_SETTINGS_KEY))) {
......
...@@ -129,6 +129,7 @@ public: ...@@ -129,6 +129,7 @@ public:
// The directory that holds the project file. This includes the absolute path. // The directory that holds the project file. This includes the absolute path.
QString projectDirectory() const; QString projectDirectory() const;
static QString projectDirectory(const QString &proFile);
signals: signals:
void fileListChanged(); void fileListChanged();
......
...@@ -99,7 +99,7 @@ void ProjectLoadWizard::setupTargetPage() ...@@ -99,7 +99,7 @@ void ProjectLoadWizard::setupTargetPage()
m_project->file()->fileName()); m_project->file()->fileName());
importVersions.append(TargetSetupPage::recursivelyCheckDirectoryForBuild(m_project->defaultTopLevelBuildDirectory(), importVersions.append(TargetSetupPage::recursivelyCheckDirectoryForBuild(m_project->defaultTopLevelBuildDirectory(),
m_project->file()->fileName())); m_project->file()->fileName()));
importVersions.append(TargetSetupPage::importInfosForKnownQtVersions(m_project)); importVersions.append(TargetSetupPage::importInfosForKnownQtVersions());
m_targetSetupPage = new TargetSetupPage(this); m_targetSetupPage = new TargetSetupPage(this);
m_targetSetupPage->setProFilePath(m_project->file()->fileName()); m_targetSetupPage->setProFilePath(m_project->file()->fileName());
......
...@@ -787,8 +787,13 @@ bool Qt4Project::wasEvaluateCanceled() ...@@ -787,8 +787,13 @@ bool Qt4Project::wasEvaluateCanceled()
QString Qt4Project::defaultTopLevelBuildDirectory() const QString Qt4Project::defaultTopLevelBuildDirectory() const
{ {
QFileInfo info(file()->fileName()); return defaultTopLevelBuildDirectory(file()->fileName());
return QDir(projectDirectory() + QLatin1String("/../") + info.baseName() + QLatin1String("-build")).absolutePath(); }
QString Qt4Project::defaultTopLevelBuildDirectory(const QString &profilePath)
{
QFileInfo info(profilePath);
return QDir(projectDirectory(profilePath) + QLatin1String("/../") + info.baseName() + QLatin1String("-build")).absolutePath();
} }
void Qt4Project::asyncUpdate() void Qt4Project::asyncUpdate()
......
...@@ -161,6 +161,7 @@ public: ...@@ -161,6 +161,7 @@ public:
bool wasEvaluateCanceled(); bool wasEvaluateCanceled();
QString defaultTopLevelBuildDirectory() const; QString defaultTopLevelBuildDirectory() const;
static QString defaultTopLevelBuildDirectory(const QString &profilePath);
signals: signals:
/// emitted after parse /// emitted after parse
......
...@@ -366,23 +366,28 @@ QString Qt4Target::defaultBuildDirectory() const ...@@ -366,23 +366,28 @@ QString Qt4Target::defaultBuildDirectory() const
) )
return project()->projectDirectory(); return project()->projectDirectory();
return defaultShadowBuildDirectory(qt4Project()->defaultTopLevelBuildDirectory(), id());
}
QString Qt4Target::defaultShadowBuildDirectory(const QString &projectLocation, const QString &id)
{
QString shortName = QLatin1String("unknown"); QString shortName = QLatin1String("unknown");
if (id() == QLatin1String(Constants::DESKTOP_TARGET_ID)) if (id == QLatin1String(Constants::DESKTOP_TARGET_ID))
shortName = QLatin1String("desktop"); shortName = QLatin1String("desktop");
else if (id() == QLatin1String(Constants::S60_EMULATOR_TARGET_ID)) else if (id == QLatin1String(Constants::S60_EMULATOR_TARGET_ID))
shortName = QLatin1String("symbian_emulator"); shortName = QLatin1String("symbian_emulator");
else if (id() == QLatin1String(Constants::S60_DEVICE_TARGET_ID)) else if (id == QLatin1String(Constants::S60_DEVICE_TARGET_ID))
shortName = QLatin1String("symbian"); shortName = QLatin1String("symbian");
else if (id() == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID)) else if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
shortName = QLatin1String("maemo"); shortName = QLatin1String("maemo");
else if (id() == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID)) else if (id == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
shortName = QLatin1String("simulator"); shortName = QLatin1String("simulator");
// currently we can't have the build directory to be deeper then the source directory // currently we can't have the build directory to be deeper then the source directory
// since that is broken in qmake // since that is broken in qmake
// Once qmake is fixed we can change that to have a top directory and // Once qmake is fixed we can change that to have a top directory and
// subdirectories per build. (Replacing "QChar('-')" with "QChar('/') ) // subdirectories per build. (Replacing "QChar('-')" with "QChar('/') )
return qt4Project()->defaultTopLevelBuildDirectory() + QChar('-') + shortName; return projectLocation + QChar('-') + shortName;
} }
bool Qt4Target::fromMap(const QVariantMap &map) bool Qt4Target::fromMap(const QVariantMap &map)
......
...@@ -81,6 +81,7 @@ public: ...@@ -81,6 +81,7 @@ public:
ProjectExplorer::ToolChain::ToolChainType preferredToolChainType(const QList<ProjectExplorer::ToolChain::ToolChainType> &candidates) const; ProjectExplorer::ToolChain::ToolChainType preferredToolChainType(const QList<ProjectExplorer::ToolChain::ToolChainType> &candidates) const;
QString defaultBuildDirectory() const; QString defaultBuildDirectory() const;
static QString defaultShadowBuildDirectory(const QString &projectLocation, const QString &id);
signals: signals:
void buildDirectoryInitialized(); void buildDirectoryInitialized();
......
...@@ -236,7 +236,7 @@ int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, bool m ...@@ -236,7 +236,7 @@ int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, bool m
connect(this, SIGNAL(projectLocationChanged(QString)), connect(this, SIGNAL(projectLocationChanged(QString)),
m_targetSetupPage, SLOT(setProFilePath(QString))); m_targetSetupPage, SLOT(setProFilePath(QString)));
QList<TargetSetupPage::ImportInfo> infos = TargetSetupPage::importInfosForKnownQtVersions(0); QList<TargetSetupPage::ImportInfo> infos = TargetSetupPage::importInfosForKnownQtVersions();
if (!targets.isEmpty()) if (!targets.isEmpty())
infos = TargetSetupPage::filterImportInfos(targets, infos); infos = TargetSetupPage::filterImportInfos(targets, infos);
m_targetSetupPage->setImportDirectoryBrowsingEnabled(false); m_targetSetupPage->setImportDirectoryBrowsingEnabled(false);
......
...@@ -168,7 +168,15 @@ void TargetSetupPage::setImportInfos(const QList<ImportInfo> &infos) ...@@ -168,7 +168,15 @@ void TargetSetupPage::setImportInfos(const QList<ImportInfo> &infos)
versionItem->setToolTip(1, status); versionItem->setToolTip(1, status);
// Column 2 (directory): // Column 2 (directory):
const QString dir = QDir::toNativeSeparators(i.directory); QString dir;
if (i.directory.isEmpty()) {
if (i.version->supportsShadowBuilds())
dir = QDir::toNativeSeparators(Qt4Target::defaultShadowBuildDirectory(Qt4Project::defaultTopLevelBuildDirectory(m_proFilePath), t));
else
dir = QDir::toNativeSeparators(Qt4Project::projectDirectory(m_proFilePath));
} else {
dir = QDir::toNativeSeparators(i.directory);
}
versionItem->setText(2, dir); versionItem->setText(2, dir);
versionItem->setToolTip(2, dir); versionItem->setToolTip(2, dir);
} }
...@@ -308,8 +316,7 @@ void TargetSetupPage::setProFilePath(const QString &path) ...@@ -308,8 +316,7 @@ void TargetSetupPage::setProFilePath(const QString &path)
setImportInfos(tmp); setImportInfos(tmp);
} }
QList<TargetSetupPage::ImportInfo> QList<TargetSetupPage::ImportInfo> TargetSetupPage::importInfosForKnownQtVersions()
TargetSetupPage::importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project)
{ {
QList<ImportInfo> results; QList<ImportInfo> results;
QtVersionManager * vm = QtVersionManager::instance(); QtVersionManager * vm = QtVersionManager::instance();
...@@ -319,12 +326,6 @@ TargetSetupPage::importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *pr ...@@ -319,12 +326,6 @@ TargetSetupPage::importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *pr
validVersions.append(vm->versions().at(0)); // there is always one! validVersions.append(vm->versions().at(0)); // there is always one!
foreach (QtVersion *v, validVersions) { foreach (QtVersion *v, validVersions) {
ImportInfo info; ImportInfo info;
if (project) {
if (v->supportsShadowBuilds())
info.directory = project->defaultTopLevelBuildDirectory();
else
info.directory = project->projectDirectory();
}
info.isExistingBuild = false; info.isExistingBuild = false;
info.isTemporary = false; info.isTemporary = false;
info.version = v; info.version = v;
......
...@@ -99,7 +99,7 @@ public: ...@@ -99,7 +99,7 @@ public:
void setShowLocationInformation(bool location); void setShowLocationInformation(bool location);
void setPreferMobile(bool mobile); void setPreferMobile(bool mobile);
static QList<ImportInfo> importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project); static QList<ImportInfo> importInfosForKnownQtVersions();
static QList<ImportInfo> filterImportInfos(const QSet<QString> &validTargets, static QList<ImportInfo> filterImportInfos(const QSet<QString> &validTargets,
const QList<ImportInfo> &infos); const QList<ImportInfo> &infos);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment