From 5c63ad3b957f7d65c063cca82c6ba9a8512aeef2 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 3 Mar 2019 20:33:17 +0200 Subject: [PATCH] Raise minimum Qt version to 5.9.0 --- .travis.yml | 10 +++++++++- CMakeLists.txt | 2 +- INSTALL | 2 +- configure | 24 ++++++++++++------------ m4/qbittorrent.m4 | 10 +++++----- src/app/application.cpp | 2 -- src/base/bittorrent/session.cpp | 9 --------- src/base/net/reverseresolution.cpp | 4 ---- src/base/search/searchhandler.cpp | 5 ----- src/gui/utils.cpp | 4 ---- src/webui/webapplication.cpp | 12 ------------ 11 files changed, 28 insertions(+), 56 deletions(-) diff --git a/.travis.yml b/.travis.yml index 721c0be7d..613c74357 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,14 +52,17 @@ addons: sources: # sources list: https://github.com/travis-ci/apt-source-safelist/blob/master/ubuntu.json - sourceline: 'ppa:qbittorrent-team/qbittorrent-stable' + - sourceline: 'ppa:beineri/opt-qt59-xenial' packages: # packages list: https://github.com/travis-ci/apt-package-safelist/blob/master/ubuntu-trusty - [autoconf, automake, colormake] - [libboost-dev, libboost-system-dev] - libssl-dev - libtorrent-rasterbar-dev - - [qtbase5-dev, qttools5-dev-tools, libqt5svg5-dev] + - [qt59base, qt59svg, qt59tools] - zlib1g-dev + # required for Qt 5.9 from 'beineri' PPA + - libgl1-mesa-dev homebrew: update: true packages: @@ -85,6 +88,11 @@ before_install: if [ "$TRAVIS_OS_NAME" = "linux" ]; then # setup virtual display for after_success target if [ "$gui" = "true" ]; then export "DISPLAY=:99.0" && /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 ; fi ; + + # Qt 5.9 + PATH=/opt/qt59/bin:${PATH} + qmake_conf="$qmake_conf PKG_CONFIG_PATH=/opt/qt59/lib/pkgconfig:$PKG_CONFIG_PATH" + cmake_conf="$cmake_conf PKG_CONFIG_PATH=/opt/qt59/lib/pkgconfig:$PKG_CONFIG_PATH" fi - | if [ "$TRAVIS_OS_NAME" = "osx" ]; then diff --git a/CMakeLists.txt b/CMakeLists.txt index 86b2fdd46..924e8ccd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ include(FeatureSummary) # version requirements set(requiredBoostVersion 1.35) -set(requiredQtVersion 5.5.1) +set(requiredQtVersion 5.9.0) set(requiredOpensslVersion 1.0) set(requiredLibtorrentVersion 1.1.10) diff --git a/INSTALL b/INSTALL index 9d7434658..d5ad61289 100644 --- a/INSTALL +++ b/INSTALL @@ -11,7 +11,7 @@ qBittorrent - A BitTorrent client in C++ / Qt - OpenSSL >= 1.0 - - Qt >= 5.5.1 + - Qt >= 5.9.0 - zlib >= 1.2.5.2 diff --git a/configure b/configure index 166855440..4bfc0af21 100755 --- a/configure +++ b/configure @@ -1431,7 +1431,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.5.1, overriding pkg-config + QT_QMAKE value of host_bins for Qt5Core >= 5.9.0, overriding pkg-config Qt5Svg_CFLAGS C compiler flags for Qt5Svg, overriding pkg-config Qt5Svg_LIBS linker flags for Qt5Svg, overriding pkg-config @@ -4498,8 +4498,8 @@ $as_echo "$enable_webui" >&6; } esac if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.5.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.9.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.9.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then @@ -4508,12 +4508,12 @@ if test -n "$QT_QMAKE"; then pkg_cv_QT_QMAKE="$QT_QMAKE" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.5.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Core >= 5.9.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.9.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_QT_QMAKE=`$PKG_CONFIG --variable="host_bins" "Qt5Core >= 5.5.1" 2>/dev/null` + pkg_cv_QT_QMAKE=`$PKG_CONFIG --variable="host_bins" "Qt5Core >= 5.9.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4540,8 +4540,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5 qmake >= 5.5.1" >&5 -$as_echo_n "checking for Qt5 qmake >= 5.5.1... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5 qmake >= 5.9.0" >&5 +$as_echo_n "checking for Qt5 qmake >= 5.9.0... " >&6; } if test "x$QT_QMAKE" != "x"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: $QT_QMAKE" >&5 $as_echo "$QT_QMAKE" >&6; } @@ -4655,11 +4655,11 @@ case "x$enable_qt_dbus" in #( "xyes") : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5DBus >= 5.5.1" >&5 -$as_echo_n "checking for Qt5DBus >= 5.5.1... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5DBus >= 5.9.0" >&5 +$as_echo_n "checking for Qt5DBus >= 5.9.0... " >&6; } if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5DBus >= 5.5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.5.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5DBus >= 5.9.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.9.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then diff --git a/m4/qbittorrent.m4 b/m4/qbittorrent.m4 index 7ef4a227a..1dff738af 100644 --- a/m4/qbittorrent.m4 +++ b/m4/qbittorrent.m4 @@ -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.5.1], +[PKG_CHECK_EXISTS([Qt5Core >= 5.9.0], [PKG_CHECK_VAR(QT_QMAKE, - [Qt5Core >= 5.5.1], + [Qt5Core >= 5.9.0], [host_bins]) ]) @@ -18,7 +18,7 @@ AS_IF([test -f "$QT_QMAKE/qmake"], [QT_QMAKE=""]) ]) -AC_MSG_CHECKING([for Qt5 qmake >= 5.5.1]) +AC_MSG_CHECKING([for Qt5 qmake >= 5.9.0]) 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.5.1]) - PKG_CHECK_EXISTS([Qt5DBus >= 5.5.1], + [AC_MSG_CHECKING([for Qt5DBus >= 5.9.0]) + PKG_CHECK_EXISTS([Qt5DBus >= 5.9.0], [AC_MSG_RESULT([found]) HAVE_QTDBUS=[true]], [AC_MSG_RESULT([not found]) diff --git a/src/app/application.cpp b/src/app/application.cpp index 207dec302..4dd1e3020 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -147,10 +147,8 @@ Application::Application(const QString &id, int &argc, char **argv) #if !defined(DISABLE_GUI) setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support setQuitOnLastWindowClosed(false); -#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) setDesktopFileName("org.qbittorrent.qBittorrent"); #endif -#endif #if defined(Q_OS_WIN) && !defined(DISABLE_GUI) connect(this, &QGuiApplication::commitDataRequest, this, &Application::shutdownCleanup, Qt::DirectConnection); diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 95d5d2708..829c82a9e 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -2179,16 +2179,7 @@ void Session::networkConfigurationChange(const QNetworkConfiguration &cfg) const QString changedInterface = cfg.name(); - // workaround for QTBUG-52633: check interface IPs, react only if the IPs have changed - // seems to be present only with NetworkManager, hence Q_OS_LINUX -#if defined Q_OS_LINUX && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && QT_VERSION < QT_VERSION_CHECK(5, 7, 1) - static QStringList boundIPs = getListeningIPs(); - const QStringList newBoundIPs = getListeningIPs(); - if ((configuredInterfaceName == changedInterface) && (boundIPs != newBoundIPs)) { - boundIPs = newBoundIPs; -#else if (configuredInterfaceName == changedInterface) { -#endif Logger::instance()->addMessage(tr("Network configuration of %1 has changed, refreshing session binding", "e.g: Network configuration of tun0 has changed, refreshing session binding").arg(changedInterface), Log::INFO); configureListeningInterface(); } diff --git a/src/base/net/reverseresolution.cpp b/src/base/net/reverseresolution.cpp index 68c075baa..116de9ef0 100644 --- a/src/base/net/reverseresolution.cpp +++ b/src/base/net/reverseresolution.cpp @@ -62,11 +62,7 @@ void ReverseResolution::resolve(const QString &ip) } else { // Actually resolve the ip -#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) m_lookups.insert(QHostInfo::lookupHost(ip, this, &ReverseResolution::hostResolved), ip); -#else - m_lookups.insert(QHostInfo::lookupHost(ip, this, SLOT(hostResolved(QHostInfo))), ip); -#endif } } diff --git a/src/base/search/searchhandler.cpp b/src/base/search/searchhandler.cpp index 5cb820628..f0dcb4c55 100644 --- a/src/base/search/searchhandler.cpp +++ b/src/base/search/searchhandler.cpp @@ -74,12 +74,7 @@ SearchHandler::SearchHandler(const QString &pattern, const QString &category, co m_searchProcess->setProgram(Utils::ForeignApps::pythonInfo().executableName); m_searchProcess->setArguments(params + m_pattern.split(' ')); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) connect(m_searchProcess, &QProcess::errorOccurred, this, &SearchHandler::processFailed); -#else - connect(m_searchProcess, static_cast(&QProcess::error) - , this, &SearchHandler::processFailed); -#endif connect(m_searchProcess, &QProcess::readyReadStandardOutput, this, &SearchHandler::readSearchOutput); connect(m_searchProcess, static_cast(&QProcess::finished) , this, &SearchHandler::processFinished); diff --git a/src/gui/utils.cpp b/src/gui/utils.cpp index 9151284a1..6a53920f3 100644 --- a/src/gui/utils.cpp +++ b/src/gui/utils.cpp @@ -55,11 +55,7 @@ qreal Utils::Gui::screenScalingFactor(const QWidget *widget) #elif defined(Q_OS_MAC) return 1; #else -#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) return widget->devicePixelRatioF(); -#else - return widget->devicePixelRatio(); -#endif #endif // Q_OS_WIN } diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 0caa27fc7..53e69b2f6 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -630,19 +630,7 @@ bool WebApplication::validateHostHeader(const QStringList &domains) const } // try matching host header with local address -#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) const bool sameAddr = m_env.localAddress.isEqual(QHostAddress(requestHost)); -#else - const auto equal = [](const Q_IPV6ADDR &l, const Q_IPV6ADDR &r) -> bool - { - for (int i = 0; i < 16; ++i) { - if (l[i] != r[i]) - return false; - } - return true; - }; - const bool sameAddr = equal(m_env.localAddress.toIPv6Address(), QHostAddress(requestHost).toIPv6Address()); -#endif if (sameAddr) return true;