mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Move qHash helper for libtorrent types to its own file
This commit is contained in:
parent
39c61327b5
commit
71827fe4e6
@ -10,6 +10,7 @@ add_library(qbt_base STATIC
|
|||||||
bittorrent/downloadpriority.h
|
bittorrent/downloadpriority.h
|
||||||
bittorrent/filterparserthread.h
|
bittorrent/filterparserthread.h
|
||||||
bittorrent/infohash.h
|
bittorrent/infohash.h
|
||||||
|
bittorrent/ltqhash.h
|
||||||
bittorrent/ltunderlyingtype.h
|
bittorrent/ltunderlyingtype.h
|
||||||
bittorrent/magneturi.h
|
bittorrent/magneturi.h
|
||||||
bittorrent/nativesessionextension.h
|
bittorrent/nativesessionextension.h
|
||||||
|
@ -9,6 +9,7 @@ HEADERS += \
|
|||||||
$$PWD/bittorrent/downloadpriority.h \
|
$$PWD/bittorrent/downloadpriority.h \
|
||||||
$$PWD/bittorrent/filterparserthread.h \
|
$$PWD/bittorrent/filterparserthread.h \
|
||||||
$$PWD/bittorrent/infohash.h \
|
$$PWD/bittorrent/infohash.h \
|
||||||
|
$$PWD/bittorrent/ltqhash.h \
|
||||||
$$PWD/bittorrent/ltunderlyingtype.h \
|
$$PWD/bittorrent/ltunderlyingtype.h \
|
||||||
$$PWD/bittorrent/magneturi.h \
|
$$PWD/bittorrent/magneturi.h \
|
||||||
$$PWD/bittorrent/nativesessionextension.h \
|
$$PWD/bittorrent/nativesessionextension.h \
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#include <libtorrent/io_context.hpp>
|
#include <libtorrent/io_context.hpp>
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
|
#include "ltqhash.h"
|
||||||
#else
|
#else
|
||||||
#include <libtorrent/storage.hpp>
|
#include <libtorrent/storage.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
47
src/base/bittorrent/ltqhash.h
Normal file
47
src/base/bittorrent/ltqhash.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Bittorrent Client using Qt and libtorrent.
|
||||||
|
* Copyright (C) 2020 Vladimir Golovnev <glassez@yandex.ru>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* In addition, as a special exception, the copyright holders give permission to
|
||||||
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||||
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||||
|
* and distribute the linked executables. You must obey the GNU General Public
|
||||||
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||||
|
* modify file(s), you may extend this exception to your version of the file(s),
|
||||||
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
* exception statement from your version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
#include <libtorrent/units.hpp>
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
|
namespace libtorrent
|
||||||
|
{
|
||||||
|
namespace aux
|
||||||
|
{
|
||||||
|
template <typename T, typename Tag>
|
||||||
|
uint qHash(const strong_typedef<T, Tag> &key, const uint seed)
|
||||||
|
{
|
||||||
|
return ::qHash((std::hash<strong_typedef<T, Tag>> {})(key), seed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -61,6 +61,7 @@
|
|||||||
#include "base/utils/string.h"
|
#include "base/utils/string.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "downloadpriority.h"
|
#include "downloadpriority.h"
|
||||||
|
#include "ltqhash.h"
|
||||||
#include "ltunderlyingtype.h"
|
#include "ltunderlyingtype.h"
|
||||||
#include "peeraddress.h"
|
#include "peeraddress.h"
|
||||||
#include "peerinfo.h"
|
#include "peerinfo.h"
|
||||||
@ -71,18 +72,6 @@ const QString QB_EXT {QStringLiteral(".!qB")};
|
|||||||
|
|
||||||
using namespace BitTorrent;
|
using namespace BitTorrent;
|
||||||
|
|
||||||
namespace libtorrent
|
|
||||||
{
|
|
||||||
namespace aux
|
|
||||||
{
|
|
||||||
template <typename T, typename Tag>
|
|
||||||
uint qHash(const strong_typedef<T, Tag> &key, const uint seed)
|
|
||||||
{
|
|
||||||
return ::qHash((std::hash<strong_typedef<T, Tag>> {})(key), seed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::vector<lt::download_priority_t> toLTDownloadPriorities(const QVector<DownloadPriority> &priorities)
|
std::vector<lt::download_priority_t> toLTDownloadPriorities(const QVector<DownloadPriority> &priorities)
|
||||||
|
Loading…
Reference in New Issue
Block a user