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))) {
// The directory that holds the project file. This includes the absolute path.
QString projectDirectory() const;
+ static QString projectDirectory(const QString &proFile);
signals:
void fileListChanged();
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());
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()
bool wasEvaluateCanceled();
QString defaultTopLevelBuildDirectory() const;
+ static QString defaultTopLevelBuildDirectory(const QString &profilePath);
signals:
/// emitted after parse
)
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)
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();
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);
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);
}
setImportInfos(tmp);
}
-QList<TargetSetupPage::ImportInfo>
-TargetSetupPage::importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project)
+QList<TargetSetupPage::ImportInfo> TargetSetupPage::importInfosForKnownQtVersions()
{
QList<ImportInfo> results;
QtVersionManager * vm = QtVersionManager::instance();
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;
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);