Browse Source

Move to separate headers

Hopefully this can speed up compilation times.
https://doc.qt.io/qt-6/qtglobal.html#details

PR #19430.
adaptive-webui-19844
Chocobo1 1 year ago committed by GitHub
parent
commit
31fe327763
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CODING_GUIDELINES.md
  2. 2
      src/app/application.h
  3. 2
      src/app/applicationinstancemanager.cpp
  4. 2
      src/app/main.cpp
  5. 2
      src/app/qtlocalpeer/qtlocalpeer.cpp
  6. 2
      src/app/signalhandler.cpp
  7. 2
      src/app/upgrade.cpp
  8. 2
      src/base/applicationcomponent.h
  9. 1
      src/base/bittorrent/abstractfilestorage.h
  10. 2
      src/base/bittorrent/cachestatus.h
  11. 1
      src/base/bittorrent/infohash.h
  12. 2
      src/base/bittorrent/peeraddress.h
  13. 2
      src/base/bittorrent/sessionstatus.h
  14. 2
      src/base/bittorrent/speedmonitor.h
  15. 2
      src/base/bittorrent/torrent.h
  16. 2
      src/base/bittorrent/tracker.h
  17. 1
      src/base/bittorrent/trackerentry.h
  18. 1
      src/base/digest32.h
  19. 2
      src/base/global.h
  20. 2
      src/base/indexrange.h
  21. 2
      src/base/interfaces/iapplication.h
  22. 2
      src/base/net/downloadmanager.h
  23. 2
      src/base/net/geoipdatabase.h
  24. 3
      src/base/path.h
  25. 2
      src/base/preferences.h
  26. 2
      src/base/torrentfileswatcher.cpp
  27. 2
      src/base/utils/compare.h
  28. 2
      src/base/utils/gzip.cpp
  29. 2
      src/base/utils/misc.h
  30. 2
      src/base/utils/random.cpp
  31. 2
      src/gui/log/loglistview.cpp
  32. 3
      src/gui/mainwindow.cpp
  33. 2
      src/gui/powermanagement/powermanagement.cpp
  34. 2
      src/gui/programupdater.cpp
  35. 1
      src/gui/properties/peerlistwidget.cpp
  36. 1
      src/gui/rss/automatedrssdownloader.cpp
  37. 2
      src/gui/search/searchwidget.cpp
  38. 1
      src/gui/uithemecommon.h
  39. 2
      src/gui/uithememanager.h
  40. 2
      src/gui/uithemesource.h
  41. 2
      src/gui/utils.cpp
  42. 1
      test/testalgorithm.cpp
  43. 1
      test/testbittorrenttrackerentry.cpp
  44. 29
      test/testglobal.cpp
  45. 1
      test/testorderedset.cpp
  46. 3
      test/testpath.cpp
  47. 1
      test/testutilsbytearray.cpp
  48. 1
      test/testutilscompare.cpp
  49. 1
      test/testutilsgzip.cpp
  50. 3
      test/testutilsio.cpp
  51. 1
      test/testutilsstring.cpp
  52. 1
      test/testutilsversion.cpp

4
CODING_GUIDELINES.md

@ -318,7 +318,7 @@ The headers should be ordered alphabetically within each group. \
If there are conditionals for the same header group, then put them at the bottom of the respective group. \ If there are conditionals for the same header group, then put them at the bottom of the respective group. \
If there are conditionals that contain headers from several different header groups, then put them above the "qBittorrent's own headers" group. If there are conditionals that contain headers from several different header groups, then put them above the "qBittorrent's own headers" group.
One exception is the header containing the library version (for example, QtGlobal), this particular header isn't constrained by the aforementioned order. One exception is the header containing the library version (for example, QtVersionChecks), this particular header isn't constrained by the aforementioned order.
Example: Example:
@ -331,7 +331,7 @@ Example:
// exceptions, headers containing version number // exceptions, headers containing version number
#include <boost/version.hpp> #include <boost/version.hpp>
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
#include <QtGlobal> #include <QtVersionChecks>
// C++ Standard Library headers // C++ Standard Library headers
#include <cstdio> #include <cstdio>

2
src/app/application.h

@ -30,7 +30,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtSystemDetection>
#include <QAtomicInt> #include <QAtomicInt>
#include <QCoreApplication> #include <QCoreApplication>
#include <QPointer> #include <QPointer>

2
src/app/applicationinstancemanager.cpp

@ -28,7 +28,7 @@
#include "applicationinstancemanager.h" #include "applicationinstancemanager.h"
#include <QtGlobal> #include <QtSystemDetection>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>

