logic: added C/C++ project setup from Code::Blocks
* also changed xml elements in sourcegroup settings that specify the used language standard, so that one sourcegroup can maintain multiple language standards * added migration and migrated sample projects
This commit is contained in:
@@ -187,16 +187,20 @@ add_files(
|
||||
qt/window/project_wizzard/QtProjectWizzard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContent.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContent.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCppStandard.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCppStandard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCStandard.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentCStandard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentExtensions.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentExtensions.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentFlags.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentGroup.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentGroup.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentJavaStandard.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentJavaStandard.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPath.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPath.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
#include <QSysInfo>
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCppStandard.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCrossCompilationOptions.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCStandard.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentExtensions.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentFlags.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentJavaStandard.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPath.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentProjectData.h"
|
||||
@@ -19,8 +21,10 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSourceGroupInfoText.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentGroup.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentVS.h"
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCppEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "settings/SourceGroupSettingsJavaEmpty.h"
|
||||
#include "settings/SourceGroupSettingsJavaGradle.h"
|
||||
@@ -235,7 +239,7 @@ void QtProjectWizzard::windowReady()
|
||||
|
||||
updateSourceGroupList();
|
||||
|
||||
if (m_allSourceGroupSettings.size())
|
||||
if (!m_allSourceGroupSettings.empty())
|
||||
{
|
||||
m_sourceGroupList->setCurrentRow(0);
|
||||
}
|
||||
@@ -407,7 +411,7 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
|
||||
if (std::shared_ptr<SourceGroupSettingsJava> settingsJava = std::dynamic_pointer_cast<SourceGroupSettingsJava>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
summary->addContent(new QtProjectWizzardContentJavaStandard(settingsJava, this));
|
||||
summary->addSpace();
|
||||
|
||||
if (std::shared_ptr<SourceGroupSettingsJavaEmpty> settingsJavaEmpty = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(group))
|
||||
@@ -443,7 +447,7 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsJavaSonargraph> settingsJavaSonargraph = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
summary->addContent(new QtProjectWizzardContentJavaStandard(settingsJavaSonargraph, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(group, this));
|
||||
summary->addSpace();
|
||||
@@ -456,7 +460,14 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
bool indicateSearchPathsAsAdditional = false;
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxEmpty> settingsCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCxxEmpty>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
if (std::shared_ptr<SourceGroupSettingsCEmpty> settingsCEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentCStandard(settingsCEmpty, this));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> settingsCppEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(group))
|
||||
{
|
||||
summary->addContent(new QtProjectWizzardContentCppStandard(settingsCppEmpty, this));
|
||||
}
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentCrossCompilationOptions(group, this));
|
||||
summary->addSpace();
|
||||
@@ -477,11 +488,25 @@ void QtProjectWizzard::selectedSourceGroupChanged(int index)
|
||||
summary->addContent(new QtProjectWizzardContentPathsExclude(group, this));
|
||||
summary->addSpace();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settingsCxxCodeblocks = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(group))
|
||||
{
|
||||
indicateSearchPathsAsAdditional = true;
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentCppStandard(settingsCxxCodeblocks, this));
|
||||
summary->addContent(new QtProjectWizzardContentCStandard(settingsCxxCodeblocks, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentCodeblocksProjectPath(settingsCxxCodeblocks, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Code::Blocks project", settingsCxxCodeblocks, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentExtensions(settingsCxxCodeblocks, this));
|
||||
summary->addSpace();
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> settingsCxxSonargraph = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(group))
|
||||
{
|
||||
indicateSearchPathsAsAdditional = true;
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentLanguageAndStandard(group, this));
|
||||
summary->addContent(new QtProjectWizzardContentCppStandard(settingsCxxSonargraph, this));
|
||||
summary->addSpace();
|
||||
summary->addContent(new QtProjectWizzardContentSonargraphProjectPath(group, this));
|
||||
summary->addSpace();
|
||||
@@ -579,12 +604,17 @@ void QtProjectWizzard::duplicateSelectedSourceGroup()
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsJavaSonargraph>(*dynamic_cast<SourceGroupSettingsJavaSonargraph*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCEmpty>(*dynamic_cast<SourceGroupSettingsCEmpty*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxEmpty>(*dynamic_cast<SourceGroupSettingsCxxEmpty*>(oldSourceGroup.get()));
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCppEmpty>(*dynamic_cast<SourceGroupSettingsCppEmpty*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxCdb>(*dynamic_cast<SourceGroupSettingsCxxCdb*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxCodeblocks>(*dynamic_cast<SourceGroupSettingsCxxCodeblocks*>(oldSourceGroup.get()));
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
newSourceGroup = std::make_shared<SourceGroupSettingsCxxSonargraph>(*dynamic_cast<SourceGroupSettingsCxxSonargraph*>(oldSourceGroup.get()));
|
||||
break;
|
||||
@@ -700,7 +730,14 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
{
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxEmpty>(sourceGroupId, sourceGroupType, m_projectSettings.get());
|
||||
if (sourceGroupType == SOURCE_GROUP_C_EMPTY)
|
||||
{
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCppEmpty>(sourceGroupId, m_projectSettings.get());
|
||||
}
|
||||
if (applicationSettingsContainVisualStudioHeaderSearchPaths())
|
||||
{
|
||||
std::vector<std::wstring> flags;
|
||||
@@ -715,6 +752,10 @@ void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxCdb>(sourceGroupId, m_projectSettings.get());
|
||||
emptySourceGroupCDB();
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxCodeblocks>(sourceGroupId, m_projectSettings.get());
|
||||
emptySourceGroupCxxCodeblocks();
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
m_newSourceGroupSettings = std::make_shared<SourceGroupSettingsCxxSonargraph>(sourceGroupId, m_projectSettings.get());
|
||||
emptySourceGroupCxxSonargraph();
|
||||
@@ -749,7 +790,18 @@ void QtProjectWizzard::emptySourceGroup()
|
||||
QtProjectWizzardWindow* window = createWindowWithContentGroup(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentLanguageAndStandard(m_newSourceGroupSettings, window));
|
||||
if (std::shared_ptr<SourceGroupSettingsCEmpty> settingsCEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentCStandard(settingsCEmpty, this));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCppEmpty> settingsCppEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentCppStandard(settingsCppEmpty, this));
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsJavaEmpty> settingsJavaEmpty = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentJavaStandard(settingsJavaEmpty, this));
|
||||
}
|
||||
if (m_newSourceGroupSettings->getType() == SOURCE_GROUP_C_EMPTY ||
|
||||
m_newSourceGroupSettings->getType() == SOURCE_GROUP_CPP_EMPTY)
|
||||
{
|
||||
@@ -810,16 +862,42 @@ void QtProjectWizzard::emptySourceGroupCDB()
|
||||
window->updateSubTitle("Compilation Database Path");
|
||||
}
|
||||
|
||||
void QtProjectWizzard::emptySourceGroupCxxCodeblocks()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContentGroup(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
|
||||
{
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentCppStandard(settings, this));
|
||||
contentGroup->addContent(new QtProjectWizzardContentCStandard(settings, this));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentCodeblocksProjectPath(settings, window));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Code::Blocks project", settings, window));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentExtensions(settings, window));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, &QtProjectWizzardWindow::next, this, &QtProjectWizzard::createSourceGroup);
|
||||
window->updateSubTitle("Code::Blocks Project 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));
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentCppStandard(settings, this));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentIndexedHeaderPaths("Sonargraph project", m_newSourceGroupSettings, window));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -832,7 +910,12 @@ void QtProjectWizzard::emptySourceGroupJavaSonargraph()
|
||||
QtProjectWizzardWindow* window = createWindowWithContentGroup(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentGroup* contentGroup)
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
|
||||
if (std::shared_ptr<SourceGroupSettingsJavaSonargraph> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addContent(new QtProjectWizzardContentJavaStandard(settings, this));
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentSonargraphProjectPath(m_newSourceGroupSettings, window));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -850,10 +933,11 @@ void QtProjectWizzard::sourcePaths()
|
||||
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))
|
||||
if (std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settingsSourceExtension =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_newSourceGroupSettings))
|
||||
{
|
||||
contentGroup->addSpace();
|
||||
contentGroup->addContent(new QtProjectWizzardContentExtensions(settingsSourcePath, window));
|
||||
contentGroup->addContent(new QtProjectWizzardContentExtensions(settingsSourceExtension, window));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ private slots:
|
||||
void emptySourceGroup();
|
||||
void emptySourceGroupCDBVS();
|
||||
void emptySourceGroupCDB();
|
||||
void emptySourceGroupCxxCodeblocks();
|
||||
void emptySourceGroupCxxSonargraph();
|
||||
void emptySourceGroupJavaSonargraph();
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCStandard.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
|
||||
QtProjectWizzardContentCStandard::QtProjectWizzardContentCStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithCStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_sourceGroupSettings(sourceGroupSettings)
|
||||
, m_standard(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCStandard::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
m_standard = new QComboBox();
|
||||
layout->addWidget(createFormLabel("C Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCStandard::load()
|
||||
{
|
||||
m_standard->clear();
|
||||
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
std::vector<std::string> standards = m_sourceGroupSettings->getAvailableCStandards();
|
||||
for (size_t i = 0; i < standards.size(); i++)
|
||||
{
|
||||
m_standard->insertItem(i, standards[i].c_str());
|
||||
}
|
||||
|
||||
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getCStandard()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCStandard::save()
|
||||
{
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
m_sourceGroupSettings->setCStandard(m_standard->currentText().toStdString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_C_STANDARD
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_C_STANDARD
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QComboBox;
|
||||
class SourceGroupSettingsWithCStandard;
|
||||
|
||||
class QtProjectWizzardContentCStandard
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentCStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithCStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettingsWithCStandard> m_sourceGroupSettings;
|
||||
|
||||
QComboBox* m_standard;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_C_STANDARD
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentCppStandard.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
|
||||
QtProjectWizzardContentCppStandard::QtProjectWizzardContentCppStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithCppStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_sourceGroupSettings(sourceGroupSettings)
|
||||
, m_standard(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCppStandard::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
m_standard = new QComboBox();
|
||||
layout->addWidget(createFormLabel("C++ Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCppStandard::load()
|
||||
{
|
||||
m_standard->clear();
|
||||
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
std::vector<std::string> standards = m_sourceGroupSettings->getAvailableCppStandards();
|
||||
for (size_t i = 0; i < standards.size(); i++)
|
||||
{
|
||||
m_standard->insertItem(i, standards[i].c_str());
|
||||
}
|
||||
|
||||
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getCppStandard()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCppStandard::save()
|
||||
{
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
m_sourceGroupSettings->setCppStandard(m_standard->currentText().toStdString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_CPP_STANDARD
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_CPP_STANDARD
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QComboBox;
|
||||
class SourceGroupSettingsWithCppStandard;
|
||||
|
||||
class QtProjectWizzardContentCppStandard
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentCppStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithCppStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettingsWithCppStandard> m_sourceGroupSettings;
|
||||
|
||||
QComboBox* m_standard;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_CPP_STANDARD
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
#include <QFormLayout>
|
||||
|
||||
#include "settings/SourceGroupSettingsWithSourcePaths.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "qt/element/QtStringListBox.h"
|
||||
|
||||
QtProjectWizzardContentExtensions::QtProjectWizzardContentExtensions(
|
||||
std::shared_ptr<SourceGroupSettingsWithSourcePaths> settings, QtProjectWizzardWindow* window
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_settings(settings)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QtStringListBox;
|
||||
class SourceGroupSettingsWithSourcePaths;
|
||||
class SourceGroupSettingsWithSourceExtensions;
|
||||
|
||||
class QtProjectWizzardContentExtensions
|
||||
: public QtProjectWizzardContent
|
||||
@@ -14,7 +14,7 @@ class QtProjectWizzardContentExtensions
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentExtensions(std::shared_ptr<SourceGroupSettingsWithSourcePaths> settings, QtProjectWizzardWindow* window);
|
||||
QtProjectWizzardContentExtensions(std::shared_ptr<SourceGroupSettingsWithSourceExtensions> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettingsWithSourcePaths> m_settings;
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> m_settings;
|
||||
|
||||
QtStringListBox* m_listBox;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentJavaStandard.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettingsWithJavaStandard.h"
|
||||
|
||||
QtProjectWizzardContentJavaStandard::QtProjectWizzardContentJavaStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithJavaStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_sourceGroupSettings(sourceGroupSettings)
|
||||
, m_standard(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentJavaStandard::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
m_standard = new QComboBox();
|
||||
layout->addWidget(createFormLabel("Java Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentJavaStandard::load()
|
||||
{
|
||||
m_standard->clear();
|
||||
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
std::vector<std::string> standards = m_sourceGroupSettings->getAvailableJavaStandards();
|
||||
for (size_t i = 0; i < standards.size(); i++)
|
||||
{
|
||||
m_standard->insertItem(i, standards[i].c_str());
|
||||
}
|
||||
|
||||
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getJavaStandard()));
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentJavaStandard::save()
|
||||
{
|
||||
if (m_sourceGroupSettings)
|
||||
{
|
||||
m_sourceGroupSettings->setJavaStandard(m_standard->currentText().toStdString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_JAVA_STANDARD
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_JAVA_STANDARD
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QComboBox;
|
||||
class SourceGroupSettingsWithJavaStandard;
|
||||
|
||||
class QtProjectWizzardContentJavaStandard
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentJavaStandard(
|
||||
std::shared_ptr<SourceGroupSettingsWithJavaStandard> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettingsWithJavaStandard> m_sourceGroupSettings;
|
||||
|
||||
QComboBox* m_standard;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_JAVA_STANDARD
|
||||
@@ -1,70 +0,0 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentLanguageAndStandard.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
QtProjectWizzardContentLanguageAndStandard::QtProjectWizzardContentLanguageAndStandard(
|
||||
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_sourceGroupSettings(sourceGroupSettings)
|
||||
, m_language(nullptr)
|
||||
, m_standard(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentLanguageAndStandard::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
m_language = new QLabel();
|
||||
layout->addWidget(createFormLabel("Language"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_language, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
m_standard = new QComboBox();
|
||||
layout->addWidget(createFormLabel("Standard"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_standard, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentLanguageAndStandard::load()
|
||||
{
|
||||
const LanguageType type = getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType());
|
||||
|
||||
if (type == LANGUAGE_UNKNOWN)
|
||||
{
|
||||
LOG_ERROR("No language type defined");
|
||||
return;
|
||||
}
|
||||
|
||||
m_language->setText(languageTypeToString(type).c_str());
|
||||
|
||||
m_standard->clear();
|
||||
std::vector<std::string> standards = m_sourceGroupSettings->getAvailableLanguageStandards();
|
||||
for (size_t i = 0; i < standards.size(); i++)
|
||||
{
|
||||
m_standard->insertItem(i, standards[i].c_str());
|
||||
}
|
||||
|
||||
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getStandard()));
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentLanguageAndStandard::save()
|
||||
{
|
||||
m_sourceGroupSettings->setStandard(m_standard->currentText().toStdString());
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_LANGUAGE_AND_STANDARD
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_LANGUAGE_AND_STANDARD
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class SourceGroupSettings;
|
||||
|
||||
class QtProjectWizzardContentLanguageAndStandard
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentLanguageAndStandard(
|
||||
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
|
||||
QtProjectWizzardWindow* window);
|
||||
|
||||
// QtProjectWizzardContent implementation
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> m_sourceGroupSettings;
|
||||
|
||||
QLabel* m_language;
|
||||
QComboBox* m_standard;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_LANGUAGE_AND_STANDARD
|
||||
@@ -16,9 +16,11 @@
|
||||
#include "settings/SourceGroupSettingsJavaMaven.h"
|
||||
#include "settings/SourceGroupSettingsJavaGradle.h"
|
||||
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "utility/file/FileManager.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/sonargraph/SonargraphProject.h"
|
||||
#include "utility/codeblocks/CodeblocksProject.h"
|
||||
#include "utility/ScopedFunctor.h"
|
||||
#include "utility/utility.h"
|
||||
#include "utility/utilityGradle.h"
|
||||
@@ -261,6 +263,132 @@ void QtProjectWizzardContentPathCDB::pickedPath()
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentCodeblocksProjectPath::QtProjectWizzardContentCodeblocksProjectPath(
|
||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContentPath(settings, window)
|
||||
{
|
||||
setTitleString("Code::Blocks Project (.cbp)");
|
||||
setHelpString(
|
||||
"Select the Code::Blocks 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 Code::Blocks project on every refresh.<br />"
|
||||
"<br />"
|
||||
"You can make use of environment variables with ${ENV_VAR}."
|
||||
);
|
||||
setFileEndings({ L".cbp" });
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCodeblocksProjectPath::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
QtProjectWizzardContentPath::populate(layout, row);
|
||||
m_picker->setPickDirectory(false);
|
||||
m_picker->setFileFilter("Code::Blocks Project (*.cbp)");
|
||||
connect(m_picker, &QtLocationPicker::locationPicked, this, &QtProjectWizzardContentCodeblocksProjectPath::pickedPath);
|
||||
|
||||
QLabel* description = new QLabel(
|
||||
"Sourcetrail will use all settings from the Code::Blocks 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 QtProjectWizzardContentCodeblocksProjectPath::load()
|
||||
{
|
||||
m_filePaths.clear();
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
m_picker->setText(QString::fromStdWString(settings->getCodeblocksProjectPath().wstr()));
|
||||
|
||||
const FilePath codeblocksProjectPath = settings->getCodeblocksProjectPathExpandedAndAbsolute();
|
||||
if (!codeblocksProjectPath.empty() && codeblocksProjectPath.exists())
|
||||
{
|
||||
if (std::shared_ptr<Codeblocks::Project> codeblocksProject = Codeblocks::Project::load(
|
||||
codeblocksProjectPath
|
||||
))
|
||||
{
|
||||
m_filePaths = utility::toVector(codeblocksProject->getAllSourceFilePathsCanonical(settings));
|
||||
}
|
||||
}
|
||||
|
||||
if (m_fileCountLabel)
|
||||
{
|
||||
m_fileCountLabel->setText("<b>" + QString::number(m_filePaths.size()) + "</b> source files were found in the Code::Blocks project.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCodeblocksProjectPath::save()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> settings =
|
||||
std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings);
|
||||
if (settings)
|
||||
{
|
||||
settings->setCodeblocksProjectPath(FilePath(m_picker->getText().toStdWString()));
|
||||
}
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentCodeblocksProjectPath::check()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<FilePath> QtProjectWizzardContentCodeblocksProjectPath::getFilePaths() const
|
||||
{
|
||||
const_cast<QtProjectWizzardContentCodeblocksProjectPath*>(this)->load();
|
||||
|
||||
return m_filePaths;
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentCodeblocksProjectPath::getFileNamesTitle() const
|
||||
{
|
||||
return "Source Files";
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContentCodeblocksProjectPath::getFileNamesDescription() const
|
||||
{
|
||||
return " source files will be indexed.";
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentCodeblocksProjectPath::pickedPath()
|
||||
{
|
||||
m_window->saveContent();
|
||||
|
||||
if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> codeblocksSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings))
|
||||
{
|
||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCodeblocksProject(codeblocksSettings))
|
||||
{
|
||||
if (projectPath.contains(path))
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getRelativeTo(projectPath));
|
||||
}
|
||||
}
|
||||
codeblocksSettings->setIndexedHeaderPaths(utility::toVector(indexedHeaderPaths));
|
||||
}
|
||||
|
||||
m_window->loadContent();
|
||||
}
|
||||
|
||||
|
||||
QtProjectWizzardContentSonargraphProjectPath::QtProjectWizzardContentSonargraphProjectPath(
|
||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
@@ -500,26 +628,23 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceMaven::getFilePaths() con
|
||||
settings->getShouldIndexMavenTests()
|
||||
);
|
||||
|
||||
if (std::shared_ptr<SourceGroupSettingsWithSourcePaths> pathSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourcePaths>(m_settings))
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
sourceDirectories,
|
||||
settings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
settings->getSourceExtensions()
|
||||
);
|
||||
|
||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||
|
||||
for (FilePath path : fileManager.getAllSourceFilePaths())
|
||||
{
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
sourceDirectories,
|
||||
settings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
pathSettings->getSourceExtensions()
|
||||
);
|
||||
|
||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||
|
||||
for (FilePath path : fileManager.getAllSourceFilePaths())
|
||||
if (projectPath.exists())
|
||||
{
|
||||
if (projectPath.exists())
|
||||
{
|
||||
path.makeRelativeTo(projectPath);
|
||||
}
|
||||
|
||||
list.push_back(path);
|
||||
path.makeRelativeTo(projectPath);
|
||||
}
|
||||
|
||||
list.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,7 +766,7 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceGradle::getFilePaths() co
|
||||
settings->getSourceExtensions()
|
||||
);
|
||||
|
||||
const FilePath projectPath = m_settings->getProjectDirectoryPath();
|
||||
const FilePath projectPath = settings->getProjectDirectoryPath();
|
||||
|
||||
for (FilePath path : fileManager.getAllSourceFilePaths())
|
||||
{
|
||||
|
||||
@@ -71,6 +71,34 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentCodeblocksProjectPath
|
||||
: public QtProjectWizzardContentPath
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentCodeblocksProjectPath(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;
|
||||
};
|
||||
|
||||
|
||||
class QtProjectWizzardContentSonargraphProjectPath
|
||||
: public QtProjectWizzardContentPath
|
||||
{
|
||||
|
||||
@@ -16,14 +16,17 @@
|
||||
#include "qt/window/QtSelectPathsDialog.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "settings/SourceGroupSettingsWithClasspath.h"
|
||||
#include "settings/SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "settings/SourceGroupSettingsWithSourcePaths.h"
|
||||
#include "utility/CompilationDatabase.h"
|
||||
#include "utility/codeblocks/CodeblocksProject.h"
|
||||
#include "utility/file/FileManager.h"
|
||||
#include "utility/sonargraph/SonargraphProject.h"
|
||||
#include "utility/CompilationDatabase.h"
|
||||
#include "utility/ScopedFunctor.h"
|
||||
#include "utility/utility.h"
|
||||
#include "utility/utilityFile.h"
|
||||
@@ -241,16 +244,17 @@ std::vector<FilePath> QtProjectWizzardContentPathsSource::getFilePaths() const
|
||||
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
|
||||
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
|
||||
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> extensionSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_settings);
|
||||
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
|
||||
if (extensionSettings && pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
|
||||
{
|
||||
FileManager fileManager;
|
||||
fileManager.update(
|
||||
pathSettings->getSourcePathsExpandedAndAbsolute(),
|
||||
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
pathSettings->getSourceExtensions()
|
||||
extensionSettings->getSourceExtensions()
|
||||
);
|
||||
|
||||
const std::set<FilePath> filePaths = fileManager.getAllSourceFilePathsRelative(m_settings->getProjectDirectoryPath());
|
||||
@@ -283,7 +287,7 @@ std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPaths
|
||||
{
|
||||
for (const FilePath& path : sonargraphProject->getAllSourceFilePathsCanonical())
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getParentDirectory());
|
||||
indexedHeaderPaths.insert(path.getCanonical().getParentDirectory());
|
||||
}
|
||||
utility::append(indexedHeaderPaths, sonargraphProject->getAllCxxHeaderSearchPathsCanonical());
|
||||
}
|
||||
@@ -296,6 +300,32 @@ std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPaths
|
||||
return utility::getTopLevelPaths(indexedHeaderPaths);
|
||||
}
|
||||
|
||||
std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCodeblocksProject(
|
||||
std::shared_ptr<const SourceGroupSettingsCxxCodeblocks> settings)
|
||||
{
|
||||
const FilePath projectPath = settings->getProjectDirectoryPath();
|
||||
std::set<FilePath> indexedHeaderPaths;
|
||||
{
|
||||
const FilePath codeblocksProjectPath = settings->getCodeblocksProjectPathExpandedAndAbsolute();
|
||||
if (!codeblocksProjectPath.empty() && codeblocksProjectPath.exists())
|
||||
{
|
||||
if (std::shared_ptr<Codeblocks::Project> codeblocksProject = Codeblocks::Project::load(codeblocksProjectPath))
|
||||
{
|
||||
for (const FilePath& path : codeblocksProject->getAllSourceFilePathsCanonical(settings))
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getCanonical().getParentDirectory());
|
||||
}
|
||||
utility::append(indexedHeaderPaths, codeblocksProject->getAllCxxHeaderSearchPathsCanonical());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Unable to fetch indexed header paths. The provided Sonargraph project path does not exist.");
|
||||
}
|
||||
}
|
||||
return utility::getTopLevelPaths(indexedHeaderPaths);
|
||||
}
|
||||
|
||||
std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(
|
||||
std::shared_ptr<const SourceGroupSettingsCxxCdb> settings)
|
||||
{
|
||||
@@ -306,13 +336,13 @@ std::vector<FilePath> QtProjectWizzardContentIndexedHeaderPaths::getIndexedPaths
|
||||
{
|
||||
for (const FilePath& path : IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath))
|
||||
{
|
||||
indexedHeaderPaths.insert(path.getParentDirectory());
|
||||
indexedHeaderPaths.insert(path.getCanonical().getParentDirectory());
|
||||
}
|
||||
for (const FilePath& path : utility::CompilationDatabase(cdbPath).getAllHeaderPaths())
|
||||
{
|
||||
if (path.exists())
|
||||
{
|
||||
indexedHeaderPaths.insert(path);
|
||||
indexedHeaderPaths.insert(path.getCanonical());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -437,6 +467,38 @@ void QtProjectWizzardContentIndexedHeaderPaths::buttonClicked()
|
||||
m_settings->getProjectDirectoryPath()
|
||||
);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCodeblocks> codeblocksSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(m_settings))
|
||||
{
|
||||
const FilePath codeblocksProjectPath = codeblocksSettings->getCodeblocksProjectPathExpandedAndAbsolute();
|
||||
if (!codeblocksProjectPath.exists())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The provided Code::Blocks project path does not exist.");
|
||||
msgBox.setDetailedText(QString::fromStdWString(codeblocksProjectPath.wstr()));
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
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 "
|
||||
"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);
|
||||
|
||||
const FilePath projectPath = codeblocksSettings->getProjectDirectoryPath();
|
||||
|
||||
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(
|
||||
utility::convert<FilePath, FilePath>(
|
||||
getIndexedPathsDerivedFromCodeblocksProject(codeblocksSettings),
|
||||
[&](const FilePath& path) { return path.getRelativeTo(projectPath); }
|
||||
),
|
||||
codeblocksSettings->getIndexedHeaderPaths(),
|
||||
m_settings->getProjectDirectoryPath()
|
||||
);
|
||||
}
|
||||
else if (std::shared_ptr<SourceGroupSettingsCxxCdb> cdbSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(m_settings))
|
||||
{
|
||||
const FilePath cdbPath = cdbSettings->getCompilationDatabasePathExpandedAndAbsolute();
|
||||
@@ -471,8 +533,11 @@ void QtProjectWizzardContentIndexedHeaderPaths::buttonClicked()
|
||||
}
|
||||
}
|
||||
|
||||
m_filesDialog->showWindow();
|
||||
m_filesDialog->raise();
|
||||
if (m_filesDialog)
|
||||
{
|
||||
m_filesDialog->showWindow();
|
||||
m_filesDialog->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentIndexedHeaderPaths::savedFilesDialog()
|
||||
@@ -627,10 +692,11 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
|
||||
|
||||
std::thread([&]()
|
||||
{
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> extensionSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_settings);
|
||||
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
|
||||
if (extensionSettings && pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
|
||||
{
|
||||
std::vector<IncludeDirective> unresolvedIncludes;
|
||||
{
|
||||
@@ -651,7 +717,7 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
|
||||
fileManager.update(
|
||||
pathSettings->getSourcePathsExpandedAndAbsolute(),
|
||||
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
pathSettings->getSourceExtensions()
|
||||
extensionSettings->getSourceExtensions()
|
||||
);
|
||||
sourceFilePaths = fileManager.getAllSourceFilePaths();
|
||||
|
||||
@@ -695,13 +761,14 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
|
||||
// TODO: regard Force Includes here, too!
|
||||
const std::vector<FilePath> searchedPaths = m_settings->makePathsExpandedAndAbsolute(m_pathsDialog->getPaths());
|
||||
closedPathsDialog();
|
||||
|
||||
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::thread([=]()
|
||||
{
|
||||
std::thread([=]()
|
||||
std::shared_ptr<SourceGroupSettingsWithSourceExtensions> extensionSettings = std::dynamic_pointer_cast<SourceGroupSettingsWithSourceExtensions>(m_settings);
|
||||
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 (extensionSettings && pathSettings && excludeFilterSettings) // FIXME: pass msettings as required type
|
||||
{
|
||||
std::set<FilePath> detectedHeaderSearchPaths;
|
||||
{
|
||||
@@ -720,7 +787,7 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
|
||||
fileManager.update(
|
||||
pathSettings->getSourcePathsExpandedAndAbsolute(),
|
||||
excludeFilterSettings->getExcludeFiltersExpandedAndAbsolute(),
|
||||
pathSettings->getSourceExtensions()
|
||||
extensionSettings->getSourceExtensions()
|
||||
);
|
||||
sourceFilePaths = fileManager.getAllSourceFilePaths();
|
||||
|
||||
@@ -753,8 +820,8 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
|
||||
}
|
||||
|
||||
m_showDetectedIncludesResultFunctor(detectedHeaderSearchPaths);
|
||||
}).detach();
|
||||
}
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearch::finishedAcceptDetectedIncludePathsDialog()
|
||||
|
||||
@@ -14,6 +14,7 @@ class QPushButton;
|
||||
class QtPathListDialog;
|
||||
class SourceGroupSettings;
|
||||
class SourceGroupSettingsCxxCdb;
|
||||
class SourceGroupSettingsCxxCodeblocks;
|
||||
class SourceGroupSettingsCxxSonargraph;
|
||||
|
||||
class QtProjectWizzardContentPaths
|
||||
@@ -88,6 +89,7 @@ class QtProjectWizzardContentIndexedHeaderPaths
|
||||
|
||||
public:
|
||||
static std::vector<FilePath> getIndexedPathsDerivedFromSonargraphProject(std::shared_ptr<const SourceGroupSettingsCxxSonargraph> settings);
|
||||
static std::vector<FilePath> getIndexedPathsDerivedFromCodeblocksProject(std::shared_ptr<const SourceGroupSettingsCxxCodeblocks> settings);
|
||||
static std::vector<FilePath> getIndexedPathsDerivedFromCDB(std::shared_ptr<const SourceGroupSettingsCxxCdb> settings);
|
||||
|
||||
QtProjectWizzardContentIndexedHeaderPaths(
|
||||
|
||||
@@ -32,10 +32,12 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
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_C].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CODEBLOCKS));
|
||||
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_CPP].push_back(SourceGroupInfo(SOURCE_GROUP_CXX_CODEBLOCKS));
|
||||
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));
|
||||
@@ -47,6 +49,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
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_CXX_CODEBLOCKS] = L"empty_icon"; // TODO: change this
|
||||
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";
|
||||
@@ -62,6 +65,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
"<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_CXX_CODEBLOCKS] = "Create a new Source Group from an existing Code::Blocks 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.";
|
||||
|
||||
Reference in New Issue
Block a user