From e288de7ec1dc4c9b4beb023f7b3e9fc6a7166086 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 16 May 2019 13:41:29 +0800 Subject: [PATCH] Forward declare as much as possible --- src/base/bittorrent/magneturi.cpp | 1 + src/base/bittorrent/magneturi.h | 7 ++++--- src/base/bittorrent/peerinfo.h | 4 ++-- .../bittorrent/private/bandwidthscheduler.cpp | 1 + .../bittorrent/private/filterparserthread.h | 4 ++-- .../bittorrent/private/portforwarderimpl.cpp | 4 ++-- .../private/resumedatasavingmanager.cpp | 1 + .../private/resumedatasavingmanager.h | 3 ++- src/base/bittorrent/session.h | 1 - src/base/bittorrent/torrentinfo.h | 1 - src/base/filesystemwatcher.h | 4 +++- src/base/iconprovider.h | 3 ++- src/base/net/smtp.cpp | 2 ++ src/base/preferences.cpp | 17 ++++++++++++----- src/base/preferences.h | 13 ++++++------- src/base/private/profile_p.cpp | 2 -- src/base/profile.h | 2 +- src/base/rss/rss_autodownloader.cpp | 1 + src/base/rss/rss_autodownloadrule.h | 2 +- src/base/search/searchhandler.h | 1 + src/base/settingvalue.h | 1 - src/base/utils/fs.cpp | 18 +++++++++--------- src/base/utils/random.cpp | 2 ++ src/gui/optionsdialog.cpp | 3 ++- src/gui/optionsdialog.h | 1 - src/gui/properties/propertieswidget.cpp | 2 ++ src/gui/properties/propertieswidget.h | 7 ++----- src/gui/properties/speedwidget.cpp | 5 ++--- src/gui/properties/speedwidget.h | 2 +- src/gui/transferlistdelegate.cpp | 2 +- src/webui/api/authcontroller.cpp | 3 +++ src/webui/api/authcontroller.h | 3 ++- src/webui/webapplication.cpp | 6 +----- 33 files changed, 71 insertions(+), 58 deletions(-) diff --git a/src/base/bittorrent/magneturi.cpp b/src/base/bittorrent/magneturi.cpp index f15ff39d0..cff9bb6cf 100644 --- a/src/base/bittorrent/magneturi.cpp +++ b/src/base/bittorrent/magneturi.cpp @@ -34,6 +34,7 @@ #include #include +#include #include "infohash.h" diff --git a/src/base/bittorrent/magneturi.h b/src/base/bittorrent/magneturi.h index e2b8757c3..f82dfc8d6 100644 --- a/src/base/bittorrent/magneturi.h +++ b/src/base/bittorrent/magneturi.h @@ -29,15 +29,16 @@ #ifndef BITTORRENT_MAGNETURI_H #define BITTORRENT_MAGNETURI_H +#include + #include #include -#include - -#include #include "infohash.h" #include "trackerentry.h" +class QUrl; + namespace BitTorrent { class MagnetUri diff --git a/src/base/bittorrent/peerinfo.h b/src/base/bittorrent/peerinfo.h index 6aae66f75..6fb3114af 100644 --- a/src/base/bittorrent/peerinfo.h +++ b/src/base/bittorrent/peerinfo.h @@ -29,12 +29,12 @@ #ifndef BITTORRENT_PEERINFO_H #define BITTORRENT_PEERINFO_H +#include + #include #include #include -#include - namespace BitTorrent { class TorrentHandle; diff --git a/src/base/bittorrent/private/bandwidthscheduler.cpp b/src/base/bittorrent/private/bandwidthscheduler.cpp index 308b3217e..a541a2427 100644 --- a/src/base/bittorrent/private/bandwidthscheduler.cpp +++ b/src/base/bittorrent/private/bandwidthscheduler.cpp @@ -33,6 +33,7 @@ #include #include +#include #include "base/preferences.h" diff --git a/src/base/bittorrent/private/filterparserthread.h b/src/base/bittorrent/private/filterparserthread.h index 0f374bbf5..7b86aa4f6 100644 --- a/src/base/bittorrent/private/filterparserthread.h +++ b/src/base/bittorrent/private/filterparserthread.h @@ -29,10 +29,10 @@ #ifndef FILTERPARSERTHREAD_H #define FILTERPARSERTHREAD_H -#include - #include +#include + class QDataStream; class FilterParserThread : public QThread diff --git a/src/base/bittorrent/private/portforwarderimpl.cpp b/src/base/bittorrent/private/portforwarderimpl.cpp index 23d8d6dbd..1a7eb02bf 100644 --- a/src/base/bittorrent/private/portforwarderimpl.cpp +++ b/src/base/bittorrent/private/portforwarderimpl.cpp @@ -28,10 +28,10 @@ #include "portforwarderimpl.h" -#include - #include +#include + #include "base/logger.h" #include "base/settingsstorage.h" diff --git a/src/base/bittorrent/private/resumedatasavingmanager.cpp b/src/base/bittorrent/private/resumedatasavingmanager.cpp index f9dc7b847..4fd93722d 100644 --- a/src/base/bittorrent/private/resumedatasavingmanager.cpp +++ b/src/base/bittorrent/private/resumedatasavingmanager.cpp @@ -28,6 +28,7 @@ #include "resumedatasavingmanager.h" +#include #include #include diff --git a/src/base/bittorrent/private/resumedatasavingmanager.h b/src/base/bittorrent/private/resumedatasavingmanager.h index 3f27d94a0..ffef21e91 100644 --- a/src/base/bittorrent/private/resumedatasavingmanager.h +++ b/src/base/bittorrent/private/resumedatasavingmanager.h @@ -28,10 +28,11 @@ #pragma once -#include #include #include +class QByteArray; + class ResumeDataSavingManager : public QObject { Q_OBJECT diff --git a/src/base/bittorrent/session.h b/src/base/bittorrent/session.h index d2c91b7e8..65a540414 100644 --- a/src/base/bittorrent/session.h +++ b/src/base/bittorrent/session.h @@ -43,7 +43,6 @@ #include #include "base/settingvalue.h" -#include "base/tristatebool.h" #include "base/types.h" #include "addtorrentparams.h" #include "cachestatus.h" diff --git a/src/base/bittorrent/torrentinfo.h b/src/base/bittorrent/torrentinfo.h index 207736954..f06f64765 100644 --- a/src/base/bittorrent/torrentinfo.h +++ b/src/base/bittorrent/torrentinfo.h @@ -29,7 +29,6 @@ #ifndef BITTORRENT_TORRENTINFO_H #define BITTORRENT_TORRENTINFO_H -#include #include #include diff --git a/src/base/filesystemwatcher.h b/src/base/filesystemwatcher.h index ac17d7124..af4c96163 100644 --- a/src/base/filesystemwatcher.h +++ b/src/base/filesystemwatcher.h @@ -32,9 +32,11 @@ #include #include #include -#include +#include #include +class QStringList; + /* * Subclassing QFileSystemWatcher in order to support Network File * System watching (NFS, CIFS) on Linux and Mac OS. diff --git a/src/base/iconprovider.h b/src/base/iconprovider.h index 3bba13361..b6ea47f8c 100644 --- a/src/base/iconprovider.h +++ b/src/base/iconprovider.h @@ -31,7 +31,8 @@ #define ICONPROVIDER_H #include -#include + +class QString; class IconProvider : public QObject { diff --git a/src/base/net/smtp.cpp b/src/base/net/smtp.cpp index 4cffa215c..1e009069a 100644 --- a/src/base/net/smtp.cpp +++ b/src/base/net/smtp.cpp @@ -33,10 +33,12 @@ #include "smtp.h" #include +#include #include #include #include #include + #ifndef QT_NO_OPENSSL #include #else diff --git a/src/base/preferences.cpp b/src/base/preferences.cpp index a96522f5c..81ac30e1f 100644 --- a/src/base/preferences.cpp +++ b/src/base/preferences.cpp @@ -29,9 +29,21 @@ #include "preferences.h" +#ifdef Q_OS_MAC +#include +#endif +#ifdef Q_OS_WIN +#include +#endif + +#include #include #include +#include #include +#include +#include +#include #ifndef DISABLE_GUI #include @@ -40,14 +52,9 @@ #endif #ifdef Q_OS_WIN -#include #include #endif -#ifdef Q_OS_MAC -#include -#endif - #include "algorithm.h" #include "global.h" #include "settingsstorage.h" diff --git a/src/base/preferences.h b/src/base/preferences.h index d8aaab2e2..26ed99dbc 100644 --- a/src/base/preferences.h +++ b/src/base/preferences.h @@ -30,16 +30,17 @@ #ifndef PREFERENCES_H #define PREFERENCES_H -#include #include -#include -#include #include -#include -#include #include "base/utils/net.h" +class QDateTime; +class QNetworkCookie; +class QSize; +class QTime; +class QVariant; + enum SchedulerDays { EVERY_DAY, @@ -74,8 +75,6 @@ namespace DNS }; } -class SettingsStorage; - class Preferences : public QObject { Q_OBJECT diff --git a/src/base/private/profile_p.cpp b/src/base/private/profile_p.cpp index 656beeebf..e5a211cc8 100644 --- a/src/base/private/profile_p.cpp +++ b/src/base/private/profile_p.cpp @@ -31,8 +31,6 @@ #include -#include "base/utils/fs.h" - Private::Profile::Profile(const QString &configurationName) : m_configurationSuffix {configurationName.isEmpty() ? QString() : QLatin1Char('_') + configurationName} { diff --git a/src/base/profile.h b/src/base/profile.h index 34b627a10..290248105 100644 --- a/src/base/profile.h +++ b/src/base/profile.h @@ -33,8 +33,8 @@ #include #include -#include +class QString; class Application; namespace Private diff --git a/src/base/rss/rss_autodownloader.cpp b/src/base/rss/rss_autodownloader.cpp index 4a8609b3f..10513ac9d 100644 --- a/src/base/rss/rss_autodownloader.cpp +++ b/src/base/rss/rss_autodownloader.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include diff --git a/src/base/rss/rss_autodownloadrule.h b/src/base/rss/rss_autodownloadrule.h index 15fd113fb..15e22b735 100644 --- a/src/base/rss/rss_autodownloadrule.h +++ b/src/base/rss/rss_autodownloadrule.h @@ -29,10 +29,10 @@ #pragma once -#include #include #include +class QDateTime; class QJsonObject; class QRegularExpression; class TriStateBool; diff --git a/src/base/search/searchhandler.h b/src/base/search/searchhandler.h index fae52d05c..3cf71318a 100644 --- a/src/base/search/searchhandler.h +++ b/src/base/search/searchhandler.h @@ -32,6 +32,7 @@ #include #include #include +#include class QProcess; class QTimer; diff --git a/src/base/settingvalue.h b/src/base/settingvalue.h index e3ff237c1..b2d13b353 100644 --- a/src/base/settingvalue.h +++ b/src/base/settingvalue.h @@ -33,7 +33,6 @@ #include #include -#include #include "settingsstorage.h" diff --git a/src/base/utils/fs.cpp b/src/base/utils/fs.cpp index ae9d1d31a..ab29a9a2c 100644 --- a/src/base/utils/fs.cpp +++ b/src/base/utils/fs.cpp @@ -34,15 +34,6 @@ #include #endif -#include -#include -#include -#include -#include -#include -#include -#include - #include #include @@ -58,6 +49,15 @@ #include #endif +#include +#include +#include +#include +#include +#include +#include +#include + #include "base/bittorrent/torrenthandle.h" #include "base/global.h" diff --git a/src/base/utils/random.cpp b/src/base/utils/random.cpp index fde12462e..ef46fe860 100644 --- a/src/base/utils/random.cpp +++ b/src/base/utils/random.cpp @@ -43,6 +43,8 @@ #include #endif +#include + #include "misc.h" namespace diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index 14a7d34b7..5ae565937 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -29,6 +29,7 @@ #include "optionsdialog.h" #include +#include #include #include @@ -62,8 +63,8 @@ #include "advancedsettings.h" #include "app/application.h" #include "banlistoptionsdialog.h" -#include "ipsubnetwhitelistoptionsdialog.h" #include "guiiconprovider.h" +#include "ipsubnetwhitelistoptionsdialog.h" #include "rss/automatedrssdownloader.h" #include "scanfoldersdelegate.h" #include "ui_optionsdialog.h" diff --git a/src/gui/optionsdialog.h b/src/gui/optionsdialog.h index 4e3a2d841..1565fdd19 100644 --- a/src/gui/optionsdialog.h +++ b/src/gui/optionsdialog.h @@ -29,7 +29,6 @@ #ifndef OPTIONSDIALOG_H #define OPTIONSDIALOG_H -#include #include class QAbstractButton; diff --git a/src/gui/properties/propertieswidget.cpp b/src/gui/properties/propertieswidget.cpp index eb10e0d0c..b6e60dd06 100644 --- a/src/gui/properties/propertieswidget.cpp +++ b/src/gui/properties/propertieswidget.cpp @@ -29,12 +29,14 @@ #include "propertieswidget.h" #include +#include #include #include #include #include #include #include +#include #include #include #include diff --git a/src/gui/properties/propertieswidget.h b/src/gui/properties/propertieswidget.h index de8b22d2d..c0c5750d3 100644 --- a/src/gui/properties/propertieswidget.h +++ b/src/gui/properties/propertieswidget.h @@ -29,14 +29,13 @@ #ifndef PROPERTIESWIDGET_H #define PROPERTIESWIDGET_H -#include +#include #include #include "base/bittorrent/torrenthandle.h" -class QAction; class QPushButton; -class QTimer; +class QShortcut; class QTreeView; class DownloadedPiecesBar; @@ -45,8 +44,6 @@ class PeerListWidget; class PieceAvailabilityBar; class PropListDelegate; class PropTabBar; -class SpeedWidget; -class torrent_file; class TorrentContentFilterModel; class TrackerListWidget; diff --git a/src/gui/properties/speedwidget.cpp b/src/gui/properties/speedwidget.cpp index 0ab151413..b3a1d3b3a 100644 --- a/src/gui/properties/speedwidget.cpp +++ b/src/gui/properties/speedwidget.cpp @@ -28,13 +28,12 @@ #include "speedwidget.h" -#include +#include #include #include #include #include - -#include +#include #include "base/bittorrent/session.h" #include "base/bittorrent/sessionstatus.h" diff --git a/src/gui/properties/speedwidget.h b/src/gui/properties/speedwidget.h index 148e40f55..79979b2a0 100644 --- a/src/gui/properties/speedwidget.h +++ b/src/gui/properties/speedwidget.h @@ -34,10 +34,10 @@ #include "speedplotview.h" -class QVBoxLayout; class QHBoxLayout; class QLabel; class QMenu; +class QVBoxLayout; class PropertiesWidget; class ComboBoxMenuButton : public QComboBox diff --git a/src/gui/transferlistdelegate.cpp b/src/gui/transferlistdelegate.cpp index d64d74e35..7a314310f 100644 --- a/src/gui/transferlistdelegate.cpp +++ b/src/gui/transferlistdelegate.cpp @@ -29,6 +29,7 @@ #include "transferlistdelegate.h" #include +#include #include #include #include @@ -37,7 +38,6 @@ #include #endif -#include "base/bittorrent/session.h" #include "base/bittorrent/torrenthandle.h" #include "base/preferences.h" #include "base/types.h" diff --git a/src/webui/api/authcontroller.cpp b/src/webui/api/authcontroller.cpp index 5798f77ec..1a34f163c 100644 --- a/src/webui/api/authcontroller.cpp +++ b/src/webui/api/authcontroller.cpp @@ -28,6 +28,9 @@ #include "authcontroller.h" +#include +#include + #include "base/logger.h" #include "base/preferences.h" #include "base/utils/password.h" diff --git a/src/webui/api/authcontroller.h b/src/webui/api/authcontroller.h index 287aee3da..0dd896473 100644 --- a/src/webui/api/authcontroller.h +++ b/src/webui/api/authcontroller.h @@ -29,10 +29,11 @@ #pragma once #include -#include #include "apicontroller.h" +class QString; + class AuthController : public APIController { Q_OBJECT diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index c0b15b001..07bbb68ec 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -29,10 +29,6 @@ #include "webapplication.h" #include -#include -#include -#include -#include #include #include @@ -41,13 +37,13 @@ #include #include #include +#include #include #include #include "base/algorithm.h" #include "base/global.h" #include "base/http/httperror.h" -#include "base/iconprovider.h" #include "base/logger.h" #include "base/preferences.h" #include "base/utils/bytearray.h"