diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp index fc175e63..c98abca3 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp @@ -246,11 +246,11 @@ void QtProjectWizzardContentPathCDB::pickedPath() const FilePath projectPath = m_settings->getProjectDirectoryPath(); std::vector indexedHeaderPaths; - for (const FilePath path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(cdbSettings)) + for (const FilePath& path : QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB(cdbSettings)) { if (projectPath.contains(path)) { - indexedHeaderPaths.push_back(path); + indexedHeaderPaths.push_back(path.getRelativeTo(projectPath)); } } cdbSettings->setIndexedHeaderPaths(indexedHeaderPaths); @@ -389,6 +389,9 @@ QString QtProjectWizzardContentSonargraphProjectPath::getFileNamesDescription() void QtProjectWizzardContentSonargraphProjectPath::pickedPath() { m_window->saveContent(); + + // TODO: update indexed headers + m_window->loadContent(); } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp index c0b994b0..7f8d4a9e 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp @@ -272,7 +272,6 @@ QString QtProjectWizzardContentPathsSource::getFileNamesDescription() const std::vector QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromSonargraphProject( std::shared_ptr settings) { - const FilePath projectPath = settings->getProjectDirectoryPath(); std::set indexedHeaderPaths; { const FilePath sonargraphProjectPath = settings->getSonargraphProjectPathExpandedAndAbsolute(); @@ -294,16 +293,12 @@ std::vector QtProjectWizzardContentIndexedHeaderPaths::getIndexedPaths LOG_WARNING("Unable to fetch indexed header paths. The provided Sonargraph project path does not exist."); } } - return utility::convert( - utility::getTopLevelPaths(indexedHeaderPaths), - [&](const FilePath& path) { return path.getRelativeTo(projectPath); } - ); + return utility::getTopLevelPaths(indexedHeaderPaths); } std::vector QtProjectWizzardContentIndexedHeaderPaths::getIndexedPathsDerivedFromCDB( std::shared_ptr settings) { - const FilePath projectPath = settings->getProjectDirectoryPath(); std::set indexedHeaderPaths; { const FilePath cdbPath = settings->getCompilationDatabasePathExpandedAndAbsolute(); @@ -327,10 +322,7 @@ std::vector QtProjectWizzardContentIndexedHeaderPaths::getIndexedPaths } } - return utility::convert( - utility::getTopLevelPaths(indexedHeaderPaths), - [&](const FilePath& path) { return path.getRelativeTo(projectPath); } - ); + return utility::getTopLevelPaths(indexedHeaderPaths); } QtProjectWizzardContentIndexedHeaderPaths::QtProjectWizzardContentIndexedHeaderPaths( @@ -434,8 +426,13 @@ void QtProjectWizzardContentIndexedHeaderPaths::buttonClicked() connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizzardContentIndexedHeaderPaths::savedFilesDialog); connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizzardContentIndexedHeaderPaths::closedFilesDialog); + const FilePath projectPath = sonargraphSettings->getProjectDirectoryPath(); + dynamic_cast(m_filesDialog.get())->setPathsList( - getIndexedPathsDerivedFromSonargraphProject(sonargraphSettings), + utility::convert( + getIndexedPathsDerivedFromSonargraphProject(sonargraphSettings), + [&](const FilePath& path) { return path.getRelativeTo(projectPath); } + ), sonargraphSettings->getIndexedHeaderPaths(), m_settings->getProjectDirectoryPath() ); @@ -461,8 +458,13 @@ void QtProjectWizzardContentIndexedHeaderPaths::buttonClicked() connect(m_filesDialog.get(), &QtSelectPathsDialog::finished, this, &QtProjectWizzardContentIndexedHeaderPaths::savedFilesDialog); connect(m_filesDialog.get(), &QtSelectPathsDialog::canceled, this, &QtProjectWizzardContentIndexedHeaderPaths::closedFilesDialog); + const FilePath projectPath = cdbSettings->getProjectDirectoryPath(); + dynamic_cast(m_filesDialog.get())->setPathsList( - getIndexedPathsDerivedFromCDB(cdbSettings), + utility::convert( + getIndexedPathsDerivedFromCDB(cdbSettings), + [&](const FilePath& path) { return path.getRelativeTo(projectPath); } + ), cdbSettings->getIndexedHeaderPaths(), m_settings->getProjectDirectoryPath() );