logic: Fixed removing duplicate compiler header and show paths in dialog (issue #710)

This commit is contained in:
Eberhard Graether
2019-07-28 21:03:45 +02:00
parent 6b54d5f07b
commit 6a2c59f3e5
@@ -52,25 +52,30 @@ bool QtProjectWizardContentPathsHeaderSearchGlobal::check()
return QtProjectWizardContentPaths::check(); return QtProjectWizardContentPaths::check();
} }
bool hasOtherCompilerConfig = false; std::vector<FilePath> paths;
QString compilerHeaderPaths;
for (const FilePath& headerPath : m_list->getPathsAsDisplayed()) for (const FilePath& headerPath : m_list->getPathsAsDisplayed())
{ {
if (headerPath != ResourcePaths::getCxxCompilerHeaderPath() && if (headerPath != ResourcePaths::getCxxCompilerHeaderPath() &&
headerPath.getCanonical().getConcatenated(L"/stdarg.h").exists()) headerPath.getCanonical().getConcatenated(L"/stdarg.h").exists())
{ {
hasOtherCompilerConfig = true; compilerHeaderPaths += QString::fromStdWString(headerPath.wstr()) + "\n";
break; }
else
{
paths.push_back(headerPath);
} }
} }
if (hasOtherCompilerConfig) if (compilerHeaderPaths.size())
{ {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText("Multiple Compiler Headers"); msgBox.setText("Multiple Compiler Headers");
msgBox.setInformativeText("Your Global Include Paths contain another path that holds C/C++ compiler headers, " msgBox.setInformativeText("Your Global Include Paths contain other paths that hold C/C++ compiler headers, "
"probably those of your local C/C++ compiler. They are possibly in conflict with the compiler headers of " "probably those of your local C/C++ compiler. They are possibly in conflict with the compiler headers of "
"Sourcetrail's C/C++ indexer. This can lead to compatiblity errors during indexing. Do you want to remove " "Sourcetrail's C/C++ indexer. This can lead to compatiblity errors during indexing. Do you want to remove "
"these paths?"); "these paths?");
msgBox.setDetailedText(compilerHeaderPaths);
msgBox.addButton("Remove", QMessageBox::ButtonRole::YesRole); msgBox.addButton("Remove", QMessageBox::ButtonRole::YesRole);
msgBox.addButton("Keep", QMessageBox::ButtonRole::NoRole); msgBox.addButton("Keep", QMessageBox::ButtonRole::NoRole);
msgBox.setIcon(QMessageBox::Icon::Question); msgBox.setIcon(QMessageBox::Icon::Question);
@@ -78,17 +83,8 @@ bool QtProjectWizardContentPathsHeaderSearchGlobal::check()
if (ret == 0) // QMessageBox::Yes if (ret == 0) // QMessageBox::Yes
{ {
std::vector<FilePath> paths;
for (const FilePath& headerPath : m_list->getPathsAsDisplayed())
{
if (headerPath != ResourcePaths::getCxxCompilerHeaderPath() &&
headerPath.getCanonical().getConcatenated(L"/stdarg.h").exists())
{
continue;
}
paths.push_back(headerPath);
}
setPaths(paths); setPaths(paths);
save();
} }
} }