ProjectExplorer: Don't let the "import project" action fail silently

Fixes: QTCREATORBUG-17839
Change-Id: I3c57ca36f793aa1858558024566518c0dfdb4097
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-05-09 14:44:44 +02:00
parent 71751bb2fc
commit bfe3599768
2 changed files with 11 additions and 5 deletions

View File

@@ -99,10 +99,18 @@ const QList<BuildInfo> ProjectImporter::import(const Utils::FileName &importPath
const Utils::FileName absoluteImportPath = Utils::FileName::fromString(fi.absoluteFilePath());
const auto handleFailure = [this, importPath, silent] {
if (silent)
return;
QMessageBox::critical(Core::ICore::mainWindow(), tr("No Build Found"),
tr("No build found in %1 matching project %2.")
.arg(importPath.toUserOutput(), projectFilePath().toUserOutput()));
};
qCDebug(log) << "Examining directory" << absoluteImportPath.toString();
QList<void *> dataList = examineDirectory(absoluteImportPath);
if (dataList.isEmpty()) {
qCDebug(log) << "Nothing to import found in" << absoluteImportPath.toString();
handleFailure();
return result;
}
@@ -141,11 +149,8 @@ const QList<BuildInfo> ProjectImporter::import(const Utils::FileName &importPath
deleteDirectoryData(dd);
dataList.clear();
if (result.isEmpty() && !silent)
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(projectFilePath().toUserOutput()));
if (result.isEmpty())
handleFailure();
return result;
}

View File

@@ -44,6 +44,7 @@ class ToolChain;
// Documentation inside.
class PROJECTEXPLORER_EXPORT ProjectImporter : public QObject
{
Q_OBJECT
public:
struct ToolChainData {
QList<ToolChain *> tcs;