diff --git a/src/lib/utility/solution/SolutionParserManager.cpp b/src/lib/utility/solution/SolutionParserManager.cpp index 94062a9e..53c0d881 100644 --- a/src/lib/utility/solution/SolutionParserManager.cpp +++ b/src/lib/utility/solution/SolutionParserManager.cpp @@ -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()); diff --git a/src/lib/utility/solution/SolutionParserManager.h b/src/lib/utility/solution/SolutionParserManager.h index 73313c96..c7fa1d38 100644 --- a/src/lib/utility/solution/SolutionParserManager.h +++ b/src/lib/utility/solution/SolutionParserManager.h @@ -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; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index 915e5c5f..14dadeab 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -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++) diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp index 5041c80d..3660b422 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentBuildFile.cpp @@ -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; } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp index 609b310a..16cbb5a3 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp @@ -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 " "" "documentation 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 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(&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 " - "" - "documentation 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() diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h index 37806467..fa933464 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.h @@ -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);