mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Update function signature for Qt6 qHash()
Since the `qhash()` signature has changed in Qt6.
This commit is contained in:
parent
8de966ea88
commit
926d51839f
@ -90,7 +90,11 @@ BitTorrent::TorrentID BitTorrent::TorrentID::fromInfoHash(const BitTorrent::Info
|
||||
return infoHash.toTorrentID();
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t BitTorrent::qHash(const BitTorrent::TorrentID &key, const std::size_t seed)
|
||||
#else
|
||||
uint BitTorrent::qHash(const BitTorrent::TorrentID &key, const uint seed)
|
||||
#endif
|
||||
{
|
||||
return ::qHash(std::hash<TorrentID::UnderlyingType>()(key), seed);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <libtorrent/info_hash.hpp>
|
||||
#endif
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QHash>
|
||||
#include <QMetaType>
|
||||
|
||||
@ -81,7 +82,11 @@ namespace BitTorrent
|
||||
WrappedType m_nativeHash;
|
||||
};
|
||||
|
||||
uint qHash(const TorrentID &key, uint seed);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const TorrentID &key, std::size_t seed = 0);
|
||||
#else
|
||||
uint qHash(const TorrentID &key, uint seed = 0);
|
||||
#endif
|
||||
|
||||
bool operator==(const InfoHash &left, const InfoHash &right);
|
||||
bool operator!=(const InfoHash &left, const InfoHash &right);
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <libtorrent/units.hpp>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QHash>
|
||||
|
||||
// From https://doc.qt.io/qt-6/qhash.html#the-hashing-function:
|
||||
@ -42,7 +43,11 @@ namespace libtorrent
|
||||
namespace aux
|
||||
{
|
||||
template <typename T, typename Tag>
|
||||
uint qHash(const strong_typedef<T, Tag> &key, const uint seed)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const strong_typedef<T, Tag> &key, const std::size_t seed = 0)
|
||||
#else
|
||||
uint qHash(const strong_typedef<T, Tag> &key, const uint seed = 0)
|
||||
#endif
|
||||
{
|
||||
return ::qHash((std::hash<strong_typedef<T, Tag>> {})(key), seed);
|
||||
}
|
||||
|
@ -77,7 +77,11 @@ bool BitTorrent::operator==(const BitTorrent::PeerAddress &left, const BitTorren
|
||||
return (left.ip == right.ip) && (left.port == right.port);
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t BitTorrent::qHash(const BitTorrent::PeerAddress &addr, const std::size_t seed)
|
||||
#else
|
||||
uint BitTorrent::qHash(const BitTorrent::PeerAddress &addr, const uint seed)
|
||||
#endif
|
||||
{
|
||||
return (::qHash(addr.ip, seed) ^ ::qHash(addr.port));
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QHostAddress>
|
||||
|
||||
class QString;
|
||||
@ -44,5 +45,9 @@ namespace BitTorrent
|
||||
};
|
||||
|
||||
bool operator==(const PeerAddress &left, const PeerAddress &right);
|
||||
uint qHash(const PeerAddress &addr, uint seed);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const PeerAddress &addr, std::size_t seed = 0);
|
||||
#else
|
||||
uint qHash(const PeerAddress &addr, uint seed = 0);
|
||||
#endif
|
||||
}
|
||||
|
@ -35,7 +35,11 @@
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const TorrentState key, const std::size_t seed)
|
||||
#else
|
||||
uint qHash(const TorrentState key, const uint seed)
|
||||
#endif
|
||||
{
|
||||
return ::qHash(static_cast<std::underlying_type_t<TorrentState>>(key), seed);
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QtContainerFwd>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
@ -97,7 +98,11 @@ namespace BitTorrent
|
||||
Error
|
||||
};
|
||||
|
||||
uint qHash(TorrentState key, uint seed);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(TorrentState key, std::size_t seed = 0);
|
||||
#else
|
||||
uint qHash(TorrentState key, uint seed = 0);
|
||||
#endif
|
||||
|
||||
class Torrent : public AbstractFileStorage
|
||||
{
|
||||
|
@ -140,7 +140,11 @@ namespace BitTorrent
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const Peer &key, const std::size_t seed)
|
||||
#else
|
||||
uint qHash(const Peer &key, const uint seed)
|
||||
#endif
|
||||
{
|
||||
return qHash(key.uniqueID(), seed);
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include <libtorrent/entry.hpp>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
@ -64,7 +65,11 @@ namespace BitTorrent
|
||||
|
||||
bool operator==(const Peer &left, const Peer &right);
|
||||
bool operator!=(const Peer &left, const Peer &right);
|
||||
uint qHash(const Peer &key, uint seed);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const Peer &key, std::size_t seed = 0);
|
||||
#else
|
||||
uint qHash(const Peer &key, uint seed = 0);
|
||||
#endif
|
||||
|
||||
// *Basic* Bittorrent tracker implementation
|
||||
// [BEP-3] The BitTorrent Protocol Specification
|
||||
|
@ -36,7 +36,11 @@ bool BitTorrent::operator==(const TrackerEntry &left, const TrackerEntry &right)
|
||||
&& QUrl(left.url) == QUrl(right.url));
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t BitTorrent::qHash(const TrackerEntry &key, const std::size_t seed)
|
||||
#else
|
||||
uint BitTorrent::qHash(const TrackerEntry &key, const uint seed)
|
||||
#endif
|
||||
{
|
||||
return (::qHash(key.url, seed) ^ ::qHash(key.tier));
|
||||
}
|
||||
|
@ -71,5 +71,9 @@ namespace BitTorrent
|
||||
};
|
||||
|
||||
bool operator==(const TrackerEntry &left, const TrackerEntry &right);
|
||||
uint qHash(const TrackerEntry &key, uint seed);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const TrackerEntry &key, std::size_t seed = 0);
|
||||
#else
|
||||
uint qHash(const TrackerEntry &key, uint seed = 0);
|
||||
#endif
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <libtorrent/sha1_hash.hpp>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QByteArray>
|
||||
#include <QHash>
|
||||
#include <QSharedData>
|
||||
@ -131,7 +132,11 @@ bool operator<(const Digest32<N> &left, const Digest32<N> &right)
|
||||
}
|
||||
|
||||
template <int N>
|
||||
uint qHash(const Digest32<N> &key, const uint seed)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const Digest32<N> &key, const std::size_t seed = 0)
|
||||
#else
|
||||
uint qHash(const Digest32<N> &key, const uint seed = 0)
|
||||
#endif
|
||||
{
|
||||
return ::qHash(std::hash<typename Digest32<N>::UnderlyingType>()(key), seed);
|
||||
}
|
||||
|
@ -364,7 +364,11 @@ Net::ServiceID Net::ServiceID::fromURL(const QUrl &url)
|
||||
return {url.host(), url.port(80)};
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t Net::qHash(const ServiceID &serviceID, const std::size_t seed)
|
||||
#else
|
||||
uint Net::qHash(const ServiceID &serviceID, const uint seed)
|
||||
#endif
|
||||
{
|
||||
return ::qHash(serviceID.hostName, seed) ^ ::qHash(serviceID.port);
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QHash>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QObject>
|
||||
@ -52,7 +53,11 @@ namespace Net
|
||||
static ServiceID fromURL(const QUrl &url);
|
||||
};
|
||||
|
||||
uint qHash(const ServiceID &serviceID, uint seed);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const ServiceID &serviceID, std::size_t seed = 0);
|
||||
#else
|
||||
uint qHash(const ServiceID &serviceID, uint seed = 0);
|
||||
#endif
|
||||
bool operator==(const ServiceID &lhs, const ServiceID &rhs);
|
||||
|
||||
enum class DownloadStatus
|
||||
|
@ -332,7 +332,11 @@ QDataStream &operator>>(QDataStream &in, Path &path)
|
||||
return in;
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const Path &key, const std::size_t seed)
|
||||
#else
|
||||
uint qHash(const Path &key, const uint seed)
|
||||
#endif
|
||||
{
|
||||
return ::qHash(key.data(), seed);
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
|
||||
@ -96,4 +97,8 @@ Path operator+(const Path &lhs, const std::string &rhs);
|
||||
QDataStream &operator<<(QDataStream &out, const Path &path);
|
||||
QDataStream &operator>>(QDataStream &in, Path &path);
|
||||
|
||||
uint qHash(const Path &key, uint seed);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const Path &key, std::size_t seed = 0);
|
||||
#else
|
||||
uint qHash(const Path &key, uint seed = 0);
|
||||
#endif
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QHeaderView>
|
||||
@ -70,7 +71,11 @@ bool operator==(const PeerEndpoint &left, const PeerEndpoint &right)
|
||||
return (left.address == right.address) && (left.connectionType == right.connectionType);
|
||||
}
|
||||
|
||||
uint qHash(const PeerEndpoint &peerEndpoint, const uint seed)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
std::size_t qHash(const PeerEndpoint &peerEndpoint, const std::size_t seed = 0)
|
||||
#else
|
||||
uint qHash(const PeerEndpoint &peerEndpoint, const uint seed = 0)
|
||||
#endif
|
||||
{
|
||||
return (qHash(peerEndpoint.address, seed) ^ ::qHash(peerEndpoint.connectionType));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user