2
src/app/main.cpp

@ -27,7 +27,7 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QtGlobal> #include <QtSystemDetection>
#include <chrono> #include <chrono>
#include <cstdlib> #include <cstdlib>

2
src/app/qtlocalpeer/qtlocalpeer.cpp

@ -68,7 +68,7 @@
#include "qtlocalpeer.h" #include "qtlocalpeer.h"
#include <QtGlobal> #include <QtSystemDetection>
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#include <Windows.h> #include <Windows.h>

2
src/app/signalhandler.cpp

@ -30,7 +30,7 @@
#include "signalhandler.h" #include "signalhandler.h"
#include <QtGlobal> #include <QtSystemDetection>
#include <algorithm> #include <algorithm>
#include <csignal> #include <csignal>

2
src/app/upgrade.cpp

@ -28,7 +28,7 @@
#include "upgrade.h" #include "upgrade.h"
#include <QtGlobal> #include <QtSystemDetection>
#include <QCoreApplication> #include <QCoreApplication>
#include <QMetaEnum> #include <QMetaEnum>

2
src/base/applicationcomponent.h

@ -28,7 +28,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtClassHelperMacros>
#include "interfaces/iapplication.h" #include "interfaces/iapplication.h"

1
src/base/bittorrent/abstractfilestorage.h

@ -28,7 +28,6 @@
#pragma once #pragma once
#include <QtGlobal>
#include <QCoreApplication> #include <QCoreApplication>
#include "base/pathfwd.h" #include "base/pathfwd.h"

2
src/base/bittorrent/cachestatus.h

