| 177 | } |
| 178 | |
| 179 | bool GM_Script::match(const QUrl& url) const |
| 180 | { |
| 181 | QString urlString = url.toString(); |
| 182 | |
| 183 | for (const auto &exclude : std::as_const(m_exclude)) { |
| 184 | QString wildcardExp = QRegularExpression::wildcardToRegularExpression( |
| 185 | exclude, |
| 186 | QRegularExpression::UnanchoredWildcardConversion |
| 187 | ); |
| 188 | QRegularExpression re(wildcardExp, |
| 189 | QRegularExpression::CaseInsensitiveOption); |
| 190 | |
| 191 | if (re.match(urlString).hasMatch()) { |
| 192 | return false; |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | for (const auto &include : std::as_const(m_include)) { |
| 197 | QString wildcardExp = QRegularExpression::wildcardToRegularExpression( |
| 198 | include, |
| 199 | QRegularExpression::UnanchoredWildcardConversion |
| 200 | ); |
| 201 | QRegularExpression re(wildcardExp, |
| 202 | QRegularExpression::CaseInsensitiveOption); |
| 203 | |
| 204 | if (re.match(urlString).hasMatch()) { |
| 205 | return true; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | return false; |
| 210 | } |
| 211 | |
| 212 | void GM_Script::watchedFileChanged(const QString &file) |
| 213 | { |
no outgoing calls
no test coverage detected