diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index 53604742e..a9c27a861 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -10,6 +10,7 @@ add_library(qbt_base STATIC bittorrent/downloadpriority.h bittorrent/filterparserthread.h bittorrent/infohash.h + bittorrent/ltqhash.h bittorrent/ltunderlyingtype.h bittorrent/magneturi.h bittorrent/nativesessionextension.h diff --git a/src/base/base.pri b/src/base/base.pri index f2f17d2fc..b8bbb3628 100644 --- a/src/base/base.pri +++ b/src/base/base.pri @@ -9,6 +9,7 @@ HEADERS += \ $$PWD/bittorrent/downloadpriority.h \ $$PWD/bittorrent/filterparserthread.h \ $$PWD/bittorrent/infohash.h \ + $$PWD/bittorrent/ltqhash.h \ $$PWD/bittorrent/ltunderlyingtype.h \ $$PWD/bittorrent/magneturi.h \ $$PWD/bittorrent/nativesessionextension.h \ diff --git a/src/base/bittorrent/customstorage.h b/src/base/bittorrent/customstorage.h index a23d1679b..444a9ffc4 100644 --- a/src/base/bittorrent/customstorage.h +++ b/src/base/bittorrent/customstorage.h @@ -40,6 +40,8 @@ #include #include + +#include "ltqhash.h" #else #include #endif diff --git a/src/base/bittorrent/ltqhash.h b/src/base/bittorrent/ltqhash.h new file mode 100644 index 000000000..668aaa850 --- /dev/null +++ b/src/base/bittorrent/ltqhash.h @@ -0,0 +1,47 @@ +/* + * Bittorrent Client using Qt and libtorrent. + * Copyright (C) 2020 Vladimir Golovnev + * + * 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 + +#include + +#include + +namespace libtorrent +{ + namespace aux + { + template + uint qHash(const strong_typedef &key, const uint seed) + { + return ::qHash((std::hash> {})(key), seed); + } + } +} diff --git a/src/base/bittorrent/torrenthandleimpl.cpp b/src/base/bittorrent/torrenthandleimpl.cpp index 28093007e..5ffa9815d 100644 --- a/src/base/bittorrent/torrenthandleimpl.cpp +++ b/src/base/bittorrent/torrenthandleimpl.cpp @@ -61,6 +61,7 @@ #include "base/utils/string.h" #include "common.h" #include "downloadpriority.h" +#include "ltqhash.h" #include "ltunderlyingtype.h" #include "peeraddress.h" #include "peerinfo.h" @@ -71,18 +72,6 @@ const QString QB_EXT {QStringLiteral(".!qB")}; using namespace BitTorrent; -namespace libtorrent -{ - namespace aux - { - template - uint qHash(const strong_typedef &key, const uint seed) - { - return ::qHash((std::hash> {})(key), seed); - } - } -} - namespace { std::vector toLTDownloadPriorities(const QVector &priorities)