mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Merge pull request #14628 from sledgehammer999/qt_511
Lower Qt requirement to 5.11
This commit is contained in:
commit
2be30a50ef
16 changed files with 70 additions and 83 deletions
|
@ -12,7 +12,7 @@ project(qBittorrent
|
|||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
# version requirements - older vesions may work, but you are on your own
|
||||
set(minBoostVersion 1.65)
|
||||
set(minQtVersion 5.12)
|
||||
set(minQtVersion 5.11)
|
||||
set(minOpenSSLVersion 1.1.1)
|
||||
set(minLibtorrentVersion 1.2.12)
|
||||
set(minZlibVersion 1.2.11)
|
||||
|
|
42
configure
vendored
42
configure
vendored
|
@ -1455,7 +1455,7 @@ Some influential environment variables:
|
|||
directories to add to pkg-config's search path
|
||||
PKG_CONFIG_LIBDIR
|
||||
path overriding pkg-config's built-in search path
|
||||
QT_QMAKE value of host_bins for Qt5Core >= 5.12, overriding pkg-config
|
||||
QT_QMAKE value of host_bins for Qt5Core >= 5.11, overriding pkg-config
|
||||
Qt5Svg_CFLAGS
|
||||
C compiler flags for Qt5Svg, overriding pkg-config
|
||||
Qt5Svg_LIBS linker flags for Qt5Svg, overriding pkg-config
|
||||
|
@ -5525,8 +5525,8 @@ printf "%s\n" "$enable_webui" >&6; }
|
|||
esac
|
||||
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.12\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.12") 2>&5
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.11\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.11") 2>&5
|
||||
ac_status=$?
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
|
@ -5535,12 +5535,12 @@ if test -n "$QT_QMAKE"; then
|
|||
pkg_cv_QT_QMAKE="$QT_QMAKE"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.12\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.12") 2>&5
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.11\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.11") 2>&5
|
||||
ac_status=$?
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_QT_QMAKE=`$PKG_CONFIG --variable="host_bins" "Qt5Core >= 5.12" 2>/dev/null`
|
||||
pkg_cv_QT_QMAKE=`$PKG_CONFIG --variable="host_bins" "Qt5Core >= 5.11" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
|
@ -5570,8 +5570,8 @@ fi
|
|||
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Qt5 qmake >= 5.12" >&5
|
||||
printf %s "checking for Qt5 qmake >= 5.12... " >&6; }
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Qt5 qmake >= 5.11" >&5
|
||||
printf %s "checking for Qt5 qmake >= 5.11... " >&6; }
|
||||
if test "x$QT_QMAKE" != "x"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $QT_QMAKE" >&5
|
||||
|
@ -5598,12 +5598,12 @@ if test -n "$Qt5Svg_CFLAGS"; then
|
|||
pkg_cv_Qt5Svg_CFLAGS="$Qt5Svg_CFLAGS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.12\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.12") 2>&5
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.11\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.11") 2>&5
|
||||
ac_status=$?
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_Qt5Svg_CFLAGS=`$PKG_CONFIG --cflags "Qt5Svg >= 5.12" 2>/dev/null`
|
||||
pkg_cv_Qt5Svg_CFLAGS=`$PKG_CONFIG --cflags "Qt5Svg >= 5.11" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
|
@ -5615,12 +5615,12 @@ if test -n "$Qt5Svg_LIBS"; then
|
|||
pkg_cv_Qt5Svg_LIBS="$Qt5Svg_LIBS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.12\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.12") 2>&5
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.11\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.11") 2>&5
|
||||
ac_status=$?
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_Qt5Svg_LIBS=`$PKG_CONFIG --libs "Qt5Svg >= 5.12" 2>/dev/null`
|
||||
pkg_cv_Qt5Svg_LIBS=`$PKG_CONFIG --libs "Qt5Svg >= 5.11" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
|
@ -5641,14 +5641,14 @@ else
|
|||
_pkg_short_errors_supported=no
|
||||
fi
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "Qt5Svg >= 5.12" 2>&1`
|
||||
Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "Qt5Svg >= 5.11" 2>&1`
|
||||
else
|
||||
Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "Qt5Svg >= 5.12" 2>&1`
|
||||
Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "Qt5Svg >= 5.11" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$Qt5Svg_PKG_ERRORS" >&5
|
||||
|
||||
as_fn_error $? "Package requirements (Qt5Svg >= 5.12) were not met:
|
||||
as_fn_error $? "Package requirements (Qt5Svg >= 5.11) were not met:
|
||||
|
||||
$Qt5Svg_PKG_ERRORS
|
||||
|
||||
|
@ -5688,11 +5688,11 @@ case "x$enable_qt_dbus" in #(
|
|||
"xyes") :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Qt5DBus >= 5.12" >&5
|
||||
printf %s "checking for Qt5DBus >= 5.12... " >&6; }
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Qt5DBus >= 5.11" >&5
|
||||
printf %s "checking for Qt5DBus >= 5.11... " >&6; }
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5DBus >= 5.12\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.12") 2>&5
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5DBus >= 5.11\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.11") 2>&5
|
||||
ac_status=$?
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
|
|
|
@ -141,7 +141,7 @@ AS_IF([test "x$QT_QMAKE" = "x"],
|
|||
[AC_MSG_ERROR([Could not find qmake])
|
||||
])
|
||||
AS_IF([test "x$enable_gui" = "xyes"],
|
||||
[PKG_CHECK_MODULES(Qt5Svg, [Qt5Svg >= 5.12])
|
||||
[PKG_CHECK_MODULES(Qt5Svg, [Qt5Svg >= 5.11])
|
||||
])
|
||||
AC_MSG_CHECKING([whether QtDBus should be enabled])
|
||||
AS_CASE(["x$enable_qt_dbus"],
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
# Sets the QT_QMAKE variable to the path of Qt5 qmake if found.
|
||||
# --------------------------------------
|
||||
AC_DEFUN([FIND_QT5],
|
||||
[PKG_CHECK_EXISTS([Qt5Core >= 5.12],
|
||||
[PKG_CHECK_EXISTS([Qt5Core >= 5.11],
|
||||
[PKG_CHECK_VAR(QT_QMAKE,
|
||||
[Qt5Core >= 5.12],
|
||||
[Qt5Core >= 5.11],
|
||||
[host_bins])
|
||||
])
|
||||
|
||||
|
@ -18,7 +18,7 @@ AS_IF([test -f "$QT_QMAKE/qmake"],
|
|||
[QT_QMAKE=""])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for Qt5 qmake >= 5.12])
|
||||
AC_MSG_CHECKING([for Qt5 qmake >= 5.11])
|
||||
AS_IF([test "x$QT_QMAKE" != "x"],
|
||||
[AC_MSG_RESULT([$QT_QMAKE])],
|
||||
[AC_MSG_RESULT([not found])]
|
||||
|
@ -29,8 +29,8 @@ AS_IF([test "x$QT_QMAKE" != "x"],
|
|||
# Sets the HAVE_QTDBUS variable to true or false.
|
||||
# --------------------------------------
|
||||
AC_DEFUN([FIND_QTDBUS],
|
||||
[AC_MSG_CHECKING([for Qt5DBus >= 5.12])
|
||||
PKG_CHECK_EXISTS([Qt5DBus >= 5.12],
|
||||
[AC_MSG_CHECKING([for Qt5DBus >= 5.11])
|
||||
PKG_CHECK_EXISTS([Qt5DBus >= 5.11],
|
||||
[AC_MSG_RESULT([found])
|
||||
HAVE_QTDBUS=[true]],
|
||||
[AC_MSG_RESULT([not found])
|
||||
|
|
|
@ -4,14 +4,22 @@
|
|||
# Based on https://gist.github.com/giraldeau/546ba5512a74dfe9d8ea0862d66db412
|
||||
file(GLOB QBT_TS_FILES "${qBittorrent_SOURCE_DIR}/src/lang/*.ts")
|
||||
set_source_files_properties(${QBT_TS_FILES} PROPERTIES OUTPUT_LOCATION "${qBittorrent_BINARY_DIR}/src/lang")
|
||||
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES} OPTIONS -silent)
|
||||
if (Qt5_VERSION VERSION_LESS 5.12)
|
||||
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES})
|
||||
else()
|
||||
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES} OPTIONS -silent)
|
||||
endif()
|
||||
configure_file("${qBittorrent_SOURCE_DIR}/src/lang/lang.qrc" "${qBittorrent_BINARY_DIR}/src/lang/lang.qrc" COPYONLY)
|
||||
|
||||
if (WEBUI)
|
||||
file(GLOB QBT_WEBUI_TS_FILES "${qBittorrent_SOURCE_DIR}/src/webui/www/translations/*.ts")
|
||||
set_source_files_properties(${QBT_WEBUI_TS_FILES}
|
||||
PROPERTIES OUTPUT_LOCATION "${qBittorrent_BINARY_DIR}/src/webui/www/translations")
|
||||
if (Qt5_VERSION VERSION_LESS 5.12)
|
||||
qt5_add_translation(QBT_WEBUI_QM_FILES ${QBT_WEBUI_TS_FILES})
|
||||
else()
|
||||
qt5_add_translation(QBT_WEBUI_QM_FILES ${QBT_WEBUI_TS_FILES} OPTIONS -silent)
|
||||
endif()
|
||||
configure_file("${qBittorrent_SOURCE_DIR}/src/webui/www/translations/webui_translations.qrc"
|
||||
"${qBittorrent_BINARY_DIR}/src/webui/www/translations/webui_translations.qrc" COPYONLY)
|
||||
endif()
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
#include <QDir>
|
||||
#include <QLocalServer>
|
||||
#include <QLocalSocket>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "base/utils/misc.h"
|
||||
|
||||
|
@ -109,7 +108,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
|
|||
#endif
|
||||
prefix = id.section(QLatin1Char('/'), -1);
|
||||
}
|
||||
prefix.remove(QRegularExpression("[^a-zA-Z]"));
|
||||
prefix.remove(QRegExp("[^a-zA-Z]"));
|
||||
prefix.truncate(6);
|
||||
|
||||
QByteArray idc = id.toUtf8();
|
||||
|
|
|
@ -213,8 +213,10 @@ QRegularExpression AutoDownloadRule::cachedRegex(const QString &expression, cons
|
|||
QRegularExpression ®ex = m_dataPtr->cachedRegexes[expression];
|
||||
if (regex.pattern().isEmpty())
|
||||
{
|
||||
const QString pattern = (isRegex ? expression : Utils::String::wildcardToRegexPattern(expression));
|
||||
regex = QRegularExpression {pattern, QRegularExpression::CaseInsensitiveOption};
|
||||
regex = QRegularExpression
|
||||
{
|
||||
(isRegex ? expression : Utils::String::wildcardToRegex(expression))
|
||||
, QRegularExpression::CaseInsensitiveOption};
|
||||
}
|
||||
|
||||
return regex;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <QGlobalStatic>
|
||||
#include <QHash>
|
||||
#include <QMetaObject>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <QXmlStreamEntityResolver>
|
||||
|
@ -391,13 +391,12 @@ namespace
|
|||
int nmin = 8;
|
||||
int nsec = 9;
|
||||
// Also accept obsolete form "Weekday, DD-Mon-YY HH:MM:SS ±hhmm"
|
||||
QRegularExpression rx {"^(?:([A-Z][a-z]+),\\s*)?(\\d{1,2})(\\s+|-)([^-\\s]+)(\\s+|-)(\\d{2,4})\\s+(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s+(\\S+)$"};
|
||||
QRegularExpressionMatch rxMatch;
|
||||
QRegExp rx("^(?:([A-Z][a-z]+),\\s*)?(\\d{1,2})(\\s+|-)([^-\\s]+)(\\s+|-)(\\d{2,4})\\s+(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s+(\\S+)$");
|
||||
QStringList parts;
|
||||
if (str.indexOf(rx, 0, &rxMatch) == 0)
|
||||
if (!str.indexOf(rx))
|
||||
{
|
||||
// Check that if date has '-' separators, both separators are '-'.
|
||||
parts = rxMatch.capturedTexts();
|
||||
parts = rx.capturedTexts();
|
||||
const bool h1 = (parts[3] == QLatin1String("-"));
|
||||
const bool h2 = (parts[5] == QLatin1String("-"));
|
||||
if (h1 != h2)
|
||||
|
@ -406,10 +405,9 @@ namespace
|
|||
else
|
||||
{
|
||||
// Check for the obsolete form "Wdy Mon DD HH:MM:SS YYYY"
|
||||
rx = QRegularExpression {"^([A-Z][a-z]+)\\s+(\\S+)\\s+(\\d\\d)\\s+(\\d\\d):(\\d\\d):(\\d\\d)\\s+(\\d\\d\\d\\d)$"};
|
||||
if (str.indexOf(rx, 0, &rxMatch) != 0)
|
||||
rx = QRegExp("^([A-Z][a-z]+)\\s+(\\S+)\\s+(\\d\\d)\\s+(\\d\\d):(\\d\\d):(\\d\\d)\\s+(\\d\\d\\d\\d)$");
|
||||
if (str.indexOf(rx))
|
||||
return QDateTime::currentDateTime();
|
||||
|
||||
nyear = 7;
|
||||
nmonth = 2;
|
||||
nday = 3;
|
||||
|
@ -417,7 +415,7 @@ namespace
|
|||
nhour = 4;
|
||||
nmin = 5;
|
||||
nsec = 6;
|
||||
parts = rxMatch.capturedTexts();
|
||||
parts = rx.capturedTexts();
|
||||
}
|
||||
|
||||
bool ok[4];
|
||||
|
@ -465,11 +463,11 @@ namespace
|
|||
bool negOffset = false;
|
||||
if (parts.count() > 10)
|
||||
{
|
||||
rx = QRegularExpression {"^([+-])(\\d\\d)(\\d\\d)$"};
|
||||
if (parts[10].indexOf(rx, 0, &rxMatch) == 0)
|
||||
rx = QRegExp("^([+-])(\\d\\d)(\\d\\d)$");
|
||||
if (!parts[10].indexOf(rx))
|
||||
{
|
||||
// It's a UTC offset ±hhmm
|
||||
parts = rxMatch.capturedTexts();
|
||||
parts = rx.capturedTexts();
|
||||
offset = parts[2].toInt(&ok[0]) * 3600;
|
||||
const int offsetMin = parts[3].toInt(&ok[1]);
|
||||
if (!ok[0] || !ok[1] || offsetMin > 59)
|
||||
|
|
|
@ -33,15 +33,10 @@
|
|||
|
||||
#include <QCollator>
|
||||
#include <QLocale>
|
||||
#include <QRegExp>
|
||||
#include <QtGlobal>
|
||||
#include <QVector>
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QRegularExpression>
|
||||
#else
|
||||
#include <QRegExp>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MACOS) || defined(__MINGW32__)
|
||||
#define QBT_USES_QTHREADSTORAGE
|
||||
#include <QThreadStorage>
|
||||
|
@ -186,21 +181,14 @@ QString Utils::String::fromDouble(const double n, const int precision)
|
|||
return QLocale::system().toString(std::floor(n * prec) / prec, 'f', precision);
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
QString Utils::String::wildcardToRegexPattern(const QString &pattern)
|
||||
{
|
||||
return QRegularExpression::wildcardToRegularExpression(pattern, QRegularExpression::UnanchoredWildcardConversion);
|
||||
}
|
||||
#else
|
||||
// This is marked as internal in QRegExp.cpp, but is exported. The alternative would be to
|
||||
// copy the code from QRegExp::wc2rx().
|
||||
QString qt_regexp_toCanonical(const QString &pattern, QRegExp::PatternSyntax patternSyntax);
|
||||
|
||||
QString Utils::String::wildcardToRegexPattern(const QString &pattern)
|
||||
QString Utils::String::wildcardToRegex(const QString &pattern)
|
||||
{
|
||||
return qt_regexp_toCanonical(pattern, QRegExp::Wildcard);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::optional<bool> Utils::String::parseBool(const QString &string)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Utils::String
|
|||
return (naturalCompare(left, right, caseSensitivity) < 0);
|
||||
}
|
||||
|
||||
QString wildcardToRegexPattern(const QString &pattern);
|
||||
QString wildcardToRegex(const QString &pattern);
|
||||
|
||||
template <typename T>
|
||||
T unquote(const T &str, const QString "es = QChar('"'))
|
||||
|
|
|
@ -825,8 +825,7 @@ void PropertiesWidget::filteredFilesChanged()
|
|||
|
||||
void PropertiesWidget::filterText(const QString &filter)
|
||||
{
|
||||
const QString pattern = Utils::String::wildcardToRegexPattern(filter);
|
||||
m_propListModel->setFilterRegularExpression(QRegularExpression(pattern, QRegularExpression::CaseInsensitiveOption));
|
||||
m_propListModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::WildcardUnix));
|
||||
if (filter.isEmpty())
|
||||
{
|
||||
m_ui->filesList->collapseAll();
|
||||
|
|
|
@ -719,14 +719,10 @@ void AutomatedRssDownloader::updateMustLineValidity()
|
|||
{
|
||||
QStringList tokens;
|
||||
if (isRegex)
|
||||
{
|
||||
tokens << text;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const QString &token : asConst(text.split('|')))
|
||||
tokens << Utils::String::wildcardToRegexPattern(token);
|
||||
}
|
||||
tokens << Utils::String::wildcardToRegex(token);
|
||||
|
||||
for (const QString &token : asConst(tokens))
|
||||
{
|
||||
|
@ -766,14 +762,10 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
|
|||
{
|
||||
QStringList tokens;
|
||||
if (isRegex)
|
||||
{
|
||||
tokens << text;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const QString &token : asConst(text.split('|')))
|
||||
tokens << Utils::String::wildcardToRegexPattern(token);
|
||||
}
|
||||
tokens << Utils::String::wildcardToRegex(token);
|
||||
|
||||
for (const QString &token : asConst(tokens))
|
||||
{
|
||||
|
|
|
@ -365,9 +365,9 @@ void SearchJobWidget::fillFilterComboBoxes()
|
|||
|
||||
void SearchJobWidget::filterSearchResults(const QString &name)
|
||||
{
|
||||
const QString pattern = (Preferences::instance()->getRegexAsFilteringPatternForSearchJob()
|
||||
? name : Utils::String::wildcardToRegexPattern(name));
|
||||
m_proxyModel->setFilterRegularExpression(QRegularExpression(pattern, QRegularExpression::CaseInsensitiveOption));
|
||||
const QRegExp::PatternSyntax patternSyntax = Preferences::instance()->getRegexAsFilteringPatternForSearchJob()
|
||||
? QRegExp::RegExp : QRegExp::WildcardUnix;
|
||||
m_proxyModel->setFilterRegExp(QRegExp(name, Qt::CaseInsensitive, patternSyntax));
|
||||
updateResultsCount();
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ bool TorrentContentFilterModel::hasFiltered(const QModelIndex &folder) const
|
|||
// this should be called only with folders
|
||||
// check if the folder name itself matches the filter string
|
||||
QString name = folder.data().toString();
|
||||
if (name.contains(filterRegularExpression()))
|
||||
if (name.contains(filterRegExp()))
|
||||
return true;
|
||||
for (int child = 0; child < m_model->rowCount(folder); ++child)
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ bool TorrentContentFilterModel::hasFiltered(const QModelIndex &folder) const
|
|||
continue;
|
||||
}
|
||||
name = childIndex.data().toString();
|
||||
if (name.contains(filterRegularExpression()))
|
||||
if (name.contains(filterRegExp()))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QSet>
|
||||
#include <QShortcut>
|
||||
|
@ -1130,9 +1131,9 @@ void TransferListWidget::applyTrackerFilter(const QSet<BitTorrent::TorrentID> &t
|
|||
|
||||
void TransferListWidget::applyNameFilter(const QString &name)
|
||||
{
|
||||
const QString pattern = (Preferences::instance()->getRegexAsFilteringPatternForTransferList()
|
||||
? name : Utils::String::wildcardToRegexPattern(name));
|
||||
m_sortFilterModel->setFilterRegularExpression(QRegularExpression(pattern, QRegularExpression::CaseInsensitiveOption));
|
||||
const QRegExp::PatternSyntax patternSyntax = Preferences::instance()->getRegexAsFilteringPatternForTransferList()
|
||||
? QRegExp::RegExp : QRegExp::WildcardUnix;
|
||||
m_sortFilterModel->setFilterRegExp(QRegExp(name, Qt::CaseInsensitive, patternSyntax));
|
||||
}
|
||||
|
||||
void TransferListWidget::applyStatusFilter(int f)
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <QMimeDatabase>
|
||||
#include <QMimeType>
|
||||
#include <QNetworkCookie>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QUrl>
|
||||
|
||||
#include "base/algorithm.h"
|
||||
|
@ -693,7 +693,7 @@ bool WebApplication::validateHostHeader(const QStringList &domains) const
|
|||
// try matching host header with domain list
|
||||
for (const auto &domain : domains)
|
||||
{
|
||||
const QRegularExpression domainRegex {Utils::String::wildcardToRegexPattern(domain), QRegularExpression::CaseInsensitiveOption};
|
||||
QRegExp domainRegex(domain, Qt::CaseInsensitive, QRegExp::Wildcard);
|
||||
if (requestHost.contains(domainRegex))
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue