From 10c45287109e94a4dd52ef8887dd6e754add2288 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:14:39 +0200 Subject: [PATCH 01/18] re-enable clang-tidy check --- .clang-tidy | 1 - 1 file changed, 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 4fe0bb846a6..5d3a0d09ea3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -23,7 +23,6 @@ Checks: "-*, -performance-noexcept-move-constructor, -misc-non-private-member-variables-in-classes, -cppcoreguidelines-non-private-member-variables-in-classes, - -cppcoreguidelines-special-member-functions, -modernize-use-nodiscard, -modernize-use-trailing-return-type, -readability-identifier-length, From 3361c798a3ad57f7b31969762fe8a0a52deb0f52 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 12:50:44 +0200 Subject: [PATCH 02/18] Atomic.hpp --- src/common/Atomic.hpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/Atomic.hpp b/src/common/Atomic.hpp index 4ea3e8ae35e..30943e239d3 100644 --- a/src/common/Atomic.hpp +++ b/src/common/Atomic.hpp @@ -1,24 +1,26 @@ #pragma once -#include - #include namespace chatterino { template -class Atomic : boost::noncopyable +class Atomic { public: - Atomic() - { - } + Atomic() = default; Atomic(T &&val) : value_(val) { } + Atomic(const Atomic &) = delete; + Atomic &operator=(const Atomic &) = delete; + + Atomic(Atomic &&) = delete; + Atomic &operator=(Atomic &&) = delete; + T get() const { std::lock_guard guard(this->mutex_); From a4ccb3c70a83dff9a48e06c884eb53ed3c310b16 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 12:51:10 +0200 Subject: [PATCH 03/18] SignalVector.hpp --- src/common/SignalVector.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/SignalVector.hpp b/src/common/SignalVector.hpp index 3de5be89914..e0f2a4e6fe3 100644 --- a/src/common/SignalVector.hpp +++ b/src/common/SignalVector.hpp @@ -2,7 +2,6 @@ #include "debug/AssertInGuiThread.hpp" -#include #include #include #include @@ -19,7 +18,7 @@ struct SignalVectorItemEvent { }; template -class SignalVector : boost::noncopyable +class SignalVector { public: pajlada::Signals::Signal> itemInserted; @@ -42,6 +41,12 @@ class SignalVector : boost::noncopyable this->itemCompare_ = std::move(compare); } + SignalVector(const SignalVector &) = delete; + SignalVector &operator=(const SignalVector &) = delete; + + SignalVector(SignalVector &&) = delete; + SignalVector &operator=(SignalVector &&) = delete; + bool isSorted() const { return bool(this->itemCompare_); From 3c76f0c1250898f028bf6b11ea380001d2382d87 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 12:52:04 +0200 Subject: [PATCH 04/18] Benchmark.hpp --- src/debug/Benchmark.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/debug/Benchmark.hpp b/src/debug/Benchmark.hpp index 4b0d4767f69..e9b058ba779 100644 --- a/src/debug/Benchmark.hpp +++ b/src/debug/Benchmark.hpp @@ -1,16 +1,22 @@ #pragma once -#include #include #include namespace chatterino { -class BenchmarkGuard : boost::noncopyable +class BenchmarkGuard { public: BenchmarkGuard(const QString &_name); ~BenchmarkGuard(); + + BenchmarkGuard(const BenchmarkGuard &) = delete; + BenchmarkGuard &operator=(const BenchmarkGuard &) = delete; + + BenchmarkGuard(BenchmarkGuard &&) = delete; + BenchmarkGuard &operator=(BenchmarkGuard &&) = delete; + qreal getElapsedMs(); private: From f54af24304d593131cd54b3e1074e7c23580f47d Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 12:52:38 +0200 Subject: [PATCH 05/18] IvrApi --- src/providers/IvrApi.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/providers/IvrApi.hpp b/src/providers/IvrApi.hpp index 9aca1454381..b20be5ba851 100644 --- a/src/providers/IvrApi.hpp +++ b/src/providers/IvrApi.hpp @@ -3,7 +3,6 @@ #include "common/NetworkRequest.hpp" #include "providers/twitch/TwitchEmotes.hpp" -#include #include #include @@ -74,7 +73,7 @@ struct IvrEmote { } }; -class IvrApi final : boost::noncopyable +class IvrApi final { public: // https://api.ivr.fi/v2/docs/static/index.html#/Twitch/get_twitch_subage__user___channel_ @@ -89,6 +88,14 @@ class IvrApi final : boost::noncopyable static void initialize(); + IvrApi() = default; + + IvrApi(const IvrApi &) = delete; + IvrApi &operator=(const IvrApi &) = delete; + + IvrApi(IvrApi &&) = delete; + IvrApi &operator=(IvrApi &&) = delete; + private: NetworkRequest makeRequest(QString url, QUrlQuery urlQuery); }; From db4a6efbbe86046fe687c747763fb9eb37b5833b Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 12:53:00 +0200 Subject: [PATCH 06/18] LoggingChannel.hpp --- src/singletons/helper/LoggingChannel.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/singletons/helper/LoggingChannel.hpp b/src/singletons/helper/LoggingChannel.hpp index 9970baaefcd..753a63b9126 100644 --- a/src/singletons/helper/LoggingChannel.hpp +++ b/src/singletons/helper/LoggingChannel.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include #include @@ -13,13 +12,20 @@ class Logging; struct Message; using MessagePtr = std::shared_ptr; -class LoggingChannel : boost::noncopyable +class LoggingChannel { explicit LoggingChannel(const QString &_channelName, const QString &platform); public: ~LoggingChannel(); + + LoggingChannel(const LoggingChannel &) = delete; + LoggingChannel &operator=(const LoggingChannel &) = delete; + + LoggingChannel(LoggingChannel &&) = delete; + LoggingChannel &operator=(LoggingChannel &&) = delete; + void addMessage(MessagePtr message); private: From 95332ad165b47a6ec11601b7cd6f2880ac403f74 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:02:54 +0200 Subject: [PATCH 07/18] Singleton.hpp --- src/common/Singleton.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/Singleton.hpp b/src/common/Singleton.hpp index 401716d78ff..2e47dec3f03 100644 --- a/src/common/Singleton.hpp +++ b/src/common/Singleton.hpp @@ -1,17 +1,22 @@ #pragma once -#include - namespace chatterino { class Settings; class Paths; -class Singleton : boost::noncopyable +class Singleton { public: + Singleton() = default; virtual ~Singleton() = default; + Singleton(const Singleton &) = delete; + Singleton &operator=(const Singleton &) = delete; + + Singleton(Singleton &&) = delete; + Singleton &operator=(Singleton &&) = delete; + virtual void initialize(Settings &settings, Paths &paths) { (void)(settings); From df7465e98789b8cfc13f075d2d165240f0f87287 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:04:56 +0200 Subject: [PATCH 08/18] Image.hpp --- src/messages/Image.hpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/messages/Image.hpp b/src/messages/Image.hpp index 98c964eac14..24091e44764 100644 --- a/src/messages/Image.hpp +++ b/src/messages/Image.hpp @@ -3,7 +3,6 @@ #include "common/Aliases.hpp" #include "common/Common.hpp" -#include #include #include #include @@ -26,13 +25,19 @@ namespace detail { Image image; int duration; }; - class Frames : boost::noncopyable + class Frames { public: Frames(); Frames(QVector> &&frames); ~Frames(); + Frames(const Frames &) = delete; + Frames &operator=(const Frames &) = delete; + + Frames(Frames &&) = delete; + Frames &operator=(Frames &&) = delete; + void clear(); bool empty() const; bool animated() const; @@ -54,7 +59,7 @@ class Image; using ImagePtr = std::shared_ptr; /// This class is thread safe. -class Image : public std::enable_shared_from_this, boost::noncopyable +class Image : public std::enable_shared_from_this { public: // Maximum amount of RAM used by the image in bytes. @@ -62,6 +67,12 @@ class Image : public std::enable_shared_from_this, boost::noncopyable ~Image(); + Image(const Image &) = delete; + Image &operator=(const Image &) = delete; + + Image(Image &&) = delete; + Image &operator=(Image &&) = delete; + static ImagePtr fromUrl(const Url &url, qreal scale = 1); static ImagePtr fromResourcePixmap(const QPixmap &pixmap, qreal scale = 1); static ImagePtr getEmpty(); From 251e909532778aebadb258e77eb9e841285946ef Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:05:07 +0200 Subject: [PATCH 09/18] PrecompiledHeader.hpp --- src/PrecompiledHeader.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/PrecompiledHeader.hpp b/src/PrecompiledHeader.hpp index a774d57d856..f430a099c32 100644 --- a/src/PrecompiledHeader.hpp +++ b/src/PrecompiledHeader.hpp @@ -2,7 +2,6 @@ # include # include # include -# include # include # include # include From 843781ee117dd51f658595b0f260e63d693ec5b8 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:05:56 +0200 Subject: [PATCH 10/18] Message.hpp --- src/messages/Message.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/messages/Message.hpp b/src/messages/Message.hpp index 83e311b1ccd..b248c93a116 100644 --- a/src/messages/Message.hpp +++ b/src/messages/Message.hpp @@ -3,7 +3,6 @@ #include "common/FlagsEnum.hpp" #include "util/QStringHash.hpp" -#include #include #include @@ -54,10 +53,16 @@ enum class MessageFlag : int64_t { }; using MessageFlags = FlagsEnum; -struct Message : boost::noncopyable { +struct Message { Message(); ~Message(); + Message(const Message &) = delete; + Message &operator=(const Message &) = delete; + + Message(Message &&) = delete; + Message &operator=(Message &&) = delete; + // Making this a mutable means that we can update a messages flags, // while still keeping Message constant. This means that a message's flag // can be updated without the renderer being made aware, which might be bad. From be035937973c3a5b5cda5350928e83e8ce62b9ec Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:06:31 +0200 Subject: [PATCH 11/18] MessageElement.hpp --- src/messages/MessageElement.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/messages/MessageElement.hpp b/src/messages/MessageElement.hpp index ddff4bf7a48..175537bf1d9 100644 --- a/src/messages/MessageElement.hpp +++ b/src/messages/MessageElement.hpp @@ -6,7 +6,6 @@ #include "messages/MessageColor.hpp" #include "singletons/Fonts.hpp" -#include #include #include #include @@ -158,7 +157,7 @@ enum class MessageElementFlag : int64_t { }; using MessageElementFlags = FlagsEnum; -class MessageElement : boost::noncopyable +class MessageElement { public: enum UpdateFlags : char { @@ -173,6 +172,12 @@ class MessageElement : boost::noncopyable virtual ~MessageElement(); + MessageElement(const MessageElement &) = delete; + MessageElement &operator=(const MessageElement &) = delete; + + MessageElement(MessageElement &&) = delete; + MessageElement &operator=(MessageElement &&) = delete; + MessageElement *setLink(const Link &link); MessageElement *setText(const QString &text); MessageElement *setTooltip(const QString &tooltip); From 5667e1ae76fc3070c59f7e87709872264b0deeee Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:06:58 +0200 Subject: [PATCH 12/18] MessageLayout.hpp --- src/messages/layouts/MessageLayout.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/messages/layouts/MessageLayout.hpp b/src/messages/layouts/MessageLayout.hpp index 81d7e403508..b5d47ba151b 100644 --- a/src/messages/layouts/MessageLayout.hpp +++ b/src/messages/layouts/MessageLayout.hpp @@ -4,7 +4,6 @@ #include "common/FlagsEnum.hpp" #include "messages/layouts/MessageLayoutContainer.hpp" -#include #include #include @@ -33,12 +32,18 @@ enum class MessageLayoutFlag : uint8_t { }; using MessageLayoutFlags = FlagsEnum; -class MessageLayout : boost::noncopyable +class MessageLayout { public: MessageLayout(MessagePtr message_); ~MessageLayout(); + MessageLayout(const MessageLayout &) = delete; + MessageLayout &operator=(const MessageLayout &) = delete; + + MessageLayout(MessageLayout &&) = delete; + MessageLayout &operator=(MessageLayout &&) = delete; + const Message *getMessage(); const MessagePtr &getMessagePtr() const; From a7f2144e9ed783a7600d0e8703533980945f3052 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:07:20 +0200 Subject: [PATCH 13/18] MessageLayoutElement.hpp --- src/messages/layouts/MessageLayoutElement.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/messages/layouts/MessageLayoutElement.hpp b/src/messages/layouts/MessageLayoutElement.hpp index 2a4ec030e1e..1cdc16edc58 100644 --- a/src/messages/layouts/MessageLayoutElement.hpp +++ b/src/messages/layouts/MessageLayoutElement.hpp @@ -3,7 +3,6 @@ #include "common/FlagsEnum.hpp" #include "messages/Link.hpp" -#include #include #include #include @@ -23,12 +22,18 @@ enum class FontStyle : uint8_t; enum class MessageElementFlag : int64_t; struct MessageColors; -class MessageLayoutElement : boost::noncopyable +class MessageLayoutElement { public: MessageLayoutElement(MessageElement &creator_, const QSize &size); virtual ~MessageLayoutElement(); + MessageLayoutElement(const MessageLayoutElement &) = delete; + MessageLayoutElement &operator=(const MessageLayoutElement &) = delete; + + MessageLayoutElement(MessageLayoutElement &&) = delete; + MessageLayoutElement &operator=(MessageLayoutElement &&) = delete; + bool reversedNeutral = false; const QRect &getRect() const; From 6fcccb893b9a4714d7d158145b04a647251de53f Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:07:28 +0200 Subject: [PATCH 14/18] Fonts.hpp (just include) --- src/singletons/Fonts.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/singletons/Fonts.hpp b/src/singletons/Fonts.hpp index a346350000d..40932d20fcb 100644 --- a/src/singletons/Fonts.hpp +++ b/src/singletons/Fonts.hpp @@ -3,7 +3,6 @@ #include "common/ChatterinoSetting.hpp" #include "common/Singleton.hpp" -#include #include #include #include From 92cb10ab38ecef22dc9717589ad63bf11b9498a6 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 13:09:52 +0200 Subject: [PATCH 15/18] Remove boost::random dependency --- CMakeLists.txt | 4 +--- vcpkg.json | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index caa3990b4a6..e5934cd60a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,9 +115,7 @@ endif () find_package(Sanitizers QUIET) # Find boost on the system -# `OPTIONAL_COMPONENTS random` is required for vcpkg builds to link. -# `OPTIONAL` is required, because conan doesn't set `boost_random_FOUND`. -find_package(Boost REQUIRED OPTIONAL_COMPONENTS random) +find_package(Boost REQUIRED) # Find OpenSSL on the system find_package(OpenSSL REQUIRED) diff --git a/vcpkg.json b/vcpkg.json index b6a60506adf..99aa00b38a1 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -9,7 +9,6 @@ "boost-circular-buffer", "boost-foreach", "boost-interprocess", - "boost-random", "boost-signals2", "boost-variant", "gtest", From 2acddc62b4b6825fb585c5b2822468b80e097edc Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 17:24:07 +0200 Subject: [PATCH 16/18] Add the required `headers` boost component --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5934cd60a0..0061779c716 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ endif () find_package(Sanitizers QUIET) # Find boost on the system -find_package(Boost REQUIRED) +find_package(Boost REQUIRED COMPONENTS headers) # Find OpenSSL on the system find_package(OpenSSL REQUIRED) From bbf167be8388286d1536c6042e708e69e8f1b374 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 20 Aug 2023 17:38:20 +0200 Subject: [PATCH 17/18] make the components optional --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0061779c716..40f1144f005 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ endif () find_package(Sanitizers QUIET) # Find boost on the system -find_package(Boost REQUIRED COMPONENTS headers) +find_package(Boost REQUIRED OPTIONAL_COMPONENTS headers) # Find OpenSSL on the system find_package(OpenSSL REQUIRED) From f09d5461b0751246b7306d0e0fb842deaf264e21 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 9 Sep 2023 11:42:37 +0200 Subject: [PATCH 18/18] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 200326e1709..be8d0ff38ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767) - Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774) - Dev: Do a pretty major refactor of the Settings classes. List settings (e.g. highlights) are most heavily modified, and should have an extra eye kept on them. (#4775) +- Dev: Remove `boost::noncopyable` use & `boost_random` dependency. (#4776) ## 2.4.5