gui: improved error message when project import fails
This commit is contained in:
parent
aa73427699
commit
0d6575da15
|
@ -1687,7 +1687,38 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const bool check
|
||||||
prjfile = inf.canonicalPath() + '/' + projectFile->getImportProject();
|
prjfile = inf.canonicalPath() + '/' + projectFile->getImportProject();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
p.import(prjfile.toStdString());
|
|
||||||
|
const ImportProject::Type result = p.import(prjfile.toStdString());
|
||||||
|
|
||||||
|
QString errorMessage;
|
||||||
|
switch (result) {
|
||||||
|
case ImportProject::Type::COMPILE_DB:
|
||||||
|
case ImportProject::Type::VS_SLN:
|
||||||
|
case ImportProject::Type::VS_VCXPROJ:
|
||||||
|
case ImportProject::Type::BORLAND:
|
||||||
|
case ImportProject::Type::CPPCHECK_GUI:
|
||||||
|
// Loading was successful
|
||||||
|
break;
|
||||||
|
case ImportProject::Type::MISSING:
|
||||||
|
errorMessage = tr("Failed to open file");
|
||||||
|
break;
|
||||||
|
case ImportProject::Type::UNKNOWN:
|
||||||
|
errorMessage = tr("Unknown project file format");
|
||||||
|
break;
|
||||||
|
case ImportProject::Type::FAILURE:
|
||||||
|
errorMessage = tr("Failed to import project file");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!errorMessage.isEmpty()) {
|
||||||
|
QMessageBox msg(QMessageBox::Critical,
|
||||||
|
tr("Cppcheck"),
|
||||||
|
tr("Failed to import '%1': %2\n\nAnalysis is stopped.").arg(prjfile).arg(errorMessage),
|
||||||
|
QMessageBox::Ok,
|
||||||
|
this);
|
||||||
|
msg.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
} catch (InternalError &e) {
|
} catch (InternalError &e) {
|
||||||
QMessageBox msg(QMessageBox::Critical,
|
QMessageBox msg(QMessageBox::Critical,
|
||||||
tr("Cppcheck"),
|
tr("Cppcheck"),
|
||||||
|
|
Loading…
Reference in New Issue