ui: generic solution parser
completed first version of generic solution parsers
This commit is contained in:
@@ -125,6 +125,18 @@ std::string SolutionParserManager::getParserIdeId(const unsigned int idx) const
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string SolutionParserManager::getIconPath(const unsigned int idx) const
|
||||
{
|
||||
if (checkIndex(idx))
|
||||
{
|
||||
return m_solutionParsers[idx]->getIconPath();
|
||||
}
|
||||
|
||||
LOG_WARNING_STREAM(<< "Index is out of range, was " << idx << ". Max is " << m_solutionParsers.size() - 1);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
bool SolutionParserManager::checkIndex(const unsigned int idx) const
|
||||
{
|
||||
return (idx < m_solutionParsers.size());
|
||||
|
||||
@@ -24,6 +24,7 @@ public:
|
||||
std::string getParserDescription(const unsigned int idx) const;
|
||||
std::string getParserFileEnding(const unsigned int idx) const;
|
||||
std::string getParserIdeId(const unsigned int idx) const;
|
||||
std::string getIconPath(const unsigned int idx) const;
|
||||
|
||||
private:
|
||||
bool checkIndex(const unsigned int idx) const;
|
||||
|
||||
@@ -347,7 +347,7 @@ void QtProjectWizzard::selectedProjectType(QtProjectWizzardContentSelect::Projec
|
||||
emptyProject();
|
||||
break;
|
||||
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
case QtProjectWizzardContentSelect::PROJECT_MANAGED:
|
||||
{
|
||||
std::string fileEndings = "(";
|
||||
for (unsigned int i = 0; i < m_parserManager->getParserCount(); i++)
|
||||
|
||||
@@ -13,7 +13,7 @@ QtProjectWizzardContentBuildFile::QtProjectWizzardContentBuildFile(
|
||||
{
|
||||
if (!m_settings->getVisualStudioSolutionPath().empty())
|
||||
{
|
||||
m_type = QtProjectWizzardContentSelect::PROJECT_VS;
|
||||
m_type = QtProjectWizzardContentSelect::PROJECT_MANAGED;
|
||||
}
|
||||
else if (!m_settings->getCompilationDatabasePath().empty())
|
||||
{
|
||||
@@ -37,7 +37,7 @@ void QtProjectWizzardContentBuildFile::populateForm(QGridLayout* layout, int& ro
|
||||
name = "Build Text";
|
||||
filter = "Text (*.txt)";
|
||||
return;
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
case QtProjectWizzardContentSelect::PROJECT_MANAGED:
|
||||
name = "Visual Studio Solution";
|
||||
filter = "Visual Studio Solution (*.sln)";
|
||||
break;
|
||||
@@ -77,7 +77,7 @@ void QtProjectWizzardContentBuildFile::load()
|
||||
{
|
||||
case QtProjectWizzardContentSelect::PROJECT_EMPTY:
|
||||
return;
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
case QtProjectWizzardContentSelect::PROJECT_MANAGED:
|
||||
m_picker->setText(QString::fromStdString(m_settings->getVisualStudioSolutionPath().str()));
|
||||
break;
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
@@ -91,7 +91,7 @@ void QtProjectWizzardContentBuildFile::save()
|
||||
switch (m_type)
|
||||
{
|
||||
case QtProjectWizzardContentSelect::PROJECT_EMPTY:
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
case QtProjectWizzardContentSelect::PROJECT_MANAGED:
|
||||
break;
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
{
|
||||
@@ -111,7 +111,7 @@ bool QtProjectWizzardContentBuildFile::check()
|
||||
switch (m_type)
|
||||
{
|
||||
case QtProjectWizzardContentSelect::PROJECT_EMPTY:
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
case QtProjectWizzardContentSelect::PROJECT_MANAGED:
|
||||
break;
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
{
|
||||
@@ -159,7 +159,7 @@ void QtProjectWizzardContentBuildFile::refreshClicked()
|
||||
case QtProjectWizzardContentSelect::PROJECT_EMPTY:
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
break;
|
||||
case QtProjectWizzardContentSelect::PROJECT_VS:
|
||||
case QtProjectWizzardContentSelect::PROJECT_MANAGED:
|
||||
emit refreshVisualStudioSolution("vs", path.str());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -68,31 +68,23 @@ void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout)
|
||||
QToolButton* c = createProjectButton(
|
||||
"from Compilation\nDatabase", (ResourcePaths::getGuiPath() + "icon/project_cdb_256_256.png").c_str());
|
||||
|
||||
/*QToolButton* b = createProjectButton(
|
||||
"from Visual\nStudio Solution", (ResourcePaths::getGuiPath() + "icon/project_vs_256_256.png").c_str());*/
|
||||
|
||||
|
||||
m_solutionDescription.push_back("Create a new Coati project by defining what files will be analyzed and header search paths.");
|
||||
m_solutionDescription.push_back("Create a project from an existing Compilation Database. Compilation Databases can be created from "
|
||||
"cmake projects. Have a look at the "
|
||||
"<a href=\"https://staging.coati.io/documentation/#CreateAProjectFromCompilationDatabase\">"
|
||||
"documentation</a> to find out more.");
|
||||
//m_solutionDescription.push_back("Create a new project from an existing Visual Studio Solution file.");
|
||||
|
||||
m_buttons = new QButtonGroup(this);
|
||||
m_buttons->addButton(a);
|
||||
m_buttons->addButton(c);
|
||||
//m_buttons->addButton(b);
|
||||
|
||||
m_buttons->setId(a, PROJECT_EMPTY);
|
||||
m_buttons->setId(c, PROJECT_CDB);
|
||||
//m_buttons->setId(b, PROJECT_VS);
|
||||
|
||||
QHBoxLayout* hlayout = new QHBoxLayout();
|
||||
|
||||
hlayout->addWidget(a);
|
||||
hlayout->addWidget(c);
|
||||
//hlayout->addWidget(b);
|
||||
|
||||
unsigned int runningId = 2;
|
||||
std::shared_ptr<SolutionParserManager> manager = m_solutionParserManager.lock();
|
||||
@@ -103,7 +95,7 @@ void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout)
|
||||
std::string name = manager->getParserButtonText(i);
|
||||
|
||||
QToolButton* button = createProjectButton(name.c_str(),
|
||||
(ResourcePaths::getGuiPath() + "icon/project_vs_256_256.png").c_str());
|
||||
(ResourcePaths::getGuiPath() + manager->getIconPath(i)).c_str());
|
||||
|
||||
m_buttons->addButton(button);
|
||||
|
||||
@@ -120,30 +112,12 @@ void QtProjectWizzardContentSelect::populateWindow(QGridLayout* layout)
|
||||
connect(m_buttons, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
|
||||
[this](int id)
|
||||
{
|
||||
/*switch (id)
|
||||
{
|
||||
case 0: m_description->setText(
|
||||
"Create a new Coati project by defining what files will be analyzed and header search paths."
|
||||
); break;
|
||||
case 1: m_description->setText(
|
||||
"Create a new project from an existing Visual Studio Solution file."
|
||||
); break;
|
||||
case 2: m_description->setText(
|
||||
"Create a project from an existing Compilation Database. Compilation Databases can be created from "
|
||||
"cmake projects. Have a look at the "
|
||||
"<a href=\"https://staging.coati.io/documentation/#CreateAProjectFromCompilationDatabase\">"
|
||||
"documentation</a> to find out more."
|
||||
); break;
|
||||
}*/
|
||||
|
||||
m_description->setText(m_solutionDescription[id].c_str());
|
||||
|
||||
m_window->setNextEnabled(true);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
QFrame* container = new QFrame();
|
||||
container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
container->setObjectName("projectContainer");
|
||||
@@ -179,13 +153,11 @@ void QtProjectWizzardContentSelect::save()
|
||||
{
|
||||
case 0: type = PROJECT_EMPTY; break;
|
||||
case 1: type = PROJECT_CDB; break;
|
||||
case 2: type = PROJECT_VS; break;
|
||||
default: type = PROJECT_VS; break; // use vs for "standard" solutions TODO: change name of enum to reflect this is the default type
|
||||
case 2: type = PROJECT_MANAGED; break;
|
||||
default: type = PROJECT_MANAGED; break;
|
||||
}
|
||||
|
||||
emit selected(type);
|
||||
|
||||
// emit selected(m_buttons->checkedId());
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentSelect::check()
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
{
|
||||
PROJECT_EMPTY = 0,
|
||||
PROJECT_CDB = 1,
|
||||
PROJECT_VS = 2
|
||||
PROJECT_MANAGED = 2 // use this type for all standard parser (parsers that are handled by the parser manager)
|
||||
};
|
||||
|
||||
QtProjectWizzardContentSelect(ProjectSettings* settings, QtProjectWizzardWindow* window, std::weak_ptr<SolutionParserManager> solutionParserManager);
|
||||
|
||||
Reference in New Issue
Block a user