logic: source groups for project settings

* project can not have multiple source groups with different types
* language of a project is now inferred from source groups
* setting global NameHierarchy delimiter of first sourceGroup in project
* added project settings migrations for source groups
* Add Settings Migration classes (MoveKey, DeleteKey, Lambda)
* Update sample projects with migrations
* added method to config to retrieve sublevel key names
* implemented recursive removing of keys in settings
* moved project files out of top level
* removed solution parsing code as it is not used anymore

fortune cookie message = The secret of getting ahead is getting started.
This commit is contained in:
malte_langkabel
2017-03-31 16:11:37 +02:00
parent 25f3c4666a
commit 7b30ac18de
133 changed files with 2545 additions and 3386 deletions
-2
View File
@@ -148,8 +148,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/QtProjectWizzardContentBuildFile.cpp
qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h
qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp
qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h
qt/window/project_wizzard/QtProjectWizzardContentData.cpp
@@ -4,12 +4,12 @@
#include "utility/messaging/type/MessageActivateFile.h"
#include "utility/messaging/type/MessageProjectEdit.h"
#include "Application.h"
#include "Project.h"
#include "project/Project.h"
#include "qt/utility/QtContextMenu.h"
#include "qt/utility/utilityQt.h"
#include "settings/ColorScheme.h"
#include "utility/ResourcePaths.h"
#include "Application.h"
QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent)
: QPushButton(parent)
+8 -1
View File
@@ -415,7 +415,14 @@ void QtMainWindow::newProjectFromSolution(const std::string& ideId, const std::s
void QtMainWindow::newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths)
{
QtProjectWizzard* wizzard = createWindow<QtProjectWizzard>();
wizzard->newProjectFromCDB(filePath, headerPaths);
std::vector<FilePath> headerFilePaths(headerPaths.size());
for (const std::string& s: headerPaths)
{
headerFilePaths.push_back(FilePath(s));
}
wizzard->newProjectFromCDB(FilePath(filePath), headerFilePaths);
}
void QtMainWindow::openProject()
@@ -5,7 +5,6 @@
#include <QSysInfo>
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentData.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentExtensions.h"
@@ -16,8 +15,8 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
#include "settings/CxxProjectSettings.h"
#include "settings/JavaProjectSettings.h"
#include "settings/SourceGroupSettingsCxx.h"
#include "settings/SourceGroupSettingsJava.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageLoadProject.h"
@@ -28,6 +27,7 @@
#include "utility/utility.h"
#include "utility/utilityPathDetection.h"
#include "utility/utilityString.h"
#include "utility/UUIDUtility.h"
#include "Application.h"
@@ -46,9 +46,6 @@ QtProjectWizzard::QtProjectWizzard(QWidget* parent)
m_appSettings.setScrollSpeed(appSettings->getScrollSpeed());
m_appSettings.setCoatiPort(appSettings->getCoatiPort());
m_appSettings.setPluginPort(appSettings->getPluginPort());
m_parserManager = std::make_shared<SolutionParserManager>();
}
void QtProjectWizzard::showWindow()
@@ -73,129 +70,69 @@ void QtProjectWizzard::hideWindow()
void QtProjectWizzard::newProject()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentSelect>();
QtProjectWizzardWindow* window = createWindowWithContent(
[this](QtProjectWizzardWindow* window)
{
return new QtProjectWizzardContentSelect(window);
}
);
window->setPreferredSize(QSize(570, 380));
connect(dynamic_cast<QtProjectWizzardContentSelect*>(window->content()),
SIGNAL(selected(ProjectType)),
this, SLOT(selectedProjectType(ProjectType)));
SIGNAL(selected(SourceGroupType)),
this, SLOT(selectedProjectType(SourceGroupType)));
window->setNextEnabled(false);
window->setPreviousEnabled(false);
window->updateSubTitle("Type Selection");
}
void QtProjectWizzard::newProjectFromSolution(const std::string& ideId, const std::string& solutionPath)
void QtProjectWizzard::newProjectFromSolution(const std::string& ideId, const FilePath& solutionPath)
{
if (m_parserManager->canParseSolution(ideId))
{
std::shared_ptr<ProjectSettings> settings = m_parserManager->getProjectSettings(ideId, solutionPath);
// this looks rather hacky.. calling the edit project and then setting the title.
editProject(settings);
QWidget* widget = m_windowStack.getTopWindow();
if (widget)
{
QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(widget);
std::string title = "NEW PROJECT FROM ";
title += utility::toUpperCase(ideId);
title += " SOLUTION";
window->updateTitle(QString(title.c_str()));
window->updateNextButton("Create");
window->setPreviousVisible(m_windowStack.getWindowCount() > 0);
}
}
else
{
LOG_ERROR_STREAM(<< "Unknown solution type");
MessageStatus("Unable to parse given solution", true).dispatch();
}
int i = 0;
}
void QtProjectWizzard::newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths)
void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::vector<FilePath>& headerPaths)
{
FilePath fp(filePath);
m_projectSettings = std::make_shared<ProjectSettings>();
std::vector<FilePath> hp;
for (size_t i = 0; i < headerPaths.size(); i++)
{
hp.push_back(FilePath(headerPaths[i]));
}
std::shared_ptr<SourceGroupSettingsCxx> sourceGroupSettings = std::make_shared<SourceGroupSettingsCxx>(UUIDUtility::getUUIDString(), SOURCE_GROUP_CXX_VS, m_projectSettings.get());
m_projectSettings->setProjectName(filePath.withoutExtension().fileName());
m_projectSettings->setProjectFileLocation(filePath.parentDirectory());
sourceGroupSettings->setCompilationDatabasePath(filePath);
sourceGroupSettings->setSourcePaths(headerPaths);
m_sourceGroupSettings = sourceGroupSettings;
std::shared_ptr<CxxProjectSettings> settings = std::make_shared<CxxProjectSettings>();
settings->setLanguage(LanguageType::LANGUAGE_CPP);
settings->setProjectName(fp.withoutExtension().fileName());
settings->setProjectFileLocation(fp.parentDirectory());
settings->setCompilationDatabasePath(fp);
settings->setSourcePaths(hp);
m_settings = settings;
emptyProjectCDBVS();
}
void QtProjectWizzard::refreshProjectFromSolution(const std::string& ideId, const std::string& solutionPath)
{
if (m_parserManager->canParseSolution(ideId))
{
QtProjectWizzardWindow* window = dynamic_cast<QtProjectWizzardWindow*>(m_windowStack.getTopWindow());
if (window)
{
window->content()->save();
}
std::shared_ptr<ProjectSettings> settings = m_parserManager->getProjectSettings(ideId, solutionPath);
std::shared_ptr<CxxProjectSettings> otherCxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(settings);
std::shared_ptr<CxxProjectSettings> ownCxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
if (otherCxxSettings && ownCxxSettings)
{
ownCxxSettings->setSourcePaths(otherCxxSettings->getSourcePaths());
ownCxxSettings->setHeaderSearchPaths(otherCxxSettings->getHeaderSearchPaths());
ownCxxSettings->setVisualStudioSolutionPath(FilePath(solutionPath));
}
if (window)
{
window->content()->load();
}
}
else
{
LOG_ERROR_STREAM(<< "Unknown solution type");
MessageStatus("Unable to parse given solution", true).dispatch();
}
int i = 0;
}
void QtProjectWizzard::editProject(const FilePath& settingsPath)
{
std::shared_ptr<ProjectSettings> settings;
switch (ProjectSettings::getLanguageOfProject(settingsPath))
{
case LANGUAGE_C:
case LANGUAGE_CPP:
settings = std::make_shared<CxxProjectSettings>(settingsPath);
break;
case LANGUAGE_JAVA:
settings = std::make_shared<JavaProjectSettings>(settingsPath);
break;
default:
return;
}
if (settings)
{
settings->reload();
editProject(settings);
}
std::shared_ptr<ProjectSettings> settings = std::make_shared<ProjectSettings>(settingsPath);
settings->reload();
editProject(settings);
}
void QtProjectWizzard::editProject(std::shared_ptr<ProjectSettings> settings)
{
m_settings = settings;
m_projectSettings = settings;
{
const std::vector<std::shared_ptr<SourceGroupSettings>> allSourceGroupSettings = m_projectSettings->getAllSourceGroupSettings();
if (!allSourceGroupSettings.empty())
{
// Todo: regard the rest of the source groups once we can have more than one in a project.
m_sourceGroupSettings = allSourceGroupSettings.front();
}
}
m_editing = true;
switch (m_settings->getLanguage())
switch (getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType()))
{
case LANGUAGE_JAVA:
showSummaryJava();
@@ -218,12 +155,12 @@ void QtProjectWizzard::showPreferences()
{
summary->setIsForm(true);
summary->addContent(new QtProjectWizzardContentPreferences(m_settings, window));
summary->addContent(new QtProjectWizzardContentPreferences(window));
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(window));
if (QSysInfo::macVersion() != QSysInfo::MV_None)
{
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(window));
}
window->setup();
@@ -264,15 +201,15 @@ bool QtProjectWizzard::applicationSettingsContainVisualStudioHeaderSearchPaths()
return false;
}
template<typename T>
QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent()
{
QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent(
std::function<QtProjectWizzardContent*(QtProjectWizzardWindow*)> func
){
QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
connect(window, SIGNAL(previous()), &m_windowStack, SLOT(popWindow()));
connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard()));
window->setContent(new T(m_settings, window));
window->setContent(func(window));
window->setPreferredSize(QSize(580, 340));
window->setup();
@@ -281,25 +218,6 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent()
return window;
}
template<>
QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent<QtProjectWizzardContentSelect>()
{
QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
connect(window, SIGNAL(previous()), &m_windowStack, SLOT(popWindow()));
connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard()));
QtProjectWizzardContentSelect* content = new QtProjectWizzardContentSelect(m_settings, window, m_parserManager);
window->setContent(content);
window->setPreferredSize(QSize(570, 380));
window->setup();
m_windowStack.pushWindow(window);
return window;
}
QtProjectWizzardWindow* QtProjectWizzard::createWindowWithSummary(
std::function<void(QtProjectWizzardWindow*, QtProjectWizzardContentSummary*)> func
){
@@ -308,7 +226,7 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithSummary(
connect(window, SIGNAL(previous()), &m_windowStack, SLOT(popWindow()));
connect(window, SIGNAL(canceled()), this, SLOT(cancelWizzard()));
QtProjectWizzardContentSummary* summary = new QtProjectWizzardContentSummary(m_settings, window);
QtProjectWizzardContentSummary* summary = new QtProjectWizzardContentSummary(window);
window->setContent(summary);
window->setPreferredSize(QSize(750, 500));
@@ -341,43 +259,41 @@ void QtProjectWizzard::windowStackChanged()
}
}
void QtProjectWizzard::selectedProjectType(ProjectType projectType)
void QtProjectWizzard::selectedProjectType(SourceGroupType sourceGroupType)
{
LanguageType languageType = getLanguageTypeForProjectType(projectType);
switch (projectType)
m_projectSettings = std::make_shared<ProjectSettings>();
const std::string sourceGroupId = UUIDUtility::getUUIDString();
switch (sourceGroupType)
{
case PROJECT_C_EMPTY:
case PROJECT_CPP_EMPTY:
m_settings = std::make_shared<CxxProjectSettings>();
case SOURCE_GROUP_C_EMPTY:
case SOURCE_GROUP_CPP_EMPTY:
m_sourceGroupSettings = std::make_shared<SourceGroupSettingsCxx>(sourceGroupId, sourceGroupType, m_projectSettings.get());
if (applicationSettingsContainVisualStudioHeaderSearchPaths())
{
std::vector<std::string> flags;
flags.push_back("-fms-extensions");
flags.push_back("-fms-compatibility");
flags.push_back("-fms-compatibility-version=19");
std::dynamic_pointer_cast<CxxProjectSettings>(m_settings)->setCompilerFlags(flags);
std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_sourceGroupSettings)->setCompilerFlags(flags);
}
m_settings->setLanguage(languageType);
emptyProject();
break;
case PROJECT_CXX_CDB:
m_settings = std::make_shared<CxxProjectSettings>();
m_settings->setLanguage(languageType);
case SOURCE_GROUP_CXX_CDB:
m_sourceGroupSettings = std::make_shared<SourceGroupSettingsCxx>(sourceGroupId, sourceGroupType, m_projectSettings.get());
emptyProjectCDB();
break;
case PROJECT_CXX_VS:
m_settings = std::make_shared<CxxProjectSettings>();
m_settings->setLanguage(languageType);
case SOURCE_GROUP_CXX_VS:
m_sourceGroupSettings = std::make_shared<SourceGroupSettingsCxx>(sourceGroupId, sourceGroupType, m_projectSettings.get()); // maybe use a different type here
emptyProjectCDBVS();
break;
case PROJECT_JAVA_EMPTY:
m_settings = std::make_shared<JavaProjectSettings>();
m_settings->setLanguage(languageType);
case SOURCE_GROUP_JAVA_EMPTY:
m_sourceGroupSettings = std::make_shared<SourceGroupSettingsJava>(sourceGroupId, sourceGroupType, m_projectSettings.get());
emptyProject();
break;
case PROJECT_JAVA_MAVEN:
m_settings = std::make_shared<JavaProjectSettings>();
m_settings->setLanguage(languageType);
case SOURCE_GROUP_JAVA_MAVEN:
m_sourceGroupSettings = std::make_shared<SourceGroupSettingsJava>(sourceGroupId, sourceGroupType, m_projectSettings.get());
emptyProjectJavaMaven();
break;
}
@@ -385,17 +301,67 @@ void QtProjectWizzard::selectedProjectType(ProjectType projectType)
void QtProjectWizzard::emptyProject()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentData>();
window->updateSubTitle("Project Data");
QtProjectWizzardWindow* window;
if (m_settings->getLanguage() == LANGUAGE_JAVA)
{
connect(window, SIGNAL(next()), this, SLOT(sourcePathsJava()));
}
else
switch (m_sourceGroupSettings->getType())
{
case SOURCE_GROUP_C_EMPTY:
case SOURCE_GROUP_CPP_EMPTY:
window = createWindowWithContent(
[this](QtProjectWizzardWindow* window)
{
return new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window);
}
);
connect(window, SIGNAL(next()), this, SLOT(sourcePaths()));
break;
case SOURCE_GROUP_JAVA_EMPTY:
window = createWindowWithContent(
[this](QtProjectWizzardWindow* window)
{
return new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window);
}
);
connect(window, SIGNAL(next()), this, SLOT(sourcePathsJava()));
break;
}
window->updateSubTitle("Project Data");
}
void QtProjectWizzard::emptyProjectCDBVS()
{
QtProjectWizzardWindow* window = window = createWindowWithContent(
[this](QtProjectWizzardWindow* window)
{
return new QtProjectWizzardContentDataCDBVS(m_projectSettings, m_sourceGroupSettings, window);
}
);
connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB()));
window->updateSubTitle("Project Data");
}
void QtProjectWizzard::emptyProjectCDB()
{
QtProjectWizzardWindow* window = createWindowWithContent(
[this](QtProjectWizzardWindow* window)
{
return new QtProjectWizzardContentDataCDB(m_projectSettings, m_sourceGroupSettings, window);
}
);
connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB()));
window->updateSubTitle("Project Data");
}
void QtProjectWizzard::emptyProjectJavaMaven()
{
QtProjectWizzardWindow* window = window = createWindowWithContent(
[this](QtProjectWizzardWindow* window)
{
return new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window);
}
);
connect(window, SIGNAL(next()), this, SLOT(sourcePathsJavaMaven()));
window->updateSubTitle("Project Data");
}
void QtProjectWizzard::sourcePaths()
@@ -403,9 +369,9 @@ void QtProjectWizzard::sourcePaths()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
summary->addContent(new QtProjectWizzardContentPathsSource(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsSource(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window));
summary->addContent(new QtProjectWizzardContentExtensions(m_sourceGroupSettings, window));
window->setup();
}
@@ -420,9 +386,9 @@ void QtProjectWizzard::headerSearchPaths()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(window));
window->setup();
}
@@ -449,9 +415,9 @@ void QtProjectWizzard::frameworkSearchPaths()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(window));
window->setup();
}
@@ -461,38 +427,14 @@ void QtProjectWizzard::frameworkSearchPaths()
window->updateSubTitle("Framework Search Paths");
}
void QtProjectWizzard::emptyProjectCDBVS()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentDataCDBVS>();
connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB()));
window->updateSubTitle("Project Data");
}
void QtProjectWizzard::emptyProjectCDB()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentDataCDB>();
connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB()));
window->updateSubTitle("Project Data");
}
void QtProjectWizzard::emptyProjectJavaMaven()
{
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentData>();
connect(window, SIGNAL(next()), this, SLOT(sourcePathsJavaMaven()));
window->updateSubTitle("Project Data");
}
void QtProjectWizzard::headerPathsCDB()
{
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
summary->addContent(new QtProjectWizzardContentCDBSource(m_settings, window));
summary->addContent(new QtProjectWizzardContentCDBSource(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_sourceGroupSettings, window));
window->setup();
}
@@ -507,9 +449,9 @@ void QtProjectWizzard::sourcePathsJava()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
summary->addContent(new QtProjectWizzardContentPathsSource(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsSource(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsClassJava(m_sourceGroupSettings, window));
window->setup();
}
@@ -521,16 +463,16 @@ void QtProjectWizzard::sourcePathsJava()
void QtProjectWizzard::sourcePathsJavaMaven()
{
std::dynamic_pointer_cast<JavaProjectSettings>(m_settings)->setMavenDependenciesDirectory(
"./coati_dependencies/" + utility::replace(m_settings->getProjectName(), " ", "_") + "/maven"
std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_sourceGroupSettings)->setMavenDependenciesDirectory(
"./coati_dependencies/" + utility::replace(m_projectSettings->getProjectName(), " ", "_") + "/maven"
);
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
summary->addContent(new QtProjectWizzardContentPathSourceMaven(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathSourceMaven(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(m_sourceGroupSettings, window));
window->setup();
}
@@ -545,9 +487,9 @@ void QtProjectWizzard::advancedSettingsCxx()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
summary->addContent(new QtProjectWizzardContentFlags(m_settings, window));
summary->addContent(new QtProjectWizzardContentFlags(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsExclude(m_sourceGroupSettings, window));
window->setup();
}
@@ -562,9 +504,9 @@ void QtProjectWizzard::advancedSettingsJava()
QtProjectWizzardWindow* window = createWindowWithSummary(
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
{
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window));
summary->addContent(new QtProjectWizzardContentExtensions(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsExclude(m_sourceGroupSettings, window));
window->setup();
}
@@ -581,49 +523,48 @@ void QtProjectWizzard::showSummary()
{
summary->setIsForm(true);
QtProjectWizzardContentBuildFile* buildFile = new QtProjectWizzardContentBuildFile(m_settings, window);
const bool isCDB = buildFile->getType() == PROJECT_CXX_CDB || buildFile->getType() == PROJECT_CXX_VS;
const bool isCDB = m_sourceGroupSettings->getType() == SOURCE_GROUP_CXX_CDB || m_sourceGroupSettings->getType() == SOURCE_GROUP_CXX_CDB;
if (!isCDB)
{
summary->addContent(new QtProjectWizzardContentData(m_settings, window, m_editing));
summary->addContent(new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window, m_editing));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsSource(m_settings, window));
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsSource(m_sourceGroupSettings, window));
summary->addContent(new QtProjectWizzardContentExtensions(m_sourceGroupSettings, window));
summary->addSpace();
}
else
{
summary->addContent(new QtProjectWizzardContentDataCDB(m_settings, window, m_editing));
summary->addContent(new QtProjectWizzardContentDataCDB(m_projectSettings, m_sourceGroupSettings, window, m_editing));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_sourceGroupSettings, window));
summary->addSpace();
}
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window, isCDB));
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_sourceGroupSettings, window, isCDB));
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_sourceGroupSettings);
if (!isCDB && cxxSettings && cxxSettings->getHasDefinedUseSourcePathsForHeaderSearch())
{
summary->addSpace();
summary->addContent(new QtProjectWizzardContentSimple(m_settings, window));
summary->addContent(new QtProjectWizzardContentSimple(m_sourceGroupSettings, window));
}
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(window));
summary->addSpace();
if (QSysInfo::macVersion() != QSysInfo::MV_None)
{
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_settings, window, isCDB));
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearch(m_sourceGroupSettings, window, isCDB));
summary->addContent(new QtProjectWizzardContentPathsFrameworkSearchGlobal(window));
summary->addSpace();
}
summary->addContent(new QtProjectWizzardContentFlags(m_settings, window));
summary->addContent(new QtProjectWizzardContentFlags(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsExclude(m_sourceGroupSettings, window));
window->setup();
@@ -652,33 +593,33 @@ void QtProjectWizzard::showSummaryJava()
summary->setIsForm(true);
bool isMaven = false;
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_sourceGroupSettings);
if (javaSettings)
{
isMaven = javaSettings->getAbsoluteMavenProjectFilePath().exists();
}
summary->addContent(new QtProjectWizzardContentData(m_settings, window, m_editing));
summary->addContent(new QtProjectWizzardContentData(m_projectSettings, m_sourceGroupSettings, window, m_editing));
summary->addSpace();
if (isMaven)
{
summary->addContent(new QtProjectWizzardContentPathSourceMaven(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathSourceMaven(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathDependenciesMaven(m_sourceGroupSettings, window));
}
else
{
summary->addContent(new QtProjectWizzardContentPathsSource(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsSource(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsClassJava(m_sourceGroupSettings, window));
}
summary->addSpace();
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window));
summary->addContent(new QtProjectWizzardContentExtensions(m_sourceGroupSettings, window));
summary->addSpace();
summary->addContent(new QtProjectWizzardContentPathsExclude(m_settings, window));
summary->addContent(new QtProjectWizzardContentPathsExclude(m_sourceGroupSettings, window));
window->setup();
@@ -701,10 +642,11 @@ void QtProjectWizzard::showSummaryJava()
void QtProjectWizzard::createProject()
{
FilePath path = m_settings->getFilePath();
FilePath path = m_projectSettings->getFilePath();
m_settings->setVersion(ProjectSettings::VERSION);
m_settings->save(path);
m_projectSettings->setVersion(ProjectSettings::VERSION);
m_projectSettings->setAllSourceGroupSettings({m_sourceGroupSettings});
m_projectSettings->save(path);
bool forceRefreshProject = false;
if (m_editing)
@@ -714,7 +656,7 @@ void QtProjectWizzard::createProject()
Application* application = Application::getInstance().get();
if (application->getCurrentProject() != NULL)
{
settingsChanged = !(application->getCurrentProject()->settingsEqualExceptNameAndLocation(*(m_settings.get())));
settingsChanged = !(application->getCurrentProject()->settingsEqualExceptNameAndLocation(*(m_projectSettings.get())));
}
bool appSettingsChanged = !(m_appSettings == *ApplicationSettings::getInstance().get());
@@ -9,8 +9,6 @@
#include "settings/ApplicationSettings.h"
#include "settings/ProjectSettings.h"
#include "utility/solution/SolutionParserManager.h"
class QtProjectWizzardContentSummary;
class QtProjectWizzardWindow;
@@ -33,8 +31,8 @@ public:
public slots:
void newProject();
void newProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
void newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths);
void newProjectFromSolution(const std::string& ideId, const FilePath& solutionPath);
void newProjectFromCDB(const FilePath& filePath, const std::vector<FilePath>& headerPaths);
void refreshProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
void editProject(const FilePath& settingsPath);
@@ -44,30 +42,32 @@ public slots:
private:
static bool applicationSettingsContainVisualStudioHeaderSearchPaths();
template<typename T>
QtProjectWizzardWindow* createWindowWithContent();
QtProjectWizzardWindow* createWindowWithContent(
std::function<QtProjectWizzardContent*(QtProjectWizzardWindow*)> func);
QtProjectWizzardWindow* createWindowWithSummary(
std::function<void(QtProjectWizzardWindow*, QtProjectWizzardContentSummary*)> func);
QtWindowStack m_windowStack;
std::shared_ptr<ProjectSettings> m_settings;
std::shared_ptr<ProjectSettings> m_projectSettings;
std::shared_ptr<SourceGroupSettings> m_sourceGroupSettings;
ApplicationSettings m_appSettings;
bool m_editing;
std::shared_ptr<SolutionParserManager> m_parserManager;
private slots:
void cancelWizzard();
void finishWizzard();
void windowStackChanged();
void selectedProjectType(ProjectType type);
void selectedProjectType(SourceGroupType sourceGroupType);
void emptyProject();
void emptyProjectCDBVS();
void emptyProjectCDB();
void emptyProjectJavaMaven();
void sourcePaths();
void headerSearchPaths();
@@ -75,10 +75,6 @@ private slots:
void headerSearchPathsDone();
void frameworkSearchPaths();
void emptyProjectCDBVS();
void emptyProjectCDB();
void emptyProjectJavaMaven();
void headerPathsCDB();
void sourcePathsJava();
@@ -94,7 +90,4 @@ private slots:
void savePreferences();
};
template<>
QtProjectWizzardWindow* QtProjectWizzard::createWindowWithContent<QtProjectWizzardContentSelect>();
#endif // QT_PROJECT_WIZZARD_H
@@ -37,9 +37,8 @@ void QtHelpButton::handleHelpPress()
}
QtProjectWizzardContent::QtProjectWizzardContent(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
QtProjectWizzardContent::QtProjectWizzardContent(QtProjectWizzardWindow* window)
: QWidget(window)
, m_settings(settings)
, m_window(window)
, m_isInForm(false)
, m_showFilesFunctor(std::bind(&QtProjectWizzardContent::showFilesDialog, this, std::placeholders::_1))
@@ -35,7 +35,7 @@ class QtProjectWizzardContent
Q_OBJECT
public:
QtProjectWizzardContent(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContent(QtProjectWizzardWindow* window);
virtual void populate(QGridLayout* layout, int& row);
virtual void windowReady();
@@ -61,7 +61,6 @@ protected:
QtHelpButton* addHelpButton(QString helpString, QGridLayout* layout, int row) const;
QPushButton* addFilesButton(QString name, QGridLayout* layout, int row) const;
std::shared_ptr<ProjectSettings> m_settings;
QtProjectWizzardWindow* m_window;
std::shared_ptr<QtTextEditDialog> m_filesDialog;
@@ -1,132 +0,0 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentBuildFile.h"
#include <QMessageBox>
#include <QPushButton>
#include "utility/ResourcePaths.h"
#include "qt/element/QtIconButton.h"
#include "qt/element/QtLocationPicker.h"
#include "settings/CxxProjectSettings.h"
QtProjectWizzardContentBuildFile::QtProjectWizzardContentBuildFile(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(settings, window)
, m_type(PROJECT_UNKNOWN)
{
m_type = m_settings->getProjectType();
}
ProjectType QtProjectWizzardContentBuildFile::getType() const
{
return m_type;
}
void QtProjectWizzardContentBuildFile::populate(QGridLayout* layout, int& row)
{
QString name;
QString filter;
switch (m_type)
{
case PROJECT_C_EMPTY:
case PROJECT_CPP_EMPTY:
name = "Build Text";
filter = "Text (*.txt)";
return;
case PROJECT_CXX_VS:
case PROJECT_CXX_CDB:
name = "Compilation Database";
filter = "JSON Compilation Database (*.json)";
break;
default:
return;
}
QLabel* label = createFormLabel(name);
layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL);
m_picker = new QtLocationPicker(this);
m_picker->setFileFilter(filter);
m_picker->setRelativeRootDirectory(m_settings->getProjectFileLocation());
layout->addWidget(m_picker, row, QtProjectWizzardWindow::BACK_COL);
row++;
}
void QtProjectWizzardContentBuildFile::load()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
if (cxxSettings)
{
switch (m_type)
{
case PROJECT_C_EMPTY:
case PROJECT_CPP_EMPTY:
return;
case PROJECT_CXX_VS:
case PROJECT_CXX_CDB:
m_picker->setText(QString::fromStdString(cxxSettings->getCompilationDatabasePath().str()));
break;
default:
return;
}
}
}
void QtProjectWizzardContentBuildFile::save()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
if (cxxSettings)
{
switch (m_type)
{
case PROJECT_C_EMPTY:
case PROJECT_CPP_EMPTY:
break;
case PROJECT_CXX_VS:
case PROJECT_CXX_CDB:
{
FilePath path = m_picker->getText().toStdString();
FilePath absPath = m_settings->makePathAbsolute(m_settings->expandPath(path));
if (!absPath.exists() || absPath.extension() != ".json")
{
return;
}
cxxSettings->setCompilationDatabasePath(path);
break;
}
default:
return;
}
}
}
bool QtProjectWizzardContentBuildFile::check()
{
switch (m_type)
{
case PROJECT_C_EMPTY:
case PROJECT_CPP_EMPTY:
break;
case PROJECT_CXX_VS:
case PROJECT_CXX_CDB:
{
FilePath path = m_picker->getText().toStdString();
FilePath absPath = m_settings->makePathAbsolute(m_settings->expandPath(path));
if (!absPath.exists() || absPath.extension() != ".json")
{
QMessageBox msgBox;
msgBox.setText("Please enter a valid compilation database file (*.json).");
msgBox.exec();
return false;
}
}
default:
break;
}
return true;
}
@@ -1,36 +0,0 @@
#ifndef QT_PROJECT_WIZZARD_CONTENT_BUILD_FILE_H
#define QT_PROJECT_WIZZARD_CONTENT_BUILD_FILE_H
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
#include "qt/window/project_wizzard/QtProjectWizzardContentSelect.h"
class QtLocationPicker;
class QPushButton;
class QtProjectWizzardContentBuildFile
: public QtProjectWizzardContent
{
Q_OBJECT
signals:
void refreshVisualStudioSolution(const std::string& ideId, const std::string& solutionPath);
public:
QtProjectWizzardContentBuildFile(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
ProjectType getType() const;
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
virtual void load() override;
virtual void save() override;
virtual bool check() override;
private:
QtLocationPicker* m_picker;
ProjectType m_type;
};
#endif // QT_PROJECT_WIZZARD_CONTENT_BUILD_FILE_H
@@ -1,12 +1,13 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentCDBSource.h"
#include "settings/CxxProjectSettings.h"
#include "settings/SourceGroupSettingsCxx.h"
#include "data/indexer/IndexerCxxCdb.h"
QtProjectWizzardContentCDBSource::QtProjectWizzardContentCDBSource(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(settings, window)
: QtProjectWizzardContent(window)
, m_settings(settings)
, m_text(nullptr)
{
}
@@ -29,10 +30,10 @@ void QtProjectWizzardContentCDBSource::load()
{
m_fileNames.clear();
FilePath projectPath = m_settings->getProjectFileLocation();
const FilePath projectPath = m_settings->getProjectFileLocation();
std::vector<FilePath> excludePaths = m_settings->getAbsoluteExcludePaths();
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
std::vector<FilePath> filePaths = IndexerCxxCdb::getSourceFilesFromCDB(cxxSettings->getAbsoluteCompilationDatabasePath());
@@ -9,7 +9,7 @@ class QtProjectWizzardContentCDBSource
Q_OBJECT
public:
QtProjectWizzardContentCDBSource(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentCDBSource(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -21,6 +21,7 @@ public:
virtual QString getFileNamesDescription() const override;
private:
std::shared_ptr<SourceGroupSettings> m_settings;
QLabel* m_text;
std::vector<std::string> m_fileNames;
};
@@ -3,15 +3,19 @@
#include <QFormLayout>
#include <QMessageBox>
#include "settings/CxxProjectSettings.h"
#include "settings/SourceGroupSettingsCxx.h"
#include "utility/messaging/type/MessageIDECreateCDB.h"
#include "utility/logging/logging.h"
QtProjectWizzardContentData::QtProjectWizzardContentData(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool disableNameEditing
std::shared_ptr<ProjectSettings> projectSettings,
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
QtProjectWizzardWindow* window,
bool disableNameEditing
)
: QtProjectWizzardContent(settings, window)
: QtProjectWizzardContent(window)
, m_projectSettings(projectSettings)
, m_sourceGroupSettings(sourceGroupSettings)
, m_disableNameEditing(disableNameEditing)
, m_projectName(nullptr)
, m_projectFileLocation(nullptr)
@@ -49,13 +53,13 @@ void QtProjectWizzardContentData::load()
{
if (m_projectName)
{
m_projectName->setText(QString::fromStdString(m_settings->getProjectName()));
m_projectFileLocation->setText(QString::fromStdString(m_settings->getProjectFileLocation().str()));
m_projectName->setText(QString::fromStdString(m_projectSettings->getProjectName()));
m_projectFileLocation->setText(QString::fromStdString(m_projectSettings->getProjectFileLocation().str()));
}
if (m_language)
{
LanguageType type = m_settings->getLanguage();
LanguageType type = getLanguageTypeForSourceGroupType(m_sourceGroupSettings->getType());
if (type == LANGUAGE_UNKNOWN)
{
@@ -66,13 +70,13 @@ void QtProjectWizzardContentData::load()
m_language->setText(languageTypeToString(type).c_str());
m_standard->clear();
std::vector<std::string> standards = m_settings->getLanguageStandards();
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_settings->getStandard()));
m_standard->setCurrentText(QString::fromStdString(m_sourceGroupSettings->getStandard()));
}
}
@@ -80,13 +84,13 @@ void QtProjectWizzardContentData::save()
{
if (m_projectName)
{
m_settings->setProjectName(m_projectName->text().toStdString());
m_settings->setProjectFileLocation(m_projectFileLocation->getText().toStdString());
m_projectSettings->setProjectName(m_projectName->text().toStdString());
m_projectSettings->setProjectFileLocation(m_projectFileLocation->getText().toStdString());
}
if (m_standard)
{
m_settings->setStandard(m_standard->currentText().toStdString());
m_sourceGroupSettings->setStandard(m_standard->currentText().toStdString());
}
}
@@ -188,8 +192,12 @@ void QtProjectWizzardContentData::addBuildFilePicker(
QtProjectWizzardContentDataCDB::QtProjectWizzardContentDataCDB(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool disableNameEditing)
: QtProjectWizzardContentData(settings, window, disableNameEditing)
std::shared_ptr<ProjectSettings> projectSettings,
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
QtProjectWizzardWindow* window,
bool disableNameEditing
)
: QtProjectWizzardContentData(projectSettings, sourceGroupSettings, window, disableNameEditing)
{
}
@@ -219,7 +227,7 @@ void QtProjectWizzardContentDataCDB::populate(QGridLayout* layout, int& row)
void QtProjectWizzardContentDataCDB::load()
{
QtProjectWizzardContentData::load();
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_sourceGroupSettings);
if (cxxSettings)
{
m_buildFilePicker->setText(QString::fromStdString(cxxSettings->getCompilationDatabasePath().str()));
@@ -231,13 +239,13 @@ void QtProjectWizzardContentDataCDB::save()
QtProjectWizzardContentData::save();
FilePath path = m_buildFilePicker->getText().toStdString();
FilePath absPath = m_settings->makePathAbsolute(m_settings->expandPath(path));
FilePath absPath = m_projectSettings->makePathAbsolute(m_projectSettings->expandPath(path)); // maybe we can use SourceGroupSettings for this... that's where the the cdb path is stored.
if (!absPath.exists() || absPath.extension() != ".json")
{
return;
}
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_sourceGroupSettings);
if (cxxSettings)
{
cxxSettings->setCompilationDatabasePath(path);
@@ -252,7 +260,7 @@ bool QtProjectWizzardContentDataCDB::check()
}
FilePath path = m_buildFilePicker->getText().toStdString();
FilePath absPath = m_settings->makePathAbsolute(m_settings->expandPath(path));
FilePath absPath = m_projectSettings->makePathAbsolute(m_projectSettings->expandPath(path));
if (!absPath.exists() || absPath.extension() != ".json")
{
QMessageBox msgBox;
@@ -266,7 +274,7 @@ bool QtProjectWizzardContentDataCDB::check()
void QtProjectWizzardContentDataCDB::pickedCDBPath()
{
FilePath projectPath = m_settings->getProjectFileLocation();
FilePath projectPath = m_projectSettings->getProjectFileLocation();
if (m_projectFileLocation)
{
projectPath = FilePath(m_projectFileLocation->getText().toStdString());
@@ -285,8 +293,12 @@ void QtProjectWizzardContentDataCDB::pickedCDBPath()
}
QtProjectWizzardContentDataCDBVS::QtProjectWizzardContentDataCDBVS(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContentDataCDB(settings, window, false)
QtProjectWizzardContentDataCDBVS::QtProjectWizzardContentDataCDBVS(
std::shared_ptr<ProjectSettings> projectSettings,
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
QtProjectWizzardWindow* window
)
: QtProjectWizzardContentDataCDB(projectSettings, sourceGroupSettings, window, false)
{
}
@@ -14,7 +14,10 @@ class QtProjectWizzardContentData
public:
QtProjectWizzardContentData(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool disableNameEditing = false);
std::shared_ptr<ProjectSettings> projectSettings,
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
QtProjectWizzardWindow* window,
bool disableNameEditing = false);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -28,6 +31,9 @@ protected:
virtual void addLanguageAndStandard(QGridLayout* layout, int& row);
virtual void addBuildFilePicker(QGridLayout* layout, int& row, const QString& name, const QString& filter);
std::shared_ptr<ProjectSettings> m_projectSettings;
std::shared_ptr<SourceGroupSettings> m_sourceGroupSettings;
bool m_disableNameEditing;
QLineEdit* m_projectName;
QtLocationPicker* m_projectFileLocation;
@@ -46,7 +52,10 @@ class QtProjectWizzardContentDataCDB
public:
QtProjectWizzardContentDataCDB(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool disableNameEditing = false);
std::shared_ptr<ProjectSettings> projectSettings,
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
QtProjectWizzardWindow* window,
bool disableNameEditing = false);
virtual void populate(QGridLayout* layout, int& row) override;
@@ -65,7 +74,10 @@ class QtProjectWizzardContentDataCDBVS
Q_OBJECT
public:
QtProjectWizzardContentDataCDBVS(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentDataCDBVS(
std::shared_ptr<ProjectSettings> projectSettings,
std::shared_ptr<SourceGroupSettings> sourceGroupSettings,
QtProjectWizzardWindow* window);
virtual void populate(QGridLayout* layout, int& row) override;
@@ -2,12 +2,14 @@
#include <QFormLayout>
#include "settings/SourceGroupSettings.h"
#include "qt/element/QtDirectoryListBox.h"
QtProjectWizzardContentExtensions::QtProjectWizzardContentExtensions(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(settings, window)
: QtProjectWizzardContent(window)
, m_settings(settings)
{
}
@@ -11,7 +11,7 @@ class QtProjectWizzardContentExtensions
Q_OBJECT
public:
QtProjectWizzardContentExtensions(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentExtensions(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -20,6 +20,8 @@ public:
virtual void save() override;
private:
std::shared_ptr<SourceGroupSettings> m_settings;
QtDirectoryListBox* m_sourceList;
};
@@ -3,10 +3,11 @@
#include <QFormLayout>
#include "qt/element/QtDirectoryListBox.h"
#include "settings/CxxProjectSettings.h"
#include "settings/SourceGroupSettingsCxx.h"
QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(settings, window)
QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(window)
, m_settings(settings)
{
}
@@ -25,7 +26,7 @@ void QtProjectWizzardContentFlags::populate(QGridLayout* layout, int& row)
void QtProjectWizzardContentFlags::load()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
m_list->setStringList(cxxSettings->getCompilerFlags());
@@ -34,7 +35,7 @@ void QtProjectWizzardContentFlags::load()
void QtProjectWizzardContentFlags::save()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
cxxSettings->setCompilerFlags(m_list->getStringList());
@@ -11,7 +11,7 @@ class QtProjectWizzardContentFlags
Q_OBJECT
public:
QtProjectWizzardContentFlags(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentFlags(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -20,6 +20,8 @@ public:
virtual void save() override;
private:
std::shared_ptr<SourceGroupSettings> m_settings;
QtDirectoryListBox* m_list;
};
@@ -9,15 +9,16 @@
#include "component/view/DialogView.h"
#include "qt/element/QtLocationPicker.h"
#include "settings/ApplicationSettings.h"
#include "settings/JavaProjectSettings.h"
#include "settings/SourceGroupSettingsJava.h"
#include "utility/file/FileManager.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/utilityMaven.h"
#include "utility/ScopedFunctor.h"
#include "Application.h"
QtProjectWizzardContentPath::QtProjectWizzardContentPath(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(settings, window)
QtProjectWizzardContentPath::QtProjectWizzardContentPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(window)
, m_settings(settings)
, m_makePathRelativeToProjectFileLocation(true)
{
}
@@ -68,7 +69,7 @@ void QtProjectWizzardContentPath::setHelpString(const QString& help)
}
QtProjectWizzardContentPathSourceMaven::QtProjectWizzardContentPathSourceMaven(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
{
@@ -101,7 +102,7 @@ void QtProjectWizzardContentPathSourceMaven::populate(QGridLayout* layout, int&
void QtProjectWizzardContentPathSourceMaven::load()
{
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
{
m_picker->setText(QString::fromStdString(javaSettings->getMavenProjectFilePath().str()));
@@ -111,7 +112,7 @@ void QtProjectWizzardContentPathSourceMaven::load()
void QtProjectWizzardContentPathSourceMaven::save()
{
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
{
javaSettings->setMavenProjectFilePath(m_picker->getText().toStdString());
@@ -121,7 +122,7 @@ void QtProjectWizzardContentPathSourceMaven::save()
std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames() const
{
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath();
const FilePath mavenProjectRoot = javaSettings->getAbsoluteMavenProjectFilePath().parentDirectory();
@@ -150,16 +151,15 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
);
FileManager fileManager;
fileManager.setPaths(
fileManager.update(
sourceDirectories,
std::vector<FilePath>(), // we don't need to specify header paths here
m_settings->getAbsoluteExcludePaths(),
m_settings->getSourceExtensions()
);
const FilePath projectPath = m_settings->getProjectFileLocation();
for (FilePath path: fileManager.getSourceFilePaths())
for (FilePath path: fileManager.getAllSourceFilePaths())
{
if (projectPath.exists())
{
@@ -175,7 +175,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
}
QtProjectWizzardContentPathDependenciesMaven::QtProjectWizzardContentPathDependenciesMaven(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPath(settings, window)
{
@@ -189,7 +189,7 @@ QtProjectWizzardContentPathDependenciesMaven::QtProjectWizzardContentPathDepende
void QtProjectWizzardContentPathDependenciesMaven::load()
{
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
{
m_picker->setText(QString::fromStdString(javaSettings->getMavenDependenciesDirectory().str()));
@@ -198,7 +198,7 @@ void QtProjectWizzardContentPathDependenciesMaven::load()
void QtProjectWizzardContentPathDependenciesMaven::save()
{
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
{
javaSettings->setMavenDependenciesDirectory(m_picker->getText().toStdString());
@@ -16,7 +16,7 @@ class QtProjectWizzardContentPath
Q_OBJECT
public:
QtProjectWizzardContentPath(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPath(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtSettingsWindow implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -27,6 +27,8 @@ protected:
void setTitleString(const QString& title);
void setHelpString(const QString& help);
std::shared_ptr<SourceGroupSettings> m_settings;
QtLocationPicker* m_picker;
bool m_makePathRelativeToProjectFileLocation;
@@ -40,7 +42,7 @@ class QtProjectWizzardContentPathSourceMaven
: public QtProjectWizzardContentPath
{
public:
QtProjectWizzardContentPathSourceMaven(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathSourceMaven(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtSettingsWindow implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -59,7 +61,7 @@ class QtProjectWizzardContentPathDependenciesMaven
: public QtProjectWizzardContentPath
{
public:
QtProjectWizzardContentPathDependenciesMaven(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathDependenciesMaven(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void load() override;
@@ -8,16 +8,17 @@
#include "qt/element/QtDirectoryListBox.h"
#include "qt/window/QtSelectPathsDialog.h"
#include "settings/ApplicationSettings.h"
#include "settings/CxxProjectSettings.h"
#include "settings/JavaProjectSettings.h"
#include "settings/SourceGroupSettingsCxx.h"
#include "settings/SourceGroupSettingsJava.h"
#include "utility/CompilationDatabase.h"
#include "utility/file/FileManager.h"
#include "utility/file/FileSystem.h"
#include "utility/utility.h"
#include "utility/utilityPathDetection.h"
QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(settings, window)
QtProjectWizzardContentPaths::QtProjectWizzardContentPaths(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(window)
, m_settings(settings)
, m_makePathsRelativeToProjectFileLocation(true)
{
}
@@ -142,7 +143,7 @@ void QtProjectWizzardContentPaths::detectionClicked()
QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPaths(settings, window)
{
@@ -173,9 +174,8 @@ void QtProjectWizzardContentPathsSource::save()
std::vector<std::string> QtProjectWizzardContentPathsSource::getFileNames() const
{
FileManager fileManager;
fileManager.setPaths(
m_settings->getAbsoluteSourcePaths(),
std::vector<FilePath>(), // we don't need to specify header paths here
fileManager.update(
m_settings->getAbsoluteSourcePaths(),
m_settings->getAbsoluteExcludePaths(),
m_settings->getSourceExtensions()
);
@@ -183,7 +183,7 @@ std::vector<std::string> QtProjectWizzardContentPathsSource::getFileNames() cons
const FilePath projectPath = m_settings->getProjectFileLocation();
std::vector<std::string> list;
for (FilePath path: fileManager.getSourceFilePaths())
for (FilePath path: fileManager.getAllSourceFilePaths())
{
if (projectPath.exists())
{
@@ -207,7 +207,7 @@ QString QtProjectWizzardContentPathsSource::getFileNamesDescription() const
}
QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPathsSource(settings, window)
{
@@ -274,7 +274,7 @@ void QtProjectWizzardContentPathsCDBHeader::buttonClicked()
utility::CompilationDatabase cdb(
dynamic_cast<CxxProjectSettings*>(m_settings.get())->getAbsoluteCompilationDatabasePath().str());
dynamic_cast<SourceGroupSettingsCxx*>(m_settings.get())->getAbsoluteCompilationDatabasePath().str());
std::vector<FilePath> cdbHeaderPaths = cdb.getAllHeaderPaths();
std::vector<FilePath> sourcePaths = m_settings->getSourcePaths();
@@ -300,7 +300,7 @@ void QtProjectWizzardContentPathsCDBHeader::savedFilesDialog()
}
QtProjectWizzardContentPathsExclude::QtProjectWizzardContentPathsExclude(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPaths(settings, window)
{
@@ -323,7 +323,7 @@ void QtProjectWizzardContentPathsExclude::save()
QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSearch(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool isCDB
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB
)
: QtProjectWizzardContentPaths(settings, window)
{
@@ -345,7 +345,7 @@ QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSear
void QtProjectWizzardContentPathsHeaderSearch::load()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
m_list->setList(cxxSettings->getHeaderSearchPaths());
@@ -354,7 +354,7 @@ void QtProjectWizzardContentPathsHeaderSearch::load()
void QtProjectWizzardContentPathsHeaderSearch::save()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
cxxSettings->setHeaderSearchPaths(m_list->getList());
@@ -367,9 +367,9 @@ bool QtProjectWizzardContentPathsHeaderSearch::isScrollAble() const
}
QtProjectWizzardContentPathsHeaderSearchGlobal::QtProjectWizzardContentPathsHeaderSearchGlobal(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPaths(settings, window)
: QtProjectWizzardContentPaths(std::shared_ptr<SourceGroupSettings>(), window)
{
setTitleString("Global Include Paths");
setHelpString(
@@ -397,7 +397,7 @@ void QtProjectWizzardContentPathsHeaderSearchGlobal::save()
QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFrameworkSearch(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool isCDB
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB
)
: QtProjectWizzardContentPaths(settings, window)
{
@@ -412,7 +412,7 @@ QtProjectWizzardContentPathsFrameworkSearch::QtProjectWizzardContentPathsFramewo
void QtProjectWizzardContentPathsFrameworkSearch::load()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
m_list->setList(cxxSettings->getFrameworkSearchPaths());
@@ -421,7 +421,7 @@ void QtProjectWizzardContentPathsFrameworkSearch::load()
void QtProjectWizzardContentPathsFrameworkSearch::save()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
cxxSettings->setFrameworkSearchPaths(m_list->getList());
@@ -434,9 +434,9 @@ bool QtProjectWizzardContentPathsFrameworkSearch::isScrollAble() const
}
QtProjectWizzardContentPathsFrameworkSearchGlobal::QtProjectWizzardContentPathsFrameworkSearchGlobal(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPaths(settings, window)
: QtProjectWizzardContentPaths(std::shared_ptr<SourceGroupSettings>(), window)
{
setTitleString("Global Framework Search Paths");
setHelpString(
@@ -465,7 +465,7 @@ void QtProjectWizzardContentPathsFrameworkSearchGlobal::save()
QtProjectWizzardContentPathsClassJava::QtProjectWizzardContentPathsClassJava(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window
)
: QtProjectWizzardContentPaths(settings, window)
{
@@ -480,7 +480,7 @@ QtProjectWizzardContentPathsClassJava::QtProjectWizzardContentPathsClassJava(
void QtProjectWizzardContentPathsClassJava::load()
{
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
{
m_list->setList(javaSettings->getClasspaths());
@@ -489,7 +489,7 @@ void QtProjectWizzardContentPathsClassJava::load()
void QtProjectWizzardContentPathsClassJava::save()
{
std::shared_ptr<JavaProjectSettings> javaSettings = std::dynamic_pointer_cast<JavaProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
{
javaSettings->setClasspaths(m_list->getList());
@@ -17,7 +17,7 @@ signals:
void showSourceFiles();
public:
QtProjectWizzardContentPaths(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPaths(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtSettingsWindow implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -30,6 +30,8 @@ protected:
void addDetection(QGridLayout* layout, int row);
std::shared_ptr<SourceGroupSettings> m_settings;
QtDirectoryListBox* m_list;
QString m_showFilesString;
@@ -52,7 +54,7 @@ class QtProjectWizzardContentPathsSource
: public QtProjectWizzardContentPaths
{
public:
QtProjectWizzardContentPathsSource(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathsSource(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void load() override;
@@ -69,7 +71,7 @@ class QtProjectWizzardContentPathsCDBHeader
Q_OBJECT
public:
QtProjectWizzardContentPathsCDBHeader(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathsCDBHeader(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
virtual void populate(QGridLayout* layout, int& row) override;
@@ -85,7 +87,7 @@ class QtProjectWizzardContentPathsExclude
: public QtProjectWizzardContentPaths
{
public:
QtProjectWizzardContentPathsExclude(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathsExclude(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
virtual void load() override;
virtual void save() override;
@@ -97,7 +99,7 @@ class QtProjectWizzardContentPathsHeaderSearch
{
public:
QtProjectWizzardContentPathsHeaderSearch(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
// QtProjectWizzardContent implementation
virtual void load() override;
@@ -110,7 +112,7 @@ class QtProjectWizzardContentPathsHeaderSearchGlobal
: public QtProjectWizzardContentPaths
{
public:
QtProjectWizzardContentPathsHeaderSearchGlobal(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathsHeaderSearchGlobal(QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void load() override;
@@ -123,7 +125,7 @@ class QtProjectWizzardContentPathsFrameworkSearch
{
public:
QtProjectWizzardContentPathsFrameworkSearch(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
// QtProjectWizzardContent implementation
virtual void load() override;
@@ -136,7 +138,7 @@ class QtProjectWizzardContentPathsFrameworkSearchGlobal
: public QtProjectWizzardContentPaths
{
public:
QtProjectWizzardContentPathsFrameworkSearchGlobal(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathsFrameworkSearchGlobal(QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void load() override;
@@ -147,7 +149,7 @@ class QtProjectWizzardContentPathsClassJava
: public QtProjectWizzardContentPaths
{
public:
QtProjectWizzardContentPathsClassJava(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPathsClassJava(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void load() override;
@@ -8,9 +8,9 @@
#include "utility/utilityApp.h"
QtProjectWizzardContentPreferences::QtProjectWizzardContentPreferences(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(settings, window)
: QtProjectWizzardContent(window)
, m_oldColorSchemeIndex(-1)
{
std::vector<std::string> colorSchemePaths =
@@ -16,7 +16,7 @@ class QtProjectWizzardContentPreferences
Q_OBJECT
public:
QtProjectWizzardContentPreferences(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentPreferences(QtProjectWizzardWindow* window);
~QtProjectWizzardContentPreferences();
// QtProjectWizzardContent implementation
@@ -9,15 +9,10 @@
#include "utility/ResourcePaths.h"
#include "utility/utilityString.h"
#include "utility/solution/SolutionParserManager.h"
QtProjectWizzardContentSelect::QtProjectWizzardContentSelect(
std::shared_ptr<ProjectSettings> settings,
QtProjectWizzardWindow* window,
std::weak_ptr<SolutionParserManager> solutionParserManager
QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(settings, window)
, m_solutionParserManager(solutionParserManager)
: QtProjectWizzardContent(window)
{
}
@@ -25,40 +20,40 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
{
struct ProjectInfo
{
ProjectInfo(ProjectType type) :type(type) {}
const ProjectType type;
ProjectInfo(SourceGroupType type) :type(type) {}
const SourceGroupType type;
};
// define which kind of projects are available for each language
std::map<LanguageType, std::vector<ProjectInfo>> projectInfos;
projectInfos[LANGUAGE_C].push_back(ProjectInfo(PROJECT_C_EMPTY));
projectInfos[LANGUAGE_C].push_back(ProjectInfo(PROJECT_CXX_CDB));
projectInfos[LANGUAGE_C].push_back(ProjectInfo(PROJECT_CXX_VS));
projectInfos[LANGUAGE_CPP].push_back(ProjectInfo(PROJECT_CPP_EMPTY));
projectInfos[LANGUAGE_CPP].push_back(ProjectInfo(PROJECT_CXX_CDB));
projectInfos[LANGUAGE_CPP].push_back(ProjectInfo(PROJECT_CXX_VS));
projectInfos[LANGUAGE_JAVA].push_back(ProjectInfo(PROJECT_JAVA_EMPTY));
projectInfos[LANGUAGE_JAVA].push_back(ProjectInfo(PROJECT_JAVA_MAVEN));
projectInfos[LANGUAGE_C].push_back(ProjectInfo(SOURCE_GROUP_C_EMPTY));
projectInfos[LANGUAGE_C].push_back(ProjectInfo(SOURCE_GROUP_CXX_CDB));
projectInfos[LANGUAGE_C].push_back(ProjectInfo(SOURCE_GROUP_CXX_VS));
projectInfos[LANGUAGE_CPP].push_back(ProjectInfo(SOURCE_GROUP_CPP_EMPTY));
projectInfos[LANGUAGE_CPP].push_back(ProjectInfo(SOURCE_GROUP_CXX_CDB));
projectInfos[LANGUAGE_CPP].push_back(ProjectInfo(SOURCE_GROUP_CXX_VS));
projectInfos[LANGUAGE_JAVA].push_back(ProjectInfo(SOURCE_GROUP_JAVA_EMPTY));
projectInfos[LANGUAGE_JAVA].push_back(ProjectInfo(SOURCE_GROUP_JAVA_MAVEN));
// define which icons should be used for which kind of project
m_projectTypeIconName[PROJECT_C_EMPTY] = "empty_icon";
m_projectTypeIconName[PROJECT_CPP_EMPTY] = "empty_icon";
m_projectTypeIconName[PROJECT_CXX_CDB] = "cdb_icon";
m_projectTypeIconName[PROJECT_CXX_VS] = "vs_icon";
m_projectTypeIconName[PROJECT_JAVA_EMPTY] = "empty_icon";
m_projectTypeIconName[PROJECT_JAVA_MAVEN] = "mvn_icon";
m_projectTypeIconName[SOURCE_GROUP_C_EMPTY] = "empty_icon";
m_projectTypeIconName[SOURCE_GROUP_CPP_EMPTY] = "empty_icon";
m_projectTypeIconName[SOURCE_GROUP_CXX_CDB] = "cdb_icon";
m_projectTypeIconName[SOURCE_GROUP_CXX_VS] = "vs_icon";
m_projectTypeIconName[SOURCE_GROUP_JAVA_EMPTY] = "empty_icon";
m_projectTypeIconName[SOURCE_GROUP_JAVA_MAVEN] = "mvn_icon";
// define descriptions for each kind of project
m_projectTypeDescriptions[PROJECT_C_EMPTY] = "Create a new Coati project by defining which C files will be indexed.";
m_projectTypeDescriptions[PROJECT_CPP_EMPTY] = "Create a new Coati project by defining which C++ files will be indexed.";
m_projectTypeDescriptions[PROJECT_CXX_CDB] = "Create a project from an existing Compilation Database (compile_commands.json). They can be created from Make and "
m_projectTypeDescriptions[SOURCE_GROUP_C_EMPTY] = "Create a new Coati project by defining which C files will be indexed.";
m_projectTypeDescriptions[SOURCE_GROUP_CPP_EMPTY] = "Create a new Coati project by defining which C++ files will be indexed.";
m_projectTypeDescriptions[SOURCE_GROUP_CXX_CDB] = "Create a project from an existing Compilation Database (compile_commands.json). They can be created from Make and "
"CMake projects. Have a look at the <a href=\"https://coati.io/documentation/#CreateAProjectFromCompilationDatabase\">"
"documentation</a> to find out more.";
m_projectTypeDescriptions[PROJECT_CXX_VS] = "Create a new project from an existing Visual Studio Solution file. "
m_projectTypeDescriptions[SOURCE_GROUP_CXX_VS] = "Create a new project from an existing Visual Studio Solution file. "
"<b>Note: Requires a running Visual Studio instance with the "
"<a href=\"https://coati.io/documentation/index.html#VisualStudio\">Visual Studio plugin</a> installed.";
m_projectTypeDescriptions[PROJECT_JAVA_EMPTY] = "Create a new Coati project by defining which Java files will be indexed.";
m_projectTypeDescriptions[PROJECT_JAVA_MAVEN] = "Create a new project from an existing Maven project.";
m_projectTypeDescriptions[SOURCE_GROUP_JAVA_EMPTY] = "Create a new Coati project by defining which Java files will be indexed.";
m_projectTypeDescriptions[SOURCE_GROUP_JAVA_MAVEN] = "Create a new project from an existing Maven project.";
QVBoxLayout* vlayout = new QVBoxLayout();
vlayout->setContentsMargins(0, 30, 0, 0);
@@ -115,10 +110,10 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
for (auto projectIt: languageIt.second)
{
QToolButton* b = createProjectButton(
utility::insertLineBreaksAtBlankSpaces(projectTypeToString(projectIt.type), 15).c_str(),
utility::insertLineBreaksAtBlankSpaces(sourceGroupTypeToString(projectIt.type), 15).c_str(),
(ResourcePaths::getGuiPath() + "icon/" + m_projectTypeIconName[projectIt.type] + ".png").c_str()
);
b->setProperty("project_type", int(projectIt.type));
b->setProperty("source_group_type", int(projectIt.type));
projectButtons->addButton(b);
hlayout->addWidget(b);
}
@@ -131,15 +126,15 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
connect(it.second, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
[this](QAbstractButton* button)
{
ProjectType selectedProject = PROJECT_UNKNOWN;
SourceGroupType selectedType = SOURCE_GROUP_UNKNOWN;
bool ok = false;
int projectTypeInt = button->property("project_type").toInt(&ok);
int selectedTypeInt = button->property("source_group_type").toInt(&ok);
if (ok)
{
selectedProject = ProjectType(projectTypeInt);
selectedType = SourceGroupType(selectedTypeInt);
}
m_description->setText(m_projectTypeDescriptions[selectedProject].c_str());
m_description->setText(m_projectTypeDescriptions[selectedType].c_str());
m_window->setNextEnabled(true);
}
@@ -175,22 +170,22 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
void QtProjectWizzardContentSelect::save()
{
ProjectType type;
SourceGroupType selectedType;
for (auto it: m_buttons)
{
if (QAbstractButton* b = it.second->checkedButton())
{
bool ok = false;
int projectType = b->property("project_type").toInt(&ok);
int selectedTypeInt = b->property("source_group_type").toInt(&ok);
if (ok)
{
type = ProjectType(projectType);
selectedType = SourceGroupType(selectedTypeInt);
break;
}
}
}
emit selected(type);
emit selected(selectedType);
}
bool QtProjectWizzardContentSelect::check()
@@ -2,6 +2,7 @@
#define QT_PROJECT_WIZZARD_CONTENT_SELECT_H
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
#include "settings/SourceGroupType.h"
class QButtonGroup;
class SolutionParserManager;
@@ -12,10 +13,7 @@ class QtProjectWizzardContentSelect
Q_OBJECT
public:
QtProjectWizzardContentSelect(
std::shared_ptr<ProjectSettings> settings,
QtProjectWizzardWindow* window,
std::weak_ptr<SolutionParserManager> solutionParserManager);
QtProjectWizzardContentSelect(QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -24,7 +22,7 @@ public:
virtual bool check() override;
signals:
void selected(ProjectType);
void selected(SourceGroupType);
private:
QButtonGroup* m_languages;
@@ -33,10 +31,9 @@ private:
QLabel* m_title;
QLabel* m_description;
std::map<ProjectType, std::string> m_projectTypeIconName;
std::map<ProjectType, std::string> m_projectTypeDescriptions;
std::map<SourceGroupType, std::string> m_projectTypeIconName;
std::map<SourceGroupType, std::string> m_projectTypeDescriptions;
std::weak_ptr<SolutionParserManager> m_solutionParserManager;
std::vector<std::string> m_solutionDescription;
};
@@ -3,10 +3,11 @@
#include <QCheckBox>
#include <QLabel>
#include "settings/CxxProjectSettings.h"
#include "settings/SourceGroupSettingsCxx.h"
QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(settings, window)
QtProjectWizzardContentSimple::QtProjectWizzardContentSimple(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window)
: QtProjectWizzardContent(window)
, m_settings(settings)
, m_checkBox(nullptr)
{
}
@@ -34,7 +35,7 @@ void QtProjectWizzardContentSimple::populate(QGridLayout* layout, int& row)
void QtProjectWizzardContentSimple::load()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
m_checkBox->setChecked(cxxSettings->getUseSourcePathsForHeaderSearch());
@@ -43,7 +44,7 @@ void QtProjectWizzardContentSimple::load()
void QtProjectWizzardContentSimple::save()
{
std::shared_ptr<CxxProjectSettings> cxxSettings = std::dynamic_pointer_cast<CxxProjectSettings>(m_settings);
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings);
if (cxxSettings)
{
cxxSettings->setUseSourcePathsForHeaderSearch(m_checkBox->isChecked());
@@ -12,7 +12,7 @@ class QtProjectWizzardContentSimple
Q_OBJECT
public:
QtProjectWizzardContentSimple(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentSimple(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
// QtProjectWizzardContent implementation
virtual void populate(QGridLayout* layout, int& row) override;
@@ -21,6 +21,8 @@ public:
virtual void save() override;
private:
std::shared_ptr<SourceGroupSettings> m_settings;
QCheckBox* m_checkBox;
QLabel* m_title;
};
@@ -1,9 +1,9 @@
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
QtProjectWizzardContentSummary::QtProjectWizzardContentSummary(
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
QtProjectWizzardWindow* window
)
: QtProjectWizzardContent(settings, window)
: QtProjectWizzardContent(window)
, m_isForm(false)
{
}
@@ -11,7 +11,7 @@ class QtProjectWizzardContentSummary
Q_OBJECT
public:
QtProjectWizzardContentSummary(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
QtProjectWizzardContentSummary(QtProjectWizzardWindow* window);
void addContent(QtProjectWizzardContent* content);
void addSpace();