forked from qt-creator/qt-creator
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:
@@ -99,10 +99,18 @@ const QList<BuildInfo> ProjectImporter::import(const Utils::FileName &importPath
|
|||||||
|
|
||||||
const Utils::FileName absoluteImportPath = Utils::FileName::fromString(fi.absoluteFilePath());
|
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();
|
qCDebug(log) << "Examining directory" << absoluteImportPath.toString();
|
||||||
QList<void *> dataList = examineDirectory(absoluteImportPath);
|
QList<void *> dataList = examineDirectory(absoluteImportPath);
|
||||||
if (dataList.isEmpty()) {
|
if (dataList.isEmpty()) {
|
||||||
qCDebug(log) << "Nothing to import found in" << absoluteImportPath.toString();
|
qCDebug(log) << "Nothing to import found in" << absoluteImportPath.toString();
|
||||||
|
handleFailure();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,11 +149,8 @@ const QList<BuildInfo> ProjectImporter::import(const Utils::FileName &importPath
|
|||||||
deleteDirectoryData(dd);
|
deleteDirectoryData(dd);
|
||||||
dataList.clear();
|
dataList.clear();
|
||||||
|
|
||||||
if (result.isEmpty() && !silent)
|
if (result.isEmpty())
|
||||||
QMessageBox::critical(Core::ICore::mainWindow(),
|
handleFailure();
|
||||||
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()));
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,7 @@ class ToolChain;
|
|||||||
// Documentation inside.
|
// Documentation inside.
|
||||||
class PROJECTEXPLORER_EXPORT ProjectImporter : public QObject
|
class PROJECTEXPLORER_EXPORT ProjectImporter : public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
struct ToolChainData {
|
struct ToolChainData {
|
||||||
QList<ToolChain *> tcs;
|
QList<ToolChain *> tcs;
|
||||||
|
Reference in New Issue
Block a user