ProjectManager: Centralize "File not found handling"

That's the only error that was ever checked for, in all nine
project manager. In the hypothetical case that we'll need something
else than the name of a file to identify a "project file", we'd
probably need to touch the signature anyway. Until then, remove
the duplication.

Change-Id: Iba00b8f71309a908e2d29c0a58c50b685eca0cae
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2017-02-28 16:07:53 +01:00
parent 3490c5751d
commit 50d1690854
18 changed files with 24 additions and 94 deletions

View File

@@ -43,15 +43,8 @@ Manager::Manager()
QString Manager::mimeType() const
{ return QLatin1String(Constants::QMLPROJECT_MIMETYPE); }
ProjectExplorer::Project *Manager::openProject(const QString &fileName, QString *errorString)
ProjectExplorer::Project *Manager::openProject(const QString &fileName)
{
if (!QFileInfo(fileName).isFile()) {
if (errorString)
*errorString = tr("Failed opening project \"%1\": Project is not a file.")
.arg(fileName);
return 0;
}
return new QmlProject(this, Utils::FileName::fromString(fileName));
}

View File

@@ -39,7 +39,7 @@ public:
Manager();
QString mimeType() const override;
ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString) override;
ProjectExplorer::Project *openProject(const QString &fileName) override;
};
} // namespace Internal