mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-08 11:47:30 +08:00
Raise minimum Qt version to 5.14
This commit is contained in:
parent
0c71756009
commit
97c7f3bc67
@ -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.14)
|
||||
set(minOpenSSLVersion 1.1.1)
|
||||
set(minLibtorrentVersion 1.2.13)
|
||||
set(minZlibVersion 1.2.11)
|
||||
|
2
INSTALL
2
INSTALL
@ -11,7 +11,7 @@ qBittorrent - A BitTorrent client in C++ / Qt
|
||||
|
||||
- OpenSSL >= 1.1.1
|
||||
|
||||
- Qt >= 5.12
|
||||
- Qt >= 5.14
|
||||
|
||||
- zlib >= 1.2.11
|
||||
|
||||
|
42
configure
vendored
42
configure
vendored
@ -1450,7 +1450,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.14, overriding pkg-config
|
||||
Qt5Svg_CFLAGS
|
||||
C compiler flags for Qt5Svg, overriding pkg-config
|
||||
Qt5Svg_LIBS linker flags for Qt5Svg, overriding pkg-config
|
||||
@ -5456,8 +5456,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.14\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.14") 2>&5
|
||||
ac_status=$?
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
@ -5466,12 +5466,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.14\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.14") 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.14" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
@ -5501,8 +5501,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.14" >&5
|
||||
printf %s "checking for Qt5 qmake >= 5.14... " >&6; }
|
||||
if test "x$QT_QMAKE" != "x"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $QT_QMAKE" >&5
|
||||
@ -5529,12 +5529,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.14\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.14") 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.14" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
@ -5546,12 +5546,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.14\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.14") 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.14" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
@ -5572,14 +5572,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.14" 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.14" 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.14) were not met:
|
||||
|
||||
$Qt5Svg_PKG_ERRORS
|
||||
|
||||
@ -5619,11 +5619,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.14" >&5
|
||||
printf %s "checking for Qt5DBus >= 5.14... " >&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.14\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.14") 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.14])
|
||||
])
|
||||
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.14],
|
||||
[PKG_CHECK_VAR(QT_QMAKE,
|
||||
[Qt5Core >= 5.12],
|
||||
[Qt5Core >= 5.14],
|
||||
[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.14])
|
||||
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.14])
|
||||
PKG_CHECK_EXISTS([Qt5DBus >= 5.14],
|
||||
[AC_MSG_RESULT([found])
|
||||
HAVE_QTDBUS=[true]],
|
||||
[AC_MSG_RESULT([not found])
|
||||
|
@ -139,11 +139,7 @@ endif()
|
||||
if (GUI)
|
||||
target_link_libraries(qbt_app PRIVATE qbt_gui)
|
||||
if ((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
|
||||
if (Qt5_VERSION VERSION_LESS 5.14)
|
||||
set_property(TARGET qbt_app APPEND PROPERTY QT_PLUGINS Qt5::QSvgIconPlugin Qt5::QSvgPlugin)
|
||||
else()
|
||||
qt_import_plugins(qbt_app INCLUDE Qt5::QSvgIconPlugin Qt5::QSvgPlugin)
|
||||
endif()
|
||||
qt_import_plugins(qbt_app INCLUDE Qt5::QSvgIconPlugin Qt5::QSvgPlugin)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -302,7 +302,7 @@ void Application::setFileLoggerAgeType(const int value)
|
||||
|
||||
void Application::processMessage(const QString &message)
|
||||
{
|
||||
const QStringList params = message.split(PARAMS_SEPARATOR, QString::SkipEmptyParts);
|
||||
const QStringList params = message.split(PARAMS_SEPARATOR, Qt::SkipEmptyParts);
|
||||
// If Application is not running (i.e., other
|
||||
// components are not ready) store params
|
||||
if (m_running)
|
||||
|
@ -134,7 +134,7 @@ int main(int argc, char *argv[])
|
||||
// We must save it here because QApplication constructor may change it
|
||||
bool isOneArg = (argc == 2);
|
||||
|
||||
#if !defined(DISABLE_GUI) && (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
#if !defined(DISABLE_GUI)
|
||||
// Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created
|
||||
if (qgetenv("QT_ENABLE_HIGHDPI_SCALING").isEmpty() && qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR").isEmpty())
|
||||
Application::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||
|
@ -479,7 +479,8 @@ Session::Session(QObject *parent)
|
||||
m_storedCategories = map_cast(m_categories);
|
||||
}
|
||||
|
||||
m_tags = List::toSet(m_storedTags.get());
|
||||
const QStringList storedTags = m_storedTags.get();
|
||||
m_tags = {storedTags.cbegin(), storedTags.cend()};
|
||||
|
||||
enqueueRefresh();
|
||||
updateSeedingLimitTimer();
|
||||
|
@ -1252,7 +1252,7 @@ QVector<int> TorrentImpl::pieceAvailability() const
|
||||
std::vector<int> avail;
|
||||
m_nativeHandle.piece_availability(avail);
|
||||
|
||||
return Vector::fromStdVector(avail);
|
||||
return {avail.cbegin(), avail.cend()};
|
||||
}
|
||||
|
||||
qreal TorrentImpl::distributedCopies() const
|
||||
@ -1857,9 +1857,9 @@ void TorrentImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p)
|
||||
if (m_oldPath[p->index].isEmpty())
|
||||
m_oldPath.remove(p->index);
|
||||
|
||||
QVector<QStringRef> oldPathParts = oldFilePath.splitRef('/', QString::SkipEmptyParts);
|
||||
QVector<QStringRef> oldPathParts = oldFilePath.splitRef('/', Qt::SkipEmptyParts);
|
||||
oldPathParts.removeLast(); // drop file name part
|
||||
QVector<QStringRef> newPathParts = newFilePath.splitRef('/', QString::SkipEmptyParts);
|
||||
QVector<QStringRef> newPathParts = newFilePath.splitRef('/', Qt::SkipEmptyParts);
|
||||
newPathParts.removeLast(); // drop file name part
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
|
@ -35,44 +35,16 @@
|
||||
#define QBT_APP_64BIT
|
||||
#endif
|
||||
|
||||
const char C_TORRENT_FILE_EXTENSION[] = ".torrent";
|
||||
const int MAX_TORRENT_SIZE = 100 * 1024 * 1024; // 100 MiB
|
||||
inline const char C_TORRENT_FILE_EXTENSION[] = ".torrent";
|
||||
inline const int MAX_TORRENT_SIZE = 100 * 1024 * 1024; // 100 MiB
|
||||
|
||||
template <typename T>
|
||||
constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
|
||||
constexpr typename std::add_const_t<T> &asConst(T &t) noexcept { return t; }
|
||||
|
||||
// Forward rvalue as const
|
||||
template <typename T>
|
||||
constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
|
||||
constexpr typename std::add_const_t<T> asConst(T &&t) noexcept { return std::move(t); }
|
||||
|
||||
// Prevent const rvalue arguments
|
||||
template <typename T>
|
||||
void asConst(const T &&) = delete;
|
||||
|
||||
namespace List
|
||||
{
|
||||
// Replacement for the deprecated`QSet<T> QSet::fromList(const QList<T> &list)`
|
||||
template <typename T>
|
||||
QSet<T> toSet(const QList<T> &list)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
return {list.cbegin(), list.cend()};
|
||||
#else
|
||||
return QSet<T>::fromList(list);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
namespace Vector
|
||||
{
|
||||
// Replacement for the deprecated `QVector<T> QVector::fromStdVector(const std::vector<T> &vector)`
|
||||
template <typename T>
|
||||
QVector<T> fromStdVector(const std::vector<T> &vector)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
return {vector.cbegin(), vector.cend()};
|
||||
#else
|
||||
return QVector<T>::fromStdVector(vector);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ bool Connection::acceptsGzipEncoding(QString codings)
|
||||
return false;
|
||||
};
|
||||
|
||||
const QVector<QStringRef> list = codings.remove(' ').remove('\t').splitRef(',', QString::SkipEmptyParts);
|
||||
const QVector<QStringRef> list = codings.remove(' ').remove('\t').splitRef(',', Qt::SkipEmptyParts);
|
||||
if (list.isEmpty())
|
||||
return false;
|
||||
|
||||
|
@ -148,7 +148,7 @@ RequestParser::ParseResult RequestParser::doParse(const QByteArray &data)
|
||||
bool RequestParser::parseStartLines(const QString &data)
|
||||
{
|
||||
// we don't handle malformed request which uses `LF` for newline
|
||||
const QVector<QStringRef> lines = data.splitRef(CRLF, QString::SkipEmptyParts);
|
||||
const QVector<QStringRef> lines = data.splitRef(CRLF, Qt::SkipEmptyParts);
|
||||
|
||||
// [rfc7230] 3.2.2. Field Order
|
||||
QStringList requestLines;
|
||||
@ -276,7 +276,7 @@ bool RequestParser::parsePostMessage(const QByteArray &data)
|
||||
|
||||
// split data by "dash-boundary"
|
||||
const QByteArray dashDelimiter = QByteArray("--") + delimiter + CRLF;
|
||||
QVector<QByteArray> multipart = splitToViews(data, dashDelimiter, QString::SkipEmptyParts);
|
||||
QVector<QByteArray> multipart = splitToViews(data, dashDelimiter, Qt::SkipEmptyParts);
|
||||
if (multipart.isEmpty())
|
||||
{
|
||||
qWarning() << Q_FUNC_INFO << "multipart empty";
|
||||
@ -299,7 +299,7 @@ bool RequestParser::parsePostMessage(const QByteArray &data)
|
||||
|
||||
bool RequestParser::parseFormData(const QByteArray &data)
|
||||
{
|
||||
const QVector<QByteArray> list = splitToViews(data, EOH, QString::KeepEmptyParts);
|
||||
const QVector<QByteArray> list = splitToViews(data, EOH, Qt::KeepEmptyParts);
|
||||
|
||||
if (list.size() != 2)
|
||||
{
|
||||
@ -311,13 +311,13 @@ bool RequestParser::parseFormData(const QByteArray &data)
|
||||
const QByteArray payload = viewWithoutEndingWith(list[1], CRLF);
|
||||
|
||||
HeaderMap headersMap;
|
||||
const QVector<QStringRef> headerLines = headers.splitRef(CRLF, QString::SkipEmptyParts);
|
||||
const QVector<QStringRef> headerLines = headers.splitRef(CRLF, Qt::SkipEmptyParts);
|
||||
for (const auto &line : headerLines)
|
||||
{
|
||||
if (line.trimmed().startsWith(HEADER_CONTENT_DISPOSITION, Qt::CaseInsensitive))
|
||||
{
|
||||
// extract out filename & name
|
||||
const QVector<QStringRef> directives = line.split(';', QString::SkipEmptyParts);
|
||||
const QVector<QStringRef> directives = line.split(';', Qt::SkipEmptyParts);
|
||||
|
||||
for (const auto &directive : directives)
|
||||
{
|
||||
|
@ -456,7 +456,7 @@ void Smtp::authenticate()
|
||||
// AUTH extension is supported, check which
|
||||
// authentication modes are supported by
|
||||
// the server
|
||||
const QStringList auth = m_extensions["AUTH"].toUpper().split(' ', QString::SkipEmptyParts);
|
||||
const QStringList auth = m_extensions["AUTH"].toUpper().split(' ', Qt::SkipEmptyParts);
|
||||
if (auth.contains("CRAM-MD5"))
|
||||
{
|
||||
qDebug() << "Using CRAM-MD5 authentication...";
|
||||
|
@ -238,7 +238,7 @@ bool AutoDownloadRule::matchesExpression(const QString &articleTitle, const QStr
|
||||
|
||||
// Only match if every wildcard token (separated by spaces) is present in the article name.
|
||||
// Order of wildcard tokens is unimportant (if order is important, they should have used *).
|
||||
const QStringList wildcards {expression.split(whitespace, QString::SplitBehavior::SkipEmptyParts)};
|
||||
const QStringList wildcards {expression.split(whitespace, Qt::SkipEmptyParts)};
|
||||
for (const QString &wildcard : wildcards)
|
||||
{
|
||||
const QRegularExpression reg {cachedRegex(wildcard, false)};
|
||||
|
@ -516,14 +516,14 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info)
|
||||
QHash<QString, PluginVersion> updateInfo;
|
||||
int numCorrectData = 0;
|
||||
|
||||
const QVector<QByteArray> lines = Utils::ByteArray::splitToViews(info, "\n", QString::SkipEmptyParts);
|
||||
const QVector<QByteArray> lines = Utils::ByteArray::splitToViews(info, "\n", Qt::SkipEmptyParts);
|
||||
for (QByteArray line : lines)
|
||||
{
|
||||
line = line.trimmed();
|
||||
if (line.isEmpty()) continue;
|
||||
if (line.startsWith('#')) continue;
|
||||
|
||||
const QVector<QByteArray> list = Utils::ByteArray::splitToViews(line, ":", QString::SkipEmptyParts);
|
||||
const QVector<QByteArray> list = Utils::ByteArray::splitToViews(line, ":", Qt::SkipEmptyParts);
|
||||
if (list.size() != 2) continue;
|
||||
|
||||
const QString pluginName = list.first().trimmed();
|
||||
|
@ -31,13 +31,13 @@
|
||||
#include <QByteArray>
|
||||
#include <QVector>
|
||||
|
||||
QVector<QByteArray> Utils::ByteArray::splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior)
|
||||
QVector<QByteArray> Utils::ByteArray::splitToViews(const QByteArray &in, const QByteArray &sep, const Qt::SplitBehavior behavior)
|
||||
{
|
||||
if (sep.isEmpty())
|
||||
return {in};
|
||||
|
||||
QVector<QByteArray> ret;
|
||||
ret.reserve((behavior == QString::KeepEmptyParts)
|
||||
ret.reserve((behavior == Qt::KeepEmptyParts)
|
||||
? (1 + (in.size() / sep.size()))
|
||||
: (1 + (in.size() / (sep.size() + 1))));
|
||||
int head = 0;
|
||||
@ -49,7 +49,7 @@ QVector<QByteArray> Utils::ByteArray::splitToViews(const QByteArray &in, const Q
|
||||
|
||||
// omit empty parts
|
||||
const QByteArray part = QByteArray::fromRawData((in.constData() + head), (end - head));
|
||||
if (!part.isEmpty() || (behavior == QString::KeepEmptyParts))
|
||||
if (!part.isEmpty() || (behavior == Qt::KeepEmptyParts))
|
||||
ret += part;
|
||||
|
||||
head = end + sep.size();
|
||||
|
@ -36,7 +36,7 @@ class QByteArray;
|
||||
namespace Utils::ByteArray
|
||||
{
|
||||
// Mimic QString::splitRef(sep, behavior)
|
||||
QVector<QByteArray> splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior = QString::KeepEmptyParts);
|
||||
QVector<QByteArray> splitToViews(const QByteArray &in, const QByteArray &sep, const Qt::SplitBehavior behavior = Qt::KeepEmptyParts);
|
||||
|
||||
// Mimic QByteArray::mid(pos, len) but instead of returning a full-copy,
|
||||
// we only return a partial view
|
||||
|
@ -63,7 +63,7 @@ namespace
|
||||
// Software 'Anaconda' installs its own python interpreter
|
||||
// and `python --version` returns a string like this:
|
||||
// "Python 3.4.3 :: Anaconda 2.3.0 (64-bit)"
|
||||
const QVector<QByteArray> outputSplit = Utils::ByteArray::splitToViews(procOutput, " ", QString::SkipEmptyParts);
|
||||
const QVector<QByteArray> outputSplit = Utils::ByteArray::splitToViews(procOutput, " ", Qt::SkipEmptyParts);
|
||||
if (outputSplit.size() <= 1)
|
||||
return false;
|
||||
|
||||
|
@ -498,7 +498,7 @@ QString Utils::Misc::opensslVersionString()
|
||||
#else
|
||||
static const auto version {QString::fromLatin1(SSLeay_version(SSLEAY_VERSION))};
|
||||
#endif
|
||||
return version.splitRef(' ', QString::SkipEmptyParts)[1].toString();
|
||||
return version.splitRef(' ', Qt::SkipEmptyParts)[1].toString();
|
||||
}
|
||||
|
||||
QString Utils::Misc::zlibVersionString()
|
||||
|
@ -99,7 +99,7 @@ bool Utils::Password::PBKDF2::verify(const QByteArray &secret, const QString &pa
|
||||
|
||||
bool Utils::Password::PBKDF2::verify(const QByteArray &secret, const QByteArray &password)
|
||||
{
|
||||
const QVector<QByteArray> list = ByteArray::splitToViews(secret, ":", QString::SkipEmptyParts);
|
||||
const QVector<QByteArray> list = ByteArray::splitToViews(secret, ":", Qt::SkipEmptyParts);
|
||||
if (list.size() != 2)
|
||||
return false;
|
||||
|
||||
|
@ -241,7 +241,7 @@ void FileSystemPathEdit::setFileNameFilter(const QString &val)
|
||||
}
|
||||
else
|
||||
{
|
||||
QStringList filters = filterString.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
QStringList filters = filterString.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
d->m_editor->setFilenameFilters(filters);
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ QValidator::State Private::FileSystemPathValidator::validate(QString &input, int
|
||||
|
||||
// we test path components from beginning to the one with cursor location in strict mode
|
||||
// and the one with cursor and beyond in non-strict mode
|
||||
QVector<QStringRef> components = input.splitRef(QDir::separator(), QString::KeepEmptyParts);
|
||||
QVector<QStringRef> components = input.splitRef(QDir::separator(), Qt::KeepEmptyParts);
|
||||
// find index of the component that contains pos
|
||||
int componentWithCursorIndex = 0;
|
||||
int pathLength = 0;
|
||||
|
@ -1154,7 +1154,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||
if (mimeData->hasText())
|
||||
{
|
||||
const bool useTorrentAdditionDialog {AddNewTorrentDialog::isEnabled()};
|
||||
const QStringList lines {mimeData->text().split('\n', QString::SkipEmptyParts)};
|
||||
const QStringList lines {mimeData->text().split('\n', Qt::SkipEmptyParts)};
|
||||
|
||||
for (QString line : lines)
|
||||
{
|
||||
|
@ -718,7 +718,7 @@ void OptionsDialog::saveOptions()
|
||||
RSS::Session::instance()->setMaxArticlesPerFeed(m_ui->spinRSSMaxArticlesPerFeed->value());
|
||||
RSS::Session::instance()->setProcessingEnabled(m_ui->checkRSSEnable->isChecked());
|
||||
RSS::AutoDownloader::instance()->setProcessingEnabled(m_ui->checkRSSAutoDownloaderEnable->isChecked());
|
||||
RSS::AutoDownloader::instance()->setSmartEpisodeFilters(m_ui->textSmartEpisodeFilters->toPlainText().split('\n', QString::SplitBehavior::SkipEmptyParts));
|
||||
RSS::AutoDownloader::instance()->setSmartEpisodeFilters(m_ui->textSmartEpisodeFilters->toPlainText().split('\n', Qt::SkipEmptyParts));
|
||||
RSS::AutoDownloader::instance()->setDownloadRepacks(m_ui->checkSmartFilterDownloadRepacks->isChecked());
|
||||
|
||||
auto session = BitTorrent::Session::instance();
|
||||
|
@ -502,15 +502,9 @@ void PeerListWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
// Shift + scroll = horizontal scroll
|
||||
event->accept();
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QWheelEvent scrollHEvent(event->position(), event->globalPosition()
|
||||
, event->pixelDelta(), event->angleDelta().transposed(), event->buttons()
|
||||
, event->modifiers(), event->phase(), event->inverted(), event->source());
|
||||
#else
|
||||
QWheelEvent scrollHEvent(event->pos(), event->globalPos()
|
||||
, event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal);
|
||||
#endif
|
||||
QTreeView::wheelEvent(&scrollHEvent);
|
||||
return;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void SearchSortModel::setNameFilter(const QString &searchTerm)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_searchTermWords = searchTerm.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
m_searchTermWords = searchTerm.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,7 +503,7 @@ void TorrentContentModel::setupModelData(const BitTorrent::TorrentInfo &info)
|
||||
const QString path = Utils::Fs::toUniformPath(info.filePath(i));
|
||||
|
||||
// Iterate of parts of the path to create necessary folders
|
||||
QVector<QStringRef> pathFolders = path.splitRef('/', QString::SkipEmptyParts);
|
||||
QVector<QStringRef> pathFolders = path.splitRef('/', Qt::SkipEmptyParts);
|
||||
pathFolders.removeLast();
|
||||
|
||||
for (const QStringRef &pathPartRef : asConst(pathFolders))
|
||||
|
@ -212,7 +212,7 @@ void TorrentCreatorDialog::onCreateButtonClicked()
|
||||
, m_ui->txtComment->toPlainText()
|
||||
, m_ui->lineEditSource->text()
|
||||
, trackers
|
||||
, m_ui->URLSeedsList->toPlainText().split('\n', QString::SkipEmptyParts)
|
||||
, m_ui->URLSeedsList->toPlainText().split('\n', Qt::SkipEmptyParts)
|
||||
};
|
||||
|
||||
// run the creator thread
|
||||
|
@ -632,9 +632,9 @@ QSet<BitTorrent::TorrentID> TrackerFiltersList::getTorrentIDs(const int row) con
|
||||
case TRACKERLESS_ROW:
|
||||
return m_trackers.value(NULL_HOST);
|
||||
case ERROR_ROW:
|
||||
return List::toSet(m_errors.keys());
|
||||
return {m_errors.keyBegin(), m_errors.keyEnd()};
|
||||
case WARNING_ROW:
|
||||
return List::toSet(m_warnings.keys());
|
||||
return {m_warnings.keyBegin(), m_warnings.keyEnd()};
|
||||
default:
|
||||
return m_trackers.value(trackerFromRow(row));
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ QStringList TransferListWidget::askTagsForSelection(const QString &dialogTitle)
|
||||
this, dialogTitle, tr("Comma-separated tags:"), QLineEdit::Normal, "", &ok).trimmed();
|
||||
if (!ok || tagsInput.isEmpty())
|
||||
return {};
|
||||
tags = tagsInput.split(',', QString::SkipEmptyParts);
|
||||
tags = tagsInput.split(',', Qt::SkipEmptyParts);
|
||||
for (QString &tag : tags)
|
||||
{
|
||||
tag = tag.trimmed();
|
||||
@ -1163,15 +1163,9 @@ void TransferListWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
// Shift + scroll = horizontal scroll
|
||||
event->accept();
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QWheelEvent scrollHEvent(event->position(), event->globalPosition()
|
||||
, event->pixelDelta(), event->angleDelta().transposed(), event->buttons()
|
||||
, event->modifiers(), event->phase(), event->inverted(), event->source());
|
||||
#else
|
||||
QWheelEvent scrollHEvent(event->pos(), event->globalPos()
|
||||
, event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal);
|
||||
#endif
|
||||
QTreeView::wheelEvent(&scrollHEvent);
|
||||
return;
|
||||
}
|
||||
|
@ -48,10 +48,6 @@
|
||||
#include <QWidget>
|
||||
#include <QWindow>
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) && defined(Q_OS_WIN)
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/version.h"
|
||||
|
||||
@ -65,26 +61,8 @@ void Utils::Gui::resize(QWidget *widget, const QSize &newSize)
|
||||
|
||||
qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
Q_UNUSED(widget);
|
||||
return 1;
|
||||
#else
|
||||
if (!widget)
|
||||
return 1;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
const int screenNumber = qApp->desktop()->screenNumber(widget);
|
||||
const QScreen *screen = QApplication::screens()[screenNumber];
|
||||
// Workaround for QScreen::physicalDotsPerInch() that could return
|
||||
// values that are smaller than the normal 96 DPI on Windows
|
||||
const qreal physicalDPI = qMax<qreal>(screen->physicalDotsPerInch(), 96);
|
||||
return (screen->logicalDotsPerInch() / physicalDPI);
|
||||
#elif defined(Q_OS_MACOS)
|
||||
return 1;
|
||||
#else
|
||||
return widget->devicePixelRatioF();
|
||||
#endif // Q_OS_WIN
|
||||
#endif // QT_VERSION
|
||||
}
|
||||
|
||||
QPixmap Utils::Gui::scaledPixmap(const QIcon &icon, const QWidget *widget, const int height)
|
||||
|
@ -523,7 +523,7 @@ void AppController::setPreferencesAction()
|
||||
if (hasKey("ip_filter_trackers"))
|
||||
session->setTrackerFilteringEnabled(it.value().toBool());
|
||||
if (hasKey("banned_IPs"))
|
||||
session->setBannedIPs(it.value().toString().split('\n', QString::SkipEmptyParts));
|
||||
session->setBannedIPs(it.value().toString().split('\n', Qt::SkipEmptyParts));
|
||||
|
||||
// Speed
|
||||
// Global Rate Limits
|
||||
@ -653,7 +653,7 @@ void AppController::setPreferencesAction()
|
||||
if (hasKey("bypass_auth_subnet_whitelist"))
|
||||
{
|
||||
// recognize new lines and commas as delimiters
|
||||
pref->setWebUiAuthSubnetWhitelist(it.value().toString().split(QRegularExpression("\n|,"), QString::SkipEmptyParts));
|
||||
pref->setWebUiAuthSubnetWhitelist(it.value().toString().split(QRegularExpression("\n|,"), Qt::SkipEmptyParts));
|
||||
}
|
||||
if (hasKey("web_ui_max_auth_fail_count"))
|
||||
pref->setWebUIMaxAuthFailCount(it.value().toInt());
|
||||
|
@ -259,7 +259,7 @@ void TorrentsController::infoAction()
|
||||
const bool reverse {parseBool(params()["reverse"]).value_or(false)};
|
||||
int limit {params()["limit"].toInt()};
|
||||
int offset {params()["offset"].toInt()};
|
||||
const QStringList hashes {params()["hashes"].split('|', QString::SkipEmptyParts)};
|
||||
const QStringList hashes {params()["hashes"].split('|', Qt::SkipEmptyParts)};
|
||||
|
||||
TorrentIDSet idSet;
|
||||
for (const QString &hash : hashes)
|
||||
@ -637,7 +637,7 @@ void TorrentsController::addAction()
|
||||
const std::optional<bool> addPaused = parseBool(params()["paused"]);
|
||||
const QString savepath = params()["savepath"].trimmed();
|
||||
const QString category = params()["category"];
|
||||
const QStringList tags = params()["tags"].split(',', QString::SkipEmptyParts);
|
||||
const QStringList tags = params()["tags"].split(',', Qt::SkipEmptyParts);
|
||||
const QString torrentName = params()["rename"].trimmed();
|
||||
const int upLimit = parseInt(params()["upLimit"]).value_or(-1);
|
||||
const int dlLimit = parseInt(params()["dlLimit"]).value_or(-1);
|
||||
@ -1215,7 +1215,7 @@ void TorrentsController::addTagsAction()
|
||||
requireParams({"hashes", "tags"});
|
||||
|
||||
const QStringList hashes {params()["hashes"].split('|')};
|
||||
const QStringList tags {params()["tags"].split(',', QString::SkipEmptyParts)};
|
||||
const QStringList tags {params()["tags"].split(',', Qt::SkipEmptyParts)};
|
||||
|
||||
for (const QString &tag : tags)
|
||||
{
|
||||
@ -1232,7 +1232,7 @@ void TorrentsController::removeTagsAction()
|
||||
requireParams({"hashes"});
|
||||
|
||||
const QStringList hashes {params()["hashes"].split('|')};
|
||||
const QStringList tags {params()["tags"].split(',', QString::SkipEmptyParts)};
|
||||
const QStringList tags {params()["tags"].split(',', Qt::SkipEmptyParts)};
|
||||
|
||||
for (const QString &tag : tags)
|
||||
{
|
||||
@ -1256,7 +1256,7 @@ void TorrentsController::createTagsAction()
|
||||
{
|
||||
requireParams({"tags"});
|
||||
|
||||
const QStringList tags {params()["tags"].split(',', QString::SkipEmptyParts)};
|
||||
const QStringList tags {params()["tags"].split(',', Qt::SkipEmptyParts)};
|
||||
|
||||
for (const QString &tag : tags)
|
||||
BitTorrent::Session::instance()->addTag(tag.trimmed());
|
||||
@ -1266,7 +1266,7 @@ void TorrentsController::deleteTagsAction()
|
||||
{
|
||||
requireParams({"tags"});
|
||||
|
||||
const QStringList tags {params()["tags"].split(',', QString::SkipEmptyParts)};
|
||||
const QStringList tags {params()["tags"].split(',', Qt::SkipEmptyParts)};
|
||||
for (const QString &tag : tags)
|
||||
BitTorrent::Session::instance()->removeTag(tag.trimmed());
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ namespace
|
||||
{
|
||||
// [rfc6265] 4.2.1. Syntax
|
||||
QStringMap ret;
|
||||
const QVector<QStringRef> cookies = cookieStr.splitRef(';', QString::SkipEmptyParts);
|
||||
const QVector<QStringRef> cookies = cookieStr.splitRef(';', Qt::SkipEmptyParts);
|
||||
|
||||
for (const auto &cookie : cookies)
|
||||
{
|
||||
@ -143,7 +143,7 @@ WebApplication::~WebApplication()
|
||||
|
||||
void WebApplication::sendWebUIFile()
|
||||
{
|
||||
const QStringList pathItems {request().path.split('/', QString::SkipEmptyParts)};
|
||||
const QStringList pathItems {request().path.split('/', Qt::SkipEmptyParts)};
|
||||
if (pathItems.contains(".") || pathItems.contains(".."))
|
||||
throw InternalServerErrorHTTPError();
|
||||
|
||||
@ -356,7 +356,7 @@ void WebApplication::configure()
|
||||
m_authSubnetWhitelist = pref->getWebUiAuthSubnetWhitelist();
|
||||
m_sessionTimeout = pref->getWebUISessionTimeout();
|
||||
|
||||
m_domainList = pref->getServerDomains().split(';', QString::SkipEmptyParts);
|
||||
m_domainList = pref->getServerDomains().split(';', Qt::SkipEmptyParts);
|
||||
std::for_each(m_domainList.begin(), m_domainList.end(), [](QString &entry) { entry = entry.trimmed(); });
|
||||
|
||||
m_isCSRFProtectionEnabled = pref->isWebUiCSRFProtectionEnabled();
|
||||
@ -387,7 +387,7 @@ void WebApplication::configure()
|
||||
if (pref->isWebUICustomHTTPHeadersEnabled())
|
||||
{
|
||||
const QString customHeaders = pref->getWebUICustomHTTPHeaders().trimmed();
|
||||
const QVector<QStringRef> customHeaderLines = customHeaders.splitRef('\n', QString::SkipEmptyParts);
|
||||
const QVector<QStringRef> customHeaderLines = customHeaders.splitRef('\n', Qt::SkipEmptyParts);
|
||||
|
||||
for (const QStringRef &line : customHeaderLines)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user