Commit dc61b989 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Project: Use Utils::FileName as return type for projectDirectory(...)



Change-Id: I3ea10aa204b1ea41702edab09884b416cd6d9e06
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 0814cc11
......@@ -98,6 +98,7 @@ public:
QString baseDirectory() const;
void setBaseDirectory(const QString &directory);
Utils::FileName baseFileName() const;
void setBaseFileName(const Utils::FileName &base);
......
......@@ -59,7 +59,7 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
params.displayName = AndroidManager::packageName(target);
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
// TODO: Not sure if these are the right paths.
params.workingDirectory = target->project()->projectDirectory();
params.workingDirectory = target->project()->projectDirectory().toString();
if (runMode == ProjectExplorer::QmlProfilerRunMode) {
QTcpServer server;
QTC_ASSERT(server.listen(QHostAddress::LocalHost)
......
......@@ -119,7 +119,7 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
params.qmlServerAddress = server.serverAddress().toString();
params.remoteSetupNeeded = true;
//TODO: Not sure if these are the right paths.
params.projectSourceDirectory = project->projectDirectory();
params.projectSourceDirectory = project->projectDirectory().toString();
params.projectSourceFiles = project->files(QmakeProject::ExcludeGeneratedFiles);
params.projectBuildDirectory = project->rootQmakeProjectNode()->buildDir();
}
......
......@@ -170,7 +170,7 @@ void AndroidDeployQtStep::ctor()
bool AndroidDeployQtStep::init()
{
if (AndroidManager::checkForQt51Files(project()->projectDirectory()))
if (AndroidManager::checkForQt51Files(project()->projectDirectory().toString()))
emit addOutput(tr("Found old folder \"android\" in source directory. Qt 5.2 does not use that folder by default."), ErrorOutput);
m_targetArch = AndroidManager::targetArch(target());
......
......@@ -98,7 +98,7 @@ AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step)
m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput());
m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation());
bool oldFiles = AndroidManager::checkForQt51Files(m_step->project()->projectDirectory());
bool oldFiles = AndroidManager::checkForQt51Files(m_step->project()->projectDirectory().toString());
m_ui->oldFilesWarningIcon->setVisible(oldFiles);
m_ui->oldFilesWarningLabel->setVisible(oldFiles);
......@@ -346,7 +346,7 @@ void AndroidDeployQtWidget::addAndroidExtraLib()
{
QStringList fileNames = QFileDialog::getOpenFileNames(this,
tr("Select additional libraries"),
m_currentBuildConfiguration->target()->project()->projectDirectory(),
m_currentBuildConfiguration->target()->project()->projectDirectory().toString(),
tr("Libraries (*.so)"));
if (!fileNames.isEmpty())
......
......@@ -126,7 +126,7 @@ void AndroidExtraLibraryListModel::addEntries(const QStringList &list)
beginInsertRows(QModelIndex(), m_entries.size(), m_entries.size() + list.size());
foreach (const QString &path, list)
m_entries += QLatin1String("$$PWD/") + QDir(m_project->projectDirectory()).relativeFilePath(path);
m_entries += QLatin1String("$$PWD/") + QDir(m_project->projectDirectory().toString()).relativeFilePath(path);
QmakeProjectManager::QmakeProFileNode *node = m_project->rootQmakeProjectNode();
node->setProVariable(QLatin1String("ANDROID_EXTRA_LIBS"), m_entries, m_scope,
......
......@@ -274,7 +274,8 @@ Utils::FileName AndroidManager::dirPath(ProjectExplorer::Target *target)
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target->kit());
if (qtVersion && qtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0))
return target->activeBuildConfiguration()->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY));
return Utils::FileName::fromString(target->project()->projectDirectory()).appendPath(AndroidDirName);
Utils::FileName dir = target->project()->projectDirectory();
return dir.appendPath(AndroidDirName);
}
Utils::FileName AndroidManager::manifestPath(ProjectExplorer::Target *target)
......@@ -539,7 +540,7 @@ bool AndroidManager::createAndroidTemplatesIfNecessary(ProjectExplorer::Target *
Utils::FileName javaSrcPath
= Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_PREFIX"))
.appendPath(QLatin1String("src/android/java"));
QDir projectDir(qmakeProject->projectDirectory());
QDir projectDir(qmakeProject->projectDirectory().toString());
Utils::FileName androidPath = dirPath(target);
QStringList m_ignoreFiles;
......
......@@ -90,7 +90,7 @@ Project *androidProject(const QString &file)
continue;
Kit *kit = project->activeTarget()->kit();
if (DeviceTypeKitInformation::deviceTypeId(kit) == Android::Constants::ANDROID_DEVICE_TYPE
&& fileName.isChildOf(Utils::FileName::fromString(project->projectDirectory())))
&& fileName.isChildOf(project->projectDirectory()))
return project;
}
return 0;
......
......@@ -80,7 +80,7 @@ void AndroidRunConfiguration::init()
bool AndroidRunConfiguration::fromMap(const QVariantMap &map)
{
const QDir projectDir = QDir(target()->project()->projectDirectory());
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString()));
m_parseSuccess = static_cast<QmakeProject *>(target()->project())->validParse(m_proFilePath);
m_parseInProgress = static_cast<QmakeProject *>(target()->project())->parseInProgress(m_proFilePath);
......@@ -90,7 +90,7 @@ bool AndroidRunConfiguration::fromMap(const QVariantMap &map)
QVariantMap AndroidRunConfiguration::toMap() const
{
const QDir projectDir = QDir(target()->project()->projectDirectory());
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
QVariantMap map(RunConfiguration::toMap());
map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath));
return map;
......
......@@ -250,7 +250,7 @@ void CreateAndroidManifestWizard::createAndroidManifestFile()
// and now time for some magic
QString dir = QFileInfo(fileName).absolutePath();
QString value = QLatin1String("$$PWD/")
+ QDir(m_target->project()->projectDirectory()).relativeFilePath(dir);
+ QDir(m_target->project()->projectDirectory().toString()).relativeFilePath(dir);
bool result =
m_node->setProVariable(QLatin1String("ANDROID_PACKAGE_SOURCE_DIR"), QStringList(value));
QStringList unChanged;
......
......@@ -97,8 +97,7 @@ int AutotoolsBuildConfigurationFactory::priority(const Target *parent) const
QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableBuilds(const Target *parent) const
{
QList<BuildInfo *> result;
result << createBuildInfo(parent->kit(),
Utils::FileName::fromString(parent->project()->projectDirectory()));
result << createBuildInfo(parent->kit(), parent->project()->projectDirectory());
return result;
}
......@@ -135,7 +134,7 @@ BuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target *parent, c
// ### Build Steps Build ###
// autogen.sh or autoreconf
QFile autogenFile(parent->project()->projectDirectory() + QLatin1String("/autogen.sh"));
QFile autogenFile(parent->project()->projectDirectory().toString() + QLatin1String("/autogen.sh"));
if (autogenFile.exists()) {
AutogenStep *autogenStep = new AutogenStep(buildSteps);
buildSteps->insertStep(0, autogenStep);
......
......@@ -59,13 +59,13 @@ AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsBuildConfigu
m_pathChooser = new Utils::PathChooser(this);
m_pathChooser->setEnabled(true);
m_pathChooser->setExpectedKind(Utils::PathChooser::Directory);
m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
m_pathChooser->setBaseFileName(bc->target()->project()->projectDirectory());
m_pathChooser->setEnvironment(bc->environment());
m_pathChooser->setHistoryCompleter(QLatin1String("AutoTools.BuildDir.History"));
fl->addRow(tr("Build directory:"), m_pathChooser);
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
m_pathChooser->setBaseDirectory(bc->target()->project()->projectDirectory());
m_pathChooser->setBaseFileName(bc->target()->project()->projectDirectory());
m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory().toString());
setDisplayName(tr("Autotools Manager"));
......
......@@ -131,7 +131,7 @@ QVariantMap BareMetalRunConfiguration::toMap() const
{
QVariantMap map(RunConfiguration::toMap());
map.insert(QLatin1String(ArgumentsKey), d->arguments);
const QDir dir = QDir(target()->project()->projectDirectory());
const QDir dir = QDir(target()->project()->projectDirectory().toString());
map.insert(QLatin1String(ProFileKey), dir.relativeFilePath(d->projectFilePath));
map.insert(QLatin1String(WorkingDirectoryKey), d->workingDirectory);
return map;
......@@ -143,7 +143,7 @@ bool BareMetalRunConfiguration::fromMap(const QVariantMap &map)
return false;
d->arguments = map.value(QLatin1String(ArgumentsKey)).toString();
const QDir dir = QDir(target()->project()->projectDirectory());
const QDir dir = QDir(target()->project()->projectDirectory().toString());
d->projectFilePath
= QDir::cleanPath(dir.filePath(map.value(QLatin1String(ProFileKey)).toString()));
d->workingDirectory = map.value(QLatin1String(WorkingDirectoryKey)).toString();
......
......@@ -93,7 +93,7 @@ DebuggerStartParameters BareMetalRunControlFactory::startParameters(const BareMe
params.remoteSetupNeeded = false; //FIXME probably start debugserver with that, how?
params.displayName = runConfig->displayName();
if (const Project *project = target->project()) {
params.projectSourceDirectory = project->projectDirectory();
params.projectSourceDirectory = project->projectDirectory().toString();
if (const BuildConfiguration *buildConfig = target->activeBuildConfiguration())
params.projectBuildDirectory = buildConfig->buildDirectory().toString();
params.projectSourceFiles = project->files(Project::ExcludeGeneratedFiles);
......
......@@ -2028,7 +2028,7 @@ void ClearCasePlugin::projectChanged(Project *project)
disconnect(ICore::mainWindow(), SIGNAL(windowActivated()), this, SLOT(syncSlot()));
ProgressManager::cancelTasks(ClearCase::Constants::TASK_INDEX);
if (project) {
QString projDir = project->projectDirectory();
QString projDir = project->projectDirectory().toString();
QString topLevel = findTopLevel(projDir);
m_topLevel = topLevel;
if (topLevel.isEmpty())
......
......@@ -132,7 +132,7 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBui
QList<ProjectExplorer::BuildInfo *> result;
CMakeBuildInfo *info = createBuildInfo(parent->kit(),
parent->project()->projectDirectory());
parent->project()->projectDirectory().toString());
result << info;
return result;
}
......@@ -147,7 +147,7 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSet
const QString &projectPath) const
{
QList<ProjectExplorer::BuildInfo *> result;
CMakeBuildInfo *info = createBuildInfo(k, ProjectExplorer::Project::projectDirectory(projectPath));
CMakeBuildInfo *info = createBuildInfo(k, ProjectExplorer::Project::projectDirectory(Utils::FileName::fromString(projectPath)).toString());
//: The name of the build configuration created by default for a cmake project.
info->displayName = tr("Default");
info->buildDirectory
......
......@@ -57,7 +57,7 @@ public:
useNinja = bc->useNinja();
QTC_ASSERT(bc->target()->project(), return);
sourceDirectory = bc->target()->project()->projectDirectory();
sourceDirectory = bc->target()->project()->projectDirectory().toString();
}
Utils::Environment environment;
......
......@@ -184,7 +184,7 @@ QString CMakeProject::shadowBuildDirectory(const QString &projectFilePath, const
const QString projectName = QFileInfo(info.absolutePath()).fileName();
ProjectExplorer::ProjectMacroExpander expander(projectFilePath, projectName, k, bcName);
QDir projectDir = QDir(projectDirectory(projectFilePath));
QDir projectDir = QDir(projectDirectory(Utils::FileName::fromString(projectFilePath)).toString());
QString buildPath = Utils::expandMacros(Core::DocumentManager::buildDirectory(), &expander);
return QDir::cleanPath(projectDir.absoluteFilePath(buildPath));
}
......@@ -239,7 +239,7 @@ bool CMakeProject::parseCMakeLists()
projectFiles.insert(node->path());
} else {
// Manually add the CMakeLists.txt file
QString cmakeListTxt = projectDirectory() + QLatin1String("/CMakeLists.txt");
QString cmakeListTxt = projectDirectory().toString() + QLatin1String("/CMakeLists.txt");
bool generated = false;
fileList.append(new ProjectExplorer::FileNode(cmakeListTxt, ProjectExplorer::ProjectFileType, generated));
projectFiles.insert(cmakeListTxt);
......@@ -343,7 +343,7 @@ bool CMakeProject::parseCMakeLists()
part->projectFile = projectFilePath().toString();
// This explicitly adds -I. to the include paths
part->includePaths += projectDirectory();
part->includePaths += projectDirectory().toString();
foreach (const QString &includeFile, cbpparser.includeFiles()) {
// CodeBlocks is utterly ignorant of frameworks on Mac, and won't report framework
......@@ -531,7 +531,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
bool hasUserFile = activeTarget();
if (!hasUserFile) {
CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), m_manager, projectDirectory(), Utils::Environment::systemEnvironment());
CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), m_manager, projectDirectory().toString(), Utils::Environment::systemEnvironment());
if (copw.exec() != QDialog::Accepted)
return false;
Kit *k = copw.kit();
......@@ -614,7 +614,7 @@ CMakeBuildTarget CMakeProject::buildTargetForTitle(const QString &title)
QString CMakeProject::uiHeaderFile(const QString &uiFile)
{
QFileInfo fi(uiFile);
Utils::FileName project = Utils::FileName::fromString(projectDirectory());
Utils::FileName project = projectDirectory();
Utils::FileName baseDirectory = Utils::FileName::fromString(fi.absolutePath());
while (baseDirectory.isChildOf(project)) {
......@@ -710,7 +710,7 @@ void CMakeProject::updateApplicationAndDeploymentTargets()
QString deploymentPrefix;
QDir sourceDir;
sourceDir.setPath(t->project()->projectDirectory());
sourceDir.setPath(t->project()->projectDirectory().toString());
deploymentFile.setFileName(sourceDir.filePath(QLatin1String("QtCreatorDeployment.txt")));
if (deploymentFile.open(QFile::ReadOnly | QFile::Text)) {
deploymentStream.setDevice(&deploymentFile);
......@@ -845,7 +845,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
m_buildConfiguration = bc;
m_pathLineEdit->setText(m_buildConfiguration->rawBuildDirectory().toString());
if (m_buildConfiguration->buildDirectory().toString() == bc->target()->project()->projectDirectory())
if (m_buildConfiguration->buildDirectory() == bc->target()->project()->projectDirectory())
m_changeButton->setEnabled(false);
else
m_changeButton->setEnabled(true);
......
......@@ -248,7 +248,7 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
m_workingDirectoryEdit = new Utils::PathChooser();
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
m_workingDirectoryEdit->setBaseDirectory(m_cmakeRunConfiguration->target()->project()->projectDirectory());
m_workingDirectoryEdit->setBaseFileName(m_cmakeRunConfiguration->target()->project()->projectDirectory());
m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->baseWorkingDirectory());
m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("CMake.WorkingDir.History"));
ProjectExplorer::EnvironmentAspect *aspect
......
......@@ -1817,7 +1817,7 @@ void DebuggerPluginPrivate::attachToQmlPort()
sourceFiles << project->files(Project::ExcludeGeneratedFiles);
sp.projectSourceDirectory =
!projects.isEmpty() ? projects.first()->projectDirectory() : QString();
!projects.isEmpty() ? projects.first()->projectDirectory().toString() : QString();
sp.projectSourceFiles = sourceFiles;
sp.sysRoot = SysRootKitInformation::sysRoot(kit).toString();
DebuggerRunControlFactory::createAndScheduleRun(sp);
......
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