diff --git a/chatterino.pro b/chatterino.pro index b7c10c64b..1665eef0a 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -313,12 +313,16 @@ win32-msvc* { # 4127 - conditional expression is constant # 4503 - decorated name length exceeded, name was truncated # 4100 - unreferences formal parameter + # 4305 - possible truncation of data + # 4267 - possible loss of data in return QMAKE_CXXFLAGS_WARN_ON += /wd4714 QMAKE_CXXFLAGS_WARN_ON += /wd4996 QMAKE_CXXFLAGS_WARN_ON += /wd4505 QMAKE_CXXFLAGS_WARN_ON += /wd4127 QMAKE_CXXFLAGS_WARN_ON += /wd4503 QMAKE_CXXFLAGS_WARN_ON += /wd4100 + QMAKE_CXXFLAGS_WARN_ON += /wd4305 + QMAKE_CXXFLAGS_WARN_ON += /wd4267 } else { QMAKE_CXXFLAGS_WARN_ON = -Wall diff --git a/src/channel.cpp b/src/channel.cpp index f72a0a01d..1834979f0 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -61,10 +61,10 @@ void Channel::addMessage(MessagePtr message) singletons::LoggingManager::getInstance().addMessage(this->name, message); if (this->messages.pushBack(message, deleted)) { - this->messageRemovedFromStart(deleted); + this->messageRemovedFromStart.invoke(deleted); } - this->messageAppended(message); + this->messageAppended.invoke(message); } void Channel::addMessagesAtStart(std::vector &_messages) @@ -72,7 +72,7 @@ void Channel::addMessagesAtStart(std::vector &_messages) std::vector addedMessages = this->messages.pushFront(_messages); if (addedMessages.size() != 0) { - this->messagesAddedAtStart(addedMessages); + this->messagesAddedAtStart.invoke(addedMessages); } } @@ -81,7 +81,7 @@ void Channel::replaceMessage(messages::MessagePtr message, messages::MessagePtr int index = this->messages.replaceItem(message, replacement); if (index >= 0) { - this->messageReplaced((size_t)index, replacement); + this->messageReplaced.invoke((size_t)index, replacement); } } diff --git a/src/channel.hpp b/src/channel.hpp index ca51c7c27..e42b5b7c9 100644 --- a/src/channel.hpp +++ b/src/channel.hpp @@ -8,14 +8,14 @@ #include #include -#include +#include #include namespace chatterino { namespace messages { struct Message; -} +} // namespace messages class Channel : public std::enable_shared_from_this { @@ -27,10 +27,10 @@ public: pajlada::Signals::Signal sendMessageSignal; - boost::signals2::signal messageRemovedFromStart; - boost::signals2::signal messageAppended; - boost::signals2::signal &)> messagesAddedAtStart; - boost::signals2::signal messageReplaced; + pajlada::Signals::Signal messageRemovedFromStart; + pajlada::Signals::Signal messageAppended; + pajlada::Signals::Signal &> messagesAddedAtStart; + pajlada::Signals::Signal messageReplaced; pajlada::Signals::NoArgSignal destroyed; virtual bool isEmpty() const; diff --git a/src/common.hpp b/src/common.hpp index 80ca6608f..bba4fa463 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -1,10 +1,11 @@ #pragma once +#include "debug/log.hpp" + #include #include -#include -#include "debug/log.hpp" +#include namespace chatterino { diff --git a/src/credentials.hpp b/src/credentials.hpp index e66cd2d34..c0e97d259 100644 --- a/src/credentials.hpp +++ b/src/credentials.hpp @@ -1,5 +1,7 @@ #pragma once +#include + namespace chatterino { inline QByteArray getDefaultClientID() diff --git a/src/messages/image.hpp b/src/messages/image.hpp index a32446d8b..f107ed769 100644 --- a/src/messages/image.hpp +++ b/src/messages/image.hpp @@ -5,7 +5,6 @@ #include #include -#include namespace chatterino { namespace messages { diff --git a/src/messages/layouts/messagelayoutcontainer.hpp b/src/messages/layouts/messagelayoutcontainer.hpp index 6c95082c7..855378115 100644 --- a/src/messages/layouts/messagelayoutcontainer.hpp +++ b/src/messages/layouts/messagelayoutcontainer.hpp @@ -15,7 +15,7 @@ namespace chatterino { namespace messages { namespace layouts { -struct MessageLayoutElement; +class MessageLayoutElement; struct Margin { int top; diff --git a/src/messages/layouts/messagelayoutelement.cpp b/src/messages/layouts/messagelayoutelement.cpp index 6d0213acf..cf43237c3 100644 --- a/src/messages/layouts/messagelayoutelement.cpp +++ b/src/messages/layouts/messagelayoutelement.cpp @@ -102,9 +102,9 @@ void ImageLayoutElement::paintAnimated(QPainter &painter, int yOffset) if (pixmap != nullptr) { // fourtf: make it use qreal values - QRect rect = this->getRect(); - rect.moveTop(rect.y() + yOffset); - painter.drawPixmap(QRectF(rect), *pixmap, QRectF()); + QRect _rect = this->getRect(); + _rect.moveTop(_rect.y() + yOffset); + painter.drawPixmap(QRectF(_rect), *pixmap, QRectF()); } } } @@ -240,8 +240,8 @@ void TextIconLayoutElement::paint(QPainter &painter) option.setAlignment(Qt::AlignHCenter); if (this->line2.isEmpty()) { - QRect rect(this->getRect()); - painter.drawText(rect, this->line1, option); + QRect _rect(this->getRect()); + painter.drawText(_rect, this->line1, option); } else { painter.drawText( QPoint(this->getRect().x(), this->getRect().y() + this->getRect().height() / 2), diff --git a/src/messages/layouts/messagelayoutelement.hpp b/src/messages/layouts/messagelayoutelement.hpp index 1df72ebb3..646c44c7f 100644 --- a/src/messages/layouts/messagelayoutelement.hpp +++ b/src/messages/layouts/messagelayoutelement.hpp @@ -15,14 +15,16 @@ class QPainter; namespace chatterino { namespace messages { -struct MessageElement; +class MessageElement; class Image; namespace layouts { -struct MessageLayoutElement : boost::noncopyable { +class MessageLayoutElement : boost::noncopyable +{ public: MessageLayoutElement(MessageElement &creator, const QSize &size); + virtual ~MessageLayoutElement() = default; const QRect &getRect() const; MessageElement &getCreator() const; diff --git a/src/messages/limitedqueue.hpp b/src/messages/limitedqueue.hpp index 23618fe0a..78d761809 100644 --- a/src/messages/limitedqueue.hpp +++ b/src/messages/limitedqueue.hpp @@ -1,9 +1,9 @@ #pragma once -#include "QDebug" - #include "messages/limitedqueuesnapshot.hpp" +#include + #include #include #include diff --git a/src/messages/limitedqueuesnapshot.hpp b/src/messages/limitedqueuesnapshot.hpp index 84dc83b3b..87918816f 100644 --- a/src/messages/limitedqueuesnapshot.hpp +++ b/src/messages/limitedqueuesnapshot.hpp @@ -11,10 +11,7 @@ template class LimitedQueueSnapshot { public: - LimitedQueueSnapshot() - : length(0) - { - } + LimitedQueueSnapshot() = default; LimitedQueueSnapshot(std::shared_ptr>>> _chunks, size_t _length, size_t _firstChunkOffset, size_t _lastChunkEnd) @@ -53,9 +50,9 @@ public: private: std::shared_ptr>>> chunks; - size_t length; - size_t firstChunkOffset; - size_t lastChunkEnd; + size_t length = 0; + size_t firstChunkOffset = 0; + size_t lastChunkEnd = 0; }; } // namespace messages diff --git a/src/messages/link.cpp b/src/messages/link.cpp index 419bfaf77..510d248ec 100644 --- a/src/messages/link.cpp +++ b/src/messages/link.cpp @@ -2,6 +2,7 @@ namespace chatterino { namespace messages { + Link::Link() : type(None) , value(QString()) @@ -18,5 +19,6 @@ bool Link::isValid() const { return this->type != None; } + } // namespace messages } // namespace chatterino diff --git a/src/messages/link.hpp b/src/messages/link.hpp index 071a175fa..945f414fe 100644 --- a/src/messages/link.hpp +++ b/src/messages/link.hpp @@ -4,6 +4,7 @@ namespace chatterino { namespace messages { + struct Link { public: enum Type { @@ -26,5 +27,6 @@ public: bool isValid() const; }; + } // namespace messages } // namespace chatterino diff --git a/src/messages/message.cpp b/src/messages/message.cpp index d2fca598d..93d564faf 100644 --- a/src/messages/message.cpp +++ b/src/messages/message.cpp @@ -2,7 +2,7 @@ #include "messageelement.hpp" #include "util/irchelpers.hpp" -typedef chatterino::widgets::ScrollbarHighlight SBHighlight; +using SBHighlight = chatterino::widgets::ScrollbarHighlight; namespace chatterino { namespace messages { diff --git a/src/messages/message.hpp b/src/messages/message.hpp index 341d6a4a4..56afc2b52 100644 --- a/src/messages/message.hpp +++ b/src/messages/message.hpp @@ -4,12 +4,12 @@ #include "util/flagsenum.hpp" #include "widgets/helper/scrollbarhighlight.hpp" +#include + #include #include #include -#include - namespace chatterino { namespace messages { diff --git a/src/messages/messagecolor.cpp b/src/messages/messagecolor.cpp index 8a0708342..6e0f877e5 100644 --- a/src/messages/messagecolor.cpp +++ b/src/messages/messagecolor.cpp @@ -2,6 +2,7 @@ namespace chatterino { namespace messages { + MessageColor::MessageColor(const QColor &_color) : type(Type::Custom) , customColor(_color) @@ -29,5 +30,6 @@ const QColor &MessageColor::getColor(singletons::ThemeManager &themeManager) con static QColor _default; return _default; } + } // namespace messages } // namespace chatterino diff --git a/src/messages/messagecolor.hpp b/src/messages/messagecolor.hpp index 00e59a029..04387bfb4 100644 --- a/src/messages/messagecolor.hpp +++ b/src/messages/messagecolor.hpp @@ -1,11 +1,12 @@ #pragma once -#include - #include "singletons/thememanager.hpp" +#include + namespace chatterino { namespace messages { + struct MessageColor { enum Type { Custom, Text, Link, System }; @@ -18,5 +19,6 @@ private: Type type; QColor customColor; }; + } // namespace messages } // namespace chatterino diff --git a/src/messages/messageelement.cpp b/src/messages/messageelement.cpp index e5d34b912..85b0e4e96 100644 --- a/src/messages/messageelement.cpp +++ b/src/messages/messageelement.cpp @@ -74,18 +74,10 @@ void ImageElement::addToContainer(MessageLayoutContainer &container, MessageElem EmoteElement::EmoteElement(const util::EmoteData &_data, MessageElement::Flags flags) : MessageElement(flags) , data(_data) - , textElement(nullptr) { if (_data.isValid()) { this->setTooltip(data.image1x->getTooltip()); - this->textElement = new TextElement(_data.image1x->getName(), MessageElement::Misc); - } -} - -EmoteElement::~EmoteElement() -{ - if (this->textElement != nullptr) { - delete this->textElement; + this->textElement.reset(new TextElement(_data.image1x->getName(), MessageElement::Misc)); } } @@ -114,7 +106,7 @@ void EmoteElement::addToContainer(MessageLayoutContainer &container, MessageElem container.addElement( (new ImageLayoutElement(*this, _image, size))->setLink(this->getLink())); } else { - if (this->textElement != nullptr) { + if (this->textElement) { this->textElement->addToContainer(container, MessageElement::Misc); } } @@ -130,7 +122,7 @@ TextElement::TextElement(const QString &text, MessageElement::Flags flags, { for (QString word : text.split(' ')) { this->words.push_back({word, -1}); - // fourtf: add logic to store mutliple spaces after message + // fourtf: add logic to store multiple spaces after message } } @@ -213,32 +205,21 @@ void TextElement::addToContainer(MessageLayoutContainer &container, MessageEleme } // TIMESTAMP -TimestampElement::TimestampElement() - : TimestampElement(QTime::currentTime()) -{ -} - TimestampElement::TimestampElement(QTime _time) : MessageElement(MessageElement::Timestamp) , time(_time) - , element(formatTime(_time)) + , element(this->formatTime(_time)) { assert(this->element != nullptr); } -TimestampElement::~TimestampElement() -{ - delete this->element; -} - void TimestampElement::addToContainer(MessageLayoutContainer &container, MessageElement::Flags _flags) { if (_flags & this->getFlags()) { if (singletons::SettingManager::getInstance().timestampFormat != this->format) { this->format = singletons::SettingManager::getInstance().timestampFormat.getValue(); - delete this->element; - this->element = TimestampElement::formatTime(this->time); + this->element.reset(this->formatTime(this->time)); } this->element->addToContainer(container, _flags); diff --git a/src/messages/messageelement.hpp b/src/messages/messageelement.hpp index bdae0129b..e943b0e77 100644 --- a/src/messages/messageelement.hpp +++ b/src/messages/messageelement.hpp @@ -4,28 +4,29 @@ #include "messages/link.hpp" #include "messages/messagecolor.hpp" #include "singletons/fontmanager.hpp" +#include "util/emotemap.hpp" -#include #include #include #include - #include -#include "util/emotemap.hpp" + +#include +#include namespace chatterino { class Channel; namespace util { struct EmoteData; -} +} // namespace util namespace messages { namespace layouts { struct MessageLayoutContainer; -} +} // namespace layouts using namespace chatterino::messages::layouts; -struct MessageElement : boost::noncopyable +class MessageElement : boost::noncopyable { public: enum Flags : uint32_t { @@ -109,9 +110,7 @@ public: Update_All = Update_Text | Update_Emotes | Update_Images }; - virtual ~MessageElement() - { - } + virtual ~MessageElement() = default; MessageElement *setLink(const Link &link); MessageElement *setTooltip(const QString &tooltip); @@ -141,8 +140,7 @@ class ImageElement : public MessageElement public: ImageElement(Image *image, MessageElement::Flags flags); - virtual void addToContainer(MessageLayoutContainer &container, - MessageElement::Flags flags) override; + void addToContainer(MessageLayoutContainer &container, MessageElement::Flags flags) override; }; // contains a text, it will split it into words @@ -161,9 +159,9 @@ public: TextElement(const QString &text, MessageElement::Flags flags, const MessageColor &color = MessageColor::Text, FontStyle style = FontStyle::Medium); + ~TextElement() override = default; - virtual void addToContainer(MessageLayoutContainer &container, - MessageElement::Flags flags) override; + void addToContainer(MessageLayoutContainer &container, MessageElement::Flags flags) override; }; // contains emote data and will pick the emote based on : @@ -172,30 +170,27 @@ public: class EmoteElement : public MessageElement { const util::EmoteData data; - TextElement *textElement; + std::unique_ptr textElement; public: EmoteElement(const util::EmoteData &data, MessageElement::Flags flags); - ~EmoteElement(); + ~EmoteElement() override = default; - virtual void addToContainer(MessageLayoutContainer &container, - MessageElement::Flags flags) override; + void addToContainer(MessageLayoutContainer &container, MessageElement::Flags flags) override; }; // contains a text, formated depending on the preferences class TimestampElement : public MessageElement { QTime time; - TextElement *element; + std::unique_ptr element; QString format; public: - TimestampElement(); - TimestampElement(QTime time); - virtual ~TimestampElement(); + TimestampElement(QTime time = QTime::currentTime()); + ~TimestampElement() override = default; - virtual void addToContainer(MessageLayoutContainer &container, - MessageElement::Flags flags) override; + void addToContainer(MessageLayoutContainer &container, MessageElement::Flags flags) override; TextElement *formatTime(const QTime &time); }; @@ -207,8 +202,8 @@ class TwitchModerationElement : public MessageElement public: TwitchModerationElement(); - virtual void addToContainer(MessageLayoutContainer &container, - MessageElement::Flags flags) override; + void addToContainer(MessageLayoutContainer &container, MessageElement::Flags flags) override; }; + } // namespace messages } // namespace chatterino diff --git a/src/messages/messageparseargs.hpp b/src/messages/messageparseargs.hpp index d0d355d74..e9b0b4db6 100644 --- a/src/messages/messageparseargs.hpp +++ b/src/messages/messageparseargs.hpp @@ -4,8 +4,7 @@ namespace chatterino { namespace messages { struct MessageParseArgs { -public: - bool disablePingSoungs = false; + bool disablePingSounds = false; bool isReceivedWhisper = false; bool isSentWhisper = false; }; diff --git a/src/messages/selection.hpp b/src/messages/selection.hpp index 1ae5d7158..ad5b05e0b 100644 --- a/src/messages/selection.hpp +++ b/src/messages/selection.hpp @@ -1,7 +1,10 @@ #pragma once +#include + namespace chatterino { namespace messages { + struct SelectionItem { int messageIndex; int charIndex; @@ -47,9 +50,7 @@ struct Selection { SelectionItem min; SelectionItem max; - Selection() - { - } + Selection() = default; Selection(const SelectionItem &start, const SelectionItem &end) : start(start) @@ -72,5 +73,6 @@ struct Selection { return this->min.messageIndex == this->max.messageIndex; } }; + } // namespace messages } // namespace chatterino diff --git a/src/precompiled_header.hpp b/src/precompiled_header.hpp index fc981efdc..89f032be6 100644 --- a/src/precompiled_header.hpp +++ b/src/precompiled_header.hpp @@ -2,11 +2,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include @@ -127,13 +125,12 @@ #include #include #include -#include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/providers/irc/abstractircserver.hpp b/src/providers/irc/abstractircserver.hpp index e62368a39..277e9b566 100644 --- a/src/providers/irc/abstractircserver.hpp +++ b/src/providers/irc/abstractircserver.hpp @@ -2,10 +2,12 @@ #include "channel.hpp" +#include #include +#include + #include #include -#include namespace chatterino { namespace providers { @@ -14,6 +16,8 @@ namespace irc { class AbstractIrcServer { public: + virtual ~AbstractIrcServer() = default; + // connection Communi::IrcConnection *getReadConnection() const; diff --git a/src/providers/twitch/emotevalue.hpp b/src/providers/twitch/emotevalue.hpp index 18f4e542e..4518690e4 100644 --- a/src/providers/twitch/emotevalue.hpp +++ b/src/providers/twitch/emotevalue.hpp @@ -1,6 +1,6 @@ #pragma once -#include "QString" +#include namespace chatterino { namespace providers { diff --git a/src/providers/twitch/ircmessagehandler.cpp b/src/providers/twitch/ircmessagehandler.cpp index ea493e3dd..796f048d5 100644 --- a/src/providers/twitch/ircmessagehandler.cpp +++ b/src/providers/twitch/ircmessagehandler.cpp @@ -1,7 +1,5 @@ #include "ircmessagehandler.hpp" -#include - #include "debug/log.hpp" #include "messages/limitedqueue.hpp" #include "messages/message.hpp" @@ -12,6 +10,8 @@ #include "singletons/resourcemanager.hpp" #include "singletons/windowmanager.hpp" +#include + using namespace chatterino::singletons; using namespace chatterino::messages; @@ -233,6 +233,7 @@ void IrcMessageHandler::handleWriteConnectionNoticeMessage(Communi::IrcNoticeMes this->handleNoticeMessage(message); } + } // namespace twitch } // namespace providers } // namespace chatterino diff --git a/src/providers/twitch/twitchaccountmanager.hpp b/src/providers/twitch/twitchaccountmanager.hpp index 4ca070f64..b97931136 100644 --- a/src/providers/twitch/twitchaccountmanager.hpp +++ b/src/providers/twitch/twitchaccountmanager.hpp @@ -13,11 +13,14 @@ // namespace chatterino { + namespace singletons { class AccountManager; -} +} // namespace singletons + namespace providers { namespace twitch { + class TwitchAccountManager { TwitchAccountManager(); @@ -62,6 +65,7 @@ private: friend class chatterino::singletons::AccountManager; }; + } // namespace twitch } // namespace providers } // namespace chatterino diff --git a/src/providers/twitch/twitchchannel.cpp b/src/providers/twitch/twitchchannel.cpp index 82537aed1..729612d49 100644 --- a/src/providers/twitch/twitchchannel.cpp +++ b/src/providers/twitch/twitchchannel.cpp @@ -81,8 +81,6 @@ TwitchChannel::TwitchChannel(const QString &channelName, Communi::IrcConnection TwitchChannel::~TwitchChannel() { - this->connectedConnection.disconnect(); - this->liveStatusTimer->stop(); this->liveStatusTimer->deleteLater(); @@ -103,7 +101,7 @@ bool TwitchChannel::canSendMessage() const void TwitchChannel::setRoomID(const QString &_roomID) { this->roomID = _roomID; - this->roomIDchanged(); + this->roomIDchanged.invoke(); this->fetchMessages.invoke(); } @@ -155,7 +153,7 @@ void TwitchChannel::setMod(bool value) if (this->mod != value) { this->mod = value; - this->userStateChanged(); + this->userStateChanged.invoke(); } } @@ -194,7 +192,7 @@ void TwitchChannel::setLive(bool newLiveStatus) this->streamStatus.live = newLiveStatus; } - this->onlineStatusChanged(); + this->onlineStatusChanged.invoke(); } void TwitchChannel::refreshLiveStatus() diff --git a/src/providers/twitch/twitchchannel.hpp b/src/providers/twitch/twitchchannel.hpp index 949c5a552..718b7b3cb 100644 --- a/src/providers/twitch/twitchchannel.hpp +++ b/src/providers/twitch/twitchchannel.hpp @@ -53,11 +53,11 @@ public: const QString popoutPlayerURL; void setRoomID(const QString &_roomID); - boost::signals2::signal roomIDchanged; - boost::signals2::signal onlineStatusChanged; + pajlada::Signals::NoArgSignal roomIDchanged; + pajlada::Signals::NoArgSignal onlineStatusChanged; pajlada::Signals::NoArgBoltSignal fetchMessages; - boost::signals2::signal userStateChanged; + pajlada::Signals::NoArgSignal userStateChanged; QString roomID; @@ -89,8 +89,6 @@ private: void fetchRecentMessages(); - boost::signals2::connection connectedConnection; - bool mod; QByteArray messageSuffix; QString lastSentMessage; diff --git a/src/providers/twitch/twitchhelpers.cpp b/src/providers/twitch/twitchhelpers.cpp index 830da86d6..4f6f663ac 100644 --- a/src/providers/twitch/twitchhelpers.cpp +++ b/src/providers/twitch/twitchhelpers.cpp @@ -8,7 +8,7 @@ namespace twitch { bool TrimChannelName(const QString &channelName, QString &outChannelName) { if (channelName.length() < 3) { - debug::Log("channel name length below 2"); + debug::Log("channel name length below 3"); return false; } diff --git a/src/singletons/emotemanager.cpp b/src/singletons/emotemanager.cpp index 8a24d81e8..c7a7a932c 100644 --- a/src/singletons/emotemanager.cpp +++ b/src/singletons/emotemanager.cpp @@ -552,7 +552,7 @@ util::EmoteData EmoteManager::getCheerImage(long long amount, bool animated) return util::EmoteData(); } -boost::signals2::signal &EmoteManager::getGifUpdateSignal() +pajlada::Signals::NoArgSignal &EmoteManager::getGifUpdateSignal() { if (!this->gifUpdateTimerInitiated) { this->gifUpdateTimerInitiated = true; @@ -571,7 +571,7 @@ boost::signals2::signal &EmoteManager::getGifUpdateSignal() }); QObject::connect(&this->gifUpdateTimer, &QTimer::timeout, [this] { - this->gifUpdateTimerSignal(); + this->gifUpdateTimerSignal.invoke(); // fourtf: auto &windowManager = singletons::WindowManager::getInstance(); windowManager.repaintGifEmotes(); diff --git a/src/singletons/emotemanager.hpp b/src/singletons/emotemanager.hpp index c9005aaa9..97376f1aa 100644 --- a/src/singletons/emotemanager.hpp +++ b/src/singletons/emotemanager.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include namespace chatterino { namespace singletons { @@ -56,7 +56,7 @@ public: _generation++; } - boost::signals2::signal &getGifUpdateSignal(); + pajlada::Signals::NoArgSignal &getGifUpdateSignal(); // Bit badge/emotes? util::ConcurrentMap miscImageCache; @@ -140,7 +140,7 @@ private: /// Chatterino emotes util::EmoteMap _chatterinoEmotes; - boost::signals2::signal gifUpdateTimerSignal; + pajlada::Signals::NoArgSignal gifUpdateTimerSignal; QTimer gifUpdateTimer; bool gifUpdateTimerInitiated = false; diff --git a/src/singletons/fontmanager.cpp b/src/singletons/fontmanager.cpp index a0c0d8289..452149176 100644 --- a/src/singletons/fontmanager.cpp +++ b/src/singletons/fontmanager.cpp @@ -105,5 +105,6 @@ FontManager::Font &FontManager::getCurrentFont(float scale) return this->currentFontByScale.back().second; } + } // namespace singletons } // namespace chatterino diff --git a/src/singletons/fontmanager.hpp b/src/singletons/fontmanager.hpp index 0f29116f8..454bafbb4 100644 --- a/src/singletons/fontmanager.hpp +++ b/src/singletons/fontmanager.hpp @@ -137,7 +137,9 @@ private: int generation = 0; }; + } // namespace singletons -typedef singletons::FontManager::Type FontStyle; +using FontStyle = singletons::FontManager::Type; + } // namespace chatterino diff --git a/src/singletons/helper/chatterinosetting.hpp b/src/singletons/helper/chatterinosetting.hpp index 54f864339..ffa8f987d 100644 --- a/src/singletons/helper/chatterinosetting.hpp +++ b/src/singletons/helper/chatterinosetting.hpp @@ -2,6 +2,7 @@ namespace chatterino { namespace singletons { + static void _registerSetting(std::weak_ptr setting); template @@ -71,5 +72,6 @@ public: return this->getValue(); } }; -} -} + +} // namespace singletons +} // namespace chatterino diff --git a/src/singletons/helper/moderationaction.cpp b/src/singletons/helper/moderationaction.cpp index 47433fe03..c8b322a1d 100644 --- a/src/singletons/helper/moderationaction.cpp +++ b/src/singletons/helper/moderationaction.cpp @@ -46,5 +46,6 @@ const QString &ModerationAction::getAction() const { return this->action; } + } // namespace singletons } // namespace chatterino diff --git a/src/singletons/helper/moderationaction.hpp b/src/singletons/helper/moderationaction.hpp index 1170df80b..0f081c9f4 100644 --- a/src/singletons/helper/moderationaction.hpp +++ b/src/singletons/helper/moderationaction.hpp @@ -3,9 +3,11 @@ #include namespace chatterino { + namespace messages { class Image; -} +} // namespace messages + namespace singletons { class ModerationAction @@ -27,5 +29,6 @@ private: QString line2; QString action; }; + } // namespace singletons } // namespace chatterino diff --git a/src/singletons/thememanager.cpp b/src/singletons/thememanager.cpp index a088a0b89..6f522b881 100644 --- a/src/singletons/thememanager.cpp +++ b/src/singletons/thememanager.cpp @@ -4,7 +4,7 @@ #include -#include +#include namespace chatterino { namespace singletons { @@ -156,7 +156,7 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier) // Selection this->messages.selection = isLightTheme() ? QColor(0, 0, 0, 64) : QColor(255, 255, 255, 64); - this->updated(); + this->updated.invoke(); } QColor ThemeManager::blendColors(const QColor &color1, const QColor &color2, qreal ratio) diff --git a/src/singletons/thememanager.hpp b/src/singletons/thememanager.hpp index 26ccfdeaa..e0b67e0c9 100644 --- a/src/singletons/thememanager.hpp +++ b/src/singletons/thememanager.hpp @@ -1,10 +1,10 @@ #pragma once +#include "util/serialize-custom.hpp" + #include #include -#include #include -#include "util/serialize-custom.hpp" namespace chatterino { namespace singletons { @@ -105,7 +105,7 @@ public: void update(); - boost::signals2::signal updated; + pajlada::Signals::NoArgSignal updated; pajlada::Settings::Setting themeName; pajlada::Settings::Setting themeHue; diff --git a/src/singletons/windowmanager.cpp b/src/singletons/windowmanager.cpp index 578879f07..bc601bec3 100644 --- a/src/singletons/windowmanager.cpp +++ b/src/singletons/windowmanager.cpp @@ -58,7 +58,7 @@ void WindowManager::initMainWindow() void WindowManager::layoutVisibleChatWidgets(Channel *channel) { - this->layout(channel); + this->layout.invoke(channel); } void WindowManager::repaintVisibleChatWidgets(Channel *channel) @@ -70,7 +70,7 @@ void WindowManager::repaintVisibleChatWidgets(Channel *channel) void WindowManager::repaintGifEmotes() { - this->repaintGifs(); + this->repaintGifs.invoke(); } // void WindowManager::updateAll() diff --git a/src/singletons/windowmanager.hpp b/src/singletons/windowmanager.hpp index 8ff0a4604..c95984d22 100644 --- a/src/singletons/windowmanager.hpp +++ b/src/singletons/windowmanager.hpp @@ -32,8 +32,8 @@ public: void save(); - boost::signals2::signal repaintGifs; - boost::signals2::signal layout; + pajlada::Signals::NoArgSignal repaintGifs; + pajlada::Signals::Signal layout; private: ThemeManager &themeManager; diff --git a/src/util/layoutcreator.hpp b/src/util/layoutcreator.hpp index f28e569ed..48f5c4354 100644 --- a/src/util/layoutcreator.hpp +++ b/src/util/layoutcreator.hpp @@ -126,5 +126,6 @@ private: return this->item->layout(); } }; + } // namespace util } // namespace chatterino diff --git a/src/util/nativeeventhelper.hpp b/src/util/nativeeventhelper.hpp index 2995b1ff0..982e6bf1e 100644 --- a/src/util/nativeeventhelper.hpp +++ b/src/util/nativeeventhelper.hpp @@ -9,6 +9,7 @@ namespace chatterino { namespace util { + static boost::optional getWindowDpi(quintptr ptr) { typedef UINT(WINAPI * GetDpiForWindow)(HWND); diff --git a/src/util/networkrequest.hpp b/src/util/networkrequest.hpp index 8a3466ecf..9973906db 100644 --- a/src/util/networkrequest.hpp +++ b/src/util/networkrequest.hpp @@ -5,6 +5,8 @@ #include "util/networkrequester.hpp" #include "util/networkworker.hpp" +#include +#include #include #include @@ -152,7 +154,7 @@ public: if (this->data.caller != nullptr) { QObject::connect(worker, &NetworkWorker::doneUrl, this->data.caller, - [ onFinished, data = this->data ](auto reply) mutable { + [onFinished, data = this->data](auto reply) mutable { if (reply->error() != QNetworkReply::NetworkError::NoError) { // TODO: We might want to call an onError callback here return; @@ -172,7 +174,7 @@ public: QObject::connect( &requester, &NetworkRequester::requestUrl, worker, - [ timer, data = std::move(this->data), worker, onFinished{std::move(onFinished)} ]() { + [timer, data = std::move(this->data), worker, onFinished{std::move(onFinished)}]() { QNetworkReply *reply = NetworkManager::NaM.get(data.request); if (timer != nullptr) { @@ -187,21 +189,21 @@ public: data.onReplyCreated(reply); } - QObject::connect(reply, &QNetworkReply::finished, worker, [ - data = std::move(data), worker, reply, onFinished = std::move(onFinished) - ]() mutable { - if (data.caller == nullptr) { - QByteArray bytes = reply->readAll(); - data.writeToCache(bytes); - onFinished(bytes); + QObject::connect(reply, &QNetworkReply::finished, worker, + [data = std::move(data), worker, reply, + onFinished = std::move(onFinished)]() mutable { + if (data.caller == nullptr) { + QByteArray bytes = reply->readAll(); + data.writeToCache(bytes); + onFinished(bytes); - reply->deleteLater(); - } else { - emit worker->doneUrl(reply); - } + reply->deleteLater(); + } else { + emit worker->doneUrl(reply); + } - delete worker; - }); + delete worker; + }); }); emit requester.requestUrl(); diff --git a/src/util/networkworker.hpp b/src/util/networkworker.hpp index 7da13fe19..21efeeadb 100644 --- a/src/util/networkworker.hpp +++ b/src/util/networkworker.hpp @@ -2,6 +2,8 @@ #include +class QNetworkReply; + namespace chatterino { namespace util { diff --git a/src/util/posttothread.hpp b/src/util/posttothread.hpp index 9868a3d35..12bdb9a37 100644 --- a/src/util/posttothread.hpp +++ b/src/util/posttothread.hpp @@ -11,6 +11,7 @@ namespace chatterino { namespace util { + class LambdaRunnable : public QRunnable { public: @@ -47,12 +48,13 @@ static void postToThread(F &&fun, QObject *obj = qApp) , fun(fun) { } - ~Event() + ~Event() override { fun(); } }; QCoreApplication::postEvent(obj, new Event(std::forward(fun))); } + } // namespace util } // namespace chatterino diff --git a/src/util/property.hpp b/src/util/property.hpp index aee1a0372..23e6563d1 100644 --- a/src/util/property.hpp +++ b/src/util/property.hpp @@ -4,6 +4,7 @@ namespace chatterino { namespace util { + template class Property final : boost::noncopyable { @@ -30,5 +31,6 @@ public: protected: T value; }; -} -} + +} // namespace util +} // namespace chatterino diff --git a/src/util/streamlink.hpp b/src/util/streamlink.hpp index 396c09afe..b38da260e 100644 --- a/src/util/streamlink.hpp +++ b/src/util/streamlink.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include diff --git a/src/util/urlfetch.hpp b/src/util/urlfetch.hpp index cd83e7c2d..5b730c08c 100644 --- a/src/util/urlfetch.hpp +++ b/src/util/urlfetch.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/src/widgets/accountpopup.hpp b/src/widgets/accountpopup.hpp index 14d819658..f8fed98b2 100644 --- a/src/widgets/accountpopup.hpp +++ b/src/widgets/accountpopup.hpp @@ -11,7 +11,7 @@ namespace Ui { class AccountPopup; -} +} // namespace Ui namespace chatterino { @@ -35,7 +35,7 @@ signals: void refreshButtons(); protected: - virtual void scaleChangedEvent(float newDpi) override; + void scaleChangedEvent(float newDpi) override; private: Ui::AccountPopup *ui; @@ -76,8 +76,8 @@ private: } relationship; protected: - virtual void focusOutEvent(QFocusEvent *event) override; - virtual void showEvent(QShowEvent *event) override; + void focusOutEvent(QFocusEvent *event) override; + void showEvent(QShowEvent *event) override; }; } // namespace widgets diff --git a/src/widgets/accountswitchpopupwidget.cpp b/src/widgets/accountswitchpopupwidget.cpp index 0b69066c0..922834d2e 100644 --- a/src/widgets/accountswitchpopupwidget.cpp +++ b/src/widgets/accountswitchpopupwidget.cpp @@ -54,5 +54,6 @@ void AccountSwitchPopupWidget::paintEvent(QPaintEvent *event) painter.fillRect(this->rect(), QColor(255, 255, 255)); } + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/accountswitchpopupwidget.hpp b/src/widgets/accountswitchpopupwidget.hpp index f2a45a988..27c22ecc9 100644 --- a/src/widgets/accountswitchpopupwidget.hpp +++ b/src/widgets/accountswitchpopupwidget.hpp @@ -17,8 +17,8 @@ public: void refresh(); protected: - virtual void focusOutEvent(QFocusEvent *event) override final; - virtual void paintEvent(QPaintEvent *event) override; + void focusOutEvent(QFocusEvent *event) final; + void paintEvent(QPaintEvent *event) override; private: struct { diff --git a/src/widgets/basewidget.cpp b/src/widgets/basewidget.cpp index 6680134e6..0d01964b3 100644 --- a/src/widgets/basewidget.cpp +++ b/src/widgets/basewidget.cpp @@ -1,4 +1,5 @@ #include "widgets/basewidget.hpp" +#include "debug/log.hpp" #include "singletons/settingsmanager.hpp" #include "singletons/thememanager.hpp" @@ -7,7 +8,6 @@ #include #include #include -#include namespace chatterino { namespace widgets { @@ -82,13 +82,13 @@ void BaseWidget::setScaleIndependantHeight(int value) void BaseWidget::init() { - auto connection = this->themeManager.updated.connect([this]() { + pajlada::Signals::Connection connection = this->themeManager.updated.connect([this]() { this->themeRefreshEvent(); this->update(); }); - QObject::connect(this, &QObject::destroyed, [connection] { + QObject::connect(this, &QObject::destroyed, [connection]() mutable { connection.disconnect(); // }); } diff --git a/src/widgets/basewidget.hpp b/src/widgets/basewidget.hpp index 376d1f210..2e2a9c0bb 100644 --- a/src/widgets/basewidget.hpp +++ b/src/widgets/basewidget.hpp @@ -6,9 +6,10 @@ namespace chatterino { namespace singletons { class ThemeManager; -} +} // namespace singletons namespace widgets { + class BaseWindow; class BaseWidget : public QWidget @@ -34,7 +35,7 @@ public: void setScaleIndependantHeight(int value); protected: - virtual void childEvent(QChildEvent *) override; + void childEvent(QChildEvent *) override; virtual void scaleChangedEvent(float newScale); virtual void themeRefreshEvent(); diff --git a/src/widgets/basewindow.cpp b/src/widgets/basewindow.cpp index bb7eda861..cb92ddc12 100644 --- a/src/widgets/basewindow.cpp +++ b/src/widgets/basewindow.cpp @@ -1,5 +1,6 @@ #include "basewindow.hpp" +#include "debug/log.hpp" #include "singletons/settingsmanager.hpp" #include "util/nativeeventhelper.hpp" #include "widgets/helper/rippleeffectlabel.hpp" @@ -11,10 +12,10 @@ #include #ifdef USEWINSDK +#include +#include #include #include -#include -#include #include #pragma comment(lib, "Dwmapi.lib") diff --git a/src/widgets/basewindow.hpp b/src/widgets/basewindow.hpp index 3f4c3c0f1..2c382eb41 100644 --- a/src/widgets/basewindow.hpp +++ b/src/widgets/basewindow.hpp @@ -9,12 +9,15 @@ class QHBoxLayout; namespace chatterino { namespace widgets { + class RippleEffectButton; class RippleEffectLabel; class TitleBarButton; class BaseWindow : public BaseWidget { + Q_OBJECT + public: explicit BaseWindow(singletons::ThemeManager &_themeManager, QWidget *parent, bool enableCustomFrame = false); @@ -60,5 +63,6 @@ private: QWidget *layoutBase; std::vector buttons; }; + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/helper/channelview.cpp b/src/widgets/helper/channelview.cpp index 663b7882b..2d12bf4d4 100644 --- a/src/widgets/helper/channelview.cpp +++ b/src/widgets/helper/channelview.cpp @@ -20,9 +20,9 @@ #include #include -#include #include #include +#include #include #include @@ -461,7 +461,7 @@ void ChannelView::setSelection(const SelectionItem &start, const SelectionItem & // selections this->selection = Selection(start, end); - this->selectionChanged(); + this->selectionChanged.invoke(); } messages::MessageElement::Flags ChannelView::getFlags() const @@ -729,7 +729,7 @@ void ChannelView::mousePressEvent(QMouseEvent *event) QPoint relativePos; int messageIndex; - this->mouseDown(event); + this->mouseDown.invoke(event); if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex)) { setCursor(Qt::ArrowCursor); diff --git a/src/widgets/helper/channelview.hpp b/src/widgets/helper/channelview.hpp index 8c794263d..bc62fb875 100644 --- a/src/widgets/helper/channelview.hpp +++ b/src/widgets/helper/channelview.hpp @@ -16,8 +16,8 @@ #include #include #include -#include #include + #include namespace chatterino { @@ -28,7 +28,7 @@ class ChannelView : public BaseWidget Q_OBJECT public: - explicit ChannelView(BaseWidget *parent = 0); + explicit ChannelView(BaseWidget *parent = nullptr); virtual ~ChannelView(); void queueUpdate(); @@ -49,26 +49,26 @@ public: void clearMessages(); - boost::signals2::signal mouseDown; - boost::signals2::signal selectionChanged; + pajlada::Signals::Signal mouseDown; + pajlada::Signals::NoArgSignal selectionChanged; pajlada::Signals::NoArgSignal highlightedMessageReceived; pajlada::Signals::Signal linkClicked; protected: - virtual void themeRefreshEvent() override; + void themeRefreshEvent() override; - virtual void resizeEvent(QResizeEvent *) override; + void resizeEvent(QResizeEvent *) override; - virtual void paintEvent(QPaintEvent *) override; - virtual void wheelEvent(QWheelEvent *event) override; + void paintEvent(QPaintEvent *) override; + void wheelEvent(QWheelEvent *event) override; - virtual void enterEvent(QEvent *) override; - virtual void leaveEvent(QEvent *) override; + void enterEvent(QEvent *) override; + void leaveEvent(QEvent *) override; - virtual void mouseMoveEvent(QMouseEvent *event) override; - virtual void mousePressEvent(QMouseEvent *event) override; - virtual void mouseReleaseEvent(QMouseEvent *event) override; - virtual void mouseDoubleClickEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void mouseDoubleClickEvent(QMouseEvent *event) override; void handleLinkClick(QMouseEvent *event, const messages::Link &link, messages::MessageLayout *layout); @@ -116,12 +116,12 @@ private: messages::LimitedQueue messages; - boost::signals2::connection messageAppendedConnection; - boost::signals2::connection messageAddedAtStartConnection; - boost::signals2::connection messageRemovedConnection; - boost::signals2::connection messageReplacedConnection; - boost::signals2::connection repaintGifsConnection; - boost::signals2::connection layoutConnection; + pajlada::Signals::Connection messageAppendedConnection; + pajlada::Signals::Connection messageAddedAtStartConnection; + pajlada::Signals::Connection messageRemovedConnection; + pajlada::Signals::Connection messageReplacedConnection; + pajlada::Signals::Connection repaintGifsConnection; + pajlada::Signals::Connection layoutConnection; std::vector managedConnections; diff --git a/src/widgets/helper/droppreview.hpp b/src/widgets/helper/droppreview.hpp index ae5a51be2..990ece25a 100644 --- a/src/widgets/helper/droppreview.hpp +++ b/src/widgets/helper/droppreview.hpp @@ -16,8 +16,8 @@ public: void setBounds(const QRect &rect); protected: - virtual void paintEvent(QPaintEvent *) override; - virtual void hideEvent(QHideEvent *) override; + void paintEvent(QPaintEvent *) override; + void hideEvent(QHideEvent *) override; QPropertyAnimation positionAnimation; QRect desiredGeometry; diff --git a/src/widgets/helper/label.cpp b/src/widgets/helper/label.cpp index a8332d9e4..26bc71607 100644 --- a/src/widgets/helper/label.cpp +++ b/src/widgets/helper/label.cpp @@ -5,6 +5,7 @@ namespace chatterino { namespace widgets { + Label::Label(BaseWidget *parent) : BaseWidget(parent) { @@ -74,5 +75,6 @@ void Label::paintEvent(QPaintEvent *) painter.drawText(this->rect(), flags, this->text); } + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/helper/label.hpp b/src/widgets/helper/label.hpp index ea3b3b604..5afa0e003 100644 --- a/src/widgets/helper/label.hpp +++ b/src/widgets/helper/label.hpp @@ -29,5 +29,6 @@ private: QString text; FontStyle fontStyle = FontStyle::Medium; }; + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/helper/notebookbutton.cpp b/src/widgets/helper/notebookbutton.cpp index 6570c3041..be07b2f85 100644 --- a/src/widgets/helper/notebookbutton.cpp +++ b/src/widgets/helper/notebookbutton.cpp @@ -144,5 +144,6 @@ void NotebookButton::dropEvent(QDropEvent *event) } } } + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/helper/notebooktab.cpp b/src/widgets/helper/notebooktab.cpp index ad2f481db..21961c0af 100644 --- a/src/widgets/helper/notebooktab.cpp +++ b/src/widgets/helper/notebooktab.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace chatterino { namespace widgets { diff --git a/src/widgets/helper/notebooktab.hpp b/src/widgets/helper/notebooktab.hpp index 8cdb96567..c474e7059 100644 --- a/src/widgets/helper/notebooktab.hpp +++ b/src/widgets/helper/notebooktab.hpp @@ -9,7 +9,6 @@ #include namespace chatterino { - namespace widgets { class Notebook; diff --git a/src/widgets/helper/resizingtextedit.cpp b/src/widgets/helper/resizingtextedit.cpp index 46038718e..609dafc5e 100644 --- a/src/widgets/helper/resizingtextedit.cpp +++ b/src/widgets/helper/resizingtextedit.cpp @@ -73,7 +73,7 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event) { event->ignore(); - this->keyPressed(event); + this->keyPressed.invoke(event); if (event->key() == Qt::Key_Backtab) { // Ignore for now. We want to use it for autocomplete later diff --git a/src/widgets/helper/resizingtextedit.hpp b/src/widgets/helper/resizingtextedit.hpp index 727e44bda..d68ea0ebd 100644 --- a/src/widgets/helper/resizingtextedit.hpp +++ b/src/widgets/helper/resizingtextedit.hpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include class ResizingTextEdit : public QTextEdit { @@ -14,14 +14,14 @@ public: bool hasHeightForWidth() const override; - boost::signals2::signal keyPressed; + pajlada::Signals::Signal keyPressed; void setCompleter(QCompleter *c); QCompleter *getCompleter() const; protected: - virtual int heightForWidth(int) const override; - virtual void keyPressEvent(QKeyEvent *event) override; + int heightForWidth(int) const override; + void keyPressEvent(QKeyEvent *event) override; private: QCompleter *completer = nullptr; diff --git a/src/widgets/helper/scrollbarhighlight.hpp b/src/widgets/helper/scrollbarhighlight.hpp index a387617f1..7dbccee15 100644 --- a/src/widgets/helper/scrollbarhighlight.hpp +++ b/src/widgets/helper/scrollbarhighlight.hpp @@ -1,9 +1,10 @@ #pragma once -#include "QString" +#include namespace chatterino { namespace widgets { + class ScrollbarHighlight { public: diff --git a/src/widgets/helper/searchpopup.hpp b/src/widgets/helper/searchpopup.hpp index 28e06f01f..909626ff5 100644 --- a/src/widgets/helper/searchpopup.hpp +++ b/src/widgets/helper/searchpopup.hpp @@ -1,15 +1,19 @@ #pragma once -#include - #include "messages/limitedqueuesnapshot.hpp" #include "messages/message.hpp" #include "widgets/basewindow.hpp" +#include + class QLineEdit; + namespace chatterino { + class Channel; + namespace widgets { + class ChannelView; class SearchPopup : public BaseWindow @@ -27,5 +31,6 @@ private: void initLayout(); void performSearch(); }; + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/helper/settingsdialogtab.hpp b/src/widgets/helper/settingsdialogtab.hpp index 8242e820f..45aa27bec 100644 --- a/src/widgets/helper/settingsdialogtab.hpp +++ b/src/widgets/helper/settingsdialogtab.hpp @@ -1,16 +1,16 @@ #pragma once +#include "widgets/basewidget.hpp" + #include #include #include -#include "widgets/basewidget.hpp" - namespace chatterino { namespace widgets { namespace settingspages { class SettingsPage; -} +} // namespace settingspages class SettingsDialog; diff --git a/src/widgets/helper/splitcolumn.cpp b/src/widgets/helper/splitcolumn.cpp index b6f346fbf..b3e7e3c7f 100644 --- a/src/widgets/helper/splitcolumn.cpp +++ b/src/widgets/helper/splitcolumn.cpp @@ -2,8 +2,6 @@ namespace chatterino { namespace helper { -SplitColumn::SplitColumn() -{ -} -} -} + +} // namespace helper +} // namespace chatterino diff --git a/src/widgets/helper/splitcolumn.hpp b/src/widgets/helper/splitcolumn.hpp index 98418d8c9..de63fffef 100644 --- a/src/widgets/helper/splitcolumn.hpp +++ b/src/widgets/helper/splitcolumn.hpp @@ -1,15 +1,16 @@ #pragma once -#include - #include "widgets/split.hpp" +#include + namespace chatterino { namespace helper { + class SplitColumn { public: - SplitColumn(); + SplitColumn() = default; void insert(widgets::Split *split, int index = -1); void remove(int index); @@ -19,5 +20,6 @@ public: private: std::vector items; }; -} -} + +} // namespace helper +} // namespace chatterino diff --git a/src/widgets/helper/splitheader.cpp b/src/widgets/helper/splitheader.cpp index 2942f137b..3228e2f05 100644 --- a/src/widgets/helper/splitheader.cpp +++ b/src/widgets/helper/splitheader.cpp @@ -57,7 +57,8 @@ SplitHeader::SplitHeader(Split *_split) title->setMouseTracking(true); QObject::connect(this->titleLabel, &SignalLabel::mouseDoubleClick, this, &SplitHeader::mouseDoubleClickEvent); - QObject::connect(this->titleLabel, &SignalLabel::mouseMove, this, &SplitHeader::mouseMoveEvent); + QObject::connect(this->titleLabel, &SignalLabel::mouseMove, this, + &SplitHeader::mouseMoveEvent); layout->addStretch(1); diff --git a/src/widgets/helper/splitheader.hpp b/src/widgets/helper/splitheader.hpp index 329f65ac5..80d81ab56 100644 --- a/src/widgets/helper/splitheader.hpp +++ b/src/widgets/helper/splitheader.hpp @@ -13,11 +13,9 @@ #include #include #include -#include #include namespace chatterino { - namespace widgets { class Split; @@ -50,7 +48,7 @@ private: QPoint dragStart; bool dragging = false; - boost::signals2::connection onlineStatusChangedConnection; + pajlada::Signals::Connection onlineStatusChangedConnection; RippleEffectButton *dropdownButton; // Label *titleLabel; diff --git a/src/widgets/scrollbar.cpp b/src/widgets/scrollbar.cpp index 720c2e88e..2525ddf89 100644 --- a/src/widgets/scrollbar.cpp +++ b/src/widgets/scrollbar.cpp @@ -162,7 +162,7 @@ void Scrollbar::offset(qreal value) } } -boost::signals2::signal &Scrollbar::getCurrentValueChanged() +pajlada::Signals::NoArgSignal &Scrollbar::getCurrentValueChanged() { return this->currentValueChanged; } @@ -176,7 +176,7 @@ void Scrollbar::setCurrentValue(qreal value) this->currentValue = value; this->updateScroll(); - this->currentValueChanged(); + this->currentValueChanged.invoke(); this->update(); } diff --git a/src/widgets/scrollbar.hpp b/src/widgets/scrollbar.hpp index 478b40a39..9ce646592 100644 --- a/src/widgets/scrollbar.hpp +++ b/src/widgets/scrollbar.hpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include namespace chatterino { @@ -43,7 +43,7 @@ public: qreal getCurrentValue() const; // offset the desired value without breaking smooth scolling void offset(qreal value); - boost::signals2::signal &getCurrentValueChanged(); + pajlada::Signals::NoArgSignal &getCurrentValueChanged(); void setCurrentValue(qreal value); void printCurrentState(const QString &prefix = QString()) const; @@ -86,7 +86,7 @@ private: qreal currentValue = 0; qreal smoothScrollingOffset = 0; - boost::signals2::signal currentValueChanged; + pajlada::Signals::NoArgSignal currentValueChanged; pajlada::Settings::Setting &smoothScrollingSetting; diff --git a/src/widgets/settingsdialog.hpp b/src/widgets/settingsdialog.hpp index 2feecfc99..362809cf0 100644 --- a/src/widgets/settingsdialog.hpp +++ b/src/widgets/settingsdialog.hpp @@ -13,7 +13,7 @@ namespace widgets { namespace settingspages { class SettingsPage; -} +} // namespace settingspages class SettingsDialogTab; @@ -32,7 +32,7 @@ public: static void showDialog(PreferredTab preferredTab = PreferredTab::NoPreference); protected: - virtual void scaleChangedEvent(float newDpi) override; + void scaleChangedEvent(float newDpi) override; private: void refresh(); diff --git a/src/widgets/settingspages/aboutpage.cpp b/src/widgets/settingspages/aboutpage.cpp index cba3ae551..a9398dd74 100644 --- a/src/widgets/settingspages/aboutpage.cpp +++ b/src/widgets/settingspages/aboutpage.cpp @@ -53,6 +53,7 @@ AboutPage::AboutPage() } layout->addStretch(1); } + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/aboutpage.hpp b/src/widgets/settingspages/aboutpage.hpp index 3f27f552a..f482244ba 100644 --- a/src/widgets/settingspages/aboutpage.hpp +++ b/src/widgets/settingspages/aboutpage.hpp @@ -16,6 +16,7 @@ public: private: QLabel *logo; }; + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/accountspage.cpp b/src/widgets/settingspages/accountspage.cpp index 0ad7cdc6a..e3ef8da4a 100644 --- a/src/widgets/settingspages/accountspage.cpp +++ b/src/widgets/settingspages/accountspage.cpp @@ -11,6 +11,7 @@ namespace chatterino { namespace widgets { namespace settingspages { + AccountsPage::AccountsPage() : SettingsPage("Accounts", ":/images/accounts.svg") { @@ -41,6 +42,7 @@ AccountsPage::AccountsPage() singletons::AccountManager::getInstance().Twitch.removeUser(selectedUser); }); } + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/accountspage.hpp b/src/widgets/settingspages/accountspage.hpp index fb5534958..0e5c1c5ba 100644 --- a/src/widgets/settingspages/accountspage.hpp +++ b/src/widgets/settingspages/accountspage.hpp @@ -1,10 +1,10 @@ #pragma once -#include - #include "widgets/accountswitchwidget.hpp" #include "widgets/settingspages/settingspage.hpp" +#include + namespace chatterino { namespace widgets { namespace settingspages { @@ -19,6 +19,7 @@ private: QPushButton *removeButton; AccountSwitchWidget *accSwitchWidget; }; + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/appearancepage.cpp b/src/widgets/settingspages/appearancepage.cpp index d591164ae..997167ddb 100644 --- a/src/widgets/settingspages/appearancepage.cpp +++ b/src/widgets/settingspages/appearancepage.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "util/layoutcreator.hpp" @@ -65,7 +66,8 @@ AppearancePage::AppearancePage() } messages.append(this->createCheckBox("Show badges", settings.showBadges)); messages.append(this->createCheckBox("Seperate messages", settings.seperateMessages)); - messages.append(this->createCheckBox("Show message length while typing", settings.showMessageLength)); + messages.append( + this->createCheckBox("Show message length while typing", settings.showMessageLength)); } layout->addStretch(1); @@ -148,6 +150,7 @@ QLayout *AppearancePage::createFontChanger() return layout; } + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/appearancepage.hpp b/src/widgets/settingspages/appearancepage.hpp index 40a5f5cbe..b1ac61b27 100644 --- a/src/widgets/settingspages/appearancepage.hpp +++ b/src/widgets/settingspages/appearancepage.hpp @@ -2,8 +2,6 @@ #include "widgets/settingspages/settingspage.hpp" -#include - namespace chatterino { namespace widgets { namespace settingspages { diff --git a/src/widgets/settingspages/behaviourpage.cpp b/src/widgets/settingspages/behaviourpage.cpp index c596d2104..3c89b2a0f 100644 --- a/src/widgets/settingspages/behaviourpage.cpp +++ b/src/widgets/settingspages/behaviourpage.cpp @@ -19,6 +19,7 @@ namespace chatterino { namespace widgets { namespace settingspages { + BehaviourPage::BehaviourPage() : SettingsPage("Behaviour", ":/images/behave.svg") { @@ -80,6 +81,7 @@ QSlider *BehaviourPage::createMouseScrollSlider() return slider; } + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/emotespage.hpp b/src/widgets/settingspages/emotespage.hpp index c09ff45f7..75cfec6af 100644 --- a/src/widgets/settingspages/emotespage.hpp +++ b/src/widgets/settingspages/emotespage.hpp @@ -11,6 +11,7 @@ class EmotesPage : public SettingsPage public: EmotesPage(); }; + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/highlightingpage.cpp b/src/widgets/settingspages/highlightingpage.cpp index 796f7da8b..bbcd1d349 100644 --- a/src/widgets/settingspages/highlightingpage.cpp +++ b/src/widgets/settingspages/highlightingpage.cpp @@ -19,6 +19,7 @@ namespace chatterino { namespace widgets { namespace settingspages { + HighlightingPage::HighlightingPage() : SettingsPage("Highlights", ":/images/notifications.svg") { @@ -239,6 +240,7 @@ void HighlightingPage::addHighlightTabSignals() delete selectedHighlight; }); } + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/highlightingpage.hpp b/src/widgets/settingspages/highlightingpage.hpp index 12cd20ec5..6bf447ece 100644 --- a/src/widgets/settingspages/highlightingpage.hpp +++ b/src/widgets/settingspages/highlightingpage.hpp @@ -1,9 +1,9 @@ #pragma once -#include - #include "widgets/settingspages/settingspage.hpp" +#include + class QPushButton; class QListWidget; diff --git a/src/widgets/settingspages/ignoremessagespage.cpp b/src/widgets/settingspages/ignoremessagespage.cpp index 19f8b5518..c4bba2c73 100644 --- a/src/widgets/settingspages/ignoremessagespage.cpp +++ b/src/widgets/settingspages/ignoremessagespage.cpp @@ -8,6 +8,7 @@ namespace chatterino { namespace widgets { namespace settingspages { + IgnoreMessagesPage::IgnoreMessagesPage() : SettingsPage("Ignore Messages", "") { @@ -32,6 +33,7 @@ IgnoreMessagesPage::IgnoreMessagesPage() // ---- misc this->keywordsUpdated.setSingleShot(true); } + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/ignoremessagespage.hpp b/src/widgets/settingspages/ignoremessagespage.hpp index f6cb3f772..571b91528 100644 --- a/src/widgets/settingspages/ignoremessagespage.hpp +++ b/src/widgets/settingspages/ignoremessagespage.hpp @@ -1,8 +1,9 @@ #pragma once -#include #include "widgets/settingspages/settingspage.hpp" +#include + namespace chatterino { namespace widgets { namespace settingspages { @@ -14,6 +15,7 @@ public: QTimer keywordsUpdated; }; + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/ignoreuserspage.cpp b/src/widgets/settingspages/ignoreuserspage.cpp index bccef00ce..62cd72844 100644 --- a/src/widgets/settingspages/ignoreuserspage.cpp +++ b/src/widgets/settingspages/ignoreuserspage.cpp @@ -17,6 +17,7 @@ namespace chatterino { namespace widgets { namespace settingspages { + IgnoreUsersPage::IgnoreUsersPage() : SettingsPage("Ignore Users", "") { @@ -50,6 +51,7 @@ IgnoreUsersPage::IgnoreUsersPage() auto userList = group.emplace(); } } + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/ignoreuserspage.hpp b/src/widgets/settingspages/ignoreuserspage.hpp index ab231eeaf..747730897 100644 --- a/src/widgets/settingspages/ignoreuserspage.hpp +++ b/src/widgets/settingspages/ignoreuserspage.hpp @@ -5,11 +5,13 @@ namespace chatterino { namespace widgets { namespace settingspages { + class IgnoreUsersPage : public SettingsPage { public: IgnoreUsersPage(); }; + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/keyboardsettingspage.cpp b/src/widgets/settingspages/keyboardsettingspage.cpp index 57565fe8a..bc9b00813 100644 --- a/src/widgets/settingspages/keyboardsettingspage.cpp +++ b/src/widgets/settingspages/keyboardsettingspage.cpp @@ -3,10 +3,12 @@ namespace chatterino { namespace widgets { namespace settingspages { + KeyboardSettingsPage::KeyboardSettingsPage() : SettingsPage("Keybindings", "") { } + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/keyboardsettingspage.hpp b/src/widgets/settingspages/keyboardsettingspage.hpp index 3cf4a6149..7064e6e39 100644 --- a/src/widgets/settingspages/keyboardsettingspage.hpp +++ b/src/widgets/settingspages/keyboardsettingspage.hpp @@ -5,11 +5,13 @@ namespace chatterino { namespace widgets { namespace settingspages { + class KeyboardSettingsPage : public SettingsPage { public: KeyboardSettingsPage(); }; + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/logspage.hpp b/src/widgets/settingspages/logspage.hpp index f43c13af0..01af35373 100644 --- a/src/widgets/settingspages/logspage.hpp +++ b/src/widgets/settingspages/logspage.hpp @@ -11,6 +11,7 @@ class LogsPage : public SettingsPage public: LogsPage(); }; + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/specialchannelspage.cpp b/src/widgets/settingspages/specialchannelspage.cpp index f6df33737..0c5550a1e 100644 --- a/src/widgets/settingspages/specialchannelspage.cpp +++ b/src/widgets/settingspages/specialchannelspage.cpp @@ -10,6 +10,7 @@ namespace chatterino { namespace widgets { namespace settingspages { + SpecialChannelsPage::SpecialChannelsPage() : SettingsPage("Special channels", "") { @@ -30,6 +31,7 @@ SpecialChannelsPage::SpecialChannelsPage() layout->addStretch(1); } + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingspages/specialchannelspage.hpp b/src/widgets/settingspages/specialchannelspage.hpp index 5c9645592..fbf18f312 100644 --- a/src/widgets/settingspages/specialchannelspage.hpp +++ b/src/widgets/settingspages/specialchannelspage.hpp @@ -5,11 +5,13 @@ namespace chatterino { namespace widgets { namespace settingspages { + class SpecialChannelsPage : public SettingsPage { public: SpecialChannelsPage(); }; + } // namespace settingspages } // namespace widgets } // namespace chatterino diff --git a/src/widgets/split.cpp b/src/widgets/split.cpp index f738f0eae..7d6692005 100644 --- a/src/widgets/split.cpp +++ b/src/widgets/split.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -150,7 +149,7 @@ void Split::setChannel(ChannelPtr _newChannel) this->header.updateModerationModeIcon(); - this->channelChanged(); + this->channelChanged.invoke(); } void Split::setFlexSizeX(double x) diff --git a/src/widgets/split.hpp b/src/widgets/split.hpp index ce5f193eb..054513b2d 100644 --- a/src/widgets/split.hpp +++ b/src/widgets/split.hpp @@ -16,7 +16,6 @@ #include #include #include -#include namespace chatterino { namespace widgets { @@ -47,7 +46,7 @@ public: ~Split() override; pajlada::Settings::Setting channelName; - boost::signals2::signal channelChanged; + pajlada::Signals::NoArgSignal channelChanged; ChannelView &getChannelView() { @@ -93,8 +92,8 @@ private: bool moderationMode; - boost::signals2::connection channelIDChangedConnection; - boost::signals2::connection usermodeChangedConnection; + pajlada::Signals::Connection channelIDChangedConnection; + pajlada::Signals::Connection usermodeChangedConnection; void setChannel(ChannelPtr newChannel); void doOpenAccountPopupWidget(AccountPopupWidget *widget, QString user); diff --git a/src/widgets/streamview.cpp b/src/widgets/streamview.cpp index 7ad017d6d..a3e2a0016 100644 --- a/src/widgets/streamview.cpp +++ b/src/widgets/streamview.cpp @@ -11,6 +11,7 @@ namespace chatterino { namespace widgets { + StreamView::StreamView(ChannelPtr channel, QUrl url) { util::LayoutCreator layoutCreator(this); @@ -30,5 +31,6 @@ StreamView::StreamView(ChannelPtr channel, QUrl url) this->layout()->setSpacing(0); this->layout()->setMargin(0); } + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/streamview.hpp b/src/widgets/streamview.hpp index 7c80abec8..deb9f4d2f 100644 --- a/src/widgets/streamview.hpp +++ b/src/widgets/streamview.hpp @@ -2,14 +2,17 @@ #include #include + #include class QWebEngineView; namespace chatterino { + class Channel; namespace widgets { + class StreamView : public QWidget { public: @@ -18,5 +21,6 @@ public: private: QWebEngineView *stream; }; + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/textinputdialog.cpp b/src/widgets/textinputdialog.cpp index 87cafa787..deb97e7a6 100644 --- a/src/widgets/textinputdialog.cpp +++ b/src/widgets/textinputdialog.cpp @@ -7,8 +7,6 @@ namespace widgets { TextInputDialog::TextInputDialog(QWidget *parent) : QDialog(parent) , _vbox(this) - , _lineEdit() - , _buttonBox() , _okButton("OK") , _cancelButton("Cancel") { diff --git a/src/widgets/tooltipwidget.cpp b/src/widgets/tooltipwidget.cpp index 3d4ed9e66..22c3f0be0 100644 --- a/src/widgets/tooltipwidget.cpp +++ b/src/widgets/tooltipwidget.cpp @@ -65,5 +65,6 @@ void TooltipWidget::leaveEvent(QEvent *) { // clear parents event } + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/tooltipwidget.hpp b/src/widgets/tooltipwidget.hpp index 96f3af2ca..ff3a7bf0e 100644 --- a/src/widgets/tooltipwidget.hpp +++ b/src/widgets/tooltipwidget.hpp @@ -1,4 +1,5 @@ #pragma once + #include "widgets/basewindow.hpp" #include @@ -11,6 +12,7 @@ namespace widgets { class TooltipWidget : public BaseWindow { Q_OBJECT + public: TooltipWidget(BaseWidget *parent = nullptr); ~TooltipWidget(); @@ -27,9 +29,9 @@ public: } protected: - virtual void changeEvent(QEvent *) override; - virtual void leaveEvent(QEvent *) override; - virtual void scaleChangedEvent(float) override; + void changeEvent(QEvent *) override; + void leaveEvent(QEvent *) override; + void scaleChangedEvent(float) override; private: QLabel *displayText; diff --git a/src/widgets/window.cpp b/src/widgets/window.cpp index 29f7d4a5b..3326a33fe 100644 --- a/src/widgets/window.cpp +++ b/src/widgets/window.cpp @@ -110,13 +110,9 @@ void Window::repaintVisibleChatWidgets(Channel *channel) return; } - const std::vector &widgets = page->getSplits(); - - for (auto it = widgets.begin(); it != widgets.end(); ++it) { - Split *widget = *it; - - if (channel == nullptr || channel == widget->getChannel().get()) { - widget->layoutMessages(); + for (const auto &split : page->getSplits()) { + if (channel == nullptr || channel == split->getChannel().get()) { + split->layoutMessages(); } } } @@ -140,7 +136,7 @@ void Window::closeEvent(QCloseEvent *) this->windowGeometry.width = geom.width(); this->windowGeometry.height = geom.height(); - this->closed(); + this->closed.invoke(); } bool Window::event(QEvent *e) diff --git a/src/widgets/window.hpp b/src/widgets/window.hpp index 79ce24204..a82a9b299 100644 --- a/src/widgets/window.hpp +++ b/src/widgets/window.hpp @@ -8,14 +8,13 @@ //#include //#endif -#include #include #include namespace chatterino { namespace singletons { class ThemeManager; -} +} // namespace singletons namespace widgets { @@ -52,11 +51,11 @@ public: void refreshWindowTitle(const QString &username); - boost::signals2::signal closed; + pajlada::Signals::NoArgSignal closed; protected: - virtual void closeEvent(QCloseEvent *event) override; - virtual bool event(QEvent *event) override; + void closeEvent(QCloseEvent *event) override; + bool event(QEvent *event) override; private: float dpi;