From 140dc9c6f4fe67fe2174639206cf3c435ea6b5c5 Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:55:15 +0200 Subject: [PATCH] Add option to set enabled state for partial match regex config --- lib/utils/regex-config.cpp | 9 +++++---- lib/utils/regex-config.hpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/utils/regex-config.cpp b/lib/utils/regex-config.cpp index 2bfa9e24..ac9ce029 100644 --- a/lib/utils/regex-config.cpp +++ b/lib/utils/regex-config.cpp @@ -79,11 +79,12 @@ bool RegexConfig::Matches(const std::string &text, QString::fromStdString(expression)); } -RegexConfig RegexConfig::PartialMatchRegexConfig() +RegexConfig RegexConfig::PartialMatchRegexConfig(bool enabled) { - RegexConfig conf; - conf._partialMatch = true; - return conf; + RegexConfig regex; + regex._partialMatch = true; + regex._enable = enabled; + return regex; } RegexConfigWidget::RegexConfigWidget(QWidget *parent, bool showEnable) diff --git a/lib/utils/regex-config.hpp b/lib/utils/regex-config.hpp index 1c51ad6d..256fba77 100644 --- a/lib/utils/regex-config.hpp +++ b/lib/utils/regex-config.hpp @@ -37,7 +37,7 @@ public: EXPORT bool Matches(const std::string &text, const std::string &expression) const; - EXPORT static RegexConfig PartialMatchRegexConfig(); + EXPORT static RegexConfig PartialMatchRegexConfig(bool enabled = false); private: bool _enable = false;