Browse Source

Merge pull request #15181 from glassez/qt5

Raise minimum Qt version to 5.15.2
adaptive-webui-19844
Vladimir Golovnev 3 years ago committed by GitHub
parent
commit
1eb246c98b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .appveyor.yml
  2. 10
      .github/workflows/ci.yaml
  3. 2
      CMakeLists.txt
  4. 2
      INSTALL
  5. 2
      cmake/Modules/MacroQbtCommonConfig.cmake
  6. 42
      configure
  7. 3
      configure.ac
  8. 10
      m4/qbittorrent.m4
  9. 8
      src/app/application.cpp
  10. 12
      src/base/bittorrent/peeraddress.cpp
  11. 2
      src/base/bittorrent/peeraddress.h
  12. 2
      src/base/bittorrent/session.cpp
  13. 6
      src/base/bittorrent/torrentimpl.cpp
  14. 2
      src/base/bittorrent/torrentinfo.cpp
  15. 12
      src/base/http/connection.cpp
  16. 18
      src/base/http/requestparser.cpp
  17. 2
      src/base/http/requestparser.h
  18. 5
      src/base/net/smtp.cpp
  19. 2
      src/base/rss/rss_autodownloadrule.cpp
  20. 2
      src/base/search/searchdownloadhandler.cpp
  21. 4
      src/base/search/searchhandler.cpp
  22. 2
      src/base/search/searchhandler.h
  23. 4
      src/base/utils/bytearray.h
  24. 8
      src/base/utils/compare.cpp
  25. 2
      src/base/utils/misc.cpp
  26. 4
      src/base/utils/string.cpp
  27. 4
      src/base/utils/string.h
  28. 8
      src/gui/downloadfromurldialog.cpp
  29. 34
      src/gui/fspathedit_p.cpp
  30. 5
      src/gui/fspathedit_p.h
  31. 7
      src/gui/mainwindow.cpp
  32. 5
      src/gui/properties/proptabbar.cpp
  33. 2
      src/gui/properties/trackersadditiondialog.cpp
  34. 10
      src/gui/torrentcontentmodel.cpp
  35. 5
      src/gui/torrentoptionsdialog.cpp
  36. 4
      src/gui/trackerentriesdialog.cpp
  37. 2
      src/src.pro
  38. 10
      src/webui/webapplication.cpp

2
.appveyor.yml

@ -43,7 +43,7 @@ install:
before_build: before_build:
# setup env # setup env
- CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" - CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
- SET PATH=%PATH%;c:\qbt\qt5_64\bin;%CACHE_DIR%\jom; - SET PATH=%PATH%;C:\Qt\5.15.2\msvc2019_64\bin;%CACHE_DIR%\jom
# setup project # setup project
- COPY /Y "%CACHE_DIR%\conf.pri" "%REPO_DIR%" - COPY /Y "%CACHE_DIR%\conf.pri" "%REPO_DIR%"
# workarounds # workarounds

10
.github/workflows/ci.yaml

@ -42,12 +42,12 @@ jobs:
libboost-dev libboost-chrono-dev libboost-random-dev libboost-system-dev libboost-dev libboost-chrono-dev libboost-random-dev libboost-system-dev
# sudo apt install libqt5svg5-dev qtbase5-dev qttools5-dev # the Qt version in the standard repositories is too old... # sudo apt install libqt5svg5-dev qtbase5-dev qttools5-dev # the Qt version in the standard repositories is too old...
# this will be installed under /opt/qt514. CMake will still find it automatically without additional hints # this will be installed under /opt/qt515. CMake will still find it automatically without additional hints
# to speed up the process, only the required components are installed rather than the full qt514-meta-full metapackage # to speed up the process, only the required components are installed rather than the full qt515-meta-full metapackage
- name: install Qt 5.14.2 from an external PPA - name: install Qt 5.15.2 from an external PPA
run: | run: |
sudo add-apt-repository ppa:beineri/opt-qt-5.14.2-focal sudo add-apt-repository ppa:beineri/opt-qt-5.15.2-focal
sudo apt install qt514base qt514svg qt514tools sudo apt install qt515base qt515svg qt515tools
- name: install libtorrent from source - name: install libtorrent from source
run: | run: |

2
CMakeLists.txt

