diff --git a/src/fontmanager.cpp b/src/fontmanager.cpp index a35cbe178..29f02ad95 100644 --- a/src/fontmanager.cpp +++ b/src/fontmanager.cpp @@ -10,11 +10,13 @@ FontManager::FontManager() , currentFont(this->currentFontFamily.getValue().c_str(), currentFontSize.getValue()) { this->currentFontFamily.getValueChangedSignal().connect([this](const std::string &newValue) { + this->incGeneration(); this->currentFont.setFamily(newValue.c_str()); // this->fontChanged.invoke(); }); this->currentFontSize.getValueChangedSignal().connect([this](const int &newValue) { - this->currentFont.setSize(newValue); // + this->incGeneration(); + this->currentFont.setSize(newValue); this->fontChanged.invoke(); }); } diff --git a/src/messages/messageref.cpp b/src/messages/messageref.cpp index 2551fa625..115a918e6 100644 --- a/src/messages/messageref.cpp +++ b/src/messages/messageref.cpp @@ -68,9 +68,11 @@ bool MessageRef::layout(int width, float dpiMultiplyer) // update word sizes if needed if (imagesChanged) { this->updateImageSizes(); + this->buffer = nullptr; } if (textChanged) { this->updateTextSizes(); + this->buffer = nullptr; } if (widthChanged || wordMaskChanged) { this->buffer = nullptr; diff --git a/src/widgets/helper/channelview.cpp b/src/widgets/helper/channelview.cpp index fea69dbbe..bd8c66133 100644 --- a/src/widgets/helper/channelview.cpp +++ b/src/widgets/helper/channelview.cpp @@ -61,6 +61,10 @@ ChannelView::ChannelView(BaseWidget *parent) this->goToBottom->getLabel().setText("Jump to bottom"); this->goToBottom->setVisible(false); + this->fontChangedConnection = FontManager::getInstance().fontChanged.connect([this] { + this->layoutMessages(); // + }); + connect(goToBottom, &RippleEffectLabel::clicked, this, [this] { QTimer::singleShot(180, [this] { this->scrollBar.scrollToBottom(); }); }); @@ -79,6 +83,7 @@ ChannelView::~ChannelView() { QObject::disconnect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged, this, &ChannelView::wordTypeMaskChanged); + FontManager::getInstance().fontChanged.disconnect(this->fontChangedConnection); } void ChannelView::queueUpdate() @@ -241,8 +246,9 @@ QString ChannelView::getSelectedText() if (first) { first = false; - bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex < - part.getCharacterLength(); + bool isSingleWord = + isSingleMessage && + this->selection.max.charIndex - charIndex < part.getCharacterLength(); if (isSingleWord) { // return single word @@ -519,9 +525,10 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap // this->selectionMax.messageIndex >= messageIndex) { // painter.fillRect(buffer->rect(), QColor(24, 55, 25)); //} else { - painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab()) - ? this->colorScheme.ChatBackgroundHighlighted - : this->colorScheme.ChatBackground); + painter.fillRect(buffer->rect(), + (messageRef->getMessage()->getCanHighlightTab()) + ? this->colorScheme.ChatBackgroundHighlighted + : this->colorScheme.ChatBackground); //} // draw selection diff --git a/src/widgets/helper/channelview.hpp b/src/widgets/helper/channelview.hpp index fe86c7a9d..7d5addc06 100644 --- a/src/widgets/helper/channelview.hpp +++ b/src/widgets/helper/channelview.hpp @@ -163,6 +163,8 @@ private: boost::signals2::connection repaintGifsConnection; boost::signals2::connection layoutConnection; + pajlada::Signals::NoArgSignal::Connection fontChangedConnection; + private slots: void wordTypeMaskChanged() {