forked from qt-creator/qt-creator
ProjectExplorer etc: More FilePath usage
Mostly for project files. Change-Id: Icb6059f80758865e42cc9f9c092ec6782770dfd7 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -102,9 +102,9 @@ QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableBuilds(const Targe
|
||||
return {createBuildInfo(parent->kit(), parent->project()->projectDirectory())};
|
||||
}
|
||||
|
||||
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
const QString path = QFileInfo(projectPath).absolutePath();
|
||||
const QString path = projectPath.toFileInfo().absolutePath();
|
||||
BuildInfo info = createBuildInfo(k, Utils::FilePath::fromString(path));
|
||||
//: The name of the build configuration created by default for a autotools project.
|
||||
info.displayName = tr("Default");
|
||||
|
@@ -55,7 +55,7 @@ public:
|
||||
private:
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
||||
const QString &projectPath) const override;
|
||||
const Utils::FilePath &projectPath) const override;
|
||||
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FilePath &buildDir) const;
|
||||
};
|
||||
|
@@ -267,7 +267,7 @@ FilePath CMakeBuildConfiguration::shadowBuildDirectory(const FilePath &projectFi
|
||||
return FilePath();
|
||||
|
||||
const QString projectName = projectFilePath.parentDir().fileName();
|
||||
ProjectMacroExpander expander(projectFilePath.toString(), projectName, k, bcName, buildType);
|
||||
ProjectMacroExpander expander(projectFilePath, projectName, k, bcName, buildType);
|
||||
QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString());
|
||||
QString buildPath = expander.expand(ProjectExplorerPlugin::buildDirectoryTemplate());
|
||||
buildPath.replace(" ", "-");
|
||||
@@ -493,17 +493,17 @@ QList<BuildInfo> CMakeBuildConfigurationFactory::availableBuilds(const Target *p
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<BuildInfo> CMakeBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||
QList<BuildInfo>
|
||||
CMakeBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
const FilePath projectPathName = FilePath::fromString(projectPath);
|
||||
for (int type = BuildTypeDebug; type != BuildTypeLast; ++type) {
|
||||
BuildInfo info = createBuildInfo(k,
|
||||
ProjectExplorer::Project::projectDirectory(projectPathName).toString(),
|
||||
ProjectExplorer::Project::projectDirectory(projectPath).toString(),
|
||||
BuildType(type));
|
||||
info.displayName = info.typeName;
|
||||
info.buildDirectory
|
||||
= CMakeBuildConfiguration::shadowBuildDirectory(projectPathName, k,
|
||||
= CMakeBuildConfiguration::shadowBuildDirectory(projectPath, k,
|
||||
info.displayName, info.buildType);
|
||||
result << info;
|
||||
}
|
||||
|
@@ -136,7 +136,7 @@ public:
|
||||
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
||||
const QString &projectPath) const override;
|
||||
const Utils::FilePath &projectPath) const override;
|
||||
|
||||
private:
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k,
|
||||
|
@@ -349,7 +349,7 @@ const QList<BuildInfo> CMakeProjectImporter::buildInfoListForKit(const Kit *k, v
|
||||
{
|
||||
auto data = static_cast<const DirectoryData *>(directoryData);
|
||||
auto factory = qobject_cast<CMakeBuildConfigurationFactory *>(
|
||||
BuildConfigurationFactory::find(k, projectFilePath().toString()));
|
||||
BuildConfigurationFactory::find(k, projectFilePath()));
|
||||
if (!factory)
|
||||
return {};
|
||||
|
||||
|
@@ -547,8 +547,7 @@ QList<ProjectExplorer::BuildInfo> CompilationDatabaseBuildConfigurationFactory::
|
||||
return defaultBuildInfos(this, tr("Release"));
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::BuildInfo> CompilationDatabaseBuildConfigurationFactory::availableSetups(
|
||||
const ProjectExplorer::Kit * /*k*/, const QString & /*projectPath*/) const
|
||||
QList<ProjectExplorer::BuildInfo> CompilationDatabaseBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit * /*k*/, const Utils::FilePath & /*projectPath*/) const
|
||||
{
|
||||
return defaultBuildInfos(this, tr("Release"));
|
||||
}
|
||||
|
@@ -106,8 +106,8 @@ public:
|
||||
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds(
|
||||
const ProjectExplorer::Target *parent) const override;
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
||||
const QString &projectPath) const override;
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(
|
||||
const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -92,16 +92,17 @@ QList<BuildInfo> GenericBuildConfigurationFactory::availableBuilds(const Target
|
||||
return {createBuildInfo(parent->kit(), parent->project()->projectDirectory())};
|
||||
}
|
||||
|
||||
QList<BuildInfo> GenericBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||
QList<BuildInfo>
|
||||
GenericBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
BuildInfo info = createBuildInfo(k, Project::projectDirectory(Utils::FilePath::fromString(projectPath)));
|
||||
BuildInfo info = createBuildInfo(k, Project::projectDirectory(projectPath));
|
||||
//: The name of the build configuration created by default for a generic project.
|
||||
info.displayName = tr("Default");
|
||||
return {info};
|
||||
}
|
||||
|
||||
BuildInfo GenericBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||
const Utils::FilePath &buildDir) const
|
||||
BuildInfo
|
||||
GenericBuildConfigurationFactory::createBuildInfo(const Kit *k, const FilePath &buildDir) const
|
||||
{
|
||||
BuildInfo info(this);
|
||||
info.typeName = tr("Build");
|
||||
|
@@ -55,7 +55,7 @@ public:
|
||||
private:
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
||||
const QString &projectPath) const override;
|
||||
const Utils::FilePath &projectPath) const override;
|
||||
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FilePath &buildDir) const;
|
||||
};
|
||||
|
@@ -52,13 +52,14 @@ using namespace Utils;
|
||||
namespace Nim {
|
||||
|
||||
static FilePath defaultBuildDirectory(const Kit *k,
|
||||
const QString &projectFilePath,
|
||||
const FilePath &projectFilePath,
|
||||
const QString &bc,
|
||||
BuildConfiguration::BuildType buildType)
|
||||
{
|
||||
QFileInfo projectFileInfo(projectFilePath);
|
||||
QFileInfo projectFileInfo = projectFilePath.toFileInfo();
|
||||
|
||||
ProjectMacroExpander expander(projectFilePath, projectFileInfo.baseName(), k, bc, buildType);
|
||||
ProjectMacroExpander expander(projectFilePath,
|
||||
projectFileInfo.baseName(), k, bc, buildType);
|
||||
QString buildDirectory = expander.expand(ProjectExplorerPlugin::buildDirectoryTemplate());
|
||||
|
||||
if (FileUtils::isAbsolutePath(buildDirectory))
|
||||
@@ -85,7 +86,7 @@ void NimBuildConfiguration::initialize(const BuildInfo &info)
|
||||
|
||||
// Create the build configuration and initialize it from build info
|
||||
setBuildDirectory(defaultBuildDirectory(target()->kit(),
|
||||
project->projectFilePath().toString(),
|
||||
project->projectFilePath(),
|
||||
info.displayName,
|
||||
info.buildType));
|
||||
|
||||
@@ -162,7 +163,7 @@ QList<BuildInfo> NimBuildConfigurationFactory::availableBuilds(const Target *par
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<BuildInfo> NimBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||
QList<BuildInfo> NimBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
for (auto buildType : {BuildConfiguration::Debug, BuildConfiguration::Release}) {
|
||||
|
@@ -66,7 +66,7 @@ private:
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
||||
const QString &projectPath) const override;
|
||||
const Utils::FilePath &projectPath) const override;
|
||||
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k,
|
||||
ProjectExplorer::BuildConfiguration::BuildType buildType) const;
|
||||
|
@@ -52,6 +52,8 @@
|
||||
#include <QDebug>
|
||||
#include <QFormLayout>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
static const char BUILD_STEP_LIST_COUNT[] = "ProjectExplorer.BuildConfiguration.BuildStepListCount";
|
||||
static const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildStepList.";
|
||||
static const char CLEAR_SYSTEM_ENVIRONMENT_KEY[] = "ProjectExplorer.BuildConfiguration.ClearSystemEnvironment";
|
||||
@@ -417,7 +419,8 @@ const QList<BuildInfo> BuildConfigurationFactory::allAvailableBuilds(const Targe
|
||||
return availableBuilds(parent);
|
||||
}
|
||||
|
||||
const QList<BuildInfo> BuildConfigurationFactory::allAvailableSetups(const Kit *k, const QString &projectPath) const
|
||||
const QList<BuildInfo>
|
||||
BuildConfigurationFactory::allAvailableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
return availableSetups(k, projectPath);
|
||||
}
|
||||
@@ -430,12 +433,13 @@ bool BuildConfigurationFactory::supportsTargetDeviceType(Core::Id id) const
|
||||
}
|
||||
|
||||
// setup
|
||||
BuildConfigurationFactory *BuildConfigurationFactory::find(const Kit *k, const QString &projectPath)
|
||||
BuildConfigurationFactory *BuildConfigurationFactory::find(const Kit *k, const FilePath &projectPath)
|
||||
{
|
||||
QTC_ASSERT(k, return nullptr);
|
||||
const Core::Id deviceType = DeviceTypeKitAspect::deviceTypeId(k);
|
||||
for (BuildConfigurationFactory *factory : g_buildConfigurationFactories) {
|
||||
if (Utils::mimeTypeForFile(projectPath).matchesName(factory->m_supportedProjectMimeTypeName)
|
||||
if (Utils::mimeTypeForFile(projectPath.toString())
|
||||
.matchesName(factory->m_supportedProjectMimeTypeName)
|
||||
&& factory->supportsTargetDeviceType(deviceType))
|
||||
return factory;
|
||||
}
|
||||
|
@@ -140,14 +140,15 @@ public:
|
||||
const QList<BuildInfo> allAvailableBuilds(const Target *parent) const;
|
||||
|
||||
// List of build information that can be used to initially set up a new build configuration.
|
||||
const QList<BuildInfo> allAvailableSetups(const Kit *k, const QString &projectPath) const;
|
||||
const QList<BuildInfo>
|
||||
allAvailableSetups(const Kit *k, const Utils::FilePath &projectPath) const;
|
||||
|
||||
BuildConfiguration *create(Target *parent, const BuildInfo &info) const;
|
||||
|
||||
static BuildConfiguration *restore(Target *parent, const QVariantMap &map);
|
||||
static BuildConfiguration *clone(Target *parent, const BuildConfiguration *source);
|
||||
|
||||
static BuildConfigurationFactory *find(const Kit *k, const QString &projectPath);
|
||||
static BuildConfigurationFactory *find(const Kit *k, const Utils::FilePath &projectPath);
|
||||
static BuildConfigurationFactory *find(Target *parent);
|
||||
|
||||
using IssueReporter = std::function<Tasks(Kit *, const QString &, const QString &)>;
|
||||
@@ -157,7 +158,8 @@ public:
|
||||
|
||||
protected:
|
||||
virtual QList<BuildInfo> availableBuilds(const Target *parent) const = 0;
|
||||
virtual QList<BuildInfo> availableSetups(const Kit *k, const QString &projectPath) const = 0;
|
||||
virtual QList<BuildInfo>
|
||||
availableSetups(const Kit *k, const Utils::FilePath &projectPath) const = 0;
|
||||
|
||||
bool supportsTargetDeviceType(Core::Id id) const;
|
||||
void setSupportedProjectType(Core::Id id);
|
||||
|
@@ -65,7 +65,7 @@ void JsonKitsPage::initializePage()
|
||||
setPreferredKitPredicate([platform, preferred](const Kit *k) {
|
||||
return k->supportedPlatforms().contains(platform) && k->hasFeatures(preferred);
|
||||
});
|
||||
setProjectPath(wiz->expander()->expand(unexpandedProjectPath()));
|
||||
setProjectPath(wiz->expander()->expand(Utils::FilePath::fromString(unexpandedProjectPath())));
|
||||
|
||||
TargetSetupPage::initializePage();
|
||||
}
|
||||
|
@@ -29,13 +29,13 @@
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
ProjectMacroExpander::ProjectMacroExpander(const QString &mainFilePath, const QString &projectName,
|
||||
ProjectMacroExpander::ProjectMacroExpander(const Utils::FilePath &mainFilePath, const QString &projectName,
|
||||
const Kit *kit, const QString &bcName,
|
||||
BuildConfiguration::BuildType buildType)
|
||||
{
|
||||
registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
|
||||
QCoreApplication::translate("ProjectExplorer", "Main file of current project"),
|
||||
[mainFilePath]() -> QString { return mainFilePath; });
|
||||
[mainFilePath] { return mainFilePath.toString(); });
|
||||
|
||||
registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
|
||||
QCoreApplication::translate("ProjectExplorer", "Name of current project"),
|
||||
|
@@ -37,8 +37,11 @@ class Kit;
|
||||
class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::MacroExpander
|
||||
{
|
||||
public:
|
||||
ProjectMacroExpander(const QString &mainFilePath, const QString &projectName, const Kit *kit,
|
||||
const QString &bcName, BuildConfiguration::BuildType buildType);
|
||||
ProjectMacroExpander(const Utils::FilePath &mainFilePath,
|
||||
const QString &projectName,
|
||||
const Kit *kit,
|
||||
const QString &bcName,
|
||||
BuildConfiguration::BuildType buildType);
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -500,7 +500,7 @@ void Target::updateDefaultBuildConfigurations()
|
||||
qWarning("No build configuration factory found for target id '%s'.", qPrintable(id().toString()));
|
||||
return;
|
||||
}
|
||||
for (const BuildInfo &info : bcFactory->allAvailableSetups(kit(), project()->projectFilePath().toString())) {
|
||||
for (const BuildInfo &info : bcFactory->allAvailableSetups(kit(), project()->projectFilePath())) {
|
||||
if (BuildConfiguration *bc = bcFactory->create(this, info))
|
||||
addBuildConfiguration(bc);
|
||||
}
|
||||
|
@@ -198,7 +198,7 @@ void TargetSetupPageWrapper::addTargetSetupPage()
|
||||
{
|
||||
m_targetSetupPage = new TargetSetupPage(this);
|
||||
m_targetSetupPage->setUseScrollArea(false);
|
||||
m_targetSetupPage->setProjectPath(m_project->projectFilePath().toString());
|
||||
m_targetSetupPage->setProjectPath(m_project->projectFilePath());
|
||||
m_targetSetupPage->setRequiredKitPredicate(m_project->requiredKitPredicate());
|
||||
m_targetSetupPage->setPreferredKitPredicate(m_project->preferredKitPredicate());
|
||||
m_targetSetupPage->setProjectImporter(m_project->projectImporter());
|
||||
|
@@ -52,6 +52,8 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QCheckBox>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
static QList<IPotentialKit *> g_potentialKits;
|
||||
@@ -67,10 +69,10 @@ IPotentialKit::~IPotentialKit()
|
||||
}
|
||||
|
||||
namespace Internal {
|
||||
static Utils::FilePath importDirectory(const QString &projectPath)
|
||||
static FilePath importDirectory(const FilePath &projectPath)
|
||||
{
|
||||
// Setup import widget:
|
||||
auto path = Utils::FilePath::fromString(projectPath);
|
||||
auto path = projectPath;
|
||||
path = path.parentDir(); // base dir
|
||||
path = path.parentDir(); // parent dir
|
||||
|
||||
@@ -298,11 +300,11 @@ TargetSetupWidget *TargetSetupPage::widget(const Core::Id kitId,
|
||||
});
|
||||
}
|
||||
|
||||
void TargetSetupPage::setProjectPath(const QString &path)
|
||||
void TargetSetupPage::setProjectPath(const FilePath &path)
|
||||
{
|
||||
m_projectPath = path;
|
||||
if (!m_projectPath.isEmpty()) {
|
||||
QFileInfo fileInfo(QDir::cleanPath(path));
|
||||
QFileInfo fileInfo(QDir::cleanPath(path.toString()));
|
||||
QStringList subDirsList = fileInfo.absolutePath().split('/');
|
||||
m_ui->headerLabel->setText(tr("The following kits can be used for project <b>%1</b>:",
|
||||
"%1: Project name").arg(subDirsList.last()));
|
||||
|
@@ -68,7 +68,7 @@ public:
|
||||
// Call these before initializePage!
|
||||
void setRequiredKitPredicate(const ProjectExplorer::Kit::Predicate &predicate);
|
||||
void setPreferredKitPredicate(const ProjectExplorer::Kit::Predicate &predicate);
|
||||
void setProjectPath(const QString &dir);
|
||||
void setProjectPath(const Utils::FilePath &dir);
|
||||
void setProjectImporter(ProjectImporter *importer);
|
||||
bool importLineEditHasFocus() const;
|
||||
|
||||
@@ -120,7 +120,7 @@ private:
|
||||
ProjectExplorer::Kit::Predicate m_preferredPredicate;
|
||||
QPointer<ProjectImporter> m_importer;
|
||||
QLayout *m_baseLayout = nullptr;
|
||||
QString m_projectPath;
|
||||
Utils::FilePath m_projectPath;
|
||||
QString m_defaultShadowBuildLocation;
|
||||
std::vector<Internal::TargetSetupWidget *> m_widgets;
|
||||
Internal::TargetSetupWidget *m_firstWidget = nullptr;
|
||||
|
@@ -47,6 +47,8 @@
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
@@ -54,7 +56,7 @@ namespace Internal {
|
||||
// TargetSetupWidget
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
TargetSetupWidget::TargetSetupWidget(Kit *k, const QString &projectPath) :
|
||||
TargetSetupWidget::TargetSetupWidget(Kit *k, const FilePath &projectPath) :
|
||||
m_kit(k)
|
||||
{
|
||||
Q_ASSERT(m_kit);
|
||||
@@ -208,7 +210,7 @@ void TargetSetupWidget::manageKit()
|
||||
}
|
||||
}
|
||||
|
||||
void TargetSetupWidget::setProjectPath(const QString &projectPath)
|
||||
void TargetSetupWidget::setProjectPath(const FilePath &projectPath)
|
||||
{
|
||||
if (!m_kit)
|
||||
return;
|
||||
@@ -225,7 +227,7 @@ void TargetSetupWidget::expandWidget()
|
||||
m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
|
||||
}
|
||||
|
||||
const QList<BuildInfo> TargetSetupWidget::buildInfoList(const Kit *k, const QString &projectPath)
|
||||
const QList<BuildInfo> TargetSetupWidget::buildInfoList(const Kit *k, const FilePath &projectPath)
|
||||
{
|
||||
if (auto factory = BuildConfigurationFactory::find(k, projectPath))
|
||||
return factory->allAvailableSetups(k, projectPath);
|
||||
@@ -320,7 +322,7 @@ QPair<Task::TaskType, QString> TargetSetupWidget::findIssues(const BuildInfo &in
|
||||
QString buildDir = info.buildDirectory.toString();
|
||||
Tasks issues;
|
||||
if (info.factory())
|
||||
issues = info.factory()->reportIssues(m_kit, m_projectPath, buildDir);
|
||||
issues = info.factory()->reportIssues(m_kit, m_projectPath.toString(), buildDir);
|
||||
|
||||
QString text;
|
||||
Task::TaskType highestType = Task::Unknown;
|
||||
|
@@ -57,8 +57,7 @@ class TargetSetupWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TargetSetupWidget(Kit *k,
|
||||
const QString &projectPath);
|
||||
TargetSetupWidget(Kit *k, const Utils::FilePath &projectPath);
|
||||
|
||||
Kit *kit() const;
|
||||
void clearKit();
|
||||
@@ -69,14 +68,14 @@ public:
|
||||
void addBuildInfo(const BuildInfo &info, bool isImport);
|
||||
|
||||
const QList<BuildInfo> selectedBuildInfoList() const;
|
||||
void setProjectPath(const QString &projectPath);
|
||||
void setProjectPath(const Utils::FilePath &projectPath);
|
||||
void expandWidget();
|
||||
|
||||
signals:
|
||||
void selectedToggled() const;
|
||||
|
||||
private:
|
||||
static const QList<BuildInfo> buildInfoList(const Kit *k, const QString &projectPath);
|
||||
static const QList<BuildInfo> buildInfoList(const Kit *k, const Utils::FilePath &projectPath);
|
||||
|
||||
void handleKitUpdate(ProjectExplorer::Kit *k);
|
||||
|
||||
@@ -90,7 +89,7 @@ private:
|
||||
void clear();
|
||||
|
||||
Kit *m_kit;
|
||||
QString m_projectPath;
|
||||
Utils::FilePath m_projectPath;
|
||||
bool m_haveImported = false;
|
||||
Utils::DetailsWidget *m_detailsWidget;
|
||||
QPushButton *m_manageButton;
|
||||
|
@@ -59,13 +59,13 @@ using namespace Utils;
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
static FilePath defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
|
||||
static FilePath defaultBuildDirectory(const FilePath &projectFilePath, const Kit *k,
|
||||
const QString &bcName,
|
||||
BuildConfiguration::BuildType buildType)
|
||||
{
|
||||
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
|
||||
const QString projectName = projectFilePath.toFileInfo().completeBaseName();
|
||||
ProjectMacroExpander expander(projectFilePath, projectName, k, bcName, buildType);
|
||||
QString projectDir = Project::projectDirectory(FilePath::fromString(projectFilePath)).toString();
|
||||
QString projectDir = Project::projectDirectory(projectFilePath).toString();
|
||||
QString buildPath = expander.expand(ProjectExplorerPlugin::buildDirectoryTemplate());
|
||||
return FilePath::fromString(FileUtils::resolvePath(projectDir, buildPath));
|
||||
}
|
||||
@@ -102,7 +102,7 @@ void QbsBuildConfiguration::initialize(const BuildInfo &info)
|
||||
|
||||
Utils::FilePath buildDir = info.buildDirectory;
|
||||
if (buildDir.isEmpty())
|
||||
buildDir = defaultBuildDirectory(target()->project()->projectFilePath().toString(),
|
||||
buildDir = defaultBuildDirectory(target()->project()->projectFilePath(),
|
||||
target()->kit(), info.displayName, info.buildType);
|
||||
setBuildDirectory(buildDir);
|
||||
|
||||
@@ -387,7 +387,8 @@ QList<BuildInfo> QbsBuildConfigurationFactory::availableBuilds(const Target *par
|
||||
return {createBuildInfo(parent->kit(), BuildConfiguration::Debug)};
|
||||
}
|
||||
|
||||
QList<BuildInfo> QbsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||
QList<BuildInfo>
|
||||
QbsBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
|
||||
|
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
||||
const QString &projectPath) const override;
|
||||
const Utils::FilePath &projectPath) const override;
|
||||
|
||||
private:
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k,
|
||||
|
@@ -725,8 +725,8 @@ void QbsProject::configureAsExampleProject(const QSet<Id> &platforms)
|
||||
= QtSupport::QtKitAspect::qtVersion(k);
|
||||
if (!qtVersion || !qtVersionMatchesPlatform(qtVersion))
|
||||
continue;
|
||||
if (auto factory = BuildConfigurationFactory::find(k, projectFilePath().toString()))
|
||||
infoList << factory->allAvailableSetups(k, projectFilePath().toString());
|
||||
if (auto factory = BuildConfigurationFactory::find(k, projectFilePath()))
|
||||
infoList << factory->allAvailableSetups(k, projectFilePath());
|
||||
}
|
||||
setup(infoList);
|
||||
prepareForParsing();
|
||||
|
@@ -87,13 +87,12 @@ QbsProjectImporter::QbsProjectImporter(const FilePath &path) : QtProjectImporter
|
||||
{
|
||||
}
|
||||
|
||||
static QString buildDir(const QString &projectFilePath, const Kit *k)
|
||||
static QString buildDir(const FilePath &projectFilePath, const Kit *k)
|
||||
{
|
||||
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
|
||||
const QString projectName = projectFilePath.toFileInfo().completeBaseName();
|
||||
ProjectMacroExpander expander(projectFilePath, projectName, k, QString(),
|
||||
BuildConfiguration::Unknown);
|
||||
const QString projectDir
|
||||
= Project::projectDirectory(FilePath::fromString(projectFilePath)).toString();
|
||||
const QString projectDir = Project::projectDirectory(projectFilePath).toString();
|
||||
const QString buildPath = expander.expand(ProjectExplorerPlugin::buildDirectoryTemplate());
|
||||
return FileUtils::resolvePath(projectDir, buildPath);
|
||||
}
|
||||
@@ -125,7 +124,7 @@ QStringList QbsProjectImporter::importCandidates()
|
||||
seenCandidates.insert(projectDir);
|
||||
const auto &kits = KitManager::kits();
|
||||
for (Kit * const k : kits) {
|
||||
QFileInfo fi(buildDir(projectFilePath().toString(), k));
|
||||
QFileInfo fi(buildDir(projectFilePath(), k));
|
||||
const QString candidate = fi.absolutePath();
|
||||
if (!seenCandidates.contains(candidate)) {
|
||||
seenCandidates.insert(candidate);
|
||||
@@ -224,7 +223,7 @@ const QList<BuildInfo> QbsProjectImporter::buildInfoListForKit(const Kit *k, voi
|
||||
{
|
||||
qCDebug(qbsPmLog) << "creating build info for kit" << k->displayName();
|
||||
const auto factory = qobject_cast<QbsBuildConfigurationFactory *>(
|
||||
BuildConfigurationFactory::find(k, projectFilePath().toString()));
|
||||
BuildConfigurationFactory::find(k, projectFilePath()));
|
||||
if (!factory) {
|
||||
qCDebug(qbsPmLog) << "no build config factory found";
|
||||
return {};
|
||||
|
@@ -78,21 +78,21 @@ namespace QmakeProjectManager {
|
||||
// Helpers:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QString QmakeBuildConfiguration::shadowBuildDirectory(const QString &proFilePath, const Kit *k,
|
||||
QString QmakeBuildConfiguration::shadowBuildDirectory(const FilePath &proFilePath, const Kit *k,
|
||||
const QString &suffix,
|
||||
BuildConfiguration::BuildType buildType)
|
||||
{
|
||||
if (proFilePath.isEmpty())
|
||||
return QString();
|
||||
|
||||
const QString projectName = QFileInfo(proFilePath).completeBaseName();
|
||||
const QString projectName = proFilePath.toFileInfo().completeBaseName();
|
||||
ProjectMacroExpander expander(proFilePath, projectName, k, suffix, buildType);
|
||||
QString projectDir = Project::projectDirectory(FilePath::fromString(proFilePath)).toString();
|
||||
QString projectDir = Project::projectDirectory(proFilePath).toString();
|
||||
QString buildPath = expander.expand(ProjectExplorerPlugin::buildDirectoryTemplate());
|
||||
return FileUtils::resolvePath(projectDir, buildPath);
|
||||
}
|
||||
|
||||
static FilePath defaultBuildDirectory(const QString &projectPath,
|
||||
static FilePath defaultBuildDirectory(const FilePath &projectPath,
|
||||
const Kit *k,
|
||||
const QString &suffix,
|
||||
BuildConfiguration::BuildType type)
|
||||
@@ -160,7 +160,7 @@ void QmakeBuildConfiguration::initialize(const BuildInfo &info)
|
||||
|
||||
FilePath directory = info.buildDirectory;
|
||||
if (directory.isEmpty()) {
|
||||
directory = defaultBuildDirectory(target()->project()->projectFilePath().toString(),
|
||||
directory = defaultBuildDirectory(target()->project()->projectFilePath(),
|
||||
target()->kit(), info.displayName, buildType());
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ QmakeBuildConfigurationFactory::QmakeBuildConfigurationFactory()
|
||||
}
|
||||
|
||||
BuildInfo QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||
const QString &projectPath,
|
||||
const FilePath &projectPath,
|
||||
BuildConfiguration::BuildType type) const
|
||||
{
|
||||
BaseQtVersion *version = QtKitAspect::qtVersion(k);
|
||||
@@ -639,10 +639,9 @@ BuildInfo QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||
info.kitId = k->id();
|
||||
|
||||
// check if this project is in the source directory:
|
||||
FilePath projectFilePath = FilePath::fromString(projectPath);
|
||||
if (version && version->isInSourceDirectory(projectFilePath)) {
|
||||
if (version && version->isInSourceDirectory(projectPath)) {
|
||||
// assemble build directory
|
||||
QString projectDirectory = projectFilePath.toFileInfo().absolutePath();
|
||||
QString projectDirectory = projectPath.toFileInfo().absolutePath();
|
||||
QDir qtSourceDir = QDir(version->sourcePath().toString());
|
||||
QString relativeProjectPath = qtSourceDir.relativeFilePath(projectDirectory);
|
||||
QString qtBuildDir = version->qmakeProperty("QT_INSTALL_PREFIX");
|
||||
@@ -657,7 +656,7 @@ BuildInfo QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||
return info;
|
||||
}
|
||||
|
||||
static QList<BuildConfiguration::BuildType> availableBuildTypes(const BaseQtVersion *version)
|
||||
static const QList<BuildConfiguration::BuildType> availableBuildTypes(const BaseQtVersion *version)
|
||||
{
|
||||
QList<BuildConfiguration::BuildType> types = {BuildConfiguration::Debug,
|
||||
BuildConfiguration::Release};
|
||||
@@ -670,9 +669,9 @@ QList<BuildInfo> QmakeBuildConfigurationFactory::availableBuilds(const Target *p
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
|
||||
const QString projectFilePath = parent->project()->projectFilePath().toString();
|
||||
const FilePath projectFilePath = parent->project()->projectFilePath();
|
||||
|
||||
foreach (BuildConfiguration::BuildType buildType,
|
||||
for (BuildConfiguration::BuildType buildType :
|
||||
availableBuildTypes(QtKitAspect::qtVersion(parent->kit()))) {
|
||||
BuildInfo info = createBuildInfo(parent->kit(), projectFilePath, buildType);
|
||||
info.displayName.clear(); // ask for a name
|
||||
@@ -683,14 +682,14 @@ QList<BuildInfo> QmakeBuildConfigurationFactory::availableBuilds(const Target *p
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<BuildInfo> QmakeBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||
QList<BuildInfo> QmakeBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
BaseQtVersion *qtVersion = QtKitAspect::qtVersion(k);
|
||||
if (!qtVersion || !qtVersion->isValid())
|
||||
return result;
|
||||
|
||||
foreach (BuildConfiguration::BuildType buildType, availableBuildTypes(qtVersion))
|
||||
for (BuildConfiguration::BuildType buildType : availableBuildTypes(qtVersion))
|
||||
result << createBuildInfo(k, projectPath, buildType);
|
||||
|
||||
return result;
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
void setQMakeBuildConfiguration(QtSupport::BaseQtVersion::QmakeBuildConfigs config);
|
||||
|
||||
/// suffix should be unique
|
||||
static QString shadowBuildDirectory(const QString &profilePath, const ProjectExplorer::Kit *k,
|
||||
static QString shadowBuildDirectory(const Utils::FilePath &profilePath, const ProjectExplorer::Kit *k,
|
||||
const QString &suffix, BuildConfiguration::BuildType type);
|
||||
|
||||
/// \internal for qmakestep
|
||||
@@ -151,9 +151,9 @@ public:
|
||||
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
||||
const QString &projectPath) const override;
|
||||
const Utils::FilePath &projectPath) const override;
|
||||
private:
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const QString &projectPath,
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath,
|
||||
ProjectExplorer::BuildConfiguration::BuildType type) const;
|
||||
};
|
||||
|
||||
|
@@ -949,8 +949,8 @@ void QmakeProject::configureAsExampleProject(const QSet<Core::Id> &platforms)
|
||||
&& !Utils::contains(version->targetDeviceTypes(), [platforms](Core::Id i) { return platforms.contains(i); })))
|
||||
continue;
|
||||
|
||||
if (auto factory = BuildConfigurationFactory::find(k, projectFilePath().toString()))
|
||||
infoList << factory->allAvailableSetups(k, projectFilePath().toString());
|
||||
if (auto factory = BuildConfigurationFactory::find(k, projectFilePath()))
|
||||
infoList << factory->allAvailableSetups(k, projectFilePath());
|
||||
}
|
||||
setup(infoList);
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc)
|
||||
Project *project = bc->target()->project();
|
||||
|
||||
m_defaultShadowBuildDir
|
||||
= QmakeBuildConfiguration::shadowBuildDirectory(project->projectFilePath().toString(),
|
||||
= QmakeBuildConfiguration::shadowBuildDirectory(project->projectFilePath(),
|
||||
bc->target()->kit(),
|
||||
Utils::FileUtils::qmakeFriendlyName(bc->displayName()),
|
||||
bc->buildType());
|
||||
|
@@ -96,7 +96,7 @@ QStringList QmakeProjectImporter::importCandidates()
|
||||
candidates << pfi.absolutePath();
|
||||
|
||||
foreach (Kit *k, KitManager::kits()) {
|
||||
QFileInfo fi(QmakeBuildConfiguration::shadowBuildDirectory(projectFilePath().toString(), k,
|
||||
QFileInfo fi(QmakeBuildConfiguration::shadowBuildDirectory(projectFilePath(), k,
|
||||
QString(), BuildConfiguration::Unknown));
|
||||
const QString baseDir = fi.absolutePath();
|
||||
|
||||
@@ -235,7 +235,7 @@ const QList<BuildInfo> QmakeProjectImporter::buildInfoListForKit(const Kit *k, v
|
||||
{
|
||||
auto *data = static_cast<DirectoryData *>(directoryData);
|
||||
auto factory = qobject_cast<QmakeBuildConfigurationFactory *>(
|
||||
BuildConfigurationFactory::find(k, projectFilePath().toString()));
|
||||
BuildConfigurationFactory::find(k, projectFilePath()));
|
||||
if (!factory)
|
||||
return {};
|
||||
|
||||
|
@@ -293,9 +293,7 @@ void BaseQmakeProjectWizardDialog::generateProfileName(const QString &name, cons
|
||||
if (!m_targetSetupPage)
|
||||
return;
|
||||
|
||||
const QString proFile =
|
||||
QDir::cleanPath(path + QLatin1Char('/') + name + QLatin1Char('/')
|
||||
+ name + QLatin1String(".pro"));
|
||||
const QString proFile = QDir::cleanPath(path + '/' + name + '/' + name + ".pro");
|
||||
|
||||
m_targetSetupPage->setProjectPath(proFile);
|
||||
m_targetSetupPage->setProjectPath(Utils::FilePath::fromString(proFile));
|
||||
}
|
||||
|
@@ -38,6 +38,9 @@
|
||||
#include <QLibraryInfo>
|
||||
#include <QTest>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
@@ -74,7 +77,7 @@ public:
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *,
|
||||
const QString &) const final
|
||||
const FilePath &) const final
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
Reference in New Issue
Block a user