diff --git a/src/lib/settings/SourceGroupSettings.cpp b/src/lib/settings/SourceGroupSettings.cpp index 6bcf1b59..72dddb8f 100644 --- a/src/lib/settings/SourceGroupSettings.cpp +++ b/src/lib/settings/SourceGroupSettings.cpp @@ -6,7 +6,9 @@ const size_t SourceGroupSettings::s_version = 1; const std::string SourceGroupSettings::s_keyPrefix = "source_groups/source_group_"; -SourceGroupSettings::SourceGroupSettings(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings) +SourceGroupSettings::SourceGroupSettings( + const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings +) : m_projectSettings(projectSettings) , m_id(id) , m_name(sourceGroupTypeToString(type)) @@ -32,8 +34,9 @@ void SourceGroupSettings::load(std::shared_ptr config) { setName(name); } - - setStatus(stringToSourceGroupStatusType(getValue(key + "/status", sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED), config))); + + setStatus(stringToSourceGroupStatusType( + getValue(key + "/status", sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED), config))); setStandard(getValue(key + "/standard", "", config)); setSourcePaths(getPathValues(key + "/source_paths/source_path", config)); setExcludeFilterStrings(getValues(key + "/exclude_filters/exclude_filter", std::vector(), config)); @@ -161,16 +164,20 @@ std::vector SourceGroupSettings::getExcludeFiltersExpandedAndAbs if (wildcardPos != filterString.npos) { std::wsmatch match; - if (std::regex_search(filterString, match, std::wregex(L"[\\\\/]")) && !match.empty() && match.position(0) < wildcardPos) + if (std::regex_search(filterString, match, std::wregex(L"[\\\\/]")) && !match.empty() && + match.position(0) < int(wildcardPos)) { const FilePath p = m_projectSettings->makePathExpandedAndAbsolute(FilePath(match.prefix().str())); std::set symLinkPaths = FileSystem::getSymLinkedDirectories(p); symLinkPaths.insert(p); - utility::append(result, + utility::append(result, utility::convert( utility::toVector(symLinkPaths), - [match](const FilePath& filePath) { return FilePathFilter(filePath.wstr() + L"/" + match.suffix().str()); } + [match](const FilePath& filePath) + { + return FilePathFilter(filePath.wstr() + L"/" + match.suffix().str()); + } ) ); } @@ -190,12 +197,15 @@ std::vector SourceGroupSettings::getExcludeFiltersExpandedAndAbs utility::append(result, utility::convert( utility::toVector(symLinkPaths), - [isFile](const FilePath& filePath) { return FilePathFilter(filePath.wstr() + (isFile ? L"" : L"**")); } + [isFile](const FilePath& filePath) + { + return FilePathFilter(filePath.wstr() + (isFile ? L"" : L"**")); + } ) ); } } - + return result; } @@ -218,7 +228,8 @@ void SourceGroupSettings::setSourceExtensions(const std::vector& s m_sourceExtensions = sourceExtensions; } -std::vector SourceGroupSettings::getPathValues(const std::string& key, std::shared_ptr config) +std::vector SourceGroupSettings::getPathValues( + const std::string& key, std::shared_ptr config) { std::vector paths; for (const std::wstring& value : getValues(key, {}, config)) @@ -228,7 +239,8 @@ std::vector SourceGroupSettings::getPathValues(const std::string& key, return paths; } -bool SourceGroupSettings::setPathValues(const std::string& key, const std::vector& paths, std::shared_ptr config) +bool SourceGroupSettings::setPathValues( + const std::string& key, const std::vector& paths, std::shared_ptr config) { std::vector values; for (const FilePath& path : paths) diff --git a/src/lib_gui/qt/element/QtPathListBox.cpp b/src/lib_gui/qt/element/QtPathListBox.cpp index b511a5d8..2d98b19d 100644 --- a/src/lib_gui/qt/element/QtPathListBox.cpp +++ b/src/lib_gui/qt/element/QtPathListBox.cpp @@ -93,7 +93,7 @@ void QtPathListBox::dropEvent(QDropEvent *event) { FilePath path(url.toLocalFile().toStdWString()); makeRelative(path); - QtListBoxItem* item = addListBoxItemWithText(QString::fromStdWString(path.wstr())); + addListBoxItemWithText(QString::fromStdWString(path.wstr())); } } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp index f408721e..209a6c25 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp @@ -26,8 +26,8 @@ #include "utility/utilityString.h" QtProjectWizzardContentPaths::QtProjectWizzardContentPaths( - std::shared_ptr settings, - QtProjectWizzardWindow* window, + std::shared_ptr settings, + QtProjectWizzardWindow* window, QtPathListBox::SelectionPolicyType selectionPolicy, bool checkMissingPaths ) @@ -120,12 +120,16 @@ bool QtProjectWizzardContentPaths::check() QPushButton* cancelButton = msgBox.addButton("Cancel", QMessageBox::ButtonRole::RejectRole); msgBox.exec(); - + if (msgBox.clickedButton() == removeButton) { m_list->setPaths(existingPaths); save(); } + else if (msgBox.clickedButton() == keepButton) + { + return true; + } else if (msgBox.clickedButton() == cancelButton) { return false;