Permalink
Browse files

Raise minimal Qt version to 5.5.1

  • Loading branch information...
zeule committed Jan 19, 2017
1 parent e64bb1d commit 008d7dbedce7020d206b4a0c4d7f059b4f2b9570
Showing with 32 additions and 65 deletions.
  1. +12 −12 configure
  2. +5 −5 m4/qbittorrent.m4
  3. +1 −1 src/CMakeLists.txt
  4. +10 −11 src/base/torrentfileguard.cpp
  5. +4 −21 src/base/torrentfileguard.h
  6. +0 −4 src/base/utils/misc.cpp
  7. +0 −11 src/webui/btjson.cpp
View
@@ -1407,7 +1407,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.2.0, overriding pkg-config
QT_QMAKE value of host_bins for Qt5Core >= 5.5.1, overriding pkg-config
libtorrent_CFLAGS
C compiler flags for libtorrent, overriding pkg-config
libtorrent_LIBS
@@ -4424,8 +4424,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.2.0\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.2.0") 2>&5
{ { $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
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
@@ -4434,12 +4434,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.2.0\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5Core >= 5.2.0") 2>&5
{ { $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
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.2.0" 2>/dev/null`
pkg_cv_QT_QMAKE=`$PKG_CONFIG --variable="host_bins" "Qt5Core >= 5.5.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -4466,8 +4466,8 @@ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt5 qmake >= 5.2.0" >&5
$as_echo_n "checking for Qt5 qmake >= 5.2.0... " >&6; }
{ $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; }
if test "x$QT_QMAKE" != "x"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $QT_QMAKE" >&5
$as_echo "$QT_QMAKE" >&6; }
@@ -4483,11 +4483,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.2.0" >&5
$as_echo_n "checking for Qt5DBus >= 5.2.0... " >&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; }
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5DBus >= 5.2.0\""; } >&5
($PKG_CONFIG --exists --print-errors "Qt5DBus >= 5.2.0") 2>&5
{ { $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
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
View
@@ -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.2.0],
[PKG_CHECK_EXISTS([Qt5Core >= 5.5.1],
[PKG_CHECK_VAR(QT_QMAKE,
[Qt5Core >= 5.2.0],
[Qt5Core >= 5.5.1],
[host_bins])
])
@@ -18,7 +18,7 @@ AS_IF([test -f "$QT_QMAKE/qmake"],
[QT_QMAKE=""])
])
AC_MSG_CHECKING([for Qt5 qmake >= 5.2.0])
AC_MSG_CHECKING([for Qt5 qmake >= 5.5.1])
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.2.0])
PKG_CHECK_EXISTS([Qt5DBus >= 5.2.0],
[AC_MSG_CHECKING([for Qt5DBus >= 5.5.1])
PKG_CHECK_EXISTS([Qt5DBus >= 5.5.1],
[AC_MSG_RESULT([found])
HAVE_QTDBUS=[true]],
[AC_MSG_RESULT([not found])
View
@@ -15,7 +15,7 @@ endif (GUI)
if (DBUS)
list (APPEND QBT_QT_COMPONENTS DBus)
endif (DBUS)
find_package(Qt5 5.2.0 COMPONENTS ${QBT_QT_COMPONENTS} REQUIRED)
find_package(Qt5 5.5.1 COMPONENTS ${QBT_QT_COMPONENTS} REQUIRED)
set(CMAKE_AUTOMOC True)
@@ -54,17 +54,22 @@ FileGuard::~FileGuard()
Utils::Fs::forceRemove(m_path); // forceRemove() checks for file existence
}
TorrentFileGuard::TorrentFileGuard(const QString &path)
: m_mode {autoDeleteMode()}
TorrentFileGuard::TorrentFileGuard(const QString &path, TorrentFileGuard::AutoDeleteMode mode)
: FileGuard {mode != Never ? path : QString()}
, m_mode {mode}
, m_wasAdded {false}
, m_guard {m_mode != Never ? path : QString()}
{
}
TorrentFileGuard::TorrentFileGuard(const QString &path)
: TorrentFileGuard {path, autoDeleteMode()}
{
}
TorrentFileGuard::~TorrentFileGuard()
{
if (!m_wasAdded && (m_mode != Always))
m_guard.setAutoRemove(false);
setAutoRemove(false);
}
void TorrentFileGuard::markAsAddedToSession()
@@ -74,7 +79,7 @@ void TorrentFileGuard::markAsAddedToSession()
void TorrentFileGuard::setAutoRemove(bool remove)
{
m_guard.setAutoRemove(remove);
setAutoRemove(remove);
}
TorrentFileGuard::AutoDeleteMode TorrentFileGuard::autoDeleteMode()
@@ -92,11 +97,5 @@ void TorrentFileGuard::setAutoDeleteMode(TorrentFileGuard::AutoDeleteMode mode)
QMetaEnum TorrentFileGuard::modeMetaEnum()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
return QMetaEnum::fromType<AutoDeleteMode>();
#else
const int enumeratorIndex = staticMetaObject.indexOfEnumerator("AutoDeleteMode");
Q_ASSERT(enumeratorIndex >= 0);
return staticMetaObject.enumerator(enumeratorIndex);
#endif
}
@@ -50,13 +50,9 @@ class FileGuard
/// Reads settings for .torrent files from preferences
/// and sets the file guard up accordingly
class TorrentFileGuard
class TorrentFileGuard: private FileGuard
{
Q_GADGET
// moc from Qt4 ignores Q_ENUMS when it is behind #if QT_VERSION check
// this declaration is needed for Qt 4 only
// TODO Qt5: remove when dropping Qt4 support
Q_ENUMS(AutoDeleteMode)
public:
TorrentFileGuard(const QString &path = QString());
@@ -79,25 +75,12 @@ class TorrentFileGuard
private:
static QMetaEnum modeMetaEnum();
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
TorrentFileGuard(const QString &path, AutoDeleteMode mode);
Q_ENUM(AutoDeleteMode)
#endif
AutoDeleteMode m_mode;
bool m_wasAdded;
// Qt 4 moc has troubles with Q_GADGET: if Q_GADGET is present in a class, moc unconditionally
// references in the generated code the statiMetaObject from the class ancestor.
// Moreover, if the ancestor class has Q_GADGET but does not have other
// Q_ declarations, moc does not generate staticMetaObject for it. These results
// in referencing the non existent staticMetaObject and such code fails to compile.
// This problem is NOT present in Qt 5.7.0 and maybe in some older Qt 5 versions too
// Qt 4.8.7 has it.
// Therefore, we can't inherit FileGuard :(
// TODO Qt5: port to private inheritance when dropping Qt 4 support
FileGuard m_guard;
};
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
Q_DECLARE_METATYPE(TorrentFileGuard::AutoDeleteMode)
#endif
#endif // TOFFENTFILEGURAD_H
View
@@ -662,14 +662,10 @@ QString Utils::Misc::osName()
{
// static initialization for usage in signal handler
static const QString name =
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
QString("%1 %2 %3")
.arg(QSysInfo::prettyProductName())
.arg(QSysInfo::kernelVersion())
.arg(QSysInfo::currentCpuArchitecture());
#else
"<Input OS name here>";
#endif
return name;
}
View
@@ -899,17 +899,6 @@ QVariantMap generateSyncData(int acceptedResponseId, QVariantMap data, QVariantM
if (fullUpdate) {
lastAcceptedData.clear();
syncData = data;
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
// QJsonDocument::fromVariant() supports QVariantHash only
// since Qt5.5, so manually convert data["torrents"]
QVariantMap torrentsMap;
QVariantHash torrents = data["torrents"].toHash();
foreach (const QString &key, torrents.keys())
torrentsMap[key] = torrents[key];
syncData["torrents"] = torrentsMap;
#endif
syncData[KEY_FULL_UPDATE] = true;
}

0 comments on commit 008d7db

Please sign in to comment.