From 0c96e79d0d73a25e797a32105dbe1eb7afde157b Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 8 May 2018 12:11:00 +0800 Subject: [PATCH] Refactor code Remove forward declarations of Qt types. Fix header include order. --- src/base/bittorrent/session.cpp | 16 +++++++--------- src/base/bittorrent/session.h | 17 +++++++++-------- src/base/bittorrent/torrentinfo.cpp | 12 ++++++------ src/base/bittorrent/torrentinfo.h | 10 +++++----- src/gui/properties/peersadditiondlg.h | 3 +-- 5 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 26a4eb518..30348fb3e 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -49,9 +49,6 @@ #include #include -#if LIBTORRENT_VERSION_NUM >= 10100 -#include -#endif #include #include #include @@ -60,17 +57,18 @@ #include #include #include -#if LIBTORRENT_VERSION_NUM < 10100 -#include -#endif #include #include -#if LIBTORRENT_VERSION_NUM >= 10100 -#include -#endif #include #include +#if LIBTORRENT_VERSION_NUM < 10100 +#include +#else +#include +#include +#endif + #include "base/algorithm.h" #include "base/logger.h" #include "base/net/downloadhandler.h" diff --git a/src/base/bittorrent/session.h b/src/base/bittorrent/session.h index 9cd2e2380..53f557d80 100644 --- a/src/base/bittorrent/session.h +++ b/src/base/bittorrent/session.h @@ -30,18 +30,14 @@ #ifndef BITTORRENT_SESSION_H #define BITTORRENT_SESSION_H -#include #include -#if LIBTORRENT_VERSION_NUM >= 10100 -#include -#endif +#include + #include #include +#include #include -#if LIBTORRENT_VERSION_NUM < 10100 -#include -#endif #include #include #include @@ -49,6 +45,12 @@ #include #include +#if LIBTORRENT_VERSION_NUM < 10100 +#include +#else +#include +#endif + #include "base/settingvalue.h" #include "base/tristatebool.h" #include "base/types.h" @@ -111,7 +113,6 @@ class QTimer; class QStringList; class QString; class QUrl; -template class QList; class FilterParserThread; class BandwidthScheduler; diff --git a/src/base/bittorrent/torrentinfo.cpp b/src/base/bittorrent/torrentinfo.cpp index c366286c9..823002c01 100644 --- a/src/base/bittorrent/torrentinfo.cpp +++ b/src/base/bittorrent/torrentinfo.cpp @@ -26,20 +26,20 @@ * exception statement from your version. */ -#include -#include -#include -#include -#include +#include "torrentinfo.h" #include +#include +#include +#include +#include + #include "base/utils/misc.h" #include "base/utils/fs.h" #include "base/utils/string.h" #include "infohash.h" #include "trackerentry.h" -#include "torrentinfo.h" namespace libt = libtorrent; using namespace BitTorrent; diff --git a/src/base/bittorrent/torrentinfo.h b/src/base/bittorrent/torrentinfo.h index 6e21df42a..71c75939b 100644 --- a/src/base/bittorrent/torrentinfo.h +++ b/src/base/bittorrent/torrentinfo.h @@ -29,12 +29,14 @@ #ifndef BITTORRENT_TORRENTINFO_H #define BITTORRENT_TORRENTINFO_H -#include -#include - #include #include +#include +#include +#include +#include + #include "base/indexrange.h" class QString; @@ -42,8 +44,6 @@ class QUrl; class QDateTime; class QStringList; class QByteArray; -template class QList; -template class QVector; namespace BitTorrent { diff --git a/src/gui/properties/peersadditiondlg.h b/src/gui/properties/peersadditiondlg.h index 75322220d..9ae19488f 100644 --- a/src/gui/properties/peersadditiondlg.h +++ b/src/gui/properties/peersadditiondlg.h @@ -30,11 +30,10 @@ #define PEERADDITION_H #include +#include #include "base/bittorrent/peerinfo.h" -template class QList; - namespace Ui { class addPeersDialog;