src: applied clang-format

This commit is contained in:
mlangkabel
2019-11-18 17:07:20 +01:00
parent 52058d9947
commit 078feca004
1100 changed files with 21382 additions and 20822 deletions
@@ -5,13 +5,13 @@
#include "CodeblocksProject.h"
#include "CompilationDatabase.h"
#include "IndexerCommandCxx.h"
#include "logging.h"
#include "OrderedCache.h"
#include "QtPathListDialog.h"
#include "QtSelectPathsDialog.h"
#include "QtTextEditDialog.h"
#include "SourceGroupSettingsCxxCdb.h"
#include "SourceGroupSettingsCxxCodeblocks.h"
#include "logging.h"
#include "utility.h"
#include "utilityFile.h"
@@ -24,27 +24,32 @@ std::vector<FilePath> QtProjectWizardContentPathsIndexedHeaders::getIndexedPaths
const FilePath codeblocksProjectPath = settings->getCodeblocksProjectPathExpandedAndAbsolute();
if (!codeblocksProjectPath.empty() && codeblocksProjectPath.exists())
{
if (std::shared_ptr<Codeblocks::Project> codeblocksProject = Codeblocks::Project::load(codeblocksProjectPath))
if (std::shared_ptr<Codeblocks::Project> codeblocksProject = Codeblocks::Project::load(
codeblocksProjectPath))
{
OrderedCache<FilePath, FilePath> canonicalDirectoryPathCache([](const FilePath& path) {
return path.getCanonical();
});
OrderedCache<FilePath, FilePath> canonicalDirectoryPathCache(
[](const FilePath& path) { return path.getCanonical(); });
for (const FilePath& path : codeblocksProject->getAllSourceFilePathsCanonical(settings->getSourceExtensions()))
for (const FilePath& path: codeblocksProject->getAllSourceFilePathsCanonical(
settings->getSourceExtensions()))
{
indexedHeaderPaths.insert(canonicalDirectoryPathCache.getValue(path.getParentDirectory()));
indexedHeaderPaths.insert(
canonicalDirectoryPathCache.getValue(path.getParentDirectory()));
}
utility::append(indexedHeaderPaths, codeblocksProject->getAllCxxHeaderSearchPathsCanonical());
utility::append(
indexedHeaderPaths, codeblocksProject->getAllCxxHeaderSearchPathsCanonical());
}
}
else
{
LOG_WARNING("Unable to fetch indexed header paths. The provided Codeblocks project path does not exist.");
LOG_WARNING(
"Unable to fetch indexed header paths. The provided Codeblocks project path does "
"not exist.");
}
}
std::vector<FilePath> topLevelPaths;
for (const FilePath& path : utility::getTopLevelPaths(indexedHeaderPaths))
for (const FilePath& path: utility::getTopLevelPaths(indexedHeaderPaths))
{
if (path.exists())
{
@@ -63,11 +68,11 @@ std::vector<FilePath> QtProjectWizardContentPathsIndexedHeaders::getIndexedPaths
const FilePath cdbPath = settings->getCompilationDatabasePathExpandedAndAbsolute();
if (!cdbPath.empty() && cdbPath.exists())
{
for (const FilePath& path : IndexerCommandCxx::getSourceFilesFromCDB(cdbPath))
for (const FilePath& path: IndexerCommandCxx::getSourceFilesFromCDB(cdbPath))
{
indexedHeaderPaths.insert(path.getCanonical().getParentDirectory());
}
for (const FilePath& path : utility::CompilationDatabase(cdbPath).getAllHeaderPaths())
for (const FilePath& path: utility::CompilationDatabase(cdbPath).getAllHeaderPaths())
{
if (path.exists())
{
@@ -77,12 +82,14 @@ std::vector<FilePath> QtProjectWizardContentPathsIndexedHeaders::getIndexedPaths
}
else
{
LOG_WARNING("Unable to fetch indexed header paths. The provided Compilation Database path does not exist.");
LOG_WARNING(
"Unable to fetch indexed header paths. The provided Compilation Database path does "
"not exist.");
}
}
std::vector<FilePath> topLevelPaths;
for (const FilePath& path : utility::getTopLevelPaths(indexedHeaderPaths))
for (const FilePath& path: utility::getTopLevelPaths(indexedHeaderPaths))
{
if (path.exists())
{
@@ -94,27 +101,33 @@ std::vector<FilePath> QtProjectWizardContentPathsIndexedHeaders::getIndexedPaths
}
QtProjectWizardContentPathsIndexedHeaders::QtProjectWizardContentPathsIndexedHeaders(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizardWindow* window, std::string projectKindName
)
: QtProjectWizardContentPaths(settings, window, QtPathListBox::SELECTION_POLICY_FILES_AND_DIRECTORIES)
std::shared_ptr<SourceGroupSettings> settings,
QtProjectWizardWindow* window,
std::string projectKindName)
: QtProjectWizardContentPaths(
settings, window, QtPathListBox::SELECTION_POLICY_FILES_AND_DIRECTORIES)
, m_projectKindName(projectKindName)
{
m_showFilesString = "";
setTitleString("Header Files & Directories to Index");
setHelpString(QString::fromStdString(
"The provided " + m_projectKindName + " already specifies which source files are part of your project. But Sourcetrail still "
"needs to know which header files to index as part of your project and which to skip. Choosing to skip indexing "
"your system headers or external frameworks will significantly improve the overall indexing performance.<br />"
"The provided " + m_projectKindName +
" already specifies which source files are part of your project. But Sourcetrail still "
"needs to know which header files to index as part of your project and which to skip. "
"Choosing to skip indexing "
"your system headers or external frameworks will significantly improve the overall "
"indexing performance.<br />"
"<br />"
"Use this list to define which header files should be indexed by Sourcetrail. Provide a directory to recursively "
"Use this list to define which header files should be indexed by Sourcetrail. Provide a "
"directory to recursively "
"add all contained files.<br />"
"<br />"
"You can make use of environment variables with ${ENV_VAR}.<br />"
"<br />"
"<b>Hint</b>: Just enter the root path of your project if you want Sourcetrail to index all contained headers it "
"encounters.<br />"
));
"<b>Hint</b>: Just enter the root path of your project if you want Sourcetrail to index "
"all contained headers it "
"encounters.<br />"));
}
void QtProjectWizardContentPathsIndexedHeaders::populate(QGridLayout* layout, int& row)
@@ -123,7 +136,8 @@ void QtProjectWizardContentPathsIndexedHeaders::populate(QGridLayout* layout, in
QPushButton* button = new QPushButton(QString::fromStdString("Select from " + m_projectKindName));
button->setObjectName("windowButton");
connect(button, &QPushButton::clicked, this, &QtProjectWizardContentPathsIndexedHeaders::buttonClicked);
connect(
button, &QPushButton::clicked, this, &QtProjectWizardContentPathsIndexedHeaders::buttonClicked);
layout->addWidget(button, row, QtProjectWizardWindow::BACK_COL, Qt::AlignRight | Qt::AlignTop);
row++;
@@ -132,7 +146,7 @@ void QtProjectWizardContentPathsIndexedHeaders::populate(QGridLayout* layout, in
void QtProjectWizardContentPathsIndexedHeaders::load()
{
if (std::shared_ptr<SourceGroupSettingsWithIndexedHeaderPaths> cdbSettings =
std::dynamic_pointer_cast<SourceGroupSettingsWithIndexedHeaderPaths>(m_settings))
std::dynamic_pointer_cast<SourceGroupSettingsWithIndexedHeaderPaths>(m_settings))
{
m_list->setPaths(cdbSettings->getIndexedHeaderPaths());
}
@@ -141,7 +155,7 @@ void QtProjectWizardContentPathsIndexedHeaders::load()
void QtProjectWizardContentPathsIndexedHeaders::save()
{
if (std::shared_ptr<SourceGroupSettingsWithIndexedHeaderPaths> cdbSettings =
std::dynamic_pointer_cast<SourceGroupSettingsWithIndexedHeaderPaths>(m_settings))
std::dynamic_pointer_cast<SourceGroupSettingsWithIndexedHeaderPaths>(m_settings))
{
cdbSettings->setIndexedHeaderPaths(m_list->getPathsAsDisplayed());
}
@@ -155,8 +169,7 @@ bool QtProjectWizardContentPathsIndexedHeaders::check()
msgBox.setText("You didn't specify any Header Files & Directories to Index.");
msgBox.setInformativeText(QString::fromStdString(
"Sourcetrail will only index the source files listed in the " + m_projectKindName +
" file and none of the included header files."
));
" file and none of the included header files."));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
return msgBox.exec() == QMessageBox::Ok;
@@ -173,9 +186,11 @@ void QtProjectWizardContentPathsIndexedHeaders::buttonClicked()
if (!m_filesDialog)
{
if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> codeblocksSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings))
if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> codeblocksSettings =
std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings))
{
const FilePath codeblocksProjectPath = codeblocksSettings->getCodeblocksProjectPathExpandedAndAbsolute();
const FilePath codeblocksProjectPath =
codeblocksSettings->getCodeblocksProjectPathExpandedAndAbsolute();
if (!codeblocksProjectPath.exists())
{
QMessageBox msgBox;
@@ -187,25 +202,37 @@ void QtProjectWizardContentPathsIndexedHeaders::buttonClicked()
m_filesDialog = std::make_shared<QtSelectPathsDialog>(
"Select from Include Paths",
"The list contains all Include Paths found in the Code::Blocks project. Red paths do not exist. Select the "
"The list contains all Include Paths found in the Code::Blocks project. Red paths "
"do not exist. Select the "
"paths containing the header files you want to index with Sourcetrail.");
m_filesDialog->setup();
connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizardContentPathsIndexedHeaders::savedFilesDialog);
connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizardContentPathsIndexedHeaders::closedFilesDialog);
connect(
m_filesDialog.get(),
&QtSelectPathsDialog::finished,
this,
&QtProjectWizardContentPathsIndexedHeaders::savedFilesDialog);
connect(
m_filesDialog.get(),
&QtSelectPathsDialog::canceled,
this,
&QtProjectWizardContentPathsIndexedHeaders::closedFilesDialog);
const FilePath projectPath = codeblocksSettings->getProjectDirectoryPath();
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(
utility::convert<FilePath, FilePath>(
getIndexedPathsDerivedFromCodeblocksProject(codeblocksSettings),
[&](const FilePath& path) { return utility::getAsRelativeIfShorter(path, projectPath); }
),
codeblocksSettings->getIndexedHeaderPaths(),
m_settings->getProjectDirectoryPath()
);
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())
->setPathsList(
utility::convert<FilePath, FilePath>(
getIndexedPathsDerivedFromCodeblocksProject(codeblocksSettings),
[&](const FilePath& path) {
return utility::getAsRelativeIfShorter(path, projectPath);
}),
codeblocksSettings->getIndexedHeaderPaths(),
m_settings->getProjectDirectoryPath());
}
else if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
else if (
std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings =
std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
{
const FilePath cdbPath = cdbSettings->getCompilationDatabasePathExpandedAndAbsolute();
if (!cdbPath.exists())
@@ -219,23 +246,33 @@ void QtProjectWizardContentPathsIndexedHeaders::buttonClicked()
m_filesDialog = std::make_shared<QtSelectPathsDialog>(
"Select from Include Paths",
"The list contains all Include Paths found in the Compilation Database. Red paths do not exist. Select the "
"The list contains all Include Paths found in the Compilation Database. Red paths "
"do not exist. Select the "
"paths containing the header files you want to index with Sourcetrail.");
m_filesDialog->setup();
connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizardContentPathsIndexedHeaders::savedFilesDialog);
connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizardContentPathsIndexedHeaders::closedFilesDialog);
connect(
m_filesDialog.get(),
&QtSelectPathsDialog::finished,
this,
&QtProjectWizardContentPathsIndexedHeaders::savedFilesDialog);
connect(
m_filesDialog.get(),
&QtSelectPathsDialog::canceled,
this,
&QtProjectWizardContentPathsIndexedHeaders::closedFilesDialog);
const FilePath projectPath = cdbSettings->getProjectDirectoryPath();
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(
utility::convert<FilePath, FilePath>(
getIndexedPathsDerivedFromCDB(cdbSettings),
[&](const FilePath& path) { return utility::getAsRelativeIfShorter(path, projectPath); }
),
cdbSettings->getIndexedHeaderPaths(),
m_settings->getProjectDirectoryPath()
);
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())
->setPathsList(
utility::convert<FilePath, FilePath>(
getIndexedPathsDerivedFromCDB(cdbSettings),
[&](const FilePath& path) {
return utility::getAsRelativeIfShorter(path, projectPath);
}),
cdbSettings->getIndexedHeaderPaths(),
m_settings->getProjectDirectoryPath());
}
}