Refactor code

Remove forward declarations of Qt types.
Fix header include order.
This commit is contained in:
Chocobo1 2018-05-08 12:11:00 +08:00 committed by sledgehammer999
parent 0704c0f5e6
commit 0c96e79d0d
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2
5 changed files with 28 additions and 30 deletions

View file

@ -49,9 +49,6 @@
#include <QUuid> #include <QUuid>
#include <libtorrent/alert_types.hpp> #include <libtorrent/alert_types.hpp>
#if LIBTORRENT_VERSION_NUM >= 10100
#include <libtorrent/bdecode.hpp>
#endif
#include <libtorrent/bencode.hpp> #include <libtorrent/bencode.hpp>
#include <libtorrent/disk_io_thread.hpp> #include <libtorrent/disk_io_thread.hpp>
#include <libtorrent/error_code.hpp> #include <libtorrent/error_code.hpp>
@ -60,17 +57,18 @@
#include <libtorrent/extensions/smart_ban.hpp> #include <libtorrent/extensions/smart_ban.hpp>
#include <libtorrent/identify_client.hpp> #include <libtorrent/identify_client.hpp>
#include <libtorrent/ip_filter.hpp> #include <libtorrent/ip_filter.hpp>
#if LIBTORRENT_VERSION_NUM < 10100
#include <libtorrent/lazy_entry.hpp>
#endif
#include <libtorrent/magnet_uri.hpp> #include <libtorrent/magnet_uri.hpp>
#include <libtorrent/session.hpp> #include <libtorrent/session.hpp>
#if LIBTORRENT_VERSION_NUM >= 10100
#include <libtorrent/session_stats.hpp>
#endif
#include <libtorrent/session_status.hpp> #include <libtorrent/session_status.hpp>
#include <libtorrent/torrent_info.hpp> #include <libtorrent/torrent_info.hpp>
#if LIBTORRENT_VERSION_NUM < 10100
#include <libtorrent/lazy_entry.hpp>
#else
#include <libtorrent/bdecode.hpp>
#include <libtorrent/session_stats.hpp>
#endif
#include "base/algorithm.h" #include "base/algorithm.h"
#include "base/logger.h" #include "base/logger.h"
#include "base/net/downloadhandler.h" #include "base/net/downloadhandler.h"

View file

@ -30,18 +30,14 @@
#ifndef BITTORRENT_SESSION_H #ifndef BITTORRENT_SESSION_H
#define BITTORRENT_SESSION_H #define BITTORRENT_SESSION_H
#include <vector>
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
#if LIBTORRENT_VERSION_NUM >= 10100 #include <vector>
#include <QElapsedTimer>
#endif
#include <QFile> #include <QFile>
#include <QHash> #include <QHash>
#include <QList>
#include <QMap> #include <QMap>
#if LIBTORRENT_VERSION_NUM < 10100
#include <QMutex>
#endif
#include <QNetworkConfigurationManager> #include <QNetworkConfigurationManager>
#include <QPointer> #include <QPointer>
#include <QSet> #include <QSet>
@ -49,6 +45,12 @@
#include <QVector> #include <QVector>
#include <QWaitCondition> #include <QWaitCondition>
#if LIBTORRENT_VERSION_NUM < 10100
#include <QMutex>
#else
#include <QElapsedTimer>
#endif
#include "base/settingvalue.h" #include "base/settingvalue.h"
#include "base/tristatebool.h" #include "base/tristatebool.h"
#include "base/types.h" #include "base/types.h"
@ -111,7 +113,6 @@ class QTimer;
class QStringList; class QStringList;
class QString; class QString;
class QUrl; class QUrl;
template<typename T> class QList;
class FilterParserThread; class FilterParserThread;
class BandwidthScheduler; class BandwidthScheduler;

View file

@ -26,20 +26,20 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QDebug> #include "torrentinfo.h"
#include <QString>
#include <QList>
#include <QUrl>
#include <QDateTime>
#include <libtorrent/error_code.hpp> #include <libtorrent/error_code.hpp>
#include <QDebug>
#include <QString>
#include <QUrl>
#include <QDateTime>
#include "base/utils/misc.h" #include "base/utils/misc.h"
#include "base/utils/fs.h" #include "base/utils/fs.h"
#include "base/utils/string.h" #include "base/utils/string.h"
#include "infohash.h" #include "infohash.h"
#include "trackerentry.h" #include "trackerentry.h"
#include "torrentinfo.h"
namespace libt = libtorrent; namespace libt = libtorrent;
using namespace BitTorrent; using namespace BitTorrent;

View file

@ -29,12 +29,14 @@
#ifndef BITTORRENT_TORRENTINFO_H #ifndef BITTORRENT_TORRENTINFO_H
#define BITTORRENT_TORRENTINFO_H #define BITTORRENT_TORRENTINFO_H
#include <QCoreApplication>
#include <QtGlobal>
#include <libtorrent/torrent_info.hpp> #include <libtorrent/torrent_info.hpp>
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
#include <QCoreApplication>
#include <QList>
#include <QtGlobal>
#include <QVector>
#include "base/indexrange.h" #include "base/indexrange.h"
class QString; class QString;
@ -42,8 +44,6 @@ class QUrl;
class QDateTime; class QDateTime;
class QStringList; class QStringList;
class QByteArray; class QByteArray;
template<typename T> class QList;
template<typename T> class QVector;
namespace BitTorrent namespace BitTorrent
{ {

View file

@ -30,11 +30,10 @@
#define PEERADDITION_H #define PEERADDITION_H
#include <QDialog> #include <QDialog>
#include <QList>
#include "base/bittorrent/peerinfo.h" #include "base/bittorrent/peerinfo.h"
template <typename T> class QList;
namespace Ui namespace Ui
{ {
class addPeersDialog; class addPeersDialog;