forked from qt-creator/qt-creator
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
(cherry picked from commit 1d8e176067
)
This commit is contained in:
@@ -229,10 +229,16 @@ QVariantMap Project::toMap() 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();
|
||||
}
|
||||
|
||||
|
||||
bool Project::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (map.contains(QLatin1String(EDITOR_SETTINGS_KEY))) {
|
||||
|
@@ -129,6 +129,7 @@ public:
|
||||
|
||||
// The directory that holds the project file. This includes the absolute path.
|
||||
QString projectDirectory() const;
|
||||
static QString projectDirectory(const QString &proFile);
|
||||
|
||||
signals:
|
||||
void fileListChanged();
|
||||
|
@@ -99,7 +99,7 @@ void ProjectLoadWizard::setupTargetPage()
|
||||
m_project->file()->fileName());
|
||||
importVersions.append(TargetSetupPage::recursivelyCheckDirectoryForBuild(m_project->defaultTopLevelBuildDirectory(),
|
||||
m_project->file()->fileName()));
|
||||
importVersions.append(TargetSetupPage::importInfosForKnownQtVersions(m_project));
|
||||
importVersions.append(TargetSetupPage::importInfosForKnownQtVersions());
|
||||
|
||||
m_targetSetupPage = new TargetSetupPage(this);
|
||||
m_targetSetupPage->setProFilePath(m_project->file()->fileName());
|
||||
|
@@ -780,8 +780,13 @@ bool Qt4Project::wasEvaluateCanceled()
|
||||
|
||||
QString Qt4Project::defaultTopLevelBuildDirectory() const
|
||||
{
|
||||
QFileInfo info(file()->fileName());
|
||||
return QDir(projectDirectory() + QLatin1String("/../") + info.baseName() + QLatin1String("-build")).absolutePath();
|
||||
return defaultTopLevelBuildDirectory(file()->fileName());
|
||||
}
|
||||
|
||||
QString Qt4Project::defaultTopLevelBuildDirectory(const QString &profilePath)
|
||||
{
|
||||
QFileInfo info(profilePath);
|
||||
return QDir(projectDirectory(profilePath) + QLatin1String("/../") + info.baseName() + QLatin1String("-build")).absolutePath();
|
||||
}
|
||||
|
||||
void Qt4Project::asyncUpdate()
|
||||
|
@@ -160,6 +160,7 @@ public:
|
||||
bool wasEvaluateCanceled();
|
||||
|
||||
QString defaultTopLevelBuildDirectory() const;
|
||||
static QString defaultTopLevelBuildDirectory(const QString &profilePath);
|
||||
|
||||
signals:
|
||||
/// emitted after parse
|
||||
|
@@ -366,23 +366,28 @@ QString Qt4Target::defaultBuildDirectory() const
|
||||
)
|
||||
return project()->projectDirectory();
|
||||
|
||||
return defaultShadowBuildDirectory(qt4Project()->defaultTopLevelBuildDirectory(), id());
|
||||
}
|
||||
|
||||
QString Qt4Target::defaultShadowBuildDirectory(const QString &projectLocation, const QString &id)
|
||||
{
|
||||
QString shortName = QLatin1String("unknown");
|
||||
if (id() == QLatin1String(Constants::DESKTOP_TARGET_ID))
|
||||
if (id == QLatin1String(Constants::DESKTOP_TARGET_ID))
|
||||
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");
|
||||
else if (id() == QLatin1String(Constants::S60_DEVICE_TARGET_ID))
|
||||
else if (id == QLatin1String(Constants::S60_DEVICE_TARGET_ID))
|
||||
shortName = QLatin1String("symbian");
|
||||
else if (id() == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
|
||||
else if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
|
||||
shortName = QLatin1String("maemo");
|
||||
else if (id() == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
|
||||
else if (id == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
|
||||
shortName = QLatin1String("simulator");
|
||||
|
||||
// currently we can't have the build directory to be deeper then the source directory
|
||||
// since that is broken in qmake
|
||||
// Once qmake is fixed we can change that to have a top directory and
|
||||
// subdirectories per build. (Replacing "QChar('-')" with "QChar('/') )
|
||||
return qt4Project()->defaultTopLevelBuildDirectory() + QChar('-') + shortName;
|
||||
return projectLocation + QChar('-') + shortName;
|
||||
}
|
||||
|
||||
bool Qt4Target::fromMap(const QVariantMap &map)
|
||||
|
@@ -81,6 +81,7 @@ public:
|
||||
ProjectExplorer::ToolChain::ToolChainType preferredToolChainType(const QList<ProjectExplorer::ToolChain::ToolChainType> &candidates) const;
|
||||
|
||||
QString defaultBuildDirectory() const;
|
||||
static QString defaultShadowBuildDirectory(const QString &projectLocation, const QString &id);
|
||||
|
||||
signals:
|
||||
void buildDirectoryInitialized();
|
||||
|
@@ -236,7 +236,7 @@ int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, bool m
|
||||
connect(this, SIGNAL(projectLocationChanged(QString)),
|
||||
m_targetSetupPage, SLOT(setProFilePath(QString)));
|
||||
|
||||
QList<TargetSetupPage::ImportInfo> infos = TargetSetupPage::importInfosForKnownQtVersions(0);
|
||||
QList<TargetSetupPage::ImportInfo> infos = TargetSetupPage::importInfosForKnownQtVersions();
|
||||
if (!targets.isEmpty())
|
||||
infos = TargetSetupPage::filterImportInfos(targets, infos);
|
||||
m_targetSetupPage->setImportDirectoryBrowsingEnabled(false);
|
||||
|
@@ -168,7 +168,15 @@ void TargetSetupPage::setImportInfos(const QList<ImportInfo> &infos)
|
||||
versionItem->setToolTip(1, status);
|
||||
|
||||
// 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->setToolTip(2, dir);
|
||||
}
|
||||
@@ -308,8 +316,7 @@ void TargetSetupPage::setProFilePath(const QString &path)
|
||||
setImportInfos(tmp);
|
||||
}
|
||||
|
||||
QList<TargetSetupPage::ImportInfo>
|
||||
TargetSetupPage::importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project)
|
||||
QList<TargetSetupPage::ImportInfo> TargetSetupPage::importInfosForKnownQtVersions()
|
||||
{
|
||||
QList<ImportInfo> results;
|
||||
QtVersionManager * vm = QtVersionManager::instance();
|
||||
@@ -319,12 +326,6 @@ TargetSetupPage::importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *pr
|
||||
validVersions.append(vm->versions().at(0)); // there is always one!
|
||||
foreach (QtVersion *v, validVersions) {
|
||||
ImportInfo info;
|
||||
if (project) {
|
||||
if (v->supportsShadowBuilds())
|
||||
info.directory = project->defaultTopLevelBuildDirectory();
|
||||
else
|
||||
info.directory = project->projectDirectory();
|
||||
}
|
||||
info.isExistingBuild = false;
|
||||
info.isTemporary = false;
|
||||
info.version = v;
|
||||
|
@@ -99,7 +99,7 @@ public:
|
||||
void setShowLocationInformation(bool location);
|
||||
void setPreferMobile(bool mobile);
|
||||
|
||||
static QList<ImportInfo> importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project);
|
||||
static QList<ImportInfo> importInfosForKnownQtVersions();
|
||||
static QList<ImportInfo> filterImportInfos(const QSet<QString> &validTargets,
|
||||
const QList<ImportInfo> &infos);
|
||||
|
||||
|
Reference in New Issue
Block a user