logic: added project setup support for Sonargraph projects (Java and CMake-JSON modules supported)

* added classes for loading a Sonargraph project
* added Sonargraph options to project setup wizard
* added test for generating indexer commands from Sonargraph modules
* fixed sqlite storage crashing in constructor when parent directory of provided path does not exist
* removed unused FileRegister from Java indexing
* removed unused info from IndexerCommandJava
* refactored loading and saving of SourceGroupSettings
* extracted sourcepaths settings to own class that can be re-used
* merged CDB wizard contentents for source file and indexed paths
* unified wizard content for sonargraph project path
* removed include filters from default source groups
* extracted generation of RefreshInfo from Project to RefreshInfoGenerator
* added tests for RefreshInfoGenerator
* added language and standard selection to sonargraph project setup
* added auto-detection for indexed header paths of sonargraph cmake json modules
* Sonargraph::Project can enable/disable support for specific modules
* warn if sonargraph project contains no matching modules
* indexed headers can be detected from sonargraph project
This commit is contained in:
mlangkabel
2018-05-18 16:07:57 +02:00
parent e55ae5ba31
commit 7b735cfd17
164 changed files with 24770 additions and 1684 deletions
-2
View File
@@ -185,8 +185,6 @@ add_files(
qt/window/project_wizzard/QtProjectWizzard.h
qt/window/project_wizzard/QtProjectWizzardContent.cpp
qt/window/project_wizzard/QtProjectWizzardContent.h
qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp
qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h
qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.cpp
qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.h
qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp
@@ -7,7 +7,6 @@
#include <QSysInfo>
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentExtensions.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentFlags.h"
@@ -22,9 +21,11 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentVS.h"
#include "settings/SourceGroupSettingsCxxEmpty.h"
#include "settings/SourceGroupSettingsCxxCdb.h"
#include "settings/SourceGroupSettingsCxxSonargraph.h"
#include "settings/SourceGroupSettingsJavaEmpty.h"
#include "settings/SourceGroupSettingsJavaGradle.h"
#include "settings/SourceGroupSettingsJavaMaven.h"
#include "settings/SourceGroupSettingsJavaSonargraph.h"
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/ResourcePaths.h"
@@ -415,7 +416,7 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentExtensions(group, this));
summary->addContent(new QtProjectWizzardContentExtensions(settingsJava, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsClassJava(group, this));
}
@@ -437,12 +438,22 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentExtensions(group, this));
summary->addContent(new QtProjectWizzardContentExtensions(settingsJava, this));
}
}
else if (std::shared_ptr<SourceGroupSettingsJavaSonargraph> settingsJavaSonargraph = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(group))
{
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(group, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsClassJava(group, this));
summary->addSpace();
}
else if (std::shared_ptr<SourceGroupSettingsCxx> settingsCxx = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(group))
{
bool isCDB = false;
bool indicateSearchPathsAsAdditional = false;
if (std::shared_ptr<SourceGroupSettingsCxxEmpty> settingsCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(group))
{
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
@@ -452,35 +463,45 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
summary->addContent(new QtProjectWizzardContentPathsSource(group, this));
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
summary->addContent(new QtProjectWizzardContentExtensions(group, this));
summary->addContent(new QtProjectWizzardContentExtensions(settingsCxxEmpty, this));
summary->addSpace();
}
else if (std::shared_ptr<SourceGroupSettingsCxxCdb> settingsCxxCdb = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(group))
{
isCDB = true;
indicateSearchPathsAsAdditional = true;
summary->addContent(new QtProjectWizzardContentPathCDB(group, this));
summary->addContent(new QtProjectWizzardContentCDBSource(group, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsCDBHeader(group, this));
summary->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Compilation Database", group, this));
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
summary->addSpace();
}
else if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> settingsCxxSonargraph = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(group))
{
indicateSearchPathsAsAdditional = true;
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(group, this, isCDB));
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(group, this));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Sonargraph project", group, this));
summary->addSpace();
}
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(group, this, indicateSearchPathsAsAdditional));
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(this));
summary->addSpace();
if (utility::getOsType() == OS_MAC)
{
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(group, this, isCDB));
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(group, this, indicateSearchPathsAsAdditional));
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(this));
summary->addSpace();
}
summary->addContent(new QtProjectWizzardContentFlags(group, this, isCDB));
summary->addContent(new QtProjectWizzardContentFlags(group, this, indicateSearchPathsAsAdditional));
}
setContent(summary);
@@ -554,6 +575,9 @@ void QtProjectWizzard::duplicateSelectedSourceGroup()
case SOURCE_GROUP_JAVA_GRADLE:
newSourceGroup = std::make_shared<SourceGroupSettingsJavaGradle>(*dynamic_cast<SourceGroupSettingsJavaGradle*>(oldSourceGroup.get()));
break;
case SOURCE_GROUP_JAVA_SONARGRAPH:
newSourceGroup = std::make_shared<SourceGroupSettingsJavaSonargraph>(*dynamic_cast<SourceGroupSettingsJavaSonargraph*>(oldSourceGroup.get()));
break;
case SOURCE_GROUP_C_EMPTY:
case SOURCE_GROUP_CPP_EMPTY:
newSourceGroup = std::make_shared<SourceGroupSettingsCxxEmpty>(*dynamic_cast<SourceGroupSettingsCxxEmpty*>(oldSourceGroup.get()));
@@ -561,6 +585,9 @@ void QtProjectWizzard::duplicateSelectedSourceGroup()
case SOURCE_GROUP_CXX_CDB:
newSourceGroup = std::make_shared<SourceGroupSettingsCxxCdb>(*dynamic_cast<SourceGroupSettingsCxxCdb*>(oldSourceGroup.get()));
break;
case SOURCE_GROUP_CXX_SONARGRAPH:
newSourceGroup = std::make_shared<SourceGroupSettingsCxxSonargraph>(*dynamic_cast<SourceGroupSettingsCxxSonargraph*>(oldSourceGroup.get()));
break;
default:
return;
}
@@ -687,6 +714,10 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxCdb>(sourceGroupId, m_projectSettings.get());
emptySourceGroupCDB();
break;
case SOURCE_GROUP_CXX_SONARGRAPH:
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxSonargraph>(sourceGroupId, m_projectSettings.get());
emptySourceGroupCxxSonargraph();
break;
case SOURCE_GROUP_CXX_VS:
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxCdb>(sourceGroupId, m_projectSettings.get());
emptySourceGroupCDBVS();
@@ -703,6 +734,10 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsJavaGradle>(sourceGroupId, m_projectSettings.get());
sourcePathsJavaGradle();
break;
case SOURCE_GROUP_JAVA_SONARGRAPH:
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsJavaSonargraph>(sourceGroupId, m_projectSettings.get());
emptySourceGroupJavaSonargraph();
break;
case SOURCE_GROUP_UNKNOWN:
break;
}
@@ -713,8 +748,8 @@ void QtProjectWizzard::emptySourceGroup()
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentLanguageAndStandard(m_newSourceGroupSettings, window));
if (m_newSourceGroupSettings->getType() == SOURCE_GROUP_C_EMPTY||
contentGroup->addContent(new QtProjectWizzardContentLanguageAndStandard(m_newSourceGroupSettings, window));
if (m_newSourceGroupSettings->getType() == SOURCE_GROUP_C_EMPTY ||
m_newSourceGroupSettings->getType() == SOURCE_GROUP_CPP_EMPTY)
{
contentGroup->addContent(new QtProjectWizzardContentCrossCompilationOptions(m_newSourceGroupSettings, window));
@@ -747,9 +782,7 @@ void QtProjectWizzard::emptySourceGroupCDBVS()
contentGroup->addContent(new QtProjectWizzardContentVS(window));
contentGroup->addContent(new QtProjectWizzardContentPathCDB(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentCDBSource(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsCDBHeader(m_newSourceGroupSettings, window));
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Compilation Database", m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
}
@@ -766,16 +799,44 @@ void QtProjectWizzard::emptySourceGroupCDB()
{
contentGroup->addContent(new QtProjectWizzardContentPathCDB(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentCDBSource(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsCDBHeader(m_newSourceGroupSettings, window));
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Compilation Database", m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
}
);
connect(window, &QtProjectWizzardWindow::next, this, &QtProjectWizzard::createSourceGroup);
window->updateSubTitle("CDB Path");
window->updateSubTitle("Compilation Database Path");
}
void QtProjectWizzard::emptySourceGroupCxxSonargraph()
{
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentLanguageAndStandard(m_newSourceGroupSettings, this));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Sonargraph project", m_newSourceGroupSettings, window));
}
);
connect(window, &QtProjectWizzardWindow::next, this, &QtProjectWizzard::createSourceGroup);
window->updateSubTitle("Sonargraph Project Path");
}
void QtProjectWizzard::emptySourceGroupJavaSonargraph()
{
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
}
);
connect(window, &QtProjectWizzardWindow::next, this, &QtProjectWizzard::createSourceGroup);
window->updateSubTitle("Sonargraph Project Path");
}
void QtProjectWizzard::sourcePaths()
@@ -783,11 +844,17 @@ void QtProjectWizzard::sourcePaths()
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentPathsSource(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentExtensions(m_newSourceGroupSettings, window));
if (std::shared_ptr<SourceGroupSettingsCxx> settingsCxx = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_newSourceGroupSettings))
{
contentGroup->addContent(new QtProjectWizzardContentPathsSource(settingsCxx, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(settingsCxx, window));
if (std::shared_ptr<SourceGroupSettingsWithSourcePaths> settingsSourcePath = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_newSourceGroupSettings))
{
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentExtensions(settingsSourcePath, window));
}
}
}
);
@@ -842,11 +909,14 @@ void QtProjectWizzard::sourcePathsJava()
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentPathsSource(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentExtensions(m_newSourceGroupSettings, window));
if (std::shared_ptr<SourceGroupSettingsJava> settingsJava = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_newSourceGroupSettings))
{
contentGroup->addContent(new QtProjectWizzardContentPathsSource(settingsJava, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(settingsJava, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentExtensions(settingsJava, window));
}
}
);
@@ -933,10 +1003,13 @@ void QtProjectWizzard::advancedSettingsJava()
QtProjectWizzardWindow* window = createWindowWithContentGroup(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
{
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(m_newSourceGroupSettings, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentExtensions(m_newSourceGroupSettings, window));
}
if (std::shared_ptr<SourceGroupSettingsJava> settingsJava = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_newSourceGroupSettings))
{
contentGroup->addContent(new QtProjectWizzardContentPathsExclude(settingsJava, window));
contentGroup->addSpace();
contentGroup->addContent(new QtProjectWizzardContentExtensions(settingsJava, window));
}
}
);
connect(window, &QtProjectWizzardWindow::next, this, &QtProjectWizzard::createSourceGroup);
@@ -87,6 +87,8 @@ private slots:
void emptySourceGroup();
void emptySourceGroupCDBVS();
void emptySourceGroupCDB();
void emptySourceGroupCxxSonargraph();
void emptySourceGroupJavaSonargraph();
void sourcePaths();
void headerSearchPaths();
@@ -1,95 +0,0 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h"
#include "data/indexer/IndexerCommandCxxCdb.h"
#include "settings/SourceGroupSettingsCxxCdb.h"
#include "utility/file/FilePath.h"
QtProjectWizzardContentCDBSource::QtProjectWizzardContentCDBSource(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(window)
, m_settings(settings)
, m_text(nullptr)
{
}
void QtProjectWizzardContentCDBSource::populate(QGridLayout* layout, int& row)
{
QLabel* title = createFormLabel("Source Files to Index");
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0);
m_text = new QLabel("");
m_text->setWordWrap(true);
layout->addWidget(m_text, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop);
addFilesButton("show source files", layout, row + 1);
row += 2;
}
void QtProjectWizzardContentCDBSource::load()
{
m_filePaths.clear();
const FilePath projectPath = m_settings->getProjectDirectoryPath();
const std::vector<FilePathFilter> excludeFilters = m_settings->getExcludeFiltersExpandedAndAbsolute();
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
{
FilePath cdbPath = cxxSettings->getCompilationDatabasePathExpandedAndAbsolute();
if (!cdbPath.empty() && cdbPath.exists())
{
std::vector<FilePath> filePaths = IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath);
for (FilePath& path : filePaths)
{
{
bool excluded = false;
for (const FilePathFilter& filter : excludeFilters)
{
if (filter.isMatching(path))
{
excluded = true;
break;
}
}
if (excluded)
{
continue;
}
}
if (projectPath.exists())
{
path.makeRelativeTo(projectPath);
}
m_filePaths.push_back(path);
}
}
}
if (m_text)
{
m_text->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the compilation database.");
}
}
std::vector<FilePath> QtProjectWizzardContentCDBSource::getFilePaths() const
{
const_cast<QtProjectWizzardContentCDBSource*>(this)->load();
return m_filePaths;
}
QString QtProjectWizzardContentCDBSource::getFileNamesTitle() const
{
return "Source Files";
}
QString QtProjectWizzardContentCDBSource::getFileNamesDescription() const
{
return " source files will be indexed.";
}
@@ -1,31 +0,0 @@
#ifndef QT_PROJECT_WIZZARD_CONTENT_CDB_SOURCE_H
#define QT_PROJECT_WIZZARD_CONTENT_CDB_SOURCE_H
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
class SourceGroupSettings;
class QtProjectWizzardContentCDBSource
: public QtProjectWizzardContent
{
Q_OBJECT
public:
QtProjectWizzardContentCDBSource(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
virtual void load() override;
virtual std::vector<FilePath> getFilePaths() const override;
virtual QString getFileNamesTitle() const override;
virtual QString getFileNamesDescription() const override;
private:
std::shared_ptr<SourceGroupSettings> m_settings;
QLabel* m_text;
std::vector<FilePath> m_filePaths;
};
#endif // QT_PROJECT_WIZZARD_CONTENT_CDB_SOURCE_H
@@ -2,11 +2,11 @@
#include <QFormLayout>
#include "settings/SourceGroupSettings.h"
#include "settings/SourceGroupSettingsWithSourcePaths.h"
#include "qt/element/QtStringListBox.h"
QtProjectWizzardContentExtensions::QtProjectWizzardContentExtensions(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettingsWithSourcePaths> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(window)
, m_settings(settings)
@@ -1,10 +1,12 @@
#ifndef QT_PROJECT_WIZZARD_CONTENT_EXTENSIONS_H
#define QT_PROJECT_WIZZARD_CONTENT_EXTENSIONS_H
#include <memory>
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
class QtStringListBox;
class SourceGroupSettings;
class SourceGroupSettingsWithSourcePaths;
class QtProjectWizzardContentExtensions
: public QtProjectWizzardContent
@@ -12,7 +14,7 @@ class QtProjectWizzardContentExtensions
Q_OBJECT
public:
QtProjectWizzardContentExtensions(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentExtensions(std::shared_ptr<SourceGroupSettingsWithSourcePaths> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -21,7 +23,7 @@ public:
virtual void save() override;
private:
std::shared_ptr<SourceGroupSettings> m_settings;
std::shared_ptr<SourceGroupSettingsWithSourcePaths> m_settings;
QtStringListBox* m_listBox;
};
@@ -6,16 +6,16 @@
#include "qt/element/QtStringListBox.h"
#include "settings/SourceGroupSettingsCxx.h"
QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB)
QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional)
: QtProjectWizzardContent(window)
, m_settings(settings)
, m_isCdb(isCDB)
, m_indicateAsAdditional(indicateAsAdditional)
{
}
void QtProjectWizzardContentFlags::populate(QGridLayout* layout, int& row)
{
const QString labelText = QString::fromStdString(std::string(m_isCdb ? "Additional " : "") + "Compiler Flags");
const QString labelText((std::string(m_indicateAsAdditional ? "Additional " : "") + "Compiler Flags").c_str());
QLabel* label = createFormLabel(labelText);
layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
@@ -12,7 +12,7 @@ class QtProjectWizzardContentFlags
Q_OBJECT
public:
QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional = false);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -23,7 +23,7 @@ public:
private:
std::shared_ptr<SourceGroupSettings> m_settings;
const bool m_isCdb;
const bool m_indicateAsAdditional;
QtStringListBox* m_list;
};
@@ -44,7 +44,7 @@ void QtProjectWizzardContentLanguageAndStandard::populate(QGridLayout* layout, i
void QtProjectWizzardContentLanguageAndStandard::load()
{
LanguageType type = getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType());
const LanguageType type = getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType());
if (type == LANGUAGE_UNKNOWN)
{
@@ -68,8 +68,3 @@ void QtProjectWizzardContentLanguageAndStandard::save()
{
m_sourceGroupSettings->setStandard(m_standard->currentText().toStdString());
}
bool QtProjectWizzardContentLanguageAndStandard::check()
{
return true;
}
@@ -22,7 +22,6 @@ public:
virtual void load() override;
virtual void save() override;
virtual bool check() override;
private:
std::shared_ptr<SourceGroupSettings> m_sourceGroupSettings;
@@ -6,7 +6,7 @@
#include <QMessageBox>
#include <QVBoxLayout>
#include "Application.h"
#include "data/indexer/IndexerCommandCxxCdb.h"
#include "qt/element/QtLocationPicker.h"
#include "qt/view/QtDialogView.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
@@ -14,11 +14,15 @@
#include "settings/SourceGroupSettingsCxxCdb.h"
#include "settings/SourceGroupSettingsJavaMaven.h"
#include "settings/SourceGroupSettingsJavaGradle.h"
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
#include "utility/file/FileManager.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/sonargraph/SonargraphProject.h"
#include "utility/ScopedFunctor.h"
#include "utility/utility.h"
#include "utility/utilityGradle.h"
#include "utility/utilityMaven.h"
#include "Application.h"
QtProjectWizzardContentPath::QtProjectWizzardContentPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(window)
@@ -118,7 +122,7 @@ QtProjectWizzardContentPathCDB::QtProjectWizzardContentPathCDB(
setTitleString("Compilation Database (compile_commands.json)");
setHelpString(
"Select the compilation database file for the project. Sourcetrail will index your project based on the compile "
"commands this file contains using all include paths and compiler flags of these compile commands. The project "
"commands. This file contains using all include paths and compiler flags of these compile commands. The project "
"will stay up to date with changes in the compilation database on every refresh.<br />"
"<br />"
"You can make use of environment variables with ${ENV_VAR}."
@@ -131,24 +135,78 @@ void QtProjectWizzardContentPathCDB::populate(QGridLayout* layout, int& row)
QtProjectWizzardContentPath::populate(layout, row);
m_picker->setPickDirectory(false);
m_picker->setFileFilter("JSON Compilation Database (*.json)");
connect(m_picker, &QtLocationPicker::locationPicked, this, &QtProjectWizzardContentPathCDB::pickedCDBPath);
connect(m_picker, &QtLocationPicker::locationPicked, this, &QtProjectWizzardContentPathCDB::pickedPath);
QLabel* description = new QLabel(
"Sourcetrail will use all include paths and compiler flags from the compilation database and stay up-to-date "
"Sourcetrail will use all include paths and compiler flags from the Compilation Database and stay up-to-date "
"with changes on refresh.", this);
description->setObjectName("description");
description->setWordWrap(true);
layout->addWidget(description, row, QtProjectWizzardWindow::BACK_COL);
row++;
QLabel* title = createFormLabel("Source Files to Index");
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0);
m_fileCountLabel = new QLabel("");
m_fileCountLabel->setWordWrap(true);
layout->addWidget(m_fileCountLabel, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop);
row++;
addFilesButton("show source files", layout, row);
row++;
}
void QtProjectWizzardContentPathCDB::load()
{
std::shared_ptr<SourceGroupSettingsCxxCdb> settings =
std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings);
if (settings)
m_filePaths.clear();
const FilePath projectPath = m_settings->getProjectDirectoryPath();
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
{
m_picker->setText(QString::fromStdWString(settings->getCompilationDatabasePath().wstr()));
m_picker->setText(QString::fromStdWString(cxxSettings->getCompilationDatabasePath().wstr()));
const std::vector<FilePathFilter> excludeFilters = cxxSettings->getExcludeFiltersExpandedAndAbsolute();
const FilePath cdbPath = cxxSettings->getCompilationDatabasePathExpandedAndAbsolute();
if (!cdbPath.empty() && cdbPath.exists())
{
std::vector<FilePath> filePaths = IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath);
for (FilePath& path : filePaths)
{
{
bool excluded = false;
for (const FilePathFilter& filter : excludeFilters)
{
if (filter.isMatching(path))
{
excluded = true;
break;
}
}
if (excluded)
{
continue;
}
}
if (projectPath.exists())
{
path.makeRelativeTo(projectPath);
}
m_filePaths.push_back(path);
}
}
if (m_fileCountLabel)
{
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the compilation database.");
}
}
}
@@ -162,19 +220,179 @@ void QtProjectWizzardContentPathCDB::save()
}
}
void QtProjectWizzardContentPathCDB::pickedCDBPath()
std::vector<FilePath> QtProjectWizzardContentPathCDB::getFilePaths() const
{
const_cast<QtProjectWizzardContentPathCDB*>(this)->load();
return m_filePaths;
}
QString QtProjectWizzardContentPathCDB::getFileNamesTitle() const
{
return "Source Files";
}
QString QtProjectWizzardContentPathCDB::getFileNamesDescription() const
{
return " source files will be indexed.";
}
void QtProjectWizzardContentPathCDB::pickedPath()
{
m_window->saveContent();
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
{
cdbSettings->setIndexedHeaderPaths(QtProjectWizzardContentPathsCDBHeader::getIndexedPathsDerivedFromCDB(cdbSettings));
const FilePath projectPath = m_settings->getProjectDirectoryPath();
std::vector<FilePath> indexedHeaderPaths;
for (const FilePath path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(cdbSettings))
{
if (projectPath.contains(path))
{
indexedHeaderPaths.push_back(path);
}
}
cdbSettings->setIndexedHeaderPaths(indexedHeaderPaths);
}
m_window->loadContent();
}
QtProjectWizzardContentSonargraphProjectPath::QtProjectWizzardContentSonargraphProjectPath(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
{
setTitleString("Sonargraph Project (system.sonargraph)");
setHelpString(
"Select the Sonargraph file for the project. Sourcetrail will index your project based on the settings "
"this file. It contains using all include paths and compiler flags required. The Sourcetrail project "
"will stay up to date with changes in the Sonargraph project on every refresh.<br />"
"<br />"
"You can make use of environment variables with ${ENV_VAR}."
);
setFileEndings({ L".sonargraph" });
}
void QtProjectWizzardContentSonargraphProjectPath::populate(QGridLayout* layout, int& row)
{
QtProjectWizzardContentPath::populate(layout, row);
m_picker->setPickDirectory(false);
m_picker->setFileFilter("Sonargraph Project (system.sonargraph)");
connect(m_picker, &QtLocationPicker::locationPicked, this, &QtProjectWizzardContentSonargraphProjectPath::pickedPath);
QLabel* description = new QLabel(
"Sourcetrail will use all settings from the Sonargraph project and stay up-to-date with changes on refresh.", this);
description->setObjectName("description");
description->setWordWrap(true);
layout->addWidget(description, row, QtProjectWizzardWindow::BACK_COL);
row++;
QLabel* title = createFormLabel("Source Files to Index");
layout->addWidget(title, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0);
m_fileCountLabel = new QLabel("");
m_fileCountLabel->setWordWrap(true);
layout->addWidget(m_fileCountLabel, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop);
row++;
addFilesButton("show source files", layout, row);
row++;
}
void QtProjectWizzardContentSonargraphProjectPath::load()
{
m_filePaths.clear();
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settings =
std::dynamic_pointer_cast<SourceGroupSettingsWithSonargraphProjectPath>(m_settings);
if (settings)
{
m_picker->setText(QString::fromStdWString(settings->getSonargraphProjectPath().wstr()));
const FilePath sonargraphProjectPath = settings->getSonargraphProjectPathExpandedAndAbsolute();
if (!sonargraphProjectPath.empty() && sonargraphProjectPath.exists())
{
if (std::shared_ptr<Sonargraph::Project> sonargraphProject = Sonargraph::Project::load(
sonargraphProjectPath, m_settings->getLanguage()
))
{
m_filePaths = utility::toVector(sonargraphProject->getAllSourceFilePathsCanonical());
}
}
if (m_fileCountLabel)
{
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the Sonargraph project.");
}
}
}
void QtProjectWizzardContentSonargraphProjectPath::save()
{
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settings =
std::dynamic_pointer_cast<SourceGroupSettingsWithSonargraphProjectPath>(m_settings);
if (settings)
{
settings->setSonargraphProjectPath(FilePath(m_picker->getText().toStdWString()));
}
}
bool QtProjectWizzardContentSonargraphProjectPath::check()
{
std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> settings =
std::dynamic_pointer_cast<SourceGroupSettingsWithSonargraphProjectPath>(m_settings);
if (settings)
{
if (std::shared_ptr<Sonargraph::Project> sonargraphProject = Sonargraph::Project::load(
settings->getSonargraphProjectPathExpandedAndAbsolute(), m_settings->getLanguage()
))
{
if (sonargraphProject->getLoadedModuleCount() == 0)
{
QMessageBox msgBox;
msgBox.setText(QString::fromStdString(
"The Sonargraph project file doesn't seem to contain any supported " +
languageTypeToString(m_settings->getLanguage()) + " modules. Please " +
"consider choosing another project file or removing this sourcegroup."
));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
return msgBox.exec() == QMessageBox::Ok;
}
}
}
return true;
}
std::vector<FilePath> QtProjectWizzardContentSonargraphProjectPath::getFilePaths() const
{
const_cast<QtProjectWizzardContentSonargraphProjectPath*>(this)->load();
return m_filePaths;
}
QString QtProjectWizzardContentSonargraphProjectPath::getFileNamesTitle() const
{
return "Source Files";
}
QString QtProjectWizzardContentSonargraphProjectPath::getFileNamesDescription() const
{
return " source files will be indexed.";
}
void QtProjectWizzardContentSonargraphProjectPath::pickedPath()
{
m_window->saveContent();
m_window->loadContent();
}
QtProjectWizzardContentPathSourceMaven::QtProjectWizzardContentPathSourceMaven(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
@@ -264,23 +482,26 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceMaven::getFilePaths() con
settings->getShouldIndexMavenTests()
);
FileManager fileManager;
fileManager.update(
sourceDirectories,
m_settings->getExcludeFiltersExpandedAndAbsolute(),
m_settings->getSourceExtensions()
);
const FilePath projectPath = m_settings->getProjectDirectoryPath();
for (FilePath path: fileManager.getAllSourceFilePaths())
if (std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings))
{
if (projectPath.exists())
{
path.makeRelativeTo(projectPath);
}
FileManager fileManager;
fileManager.update(
sourceDirectories,
settings->getExcludeFiltersExpandedAndAbsolute(),
pathSettings->getSourceExtensions()
);
list.push_back(path);
const FilePath projectPath = m_settings->getProjectDirectoryPath();
for (FilePath path : fileManager.getAllSourceFilePaths())
{
if (projectPath.exists())
{
path.makeRelativeTo(projectPath);
}
list.push_back(path);
}
}
}
@@ -398,8 +619,8 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceGradle::getFilePaths() co
FileManager fileManager;
fileManager.update(
sourceDirectories,
m_settings->getExcludeFiltersExpandedAndAbsolute(),
m_settings->getSourceExtensions()
settings->getExcludeFiltersExpandedAndAbsolute(),
settings->getSourceExtensions()
);
const FilePath projectPath = m_settings->getProjectDirectoryPath();
@@ -58,8 +58,44 @@ public:
virtual void load() override;
virtual void save() override;
virtual std::vector<FilePath> getFilePaths() const override;
virtual QString getFileNamesTitle() const override;
virtual QString getFileNamesDescription() const override;
private slots:
void pickedCDBPath();
void pickedPath();
private:
QLabel* m_fileCountLabel;
std::vector<FilePath> m_filePaths;
};
class QtProjectWizzardContentSonargraphProjectPath
: public QtProjectWizzardContentPath
{
Q_OBJECT
public:
QtProjectWizzardContentSonargraphProjectPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
virtual void load() override;
virtual void save() override;
virtual bool check() override;
virtual std::vector<FilePath> getFilePaths() const override;
virtual QString getFileNamesTitle() const override;
virtual QString getFileNamesDescription() const override;
private slots:
void pickedPath();
private:
QLabel* m_fileCountLabel;
std::vector<FilePath> m_filePaths;
};
@@ -16,9 +16,14 @@
#include "qt/window/QtSelectPathsDialog.h"
#include "settings/ApplicationSettings.h"
#include "settings/SourceGroupSettingsCxxCdb.h"
#include "settings/SourceGroupSettingsJava.h"
#include "settings/SourceGroupSettingsCxxSonargraph.h"
#include "settings/SourceGroupSettingsWithClasspath.h"
#include "settings/SourceGroupSettingsWithIndexedHeaderPaths.h"
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
#include "settings/SourceGroupSettingsWithSourcePaths.h"
#include "utility/CompilationDatabase.h"
#include "utility/file/FileManager.h"
#include "utility/sonargraph/SonargraphProject.h"
#include "utility/ScopedFunctor.h"
#include "utility/utility.h"
#include "utility/utilityFile.h"
@@ -211,12 +216,18 @@ QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource(
void QtProjectWizzardContentPathsSource::load()
{
m_list->setPaths(m_settings->getSourcePaths());
if (std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings)) // FIXME: pass msettings as required type
{
m_list->setPaths(pathSettings->getSourcePaths());
}
}
void QtProjectWizzardContentPathsSource::save()
{
m_settings->setSourcePaths(m_list->getPathsAsDisplayed());
if (std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings)) // FIXME: pass msettings as required type
{
pathSettings->setSourcePaths(m_list->getPathsAsDisplayed());
}
}
std::vector<FilePath> QtProjectWizzardContentPathsSource::getFilePaths() const
@@ -230,16 +241,22 @@ std::vector<FilePath> QtProjectWizzardContentPathsSource::getFilePaths() const
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
FileManager fileManager;
fileManager.update(
m_settings->getSourcePathsExpandedAndAbsolute(),
m_settings->getExcludeFiltersExpandedAndAbsolute(),
m_settings->getSourceExtensions()
);
std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings);
std::shared_ptr<SourceGroupSettingsWithExcludeFilters> excludeFilterSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings);
const std::set<FilePath> filePaths = fileManager.getAllSourceFilePathsRelative(m_settings->getProjectDirectoryPath());
if (pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
{
FileManager fileManager;
fileManager.update(
pathSettings->getSourcePathsExpandedAndAbsolute(),
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
pathSettings->getSourceExtensions()
);
return utility::toVector(filePaths);
const std::set<FilePath> filePaths = fileManager.getAllSourceFilePathsRelative(m_settings->getProjectDirectoryPath());
return utility::toVector(filePaths);
}
return std::vector<FilePath>();
}
QString QtProjectWizzardContentPathsSource::getFileNamesTitle() const
@@ -252,59 +269,81 @@ QString QtProjectWizzardContentPathsSource::getFileNamesDescription() const
return " files will be indexed.";
}
std::vector<FilePath> QtProjectWizzardContentPathsCDBHeader::getIndexedPathsDerivedFromCDB(
std::shared_ptr<SourceGroupSettingsCxxCdb> settings)
std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromSonargraphProject(
std::shared_ptr<const SourceGroupSettingsCxxSonargraph> settings)
{
const FilePath projectPath = settings->getProjectDirectoryPath();
const FilePath cdbPath = settings->getCompilationDatabasePathExpandedAndAbsolute();
std::set<FilePath> indexedHeaderPaths;
if (!cdbPath.empty() && cdbPath.exists())
{
for (const FilePath& path : IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath))
const FilePath sonargraphProjectPath = settings->getSonargraphProjectPathExpandedAndAbsolute();
if (!sonargraphProjectPath.empty() && sonargraphProjectPath.exists())
{
indexedHeaderPaths.insert(path.getParentDirectory());
if (std::shared_ptr<Sonargraph::Project> sonargraphProject = Sonargraph::Project::load(
sonargraphProjectPath, settings->getLanguage()
))
{
for (const FilePath& path : sonargraphProject->getAllSourceFilePathsCanonical())
{
indexedHeaderPaths.insert(path.getParentDirectory());
}
utility::append(indexedHeaderPaths, sonargraphProject->getAllCxxHeaderSearchPathsCanonical());
}
}
else
{
LOG_WARNING("Unable to fetch indexed header paths. The provided Sonargraph project path does not exist.");
}
}
else
{
LOG_WARNING("Unable to fetch indexed header paths. The provided Compilation Database path does not exist.");
}
for (const FilePath& path : utility::CompilationDatabase(cdbPath).getAllHeaderPaths())
{
if (path.exists() && projectPath.contains(path))
{
indexedHeaderPaths.insert(path);
}
}
std::vector<FilePath> rootPaths;
FilePath lastPath;
for (const FilePath& path : indexedHeaderPaths)
{
if (lastPath.empty() || !lastPath.contains(path)) // don't add subdirectories of already added paths
{
lastPath = path;
rootPaths.push_back(path.getRelativeTo(projectPath));
}
}
return rootPaths;
return utility::convert<FilePath, FilePath>(
utility::getTopLevelPaths(indexedHeaderPaths),
[&](const FilePath& path) { return path.getRelativeTo(projectPath); }
);
}
QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(
std::shared_ptr<const SourceGroupSettingsCxxCdb> settings)
{
const FilePath projectPath = settings->getProjectDirectoryPath();
std::set<FilePath> indexedHeaderPaths;
{
const FilePath cdbPath = settings->getCompilationDatabasePathExpandedAndAbsolute();
if (!cdbPath.empty() && cdbPath.exists())
{
for (const FilePath& path : IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath))
{
indexedHeaderPaths.insert(path.getParentDirectory());
}
for (const FilePath& path : utility::CompilationDatabase(cdbPath).getAllHeaderPaths())
{
if (path.exists())
{
indexedHeaderPaths.insert(path);
}
}
}
else
{
LOG_WARNING("Unable to fetch indexed header paths. The provided Compilation Database path does not exist.");
}
}
return utility::convert<FilePath, FilePath>(
utility::getTopLevelPaths(indexedHeaderPaths),
[&](const FilePath& path) { return path.getRelativeTo(projectPath); }
);
}
QtProjectWizzardContentIndexedHeaderPaths::QtProjectWizzardContentIndexedHeaderPaths(
const std::string& projectKindName, std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPaths(settings, window, QtPathListBox::SELECTION_POLICY_FILES_AND_DIRECTORIES)
, m_projectKindName(projectKindName)
{
m_showFilesString = "";
setTitleString("Header Files & Directories to Index");
setHelpString(
"Your Compilation Database already specifies which source files are part of your project. But Sourcetrail still "
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 />"
"<br />"
@@ -315,51 +354,52 @@ QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader(
"<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 QtProjectWizzardContentPathsCDBHeader::populate(QGridLayout* layout, int& row)
void QtProjectWizzardContentIndexedHeaderPaths::populate(QGridLayout* layout, int& row)
{
QtProjectWizzardContentPaths::populate(layout, row);
QPushButton* button = new QPushButton("Select from Include Paths");
QPushButton* button = new QPushButton(QString::fromStdString("Select from " + m_projectKindName));
button->setObjectName("windowButton");
connect(button, &QPushButton::clicked, this, &QtProjectWizzardContentPathsCDBHeader::buttonClicked);
connect(button, &QPushButton::clicked, this, &QtProjectWizzardContentIndexedHeaderPaths::buttonClicked);
layout->addWidget(button, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignRight | Qt::AlignTop);
row++;
}
void QtProjectWizzardContentPathsCDBHeader::load()
void QtProjectWizzardContentIndexedHeaderPaths::load()
{
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
if (std::shared_ptr<SourceGroupSettingsWithIndexedHeaderPaths> cdbSettings =
std::dynamic_pointer_cast<SourceGroupSettingsWithIndexedHeaderPaths>(m_settings))
{
m_list->setPaths(cdbSettings->getIndexedHeaderPaths());
}
}
void QtProjectWizzardContentPathsCDBHeader::save()
void QtProjectWizzardContentIndexedHeaderPaths::save()
{
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
if (std::shared_ptr<SourceGroupSettingsWithIndexedHeaderPaths> cdbSettings =
std::dynamic_pointer_cast<SourceGroupSettingsWithIndexedHeaderPaths>(m_settings))
{
cdbSettings->setIndexedHeaderPaths(m_list->getPathsAsDisplayed());
}
}
bool QtProjectWizzardContentPathsCDBHeader::check()
bool QtProjectWizzardContentIndexedHeaderPaths::check()
{
if (m_list->getPathsAsDisplayed().empty())
{
QMessageBox msgBox;
msgBox.setText("You didn't specify any Header Files & Directories to Index.");
msgBox.setInformativeText(
"Sourcetrail will only index the source files listed in the compilation database file and none of the included "
"header files.");
msgBox.setInformativeText(QString::fromStdString(
"Sourcetrail will only index the source files listed in the " + m_projectKindName +
" file and none of the included header files."
));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
return ret == QMessageBox::Ok;
return msgBox.exec() == QMessageBox::Ok;
}
else
{
@@ -367,13 +407,40 @@ bool QtProjectWizzardContentPathsCDBHeader::check()
}
}
void QtProjectWizzardContentPathsCDBHeader::buttonClicked()
void QtProjectWizzardContentIndexedHeaderPaths::buttonClicked()
{
save();
if (!m_filesDialog)
{
if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> sonargraphSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(m_settings))
{
const FilePath sonargraphProjectPath = sonargraphSettings->getSonargraphProjectPathExpandedAndAbsolute();
if (!sonargraphProjectPath.exists())
{
QMessageBox msgBox;
msgBox.setText("The provided Sonargraph project path does not exist.");
msgBox.setDetailedText(QString::fromStdWString(sonargraphProjectPath.wstr()));
msgBox.exec();
return;
}
m_filesDialog = std::make_shared<QtSelectPathsDialog>(
"Select from Include Paths",
"The list contains all Include Paths found in the Sonargraph 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, &QtProjectWizzardContentIndexedHeaderPaths::savedFilesDialog);
connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizzardContentIndexedHeaderPaths::closedFilesDialog);
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(
getIndexedPathsDerivedFromSonargraphProject(sonargraphSettings),
sonargraphSettings->getIndexedHeaderPaths(),
m_settings->getProjectDirectoryPath()
);
}
else if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
{
const FilePath cdbPath = cdbSettings->getCompilationDatabasePathExpandedAndAbsolute();
if (!cdbPath.exists())
@@ -391,8 +458,8 @@ void QtProjectWizzardContentPathsCDBHeader::buttonClicked()
"paths containing the header files you want to index with Sourcetrail.");
m_filesDialog->setup();
connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizzardContentPathsCDBHeader::savedFilesDialog);
connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizzardContentPathsCDBHeader::closedFilesDialog);
connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizzardContentIndexedHeaderPaths::savedFilesDialog);
connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizzardContentIndexedHeaderPaths::closedFilesDialog);
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(
getIndexedPathsDerivedFromCDB(cdbSettings),
@@ -406,12 +473,13 @@ void QtProjectWizzardContentPathsCDBHeader::buttonClicked()
m_filesDialog->raise();
}
void QtProjectWizzardContentPathsCDBHeader::savedFilesDialog()
void QtProjectWizzardContentIndexedHeaderPaths::savedFilesDialog()
{
m_list->setPaths(dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->getPathsList());
closedFilesDialog();
}
QtProjectWizzardContentPathsExclude::QtProjectWizzardContentPathsExclude(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
@@ -431,39 +499,49 @@ QtProjectWizzardContentPathsExclude::QtProjectWizzardContentPathsExclude(
void QtProjectWizzardContentPathsExclude::load()
{
m_list->setPaths(utility::convert<std::wstring, FilePath>(m_settings->getExcludeFilterStrings(), [](const std::wstring& s) { return FilePath(s); }));
if (std::shared_ptr<SourceGroupSettingsWithExcludeFilters> settings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings)) // FIXME: pass msettings as required type
{
m_list->setPaths(utility::convert<std::wstring, FilePath>(settings->getExcludeFilterStrings(), [](const std::wstring& s) { return FilePath(s); }));
}
}
void QtProjectWizzardContentPathsExclude::save()
{
m_settings->setExcludeFilterStrings(utility::toWStrings(m_list->getPathsAsDisplayed()));
if (std::shared_ptr<SourceGroupSettingsWithExcludeFilters> settings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings)) // FIXME: pass msettings as required type
{
settings->setExcludeFilterStrings(utility::toWStrings(m_list->getPathsAsDisplayed()));
}
}
QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSearch(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional
)
: QtProjectWizzardContentPaths(settings, window, QtPathListBox::SELECTION_POLICY_DIRECTORIES_ONLY)
, m_showDetectedIncludesResultFunctor(std::bind(
&QtProjectWizzardContentPathsHeaderSearch::showDetectedIncludesResult, this, std::placeholders::_1))
, m_showValidationResultFunctor(std::bind(
&QtProjectWizzardContentPathsHeaderSearch::showValidationResult, this, std::placeholders::_1))
, m_isCdb(isCDB)
, m_indicateAsAdditional(indicateAsAdditional)
{
setTitleString(m_isCdb ? "Additional Include Paths" : "Include Paths");
setTitleString(m_indicateAsAdditional ? "Additional Include Paths" : "Include Paths");
setHelpString(
((m_isCdb ? "<b>Note</b>: Use the Additional Include Paths to add paths that are missing in the Compilation "
"Database.<br /><br />" : "") + std::string(
"Include Paths are used for resolving #include directives in the indexed source and header files. These paths are "
"usually passed to the compiler with the '-I' or '-iquote' flags.<br />"
"<br />"
"Add all paths #include directives throughout your project are relative to. If all #include directives are "
"specified relative to the project's root directory, please add that root directory here.<br />"
"<br />"
"If your project also includes files from external libraries (e.g. boost), please add these directories as well "
"(e.g. add 'path/to/boost_home/include').<br />"
"<br />"
"You can make use of environment variables with ${ENV_VAR}.")).c_str()
(
(m_indicateAsAdditional ? "<b>Note</b>: Use the Additional Include Paths to add paths that are missing in the "
"referenced project file.<br /><br />" : ""
) + std::string(
"Include Paths are used for resolving #include directives in the indexed source and header files. These paths are "
"usually passed to the compiler with the '-I' or '-iquote' flags.<br />"
"<br />"
"Add all paths #include directives throughout your project are relative to. If all #include directives are "
"specified relative to the project's root directory, please add that root directory here.<br />"
"<br />"
"If your project also includes files from external libraries (e.g. boost), please add these directories as well "
"(e.g. add 'path/to/boost_home/include').<br />"
"<br />"
"You can make use of environment variables with ${ENV_VAR}."
)
).c_str()
);
}
@@ -471,7 +549,7 @@ void QtProjectWizzardContentPathsHeaderSearch::populate(QGridLayout* layout, int
{
QtProjectWizzardContentPaths::populate(layout, row);
if (!m_isCdb)
if (!m_indicateAsAdditional)
{
{
QPushButton* detectionButton = new QPushButton("auto-detect");
@@ -530,7 +608,10 @@ void QtProjectWizzardContentPathsHeaderSearch::detectIncludesButtonClicked()
m_pathsDialog->setCloseVisible(true);
m_pathsDialog->setRelativeRootDirectory(m_settings->getProjectDirectoryPath());
m_pathsDialog->setPaths(m_settings->getSourcePaths(), true);
if (std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings)) // FIXME: pass msettings as required type
{
m_pathsDialog->setPaths(pathSettings->getSourcePaths(), true);
}
m_pathsDialog->showWindow();
connect(m_pathsDialog.get(), &QtPathListDialog::finished, this, &QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootPathsDialog);
@@ -542,62 +623,68 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
// TODO: regard Force Includes here, too!
m_window->saveContent();
std::thread([&]()
std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings);
std::shared_ptr<SourceGroupSettingsWithExcludeFilters> excludeFilterSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings);
if (pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
{
std::vector<IncludeDirective> unresolvedIncludes;
std::thread([&]()
{
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
std::set<FilePath> sourceFilePaths;
std::vector<FilePath> indexedFilePaths;
std::vector<FilePath> headerSearchPaths;
std::vector<IncludeDirective> unresolvedIncludes;
{
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
ScopedFunctor dialogHider([&dialogView](){
dialogView->hideUnknownProgressDialog();
});
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
FileManager fileManager;
fileManager.update(
m_settings->getSourcePathsExpandedAndAbsolute(),
m_settings->getExcludeFiltersExpandedAndAbsolute(),
m_settings->getSourceExtensions()
);
sourceFilePaths = fileManager.getAllSourceFilePaths();
std::set<FilePath> sourceFilePaths;
std::vector<FilePath> indexedFilePaths;
std::vector<FilePath> headerSearchPaths;
headerSearchPaths = ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded();
if (std::shared_ptr<SourceGroupSettingsCxx> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings))
{
indexedFilePaths = cxxSettings->getSourcePaths();
utility::append(headerSearchPaths, cxxSettings->getHeaderSearchPathsExpandedAndAbsolute());
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
ScopedFunctor dialogHider([&dialogView](){
dialogView->hideUnknownProgressDialog();
});
FileManager fileManager;
fileManager.update(
pathSettings->getSourcePathsExpandedAndAbsolute(),
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
pathSettings->getSourceExtensions()
);
sourceFilePaths = fileManager.getAllSourceFilePaths();
indexedFilePaths = pathSettings->getSourcePathsExpandedAndAbsolute();
headerSearchPaths = ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded();
if (std::shared_ptr<SourceGroupSettingsCxx> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings))
{
utility::append(headerSearchPaths, cxxSettings->getHeaderSearchPathsExpandedAndAbsolute());
}
}
{
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
ScopedFunctor dialogHider([&dialogView](){
dialogView->hideProgressDialog();
});
unresolvedIncludes = IncludeProcessing::getUnresolvedIncludeDirectives(
sourceFilePaths,
utility::toSet(indexedFilePaths),
utility::toSet(headerSearchPaths),
log2(sourceFilePaths.size()),
[&](const float progress)
{
Application::getInstance()->getDialogView()->showProgressDialog(
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files", int(progress * 100.0f)
);
}
);
}
}
{
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
ScopedFunctor dialogHider([&dialogView](){
dialogView->hideProgressDialog();
});
unresolvedIncludes = IncludeProcessing::getUnresolvedIncludeDirectives(
sourceFilePaths,
utility::toSet(indexedFilePaths),
utility::toSet(headerSearchPaths),
log2(sourceFilePaths.size()),
[&](const float progress)
{
Application::getInstance()->getDialogView()->showProgressDialog(
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files", int(progress * 100.0f)
);
}
);
}
}
m_showValidationResultFunctor(unresolvedIncludes);
}).detach();
m_showValidationResultFunctor(unresolvedIncludes);
}).detach();
}
}
@@ -607,59 +694,65 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
const std::vector<FilePath> searchedPaths = m_settings->makePathsExpandedAndAbsolute(m_pathsDialog->getPaths());
closedPathsDialog();
std::thread([=]()
std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings);
std::shared_ptr<SourceGroupSettingsWithExcludeFilters> excludeFilterSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithExcludeFilters>(m_settings);
if (pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
{
std::set<FilePath> detectedHeaderSearchPaths;
std::thread([=]()
{
std::shared_ptr<QtDialogView> dialogView = std::dynamic_pointer_cast<QtDialogView>(Application::getInstance()->getDialogView());
std::set<FilePath> sourceFilePaths;
std::vector<FilePath> headerSearchPaths;
std::set<FilePath> detectedHeaderSearchPaths;
{
dialogView->setParentWindow(m_window);
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
ScopedFunctor dialogHider([&dialogView]() {
dialogView->hideUnknownProgressDialog();
});
std::shared_ptr<QtDialogView> dialogView = std::dynamic_pointer_cast<QtDialogView>(Application::getInstance()->getDialogView());
FileManager fileManager;
fileManager.update(
m_settings->getSourcePathsExpandedAndAbsolute(),
m_settings->getExcludeFiltersExpandedAndAbsolute(),
m_settings->getSourceExtensions()
);
sourceFilePaths = fileManager.getAllSourceFilePaths();
headerSearchPaths = ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded();
if (std::shared_ptr<SourceGroupSettingsCxx> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings))
std::set<FilePath> sourceFilePaths;
std::vector<FilePath> headerSearchPaths;
{
utility::append(headerSearchPaths, cxxSettings->getHeaderSearchPathsExpandedAndAbsolute());
dialogView->setParentWindow(m_window);
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
ScopedFunctor dialogHider([&dialogView]() {
dialogView->hideUnknownProgressDialog();
});
FileManager fileManager;
fileManager.update(
pathSettings->getSourcePathsExpandedAndAbsolute(),
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
pathSettings->getSourceExtensions()
);
sourceFilePaths = fileManager.getAllSourceFilePaths();
headerSearchPaths = ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded();
if (std::shared_ptr<SourceGroupSettingsCxx> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings))
{
utility::append(headerSearchPaths, cxxSettings->getHeaderSearchPathsExpandedAndAbsolute());
}
}
{
dialogView->setParentWindow(m_window);
ScopedFunctor dialogHider([&dialogView]() {
dialogView->hideProgressDialog();
});
detectedHeaderSearchPaths = IncludeProcessing::getHeaderSearchDirectories(
sourceFilePaths,
utility::toSet(searchedPaths),
utility::toSet(headerSearchPaths),
log2(sourceFilePaths.size()),
[&](const float progress)
{
Application::getInstance()->getDialogView()->showProgressDialog(
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files", int(progress * 100.0f)
);
}
);
}
}
{
dialogView->setParentWindow(m_window);
ScopedFunctor dialogHider([&dialogView]() {
dialogView->hideProgressDialog();
});
detectedHeaderSearchPaths = IncludeProcessing::getHeaderSearchDirectories(
sourceFilePaths,
utility::toSet(searchedPaths),
utility::toSet(headerSearchPaths),
log2(sourceFilePaths.size()),
[&](const float progress)
{
Application::getInstance()->getDialogView()->showProgressDialog(
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files", int(progress * 100.0f)
);
}
);
}
}
m_showDetectedIncludesResultFunctor(detectedHeaderSearchPaths);
}).detach();
m_showDetectedIncludesResultFunctor(detectedHeaderSearchPaths);
}).detach();
}
}
void QtProjectWizzardContentPathsHeaderSearch::finishedAcceptDetectedIncludePathsDialog()
@@ -830,11 +923,11 @@ void QtProjectWizzardContentPathsHeaderSearchGlobal::save()
QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFrameworkSearch(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional
)
: QtProjectWizzardContentPaths(settings, window, QtPathListBox::SELECTION_POLICY_DIRECTORIES_ONLY)
{
setTitleString(isCDB ? "Additional Framework Search Paths" : "Framework Search Paths");
setTitleString(indicateAsAdditional ? "Additional Framework Search Paths" : "Framework Search Paths");
setHelpString(
"Framework Search Paths define where MacOS framework containers (.framework), that your project depends on, are "
"found. These paths are usually passed to the compiler with the '-iframework' flag.<br />"
@@ -927,22 +1020,22 @@ void QtProjectWizzardContentPathsClassJava::populate(QGridLayout* layout, int& r
void QtProjectWizzardContentPathsClassJava::load()
{
std::shared_ptr<SourceGroupSettingsJava> javaSettings =
std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
std::shared_ptr<SourceGroupSettingsWithClasspath> settings =
std::dynamic_pointer_cast<SourceGroupSettingsWithClasspath>(m_settings);
if (settings)
{
m_list->setPaths(javaSettings->getClasspath());
m_useJreSystemLibraryCheckBox->setChecked(javaSettings->getUseJreSystemLibrary());
m_list->setPaths(settings->getClasspath());
m_useJreSystemLibraryCheckBox->setChecked(settings->getUseJreSystemLibrary());
}
}
void QtProjectWizzardContentPathsClassJava::save()
{
std::shared_ptr<SourceGroupSettingsJava> javaSettings =
std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
std::shared_ptr<SourceGroupSettingsWithClasspath> settings =
std::dynamic_pointer_cast<SourceGroupSettingsWithClasspath>(m_settings);
if (settings)
{
javaSettings->setClasspath(m_list->getPathsAsDisplayed());
javaSettings->setUseJreSystemLibrary(m_useJreSystemLibraryCheckBox->isChecked());
settings->setClasspath(m_list->getPathsAsDisplayed());
settings->setUseJreSystemLibrary(m_useJreSystemLibraryCheckBox->isChecked());
}
}
@@ -14,6 +14,7 @@ class QPushButton;
class QtPathListDialog;
class SourceGroupSettings;
class SourceGroupSettingsCxxCdb;
class SourceGroupSettingsCxxSonargraph;
class QtProjectWizzardContentPaths
: public QtProjectWizzardContent
@@ -80,15 +81,17 @@ public:
};
class QtProjectWizzardContentPathsCDBHeader
class QtProjectWizzardContentIndexedHeaderPaths
: public QtProjectWizzardContentPaths
{
Q_OBJECT
public:
static std::vector<FilePath> getIndexedPathsDerivedFromCDB(std::shared_ptr<SourceGroupSettingsCxxCdb> settings);
static std::vector<FilePath> getIndexedPathsDerivedFromSonargraphProject(std::shared_ptr<const SourceGroupSettingsCxxSonargraph> settings);
static std::vector<FilePath> getIndexedPathsDerivedFromCDB(std::shared_ptr<const SourceGroupSettingsCxxCdb> settings);
QtProjectWizzardContentPathsCDBHeader(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentIndexedHeaderPaths(
const std::string& projectKindName, std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
virtual void populate(QGridLayout* layout, int& row) override;
@@ -101,6 +104,9 @@ public:
private slots:
void buttonClicked();
void savedFilesDialog();
private:
const std::string m_projectKindName;
};
@@ -122,7 +128,7 @@ class QtProjectWizzardContentPathsHeaderSearch
Q_OBJECT
public:
QtProjectWizzardContentPathsHeaderSearch(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional = false);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -145,7 +151,7 @@ private:
QtThreadedFunctor<std::vector<IncludeDirective>> m_showValidationResultFunctor;
std::shared_ptr<QtPathListDialog> m_pathsDialog;
const bool m_isCdb;
const bool m_indicateAsAdditional;
};
class QtProjectWizzardContentPathsHeaderSearchGlobal
@@ -167,7 +173,7 @@ class QtProjectWizzardContentPathsFrameworkSearch
Q_OBJECT
public:
QtProjectWizzardContentPathsFrameworkSearch(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool indicateAsAdditional = false);
// QtProjectWizzardContent implementation
virtual void load() override;
@@ -30,21 +30,26 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_C_EMPTY));
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CDB));
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_VS));
sourceGroupInfos[LANGUAGE_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_SONARGRAPH));
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CPP_EMPTY));
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CDB));
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_VS));
sourceGroupInfos[LANGUAGE_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_SONARGRAPH));
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_EMPTY));
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_MAVEN));
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_GRADLE));
sourceGroupInfos[LANGUAGE_JAVA].push_back(SourceGroupInfo(SOURCE_GROUP_JAVA_SONARGRAPH));
// define which icons should be used for which kind of source group
m_sourceGroupTypeIconName[SOURCE_GROUP_C_EMPTY] = L"empty_icon";
m_sourceGroupTypeIconName[SOURCE_GROUP_CPP_EMPTY] = L"empty_icon";
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_CDB] = L"cdb_icon";
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_VS] = L"vs_icon";
m_sourceGroupTypeIconName[SOURCE_GROUP_CXX_SONARGRAPH] = L"sonargraph_icon";
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_EMPTY] = L"empty_icon";
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_MAVEN] = L"mvn_icon";
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_GRADLE] = L"gradle_icon";
m_sourceGroupTypeIconName[SOURCE_GROUP_JAVA_SONARGRAPH] = L"sonargraph_icon";
// define descriptions for each kind of Source Group
m_sourceGroupTypeDescriptions[SOURCE_GROUP_C_EMPTY] = "Create a new Sourcetrail Source Group by defining which C files will be indexed.";
@@ -55,9 +60,11 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
m_sourceGroupTypeDescriptions[SOURCE_GROUP_CXX_VS] = "Create a new Source Group from an existing Visual Studio Solution file. "
"<b>Note: Requires a running Visual Studio instance with the "
"<a href=\"https://sourcetrail.com/documentation/index.html#VisualStudio\">Visual Studio plugin</a> installed.";
m_sourceGroupTypeDescriptions[SOURCE_GROUP_CXX_SONARGRAPH] = "Create a new Source Group from an existing Sonargraph project file.";
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_EMPTY] = "Create a new Sourcetrail Source Group by defining which Java files will be indexed.";
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_MAVEN] = "Create a new Source Group from an existing Maven project.";
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_GRADLE] = "Create a new Source Group from an existing Gradle project.";
m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_SONARGRAPH] = "Create a new Source Group from an existing Sonargraph project file.";
QVBoxLayout* vlayout = new QVBoxLayout();
vlayout->setContentsMargins(0, 30, 0, 0);