Commit 6e17882b authored by Tobias Hunger's avatar Tobias Hunger

ProjectExplorer: Use Utils::FileName in ProjectImporter API

Change-Id: I60e05f1bd892b508db90bc48837e29e2725bf333
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 028b1170
......@@ -69,7 +69,7 @@ static bool hasOtherUsers(Core::Id id, const QVariant &v, Kit *k)
});
}
ProjectImporter::ProjectImporter(const QString &path) : m_projectPath(path)
ProjectImporter::ProjectImporter(const Utils::FileName &path) : m_projectPath(path)
{ }
ProjectImporter::~ProjectImporter()
......@@ -139,7 +139,7 @@ QList<BuildInfo *> ProjectImporter::import(const Utils::FileName &importPath, bo
QMessageBox::critical(Core::ICore::mainWindow(),
QCoreApplication::translate("ProjectExplorer::ProjectImporter", "No Build Found"),
QCoreApplication::translate("ProjectExplorer::ProjectImporter", "No build found in %1 matching project %2.")
.arg(importPath.toUserOutput()).arg(QDir::toNativeSeparators(projectFilePath())));
.arg(importPath.toUserOutput()).arg(projectFilePath().toUserOutput()));
return result;
}
......@@ -247,7 +247,7 @@ void ProjectImporter::addProject(Kit *k) const
UpdateGuard guard(*this);
QStringList projects = k->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
projects.append(m_projectPath); // note: There can be more than one instance of the project added!
projects.append(m_projectPath.toString()); // note: There can be more than one instance of the project added!
k->setValueSilently(TEMPORARY_OF_PROJECTS, projects);
}
......@@ -258,7 +258,7 @@ void ProjectImporter::removeProject(Kit *k) const
UpdateGuard guard(*this);
QStringList projects = k->value(TEMPORARY_OF_PROJECTS, QStringList()).toStringList();
projects.removeOne(m_projectPath);
projects.removeOne(m_projectPath.toString());
if (projects.isEmpty()) {
cleanupKit(k);
......
......@@ -42,10 +42,10 @@ class Target;
class PROJECTEXPLORER_EXPORT ProjectImporter
{
public:
ProjectImporter(const QString &path);
ProjectImporter(const Utils::FileName &path);
virtual ~ProjectImporter();
const QString projectFilePath() const { return m_projectPath; }
const Utils::FileName projectFilePath() const { return m_projectPath; }
virtual QList<BuildInfo *> import(const Utils::FileName &importPath, bool silent = false);
virtual QStringList importCandidates() = 0;
......@@ -104,7 +104,7 @@ private:
void markKitAsTemporary(Kit *k) const;
bool findTemporaryHandler(Core::Id id) const;
const QString m_projectPath;
const Utils::FileName m_projectPath;
mutable bool m_isUpdating = false;
class TemporaryInformationHandler {
......
......@@ -1611,7 +1611,7 @@ void QmakeProject::emitBuildDirectoryInitialized()
ProjectImporter *QmakeProject::projectImporter() const
{
if (!m_projectImporter)
m_projectImporter = new QmakeProjectImporter(projectFilePath().toString());
m_projectImporter = new QmakeProjectImporter(projectFilePath());
return m_projectImporter;
}
......
......@@ -80,7 +80,7 @@ namespace Internal {
const Core::Id QT_IS_TEMPORARY("Qmake.TempQt");
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // ugly
QmakeProjectImporter::QmakeProjectImporter(const QString &path) :
QmakeProjectImporter::QmakeProjectImporter(const FileName &path) :
QtProjectImporter(path)
{ }
......@@ -88,12 +88,12 @@ QStringList QmakeProjectImporter::importCandidates()
{
QStringList candidates;
QFileInfo pfi = QFileInfo(projectFilePath());
QFileInfo pfi = projectFilePath().toFileInfo();
const QString prefix = pfi.baseName();
candidates << pfi.absolutePath();
foreach (Kit *k, KitManager::kits()) {
QFileInfo fi(QmakeBuildConfiguration::shadowBuildDirectory(projectFilePath(), k,
QFileInfo fi(QmakeBuildConfiguration::shadowBuildDirectory(projectFilePath().toString(), k,
QString(), BuildConfiguration::Unknown));
const QString baseDir = fi.absolutePath();
......@@ -127,7 +127,7 @@ QList<void *> QmakeProjectImporter::examineDirectory(const FileName &importPath)
qCDebug(logs) << " Parsing the makefile failed" << makefile;
continue;
}
if (parse.srcProFile() != projectFilePath()) {
if (parse.srcProFile() != projectFilePath().toString()) {
qCDebug(logs) << " pro files doesn't match" << parse.srcProFile() << projectFilePath();
continue;
}
......@@ -233,7 +233,7 @@ QList<BuildInfo *> QmakeProjectImporter::buildInfoListForKit(const Kit *k, void
QList<BuildInfo *> result;
DirectoryData *data = static_cast<DirectoryData *>(directoryData);
auto factory = qobject_cast<QmakeBuildConfigurationFactory *>(
IBuildConfigurationFactory::find(k, projectFilePath()));
IBuildConfigurationFactory::find(k, projectFilePath().toString()));
if (!factory)
return result;
......
......@@ -41,7 +41,7 @@ namespace Internal {
class QmakeProjectImporter : public QtSupport::QtProjectImporter
{
public:
QmakeProjectImporter(const QString &path);
QmakeProjectImporter(const Utils::FileName &path);
QStringList importCandidates() final;
......
......@@ -44,7 +44,7 @@ using namespace ProjectExplorer;
namespace QtSupport {
QtProjectImporter::QtProjectImporter(const QString &path) : ProjectImporter(path)
QtProjectImporter::QtProjectImporter(const Utils::FileName &path) : ProjectImporter(path)
{
useTemporaryKitInformation(QtKitInformation::id(),
[this](Kit *k, const QVariantList &vl) { cleanupTemporaryQt(k, vl); },
......@@ -172,7 +172,7 @@ struct DirectoryData {
class TestQtProjectImporter : public QtProjectImporter
{
public:
TestQtProjectImporter(const QString &pp, const QList<void *> &testData) :
TestQtProjectImporter(const Utils::FileName &pp, const QList<void *> &testData) :
QtProjectImporter(pp),
m_testData(testData)
{ }
......@@ -418,7 +418,7 @@ void QtSupportPlugin::testQtProjectImporter_oneProject()
// Finally set up importer:
// Copy the directoryData so that importer is free to delete it later.
TestQtProjectImporter importer(tempDir1.path(),
TestQtProjectImporter importer(Utils::FileName::fromString(tempDir1.path()),
Utils::transform(testData, [](DirectoryData *i) {
return static_cast<void *>(new DirectoryData(*i));
}));
......@@ -431,7 +431,7 @@ void QtSupportPlugin::testQtProjectImporter_oneProject()
const QList<BuildInfo *> buildInfo = importer.import(Utils::FileName::fromString(appDir), true);
// VALIDATE: Basic TestImporter state:
QCOMPARE(importer.projectFilePath(), tempDir1.path());
QCOMPARE(importer.projectFilePath().toString(), tempDir1.path());
QCOMPARE(importer.allDeleted(), true);
// VALIDATE: Result looks reasonable:
......@@ -535,7 +535,7 @@ void QtSupportPlugin::testQtProjectImporter_oneProject()
QCOMPARE(newKitId, newKitIdAfterImport);
// VALIDATE: Importer state
QCOMPARE(importer.projectFilePath(), tempDir1.path());
QCOMPARE(importer.projectFilePath().toString(), tempDir1.path());
QCOMPARE(importer.allDeleted(), true);
if (kitIsPersistent) {
......
......@@ -39,7 +39,7 @@ class BaseQtVersion;
class QTSUPPORT_EXPORT QtProjectImporter : public ProjectExplorer::ProjectImporter
{
public:
QtProjectImporter(const QString &path);
QtProjectImporter(const Utils::FileName &path);
class QtVersionData
{
......
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