@ -12,7 +12,7 @@ project(qBittorrent
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
# version requirements - older vesions may work, but you are on your own # version requirements - older vesions may work, but you are on your own
set(minBoostVersion 1.65) set(minBoostVersion 1.65)
set(minQtVersion 5.14) set(minQtVersion 5.15.2)
set(minOpenSSLVersion 1.1.1) set(minOpenSSLVersion 1.1.1)
set(minLibtorrentVersion 1.2.14) set(minLibtorrentVersion 1.2.14)
set(minZlibVersion 1.2.11) set(minZlibVersion 1.2.11)

2
INSTALL

@ -11,7 +11,7 @@ qBittorrent - A BitTorrent client in C++ / Qt
- OpenSSL >= 1.1.1 - OpenSSL >= 1.1.1
- Qt >= 5.14 - Qt >= 5.15.2
- zlib >= 1.2.11 - zlib >= 1.2.11

2
cmake/Modules/MacroQbtCommonConfig.cmake

@ -17,7 +17,7 @@ macro(qbt_common_config)
) )
target_compile_definitions(qbt_common_cfg INTERFACE target_compile_definitions(qbt_common_cfg INTERFACE
QT_DISABLE_DEPRECATED_BEFORE=0x050e00 QT_DISABLE_DEPRECATED_BEFORE=0x050f02
QT_NO_CAST_TO_ASCII QT_NO_CAST_TO_ASCII
QT_NO_CAST_FROM_BYTEARRAY QT_NO_CAST_FROM_BYTEARRAY
QT_USE_QSTRINGBUILDER QT_USE_QSTRINGBUILDER

42
configure vendored

@ -1450,7 +1450,7 @@ Some influential environment variables:
directories to add to pkg-config's search path directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path path overriding pkg-config's built-in search path
QT_QMAKE value of host_bins for Qt5Core >= 5.14, overriding pkg-config QT_QMAKE value of host_bins for Qt5Core >= 5.15.2, overriding pkg-config
Qt5Svg_CFLAGS Qt5Svg_CFLAGS
C compiler flags for Qt5Svg, overriding pkg-config C compiler flags for Qt5Svg, overriding pkg-config
Qt5Svg_LIBS linker 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 esac
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.14\""; } >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.15.2\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.14") 2>&5 ($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.15.2") 2>&5
ac_status=$? ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
@ -5466,12 +5466,12 @@ if test -n "$QT_QMAKE"; then
pkg_cv_QT_QMAKE="$QT_QMAKE" pkg_cv_QT_QMAKE="$QT_QMAKE"
elif test -n "$PKG_CONFIG"; then elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.14\""; } >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.15.2\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.14") 2>&5 ($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.15.2") 2>&5
ac_status=$? ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
pkg_cv_QT_QMAKE=`$PKG_CONFIG --variable="host_bins" "Qt5Core >= 5.14" 2>/dev/null` pkg_cv_QT_QMAKE=`$PKG_CONFIG --variable="host_bins" "Qt5Core >= 5.15.2" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes test "x$?" != "x0" && pkg_failed=yes
else else
pkg_failed=yes pkg_failed=yes
@ -5501,8 +5501,8 @@ fi
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Qt5 qmake >= 5.14" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Qt5 qmake >= 5.15.2" >&5
printf %s "checking for Qt5 qmake >= 5.14... " >&6; } printf %s "checking for Qt5 qmake >= 5.15.2... " >&6; }
if test "x$QT_QMAKE" != "x" if test "x$QT_QMAKE" != "x"
then : then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $QT_QMAKE" >&5 { 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" pkg_cv_Qt5Svg_CFLAGS="$Qt5Svg_CFLAGS"
elif test -n "$PKG_CONFIG"; then elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.14\""; } >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.15.2\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.14") 2>&5 ($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.15.2") 2>&5
ac_status=$? ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
pkg_cv_Qt5Svg_CFLAGS=`$PKG_CONFIG --cflags "Qt5Svg >= 5.14" 2>/dev/null` pkg_cv_Qt5Svg_CFLAGS=`$PKG_CONFIG --cflags "Qt5Svg >= 5.15.2" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes test "x$?" != "x0" && pkg_failed=yes
else else
pkg_failed=yes pkg_failed=yes
@ -5546,12 +5546,12 @@ if test -n "$Qt5Svg_LIBS"; then
pkg_cv_Qt5Svg_LIBS="$Qt5Svg_LIBS" pkg_cv_Qt5Svg_LIBS="$Qt5Svg_LIBS"
elif test -n "$PKG_CONFIG"; then elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.14\""; } >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Svg >= 5.15.2\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.14") 2>&5 ($PKG_CONFIG --exists --print-errors "Qt5Svg >= 5.15.2") 2>&5
ac_status=$? ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
pkg_cv_Qt5Svg_LIBS=`$PKG_CONFIG --libs "Qt5Svg >= 5.14" 2>/dev/null` pkg_cv_Qt5Svg_LIBS=`$PKG_CONFIG --libs "Qt5Svg >= 5.15.2" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes test "x$?" != "x0" && pkg_failed=yes
else else
pkg_failed=yes pkg_failed=yes
@ -5572,14 +5572,14 @@ else
_pkg_short_errors_supported=no _pkg_short_errors_supported=no
fi fi
if test $_pkg_short_errors_supported = yes; then if test $_pkg_short_errors_supported = yes; then
Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "Qt5Svg >= 5.14" 2>&1` Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "Qt5Svg >= 5.15.2" 2>&1`
else else
Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "Qt5Svg >= 5.14" 2>&1` Qt5Svg_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "Qt5Svg >= 5.15.2" 2>&1`
fi fi
# Put the nasty error message in config.log where it belongs # Put the nasty error message in config.log where it belongs
echo "$Qt5Svg_PKG_ERRORS" >&5 echo "$Qt5Svg_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (Qt5Svg >= 5.14) were not met: as_fn_error $? "Package requirements (Qt5Svg >= 5.15.2) were not met:
$Qt5Svg_PKG_ERRORS $Qt5Svg_PKG_ERRORS
@ -5619,11 +5619,11 @@ case "x$enable_qt_dbus" in #(
"xyes") : "xyes") :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; } printf "%s\n" "yes" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Qt5DBus >= 5.14" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Qt5DBus >= 5.15.2" >&5
printf %s "checking for Qt5DBus >= 5.14... " >&6; } printf %s "checking for Qt5DBus >= 5.15.2... " >&6; }
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5DBus >= 5.14\""; } >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5DBus >= 5.15.2\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.14") 2>&5 ($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.15.2") 2>&5
ac_status=$? ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then

3
configure.ac

@ -1,3 +1,4 @@
AC_INIT([qbittorrent], [v4.4.0alpha], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/]) AC_INIT([qbittorrent], [v4.4.0alpha], [bugs.qbittorrent.org], [], [https://www.qbittorrent.org/])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
@ -141,7 +142,7 @@ AS_IF([test "x$QT_QMAKE" = "x"],
[AC_MSG_ERROR([Could not find qmake]) [AC_MSG_ERROR([Could not find qmake])
]) ])
AS_IF([test "x$enable_gui" = "xyes"], AS_IF([test "x$enable_gui" = "xyes"],
[PKG_CHECK_MODULES(Qt5Svg, [Qt5Svg >= 5.14]) [PKG_CHECK_MODULES(Qt5Svg, [Qt5Svg >= 5.15.2])
]) ])
AC_MSG_CHECKING([whether QtDBus should be enabled]) AC_MSG_CHECKING([whether QtDBus should be enabled])
AS_CASE(["x$enable_qt_dbus"], AS_CASE(["x$enable_qt_dbus"],

10
m4/qbittorrent.m4

@ -5,9 +5,9 @@
# Sets the QT_QMAKE variable to the path of Qt5 qmake if found. # Sets the QT_QMAKE variable to the path of Qt5 qmake if found.
# -------------------------------------- # --------------------------------------
AC_DEFUN([FIND_QT5], AC_DEFUN([FIND_QT5],
[PKG_CHECK_EXISTS([Qt5Core >= 5.14], [PKG_CHECK_EXISTS([Qt5Core >= 5.15.2],
[PKG_CHECK_VAR(QT_QMAKE, [PKG_CHECK_VAR(QT_QMAKE,
[Qt5Core >= 5.14], [Qt5Core >= 5.15.2],
[host_bins]) [host_bins])
]) ])
@ -18,7 +18,7 @@ AS_IF([test -f "$QT_QMAKE/qmake"],
[QT_QMAKE=""]) [QT_QMAKE=""])
]) ])
AC_MSG_CHECKING([for Qt5 qmake >= 5.14]) AC_MSG_CHECKING([for Qt5 qmake >= 5.15.2])
AS_IF([test "x$QT_QMAKE" != "x"], AS_IF([test "x$QT_QMAKE" != "x"],
[AC_MSG_RESULT([$QT_QMAKE])], [AC_MSG_RESULT([$QT_QMAKE])],
[AC_MSG_RESULT([not found])] [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. # Sets the HAVE_QTDBUS variable to true or false.
# -------------------------------------- # --------------------------------------
AC_DEFUN([FIND_QTDBUS], AC_DEFUN([FIND_QTDBUS],
[AC_MSG_CHECKING([for Qt5DBus >= 5.14]) [AC_MSG_CHECKING([for Qt5DBus >= 5.15.2])
PKG_CHECK_EXISTS([Qt5DBus >= 5.14], PKG_CHECK_EXISTS([Qt5DBus >= 5.15.2],
[AC_MSG_RESULT([found]) [AC_MSG_RESULT([found])
HAVE_QTDBUS=[true]], HAVE_QTDBUS=[true]],
[AC_MSG_RESULT([not found]) [AC_MSG_RESULT([not found])

8
src/app/application.cpp

@ -435,16 +435,12 @@ void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const
// enable command injection via torrent name and other arguments // enable command injection via torrent name and other arguments
// (especially when some automated download mechanism has been setup). // (especially when some automated download mechanism has been setup).
// See: https://github.com/qbittorrent/qBittorrent/issues/10925 // See: https://github.com/qbittorrent/qBittorrent/issues/10925
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QStringList args = QProcess::splitCommand(program); QStringList args = QProcess::splitCommand(program);
if (args.isEmpty()) if (args.isEmpty())
return; return;
const QString command = args.takeFirst(); const QString command = args.takeFirst();
QProcess::startDetached(command, args); QProcess::startDetached(command, args);
#else
QProcess::startDetached(program);
#endif
#endif #endif
} }
@ -565,7 +561,7 @@ void Application::processParams(const QStringList &params)
if (param.startsWith(QLatin1String("@addPaused="))) if (param.startsWith(QLatin1String("@addPaused=")))
{ {
torrentParams.addPaused = (param.midRef(11).toInt() != 0); torrentParams.addPaused = (QStringView(param).mid(11).toInt() != 0);
continue; continue;
} }
@ -595,7 +591,7 @@ void Application::processParams(const QStringList &params)
if (param.startsWith(QLatin1String("@skipDialog="))) if (param.startsWith(QLatin1String("@skipDialog=")))
{ {
skipTorrentDialog = (param.midRef(12).toInt() != 0); skipTorrentDialog = (QStringView(param).mid(12).toInt() != 0);
continue; continue;
} }

12
src/base/bittorrent/peeraddress.cpp

@ -32,18 +32,18 @@
using namespace BitTorrent; using namespace BitTorrent;
PeerAddress PeerAddress::parse(const QString &address) PeerAddress PeerAddress::parse(const QStringView address)
{ {
QVector<QStringRef> ipPort; QList<QStringView> ipPort;
if (address.startsWith('[') && address.contains("]:")) if (address.startsWith(u'[') && address.contains(QLatin1String("]:")))
{ // IPv6 { // IPv6
ipPort = address.splitRef("]:"); ipPort = address.split(QString::fromLatin1("]:"));
ipPort[0] = ipPort[0].mid(1); // chop '[' ipPort[0] = ipPort[0].mid(1); // chop '['
} }
else if (address.contains(':')) else if (address.contains(u':'))
{ // IPv4 { // IPv4
ipPort = address.splitRef(':'); ipPort = address.split(u':');
} }
else else
{ {

2
src/base/bittorrent/peeraddress.h

@ -39,7 +39,7 @@ namespace BitTorrent
QHostAddress ip; QHostAddress ip;
ushort port = 0; ushort port = 0;
static PeerAddress parse(const QString &address); static PeerAddress parse(QStringView address);
QString toString() const; QString toString() const;
}; };

2
src/base/bittorrent/session.cpp

@ -1590,7 +1590,7 @@ void Session::populateAdditionalTrackers()
m_additionalTrackerList.clear(); m_additionalTrackerList.clear();
const QString trackers = additionalTrackers(); const QString trackers = additionalTrackers();
for (QStringRef tracker : asConst(trackers.splitRef('\n'))) for (QStringView tracker : asConst(QStringView(trackers).split(u'\n')))
{ {
tracker = tracker.trimmed(); tracker = tracker.trimmed();
if (!tracker.isEmpty()) if (!tracker.isEmpty())

6
src/base/bittorrent/torrentimpl.cpp

@ -1868,9 +1868,9 @@ void TorrentImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p)
if (m_oldPath[p->index].isEmpty()) if (m_oldPath[p->index].isEmpty())
m_oldPath.remove(p->index); m_oldPath.remove(p->index);
QVector<QStringRef> oldPathParts = oldFilePath.splitRef('/', Qt::SkipEmptyParts); QList<QStringView> oldPathParts = QStringView(oldFilePath).split('/', Qt::SkipEmptyParts);
oldPathParts.removeLast(); // drop file name part oldPathParts.removeLast(); // drop file name part
QVector<QStringRef> newPathParts = newFilePath.splitRef('/', Qt::SkipEmptyParts); QList<QStringView> newPathParts = QStringView(newFilePath).split('/', Qt::SkipEmptyParts);
newPathParts.removeLast(); // drop file name part newPathParts.removeLast(); // drop file name part
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
@ -1889,7 +1889,7 @@ void TorrentImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p)
for (int i = (oldPathParts.size() - 1); i >= pathIdx; --i) for (int i = (oldPathParts.size() - 1); i >= pathIdx; --i)
{ {
QDir().rmdir(savePath() + Utils::String::join(oldPathParts, QLatin1String("/"))); QDir().rmdir(savePath() + Utils::String::join(oldPathParts, QString::fromLatin1("/")));
oldPathParts.removeLast(); oldPathParts.removeLast();
} }

2
src/base/bittorrent/torrentinfo.cpp

@ -61,7 +61,7 @@ namespace
{ {
if (QDir::isAbsolutePath(filePath)) continue; if (QDir::isAbsolutePath(filePath)) continue;
const auto filePathElements = filePath.splitRef('/'); const auto filePathElements = QStringView(filePath).split(u'/');
// if at least one file has no root folder, no common root folder exists // if at least one file has no root folder, no common root folder exists
if (filePathElements.count() <= 1) return {}; if (filePathElements.count() <= 1) return {};

12
src/base/http/connection.cpp

@ -137,9 +137,9 @@ bool Connection::acceptsGzipEncoding(QString codings)
{ {
// [rfc7231] 5.3.4. Accept-Encoding // [rfc7231] 5.3.4. Accept-Encoding
const auto isCodingAvailable = [](const QVector<QStringRef> &list, const QString &encoding) -> bool const auto isCodingAvailable = [](const QList<QStringView> &list, const QStringView encoding) -> bool
{ {
for (const QStringRef &str : list) for (const QStringView &str : list)
{ {
if (!str.startsWith(encoding)) if (!str.startsWith(encoding))
continue; continue;
@ -149,7 +149,7 @@ bool Connection::acceptsGzipEncoding(QString codings)
return true; return true;
// [rfc7231] 5.3.1. Quality Values // [rfc7231] 5.3.1. Quality Values
const QStringRef substr = str.mid(encoding.size() + 3); // ex. skip over "gzip;q=" const QStringView substr = str.mid(encoding.size() + 3); // ex. skip over "gzip;q="
bool ok = false; bool ok = false;
const double qvalue = substr.toDouble(&ok); const double qvalue = substr.toDouble(&ok);
@ -161,15 +161,15 @@ bool Connection::acceptsGzipEncoding(QString codings)
return false; return false;
}; };
const QVector<QStringRef> list = codings.remove(' ').remove('\t').splitRef(',', Qt::SkipEmptyParts); const QList<QStringView> list = QStringView(codings.remove(' ').remove('\t')).split(u',', Qt::SkipEmptyParts);
if (list.isEmpty()) if (list.isEmpty())
return false; return false;
const bool canGzip = isCodingAvailable(list, QLatin1String("gzip")); const bool canGzip = isCodingAvailable(list, QString::fromLatin1("gzip"));
if (canGzip) if (canGzip)
return true; return true;
const bool canAny = isCodingAvailable(list, QLatin1String("*")); const bool canAny = isCodingAvailable(list, QString::fromLatin1("*"));
if (canAny) if (canAny)
return true; return true;

18
src/base/http/requestparser.cpp

@ -57,7 +57,7 @@ namespace
return in; return in;
} }
bool parseHeaderLine(const QString &line, HeaderMap &out) bool parseHeaderLine(const QStringView line, HeaderMap &out)
{ {
// [rfc7230] 3.2. Header Fields // [rfc7230] 3.2. Header Fields
const int i = line.indexOf(':'); const int i = line.indexOf(':');
@ -67,8 +67,8 @@ namespace
return false; return false;
} }
const QString name = line.leftRef(i).trimmed().toString().toLower(); const QString name = line.left(i).trimmed().toString().toLower();
const QString value = line.midRef(i + 1).trimmed().toString(); const QString value = line.mid(i + 1).trimmed().toString();
out[name] = value; out[name] = value;
return true; return true;
@ -145,10 +145,10 @@ RequestParser::ParseResult RequestParser::doParse(const QByteArray &data)
return {ParseStatus::BadRequest, Request(), 0}; // TODO: SHOULD respond "501 Not Implemented" return {ParseStatus::BadRequest, Request(), 0}; // TODO: SHOULD respond "501 Not Implemented"
} }
bool RequestParser::parseStartLines(const QString &data) bool RequestParser::parseStartLines(const QStringView data)
{ {
// we don't handle malformed request which uses `LF` for newline // we don't handle malformed request which uses `LF` for newline
const QVector<QStringRef> lines = data.splitRef(CRLF, Qt::SkipEmptyParts); const QList<QStringView> lines = data.split(QString::fromLatin1(CRLF), Qt::SkipEmptyParts);
// [rfc7230] 3.2.2. Field Order // [rfc7230] 3.2.2. Field Order
QStringList requestLines; QStringList requestLines;
@ -267,7 +267,7 @@ bool RequestParser::parsePostMessage(const QByteArray &data)
return false; return false;
} }
const QByteArray delimiter = Utils::String::unquote(contentType.midRef(idx + boundaryFieldName.size())).toLatin1(); const QByteArray delimiter = Utils::String::unquote(QStringView(contentType).mid(idx + boundaryFieldName.size())).toLatin1();
if (delimiter.isEmpty()) if (delimiter.isEmpty())
{ {
qWarning() << Q_FUNC_INFO << "boundary delimiter field empty!"; qWarning() << Q_FUNC_INFO << "boundary delimiter field empty!";
@ -311,13 +311,13 @@ bool RequestParser::parseFormData(const QByteArray &data)
const QByteArray payload = viewWithoutEndingWith(list[1], CRLF); const QByteArray payload = viewWithoutEndingWith(list[1], CRLF);
HeaderMap headersMap; HeaderMap headersMap;
const QVector<QStringRef> headerLines = headers.splitRef(CRLF, Qt::SkipEmptyParts); const QList<QStringView> headerLines = QStringView(headers).split(QString::fromLatin1(CRLF), Qt::SkipEmptyParts);
for (const auto &line : headerLines) for (const auto &line : headerLines)
{ {
if (line.trimmed().startsWith(HEADER_CONTENT_DISPOSITION, Qt::CaseInsensitive)) if (line.trimmed().startsWith(QString::fromLatin1(HEADER_CONTENT_DISPOSITION), Qt::CaseInsensitive))
{ {
// extract out filename & name // extract out filename & name
const QVector<QStringRef> directives = line.split(';', Qt::SkipEmptyParts); const QList<QStringView> directives = line.split(u';', Qt::SkipEmptyParts);
for (const auto &directive : directives) for (const auto &directive : directives)
{ {

2
src/base/http/requestparser.h

@ -60,7 +60,7 @@ namespace Http
RequestParser(); RequestParser();
ParseResult doParse(const QByteArray &data); ParseResult doParse(const QByteArray &data);
bool parseStartLines(const QString &data); bool parseStartLines(QStringView data);
bool parseRequestLine(const QString &line); bool parseRequestLine(const QString &line);
bool parsePostMessage(const QByteArray &data); bool parsePostMessage(const QByteArray &data);

5
src/base/net/smtp.cpp

@ -122,12 +122,7 @@ Smtp::Smtp(QObject *parent)
connect(m_socket, &QIODevice::readyRead, this, &Smtp::readyRead); connect(m_socket, &QIODevice::readyRead, this, &Smtp::readyRead);
connect(m_socket, &QAbstractSocket::disconnected, this, &QObject::deleteLater); connect(m_socket, &QAbstractSocket::disconnected, this, &QObject::deleteLater);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
connect(m_socket, &QAbstractSocket::errorOccurred, this, &Smtp::error); connect(m_socket, &QAbstractSocket::errorOccurred, this, &Smtp::error);
#else
connect(m_socket, qOverload<QAbstractSocket::SocketError>(&QAbstractSocket::error)
, this, &Smtp::error);
#endif
// Test hmacMD5 function (http://www.faqs.org/rfcs/rfc2202.html) // Test hmacMD5 function (http://www.faqs.org/rfcs/rfc2202.html)
Q_ASSERT(hmacMD5("Jefe", "what do ya want for nothing?").toHex() Q_ASSERT(hmacMD5("Jefe", "what do ya want for nothing?").toHex()

2
src/base/rss/rss_autodownloadrule.cpp

@ -325,7 +325,7 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl
if (episode.endsWith('-')) if (episode.endsWith('-'))
{ // Infinite range { // Infinite range
const int episodeOurs {episode.leftRef(episode.size() - 1).toInt()}; const int episodeOurs {QStringView(episode).left(episode.size() - 1).toInt()};
if (((seasonTheirs == seasonOurs) && (episodeTheirs >= episodeOurs)) || (seasonTheirs > seasonOurs)) if (((seasonTheirs == seasonOurs) && (episodeTheirs >= episodeOurs)) || (seasonTheirs > seasonOurs))
return true; return true;
} }

2
src/base/search/searchdownloadhandler.cpp

@ -59,7 +59,7 @@ void SearchDownloadHandler::downloadProcessFinished(int exitcode)
if ((exitcode == 0) && (m_downloadProcess->exitStatus() == QProcess::NormalExit)) if ((exitcode == 0) && (m_downloadProcess->exitStatus() == QProcess::NormalExit))
{ {
const QString line = QString::fromUtf8(m_downloadProcess->readAllStandardOutput()).trimmed(); const QString line = QString::fromUtf8(m_downloadProcess->readAllStandardOutput()).trimmed();
const QVector<QStringRef> parts = line.splitRef(' '); const QList<QStringView> parts = QStringView(line).split(u' ');
if (parts.size() == 2) if (parts.size() == 2)
path = parts[0].toString(); path = parts[0].toString();
} }

4
src/base/search/searchhandler.cpp

@ -163,9 +163,9 @@ void SearchHandler::processFailed()
// Parse one line of search results list // Parse one line of search results list
// Line is in the following form: // Line is in the following form:
// file url | file name | file size | nb seeds | nb leechers | Search engine url // file url | file name | file size | nb seeds | nb leechers | Search engine url
bool SearchHandler::parseSearchResult(const QString &line, SearchResult &searchResult) bool SearchHandler::parseSearchResult(const QStringView line, SearchResult &searchResult)
{ {
const QVector<QStringRef> parts = line.splitRef('|'); const QList<QStringView> parts = line.split(u'|');
const int nbFields = parts.size(); const int nbFields = parts.size();
if (nbFields < (NB_PLUGIN_COLUMNS - 1)) return false; // -1 because desc_link is optional if (nbFields < (NB_PLUGIN_COLUMNS - 1)) return false; // -1 because desc_link is optional

2
src/base/search/searchhandler.h

@ -78,7 +78,7 @@ private:
void readSearchOutput(); void readSearchOutput();
void processFailed(); void processFailed();
void processFinished(int exitcode); void processFinished(int exitcode);
bool parseSearchResult(const QString &line, SearchResult &searchResult); bool parseSearchResult(QStringView line, SearchResult &searchResult);
const QString m_pattern; const QString m_pattern;
const QString m_category; const QString m_category;

4
src/base/utils/bytearray.h

@ -28,14 +28,14 @@
#pragma once #pragma once
#include <QString> #include <Qt>
#include <QtContainerFwd> #include <QtContainerFwd>
class QByteArray; class QByteArray;
namespace Utils::ByteArray namespace Utils::ByteArray
{ {
// Mimic QString::splitRef(sep, behavior) // Mimic QStringView(in).split(sep, behavior)
QVector<QByteArray> splitToViews(const QByteArray &in, const QByteArray &sep, const Qt::SplitBehavior behavior = Qt::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, // Mimic QByteArray::mid(pos, len) but instead of returning a full-copy,

8
src/base/utils/compare.cpp

@ -60,16 +60,16 @@ int Utils::Compare::naturalCompare(const QString &left, const QString &right, co
{ {
// Both are digits, compare the numbers // Both are digits, compare the numbers
const auto numberView = [](const QString &str, int &pos) -> QStringRef const auto numberView = [](const QStringView str, int &pos) -> QStringView
{ {
const int start = pos; const int start = pos;
while ((pos < str.size()) && str[pos].isDigit()) while ((pos < str.size()) && str[pos].isDigit())
++pos; ++pos;
return str.midRef(start, (pos - start)); return str.mid(start, (pos - start));
}; };
const QStringRef numViewL = numberView(left, posL); const QStringView numViewL = numberView(left, posL);
const QStringRef numViewR = numberView(right, posR); const QStringView numViewR = numberView(right, posR);
if (numViewL.length() != numViewR.length()) if (numViewL.length() != numViewR.length())
return (numViewL.length() - numViewR.length()); return (numViewL.length() - numViewR.length());

2
src/base/utils/misc.cpp

@ -498,7 +498,7 @@ QString Utils::Misc::opensslVersionString()
#else #else
static const auto version {QString::fromLatin1(SSLeay_version(SSLEAY_VERSION))}; static const auto version {QString::fromLatin1(SSLeay_version(SSLEAY_VERSION))};
#endif #endif
return version.splitRef(' ', Qt::SkipEmptyParts)[1].toString(); return QStringView(version).split(u' ', Qt::SkipEmptyParts)[1].toString();
} }
QString Utils::Misc::zlibVersionString() QString Utils::Misc::zlibVersionString()

4
src/base/utils/string.cpp

@ -43,7 +43,7 @@
// to send numbers instead of strings with suffixes // to send numbers instead of strings with suffixes
QString Utils::String::fromDouble(const double n, const int precision) QString Utils::String::fromDouble(const double n, const int precision)
{ {
/* HACK because QString rounds up. Eg QString::number(0.999*100.0, 'f' ,1) == 99.9 /* HACK because QString rounds up. Eg QString::number(0.999*100.0, 'f', 1) == 99.9
** but QString::number(0.9999*100.0, 'f' ,1) == 100.0 The problem manifests when ** but QString::number(0.9999*100.0, 'f' ,1) == 100.0 The problem manifests when
** the number has more digits after the decimal than we want AND the digit after ** the number has more digits after the decimal than we want AND the digit after
** our 'wanted' is >= 5. In this case our last digit gets rounded up. So for each ** our 'wanted' is >= 5. In this case our last digit gets rounded up. So for each
@ -99,7 +99,7 @@ std::optional<double> Utils::String::parseDouble(const QString &string)
return std::nullopt; return std::nullopt;
} }
QString Utils::String::join(const QVector<QStringRef> &strings, const QString &separator) QString Utils::String::join(const QList<QStringView> &strings, const QStringView separator)
{ {
if (strings.empty()) if (strings.empty())
return {}; return {};

4
src/base/utils/string.h

@ -37,8 +37,6 @@
#include <Qt> #include <Qt>
#include <QtContainerFwd> #include <QtContainerFwd>
class QStringRef;
namespace Utils::String namespace Utils::String
{ {
QString wildcardToRegexPattern(const QString &pattern); QString wildcardToRegexPattern(const QString &pattern);
@ -61,7 +59,7 @@ namespace Utils::String
std::optional<int> parseInt(const QString &string); std::optional<int> parseInt(const QString &string);
std::optional<double> parseDouble(const QString &string); std::optional<double> parseDouble(const QString &string);
QString join(const QVector<QStringRef> &strings, const QString &separator); QString join(const QList<QStringView> &strings, QStringView separator);
QString fromDouble(double n, int precision); QString fromDouble(double n, int precision);

8
src/gui/downloadfromurldialog.cpp

@ -75,10 +75,10 @@ DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent)
// Paste clipboard if there is an URL in it // Paste clipboard if there is an URL in it
const QString clipboardText = qApp->clipboard()->text(); const QString clipboardText = qApp->clipboard()->text();
const QVector<QStringRef> clipboardList = clipboardText.splitRef('\n'); const QList<QStringView> clipboardList = QStringView(clipboardText).split(u'\n');
QSet<QString> uniqueURLs; QSet<QString> uniqueURLs;
for (QStringRef strRef : clipboardList) for (QStringView strRef : clipboardList)
{ {
strRef = strRef.trimmed(); strRef = strRef.trimmed();
if (strRef.isEmpty()) continue; if (strRef.isEmpty()) continue;
@ -107,10 +107,10 @@ DownloadFromURLDialog::~DownloadFromURLDialog()
void DownloadFromURLDialog::downloadButtonClicked() void DownloadFromURLDialog::downloadButtonClicked()
{ {
const QString plainText = m_ui->textUrls->toPlainText(); const QString plainText = m_ui->textUrls->toPlainText();
const QVector<QStringRef> urls = plainText.splitRef('\n'); const QList<QStringView> urls = QStringView(plainText).split(u'\n');
QSet<QString> uniqueURLs; QSet<QString> uniqueURLs;
for (QStringRef url : urls) for (QStringView url : urls)
{ {
url = url.trimmed(); url = url.trimmed();
if (url.isEmpty()) continue; if (url.isEmpty()) continue;

34
src/gui/fspathedit_p.cpp

@ -107,30 +107,32 @@ QValidator::State Private::FileSystemPathValidator::validate(QString &input, int
// we test path components from beginning to the one with cursor location in strict mode // 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 // and the one with cursor and beyond in non-strict mode
QVector<QStringRef> components = input.splitRef(QDir::separator(), Qt::KeepEmptyParts); QList<QStringView> components = QStringView(input).split(QDir::separator(), Qt::KeepEmptyParts);
// find index of the component that contains pos // find index of the component that contains pos
int componentWithCursorIndex = 0; int componentWithCursorIndex = 0;
int componentWithCursorPosition = 0;
int pathLength = 0; int pathLength = 0;
// components.size() - 1 because when path ends with QDir::separator(), we will not see the last // components.size() - 1 because when path ends with QDir::separator(), we will not see the last
// character in the components array, yet everything past the one before the last delimiter // character in the components array, yet everything past the one before the last delimiter
// belongs to the last component // belongs to the last component
for (; (componentWithCursorIndex < components.size() - 1) && (pathLength < pos); ++componentWithCursorIndex) for (; (componentWithCursorIndex < (components.size() - 1)) && (pathLength < pos); ++componentWithCursorIndex)
{ {
pathLength = components[componentWithCursorIndex].position() + components[componentWithCursorIndex].size(); pathLength = componentWithCursorPosition + components[componentWithCursorIndex].size();
componentWithCursorPosition += components[componentWithCursorIndex].size() + 1;
} }
Q_ASSERT(componentWithCursorIndex < components.size()); Q_ASSERT(componentWithCursorIndex < components.size());
m_lastValidationState = QValidator::Acceptable; m_lastValidationState = QValidator::Acceptable;
if (componentWithCursorIndex > 0) if (componentWithCursorIndex > 0)
m_lastValidationState = validate(input, components, m_strictMode, 0, componentWithCursorIndex - 1); m_lastValidationState = validate(components, m_strictMode, 0, componentWithCursorIndex - 1);
if ((m_lastValidationState == QValidator::Acceptable) && (componentWithCursorIndex < components.size())) if ((m_lastValidationState == QValidator::Acceptable) && (componentWithCursorIndex < components.size()))
m_lastValidationState = validate(input, components, false, componentWithCursorIndex, components.size() - 1); m_lastValidationState = validate(components, false, componentWithCursorIndex, components.size() - 1);
return m_lastValidationState; return m_lastValidationState;
} }
QValidator::State Private::FileSystemPathValidator::validate(const QString &path, const QVector<QStringRef> &pathComponents, bool strict, QValidator::State Private::FileSystemPathValidator::validate(const QList<QStringView> &pathComponents, bool strict,
int firstComponentToTest, int lastComponentToTest) const int firstComponentToTest, int lastComponentToTest) const
{ {
Q_ASSERT(firstComponentToTest >= 0); Q_ASSERT(firstComponentToTest >= 0);
@ -141,12 +143,13 @@ QValidator::State Private::FileSystemPathValidator::validate(const QString &path
if (pathComponents.empty()) if (pathComponents.empty())
return strict ? QValidator::Invalid : QValidator::Intermediate; return strict ? QValidator::Invalid : QValidator::Intermediate;
for (int i = firstComponentToTest; i < lastComponentToTest; ++i) for (int i = firstComponentToTest; i <= lastComponentToTest; ++i)
{ {
if (pathComponents[i].isEmpty()) continue; const bool isFinalPath = (i == (pathComponents.size() - 1));
const QStringView componentPath = pathComponents[i];
if (componentPath.isEmpty()) continue;
QStringRef componentPath(&path, 0, pathComponents[i].position() + pathComponents[i].size()); m_lastTestResult = testPath(pathComponents[i], isFinalPath);
m_lastTestResult = testPath(componentPath, false);
if (m_lastTestResult != TestResult::OK) if (m_lastTestResult != TestResult::OK)
{ {
m_lastTestedPath = componentPath.toString(); m_lastTestedPath = componentPath.toString();
@ -154,20 +157,11 @@ QValidator::State Private::FileSystemPathValidator::validate(const QString &path
} }
} }
const bool finalPath = (lastComponentToTest == (pathComponents.size() - 1));
QStringRef componentPath(&path, 0, pathComponents[lastComponentToTest].position()
+ pathComponents[lastComponentToTest].size());
m_lastTestResult = testPath(componentPath, finalPath);
if (m_lastTestResult != TestResult::OK)
{
m_lastTestedPath = componentPath.toString();
return strict ? QValidator::Invalid : QValidator::Intermediate;
}
return QValidator::Acceptable; return QValidator::Acceptable;
} }
Private::FileSystemPathValidator::TestResult Private::FileSystemPathValidator::TestResult
Private::FileSystemPathValidator::testPath(const QStringRef &path, bool pathIsComplete) const Private::FileSystemPathValidator::testPath(const QStringView path, bool pathIsComplete) const
{ {
QFileInfo fi(path.toString()); QFileInfo fi(path.toString());
if (m_existingOnly && !fi.exists()) if (m_existingOnly && !fi.exists())

5
src/gui/fspathedit_p.h

@ -39,7 +39,6 @@ class QCompleter;
class QContextMenuEvent; class QContextMenuEvent;
class QFileSystemModel; class QFileSystemModel;
class QKeyEvent; class QKeyEvent;
class QStringRef;
namespace Private namespace Private
{ {
@ -82,10 +81,10 @@ namespace Private
QString lastTestedPath() const; QString lastTestedPath() const;
private: private:
QValidator::State validate(const QString &path, const QVector<QStringRef> &pathComponents, bool strict, QValidator::State validate(const QList<QStringView> &pathComponents, bool strict,
int firstComponentToTest, int lastComponentToTest) const; int firstComponentToTest, int lastComponentToTest) const;
TestResult testPath(const QStringRef &path, bool pathIsComplete) const; TestResult testPath(QStringView path, bool pathIsComplete) const;
bool m_strictMode; bool m_strictMode;
bool m_existingOnly; bool m_existingOnly;

7
src/gui/mainwindow.cpp

@ -2184,8 +2184,9 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
QProcess installer; QProcess installer;
qDebug("Launching Python installer in passive mode..."); qDebug("Launching Python installer in passive mode...");
QFile::rename(result.filePath, result.filePath + ".exe"); const QString exePath = result.filePath + QLatin1String(".exe");
installer.start('"' + Utils::Fs::toNativePath(result.filePath) + ".exe\" /passive"); QFile::rename(result.filePath, exePath);
installer.start(Utils::Fs::toNativePath(exePath), {"/passive"});
// Wait for setup to complete // Wait for setup to complete
installer.waitForFinished(10 * 60 * 1000); installer.waitForFinished(10 * 60 * 1000);
@ -2195,7 +2196,7 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
qDebug("Setup should be complete!"); qDebug("Setup should be complete!");
// Delete temp file // Delete temp file
Utils::Fs::forceRemove(result.filePath + ".exe"); Utils::Fs::forceRemove(exePath);
// Reload search engine // Reload search engine
if (Utils::ForeignApps::pythonInfo().isSupportedVersion()) if (Utils::ForeignApps::pythonInfo().isSupportedVersion())

5
src/gui/properties/proptabbar.cpp

@ -100,13 +100,8 @@ PropTabBar::PropTabBar(QWidget *parent)
addWidget(speedButton); addWidget(speedButton);
m_btnGroup->addButton(speedButton, SpeedTab); m_btnGroup->addButton(speedButton, SpeedTab);
// SIGNAL/SLOT // SIGNAL/SLOT
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
connect(m_btnGroup, &QButtonGroup::idClicked connect(m_btnGroup, &QButtonGroup::idClicked
, this, &PropTabBar::setCurrentIndex); , this, &PropTabBar::setCurrentIndex);
#else
connect(m_btnGroup, qOverload<int>(&QButtonGroup::buttonClicked)
, this, &PropTabBar::setCurrentIndex);
#endif
// Disable buttons focus // Disable buttons focus
for (QAbstractButton *btn : asConst(m_btnGroup->buttons())) for (QAbstractButton *btn : asConst(m_btnGroup->buttons()))
btn->setFocusPolicy(Qt::NoFocus); btn->setFocusPolicy(Qt::NoFocus);

2
src/gui/properties/trackersadditiondialog.cpp

@ -59,7 +59,7 @@ QStringList TrackersAdditionDialog::newTrackers() const
const QString plainText = m_ui->textEditTrackersList->toPlainText(); const QString plainText = m_ui->textEditTrackersList->toPlainText();
QStringList cleanTrackers; QStringList cleanTrackers;
for (QStringRef url : asConst(plainText.splitRef('\n'))) for (QStringView url : asConst(QStringView(plainText).split(u'\n')))
{ {
url = url.trimmed(); url = url.trimmed();
if (!url.isEmpty()) if (!url.isEmpty())

10
src/gui/torrentcontentmodel.cpp

@ -504,16 +504,16 @@ void TorrentContentModel::setupModelData(const BitTorrent::TorrentInfo &info)
const QString path = Utils::Fs::toUniformPath(info.filePath(i)); const QString path = Utils::Fs::toUniformPath(info.filePath(i));
// Iterate of parts of the path to create necessary folders // Iterate of parts of the path to create necessary folders
QVector<QStringRef> pathFolders = path.splitRef('/', Qt::SkipEmptyParts); QList<QStringView> pathFolders = QStringView(path).split(u'/', Qt::SkipEmptyParts);
pathFolders.removeLast(); pathFolders.removeLast();
for (const QStringRef &pathPartRef : asConst(pathFolders)) for (const QStringView pathPart : asConst(pathFolders))
{ {
const QString pathPart = pathPartRef.toString(); const QString folderPath = pathPart.toString();
TorrentContentModelFolder *newParent = currentParent->childFolderWithName(pathPart); TorrentContentModelFolder *newParent = currentParent->childFolderWithName(folderPath);
if (!newParent) if (!newParent)
{ {
newParent = new TorrentContentModelFolder(pathPart, currentParent); newParent = new TorrentContentModelFolder(folderPath, currentParent);
currentParent->appendChild(newParent); currentParent->appendChild(newParent);
} }
currentParent = newParent; currentParent = newParent;

5
src/gui/torrentoptionsdialog.cpp

@ -263,12 +263,7 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor
connect(m_ui->checkMaxRatio, &QCheckBox::toggled, m_ui->spinRatioLimit, &QDoubleSpinBox::setEnabled); connect(m_ui->checkMaxRatio, &QCheckBox::toggled, m_ui->spinRatioLimit, &QDoubleSpinBox::setEnabled);
connect(m_ui->checkMaxTime, &QCheckBox::toggled, m_ui->spinTimeLimit, &QSpinBox::setEnabled); connect(m_ui->checkMaxTime, &QCheckBox::toggled, m_ui->spinTimeLimit, &QSpinBox::setEnabled);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
connect(m_ui->buttonGroup, &QButtonGroup::idClicked, this, &TorrentOptionsDialog::handleRatioTypeChanged); connect(m_ui->buttonGroup, &QButtonGroup::idClicked, this, &TorrentOptionsDialog::handleRatioTypeChanged);
#else
connect(m_ui->buttonGroup, qOverload<int>(&QButtonGroup::buttonClicked)
, this, &TorrentOptionsDialog::handleRatioTypeChanged);
#endif
Utils::Gui::resize(this, m_storeDialogSize); Utils::Gui::resize(this, m_storeDialogSize);
} }

4
src/gui/trackerentriesdialog.cpp

@ -81,13 +81,13 @@ void TrackerEntriesDialog::setTrackers(const QVector<BitTorrent::TrackerEntry> &
QVector<BitTorrent::TrackerEntry> TrackerEntriesDialog::trackers() const QVector<BitTorrent::TrackerEntry> TrackerEntriesDialog::trackers() const
{ {
const QString plainText = m_ui->plainTextEdit->toPlainText(); const QString plainText = m_ui->plainTextEdit->toPlainText();
const QVector<QStringRef> lines = plainText.splitRef('\n'); const QList<QStringView> lines = QStringView(plainText).split(u'\n');
QVector<BitTorrent::TrackerEntry> entries; QVector<BitTorrent::TrackerEntry> entries;
entries.reserve(lines.size()); entries.reserve(lines.size());
int tier = 0; int tier = 0;
for (QStringRef line : lines) for (QStringView line : lines)
{ {
line = line.trimmed(); line = line.trimmed();

2
src/src.pro

@ -56,7 +56,7 @@ CONFIG(release, debug|release) {
include(../version.pri) include(../version.pri)
# Qt defines # Qt defines
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050e00 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050f02
DEFINES += QT_NO_CAST_TO_ASCII DEFINES += QT_NO_CAST_TO_ASCII
DEFINES += QT_NO_CAST_FROM_BYTEARRAY DEFINES += QT_NO_CAST_FROM_BYTEARRAY
DEFINES += QT_USE_QSTRINGBUILDER DEFINES += QT_USE_QSTRINGBUILDER

10
src/webui/webapplication.cpp

@ -72,11 +72,11 @@ const QString PRIVATE_FOLDER {QStringLiteral("/private")};
namespace namespace
{ {
QStringMap parseCookie(const QString &cookieStr) QStringMap parseCookie(const QStringView cookieStr)
{ {
// [rfc6265] 4.2.1. Syntax // [rfc6265] 4.2.1. Syntax
QStringMap ret; QStringMap ret;
const QVector<QStringRef> cookies = cookieStr.splitRef(';', Qt::SkipEmptyParts); const QList<QStringView> cookies = cookieStr.split(u';', Qt::SkipEmptyParts);
for (const auto &cookie : cookies) for (const auto &cookie : cookies)
{ {
@ -386,10 +386,10 @@ void WebApplication::configure()
if (pref->isWebUICustomHTTPHeadersEnabled()) if (pref->isWebUICustomHTTPHeadersEnabled())
{ {
const QString customHeaders = pref->getWebUICustomHTTPHeaders().trimmed(); const QString customHeaders = pref->getWebUICustomHTTPHeaders();
const QVector<QStringRef> customHeaderLines = customHeaders.splitRef('\n', Qt::SkipEmptyParts); const QList<QStringView> customHeaderLines = QStringView(customHeaders).trimmed().split(u'\n', Qt::SkipEmptyParts);
for (const QStringRef &line : customHeaderLines) for (const QStringView line : customHeaderLines)
{ {
const int idx = line.indexOf(':'); const int idx = line.indexOf(':');
if (idx < 0) if (idx < 0)

Loading…
Cancel
Save