@ -28,7 +28,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtTypes>
namespace BitTorrent namespace BitTorrent
{ {

1
src/base/bittorrent/infohash.h

@ -32,7 +32,6 @@
#include <libtorrent/info_hash.hpp> #include <libtorrent/info_hash.hpp>
#endif #endif
#include <QtGlobal>
#include <QMetaType> #include <QMetaType>
#include "base/digest32.h" #include "base/digest32.h"

2
src/base/bittorrent/peeraddress.h

@ -28,7 +28,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtTypes>
#include <QHostAddress> #include <QHostAddress>
class QString; class QString;

2
src/base/bittorrent/sessionstatus.h

@ -28,7 +28,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtTypes>
namespace BitTorrent namespace BitTorrent
{ {

2
src/base/bittorrent/speedmonitor.h

@ -33,7 +33,7 @@
#include <boost/circular_buffer.hpp> #include <boost/circular_buffer.hpp>
#endif #endif
#include <QtGlobal> #include <QtTypes>
template<typename T> template<typename T>
struct Sample struct Sample

2
src/base/bittorrent/torrent.h

@ -29,8 +29,8 @@
#pragma once #pragma once
#include <QtGlobal>
#include <QtContainerFwd> #include <QtContainerFwd>
#include <QtTypes>
#include <QMetaType> #include <QMetaType>
#include <QString> #include <QString>

2
src/base/bittorrent/tracker.h

@ -34,7 +34,7 @@
#include <libtorrent/entry.hpp> #include <libtorrent/entry.hpp>
#include <QtGlobal> #include <QtTypes>
#include <QHash> #include <QHash>
#include <QObject> #include <QObject>
#include <QSet> #include <QSet>

1
src/base/bittorrent/trackerentry.h

@ -31,7 +31,6 @@
#include <libtorrent/socket.hpp> #include <libtorrent/socket.hpp>
#include <QtContainerFwd> #include <QtContainerFwd>
#include <QtGlobal>
#include <QHash> #include <QHash>
#include <QMap> #include <QMap>
#include <QString> #include <QString>

1
src/base/digest32.h

@ -30,7 +30,6 @@
#include <libtorrent/sha1_hash.hpp> #include <libtorrent/sha1_hash.hpp>
#include <QtGlobal>
#include <QByteArray> #include <QByteArray>
#include <QHash> #include <QHash>
#include <QSharedData> #include <QSharedData>

2
src/base/global.h

@ -30,7 +30,7 @@
#include <type_traits> #include <type_traits>
#include <QtGlobal> #include <QtProcessorDetection>
#include <QString> #include <QString>

2
src/base/indexrange.h

@ -28,7 +28,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtAssert>
// Interval is defined via [first;last] // Interval is defined via [first;last]
template <typename Index> template <typename Index>

2
src/base/interfaces/iapplication.h

@ -30,7 +30,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtSystemDetection>
#include <QMetaObject> #include <QMetaObject>
class QString; class QString;

2
src/base/net/downloadmanager.h

@ -29,7 +29,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtTypes>
#include <QHash> #include <QHash>
#include <QNetworkProxy> #include <QNetworkProxy>
#include <QObject> #include <QObject>

2
src/base/net/geoipdatabase.h

@ -28,7 +28,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtTypes>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDateTime> #include <QDateTime>
#include <QHash> #include <QHash>

3
src/base/path.h

@ -31,7 +31,6 @@
#include <filesystem> #include <filesystem>
#include <QtGlobal>
#include <QMetaType> #include <QMetaType>
#include <QString> #include <QString>
@ -39,6 +38,8 @@
#include "base/interfaces/istringable.h" #include "base/interfaces/istringable.h"
class QStringView;
class Path final : public IStringable class Path final : public IStringable
{ {
public: public:

2
src/base/preferences.h

@ -30,7 +30,7 @@
#pragma once #pragma once
#include <QtContainerFwd> #include <QtContainerFwd>
#include <QtGlobal> #include <QtSystemDetection>
#include <QObject> #include <QObject>
#include "base/pathfwd.h" #include "base/pathfwd.h"

2
src/base/torrentfileswatcher.cpp

@ -31,7 +31,7 @@
#include <chrono> #include <chrono>
#include <QtGlobal> #include <QtAssert>
#include <QDir> #include <QDir>
#include <QDirIterator> #include <QDirIterator>
#include <QFile> #include <QFile>

2
src/base/utils/compare.h

@ -29,7 +29,7 @@
#pragma once #pragma once
#include <Qt> #include <Qt>
#include <QtGlobal> #include <QtSystemDetection>
#if !defined(Q_OS_WIN) && (!defined(Q_OS_UNIX) || defined(Q_OS_MACOS) || defined(QT_FEATURE_icu)) #if !defined(Q_OS_WIN) && (!defined(Q_OS_UNIX) || defined(Q_OS_MACOS) || defined(QT_FEATURE_icu))
#define QBT_USE_QCOLLATOR #define QBT_USE_QCOLLATOR

2
src/base/utils/gzip.cpp

@ -31,7 +31,7 @@
#include <vector> #include <vector>
#include <QtGlobal> #include <QtAssert>
#include <QByteArray> #include <QByteArray>
#ifndef ZLIB_CONST #ifndef ZLIB_CONST

2
src/base/utils/misc.h

@ -28,7 +28,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtSystemDetection>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <Windows.h> #include <Windows.h>

2
src/base/utils/random.cpp

@ -30,7 +30,7 @@
#include <random> #include <random>
#include <QtGlobal> #include <QtSystemDetection>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <Windows.h> #include <Windows.h>

2
src/gui/log/loglistview.cpp

@ -29,7 +29,7 @@
#include "loglistview.h" #include "loglistview.h"
#include <QtGlobal> #include <QtSystemDetection>
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QFontMetrics> #include <QFontMetrics>

3
src/gui/mainwindow.cpp

@ -29,7 +29,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <QtGlobal> #include <QtSystemDetection>
#include <algorithm> #include <algorithm>
#include <chrono> #include <chrono>
@ -59,7 +59,6 @@
#include <QShortcut> #include <QShortcut>
#include <QSplitter> #include <QSplitter>
#include <QStatusBar> #include <QStatusBar>
#include <QtGlobal>
#include <QTimer> #include <QTimer>
#include "base/bittorrent/session.h" #include "base/bittorrent/session.h"

2
src/gui/powermanagement/powermanagement.cpp

@ -28,7 +28,7 @@
#include "powermanagement.h" #include "powermanagement.h"
#include <QtGlobal> #include <QtSystemDetection>
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
#include <IOKit/pwr_mgt/IOPMLib.h> #include <IOKit/pwr_mgt/IOPMLib.h>

2
src/gui/programupdater.cpp

@ -29,7 +29,7 @@
#include "programupdater.h" #include "programupdater.h"
#include <QtGlobal> #include <QtSystemDetection>
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#include <Windows.h> #include <Windows.h>

1
src/gui/properties/peerlistwidget.cpp

@ -31,7 +31,6 @@
#include <algorithm> #include <algorithm>
#include <QtGlobal>
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QHeaderView> #include <QHeaderView>

1
src/gui/rss/automatedrssdownloader.cpp

@ -29,7 +29,6 @@
#include "automatedrssdownloader.h" #include "automatedrssdownloader.h"
#include <QtGlobal>
#include <QCursor> #include <QCursor>
#include <QFileDialog> #include <QFileDialog>
#include <QMenu> #include <QMenu>

2
src/gui/search/searchwidget.cpp

@ -30,7 +30,7 @@
#include "searchwidget.h" #include "searchwidget.h"
#include <QtGlobal> #include <QtSystemDetection>
#include <utility> #include <utility>

1
src/gui/uithemecommon.h

@ -29,7 +29,6 @@
#pragma once #pragma once
#include <QtGlobal>
#include <QApplication> #include <QApplication>
#include <QColor> #include <QColor>
#include <QHash> #include <QHash>

2
src/gui/uithememanager.h

@ -30,7 +30,7 @@
#pragma once #pragma once
#include <QtGlobal> #include <QtSystemDetection>
#include <QColor> #include <QColor>
#include <QHash> #include <QHash>
#include <QIcon> #include <QIcon>

2
src/gui/uithemesource.h

@ -32,8 +32,8 @@
#include <memory> #include <memory>
#include <QtGlobal>
#include <QColor> #include <QColor>
#include <QCoreApplication>
#include <QHash> #include <QHash>
#include <QIcon> #include <QIcon>
#include <QString> #include <QString>

2
src/gui/utils.cpp

@ -28,7 +28,7 @@
#include "utils.h" #include "utils.h"
#include <QtGlobal> #include <QtSystemDetection>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <Objbase.h> #include <Objbase.h>

1
test/testalgorithm.cpp

@ -31,6 +31,7 @@
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <QObject>
#include <QTest> #include <QTest>
#include "base/algorithm.h" #include "base/algorithm.h"

1
test/testbittorrenttrackerentry.cpp

@ -28,6 +28,7 @@
#include <algorithm> #include <algorithm>
#include <QObject>
#include <QTest> #include <QTest>
#include <QVector> #include <QVector>

29
test/testglobal.cpp

@ -26,7 +26,10 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QtGlobal> #include <type_traits>
#include <QList>
#include <QObject>
#include <QTest> #include <QTest>
#include "base/global.h" #include "base/global.h"
@ -40,13 +43,27 @@ public:
TestGlobal() = default; TestGlobal() = default;
private slots: private slots:
#if (QT_VERSION < QT_VERSION_CHECK(6, 4, 0)) void testAsConst() const
void testStringLiteral() const {
{ {
QCOMPARE(u""_s, QStringLiteral("")); QList<int> list = {0, 1, 2};
QCOMPARE(u"abc"_s, QStringLiteral("abc"));
static_assert(std::is_const_v<std::remove_reference_t<decltype(asConst(list))>>);
QCOMPARE(list, asConst(list));
QCOMPARE(list, asConst(QList<int>(list)));
}
{
const QList<int> list = {0, 1, 2};
static_assert(std::is_const_v<std::remove_reference_t<decltype(asConst(list))>>);
QCOMPARE(list, asConst(list));
QCOMPARE(list, asConst(QList<int>(list)));
// should not compile:
//asConst(std::move(list));
}
} }
#endif
}; };
QTEST_APPLESS_MAIN(TestGlobal) QTEST_APPLESS_MAIN(TestGlobal)

1
test/testorderedset.cpp

@ -27,6 +27,7 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QObject>
#include <QSet> #include <QSet>
#include <QTest> #include <QTest>

3
test/testpath.cpp

@ -26,7 +26,8 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QtGlobal> #include <QtSystemDetection>
#include <QObject>
#include <QTest> #include <QTest>
#include "base/global.h" #include "base/global.h"

1
test/testutilsbytearray.cpp

@ -26,6 +26,7 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QObject>
#include <QTest> #include <QTest>
#include "base/global.h" #include "base/global.h"

1
test/testutilscompare.cpp

@ -28,6 +28,7 @@
#include <tuple> #include <tuple>
#include <QObject>
#include <QTest> #include <QTest>
#include "base/global.h" #include "base/global.h"

1
test/testutilsgzip.cpp

@ -26,6 +26,7 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QObject>
#include <QTest> #include <QTest>
#include "base/global.h" #include "base/global.h"

3
test/testutilsio.cpp

@ -26,7 +26,8 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QtGlobal> #include <QtSystemDetection>
#include <QObject>
#include <QTest> #include <QTest>
#include "base/global.h" #include "base/global.h"

1
test/testutilsstring.cpp

@ -26,6 +26,7 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QObject>
#include <QTest> #include <QTest>
#include "base/global.h" #include "base/global.h"

1
test/testutilsversion.cpp

@ -26,6 +26,7 @@
* exception statement from your version. * exception statement from your version.
*/ */
#include <QObject>
#include <QTest> #include <QTest>
#include "base/global.h" #include "base/global.h"

Loading…
Cancel
Save