mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed splits not redrawing after font changed
This commit is contained in:
parent
266ad36de3
commit
5cb33647dc
4 changed files with 19 additions and 6 deletions
|
@ -10,11 +10,13 @@ FontManager::FontManager()
|
||||||
, currentFont(this->currentFontFamily.getValue().c_str(), currentFontSize.getValue())
|
, currentFont(this->currentFontFamily.getValue().c_str(), currentFontSize.getValue())
|
||||||
{
|
{
|
||||||
this->currentFontFamily.getValueChangedSignal().connect([this](const std::string &newValue) {
|
this->currentFontFamily.getValueChangedSignal().connect([this](const std::string &newValue) {
|
||||||
|
this->incGeneration();
|
||||||
this->currentFont.setFamily(newValue.c_str()); //
|
this->currentFont.setFamily(newValue.c_str()); //
|
||||||
this->fontChanged.invoke();
|
this->fontChanged.invoke();
|
||||||
});
|
});
|
||||||
this->currentFontSize.getValueChangedSignal().connect([this](const int &newValue) {
|
this->currentFontSize.getValueChangedSignal().connect([this](const int &newValue) {
|
||||||
this->currentFont.setSize(newValue); //
|
this->incGeneration();
|
||||||
|
this->currentFont.setSize(newValue);
|
||||||
this->fontChanged.invoke();
|
this->fontChanged.invoke();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,9 +68,11 @@ bool MessageRef::layout(int width, float dpiMultiplyer)
|
||||||
// update word sizes if needed
|
// update word sizes if needed
|
||||||
if (imagesChanged) {
|
if (imagesChanged) {
|
||||||
this->updateImageSizes();
|
this->updateImageSizes();
|
||||||
|
this->buffer = nullptr;
|
||||||
}
|
}
|
||||||
if (textChanged) {
|
if (textChanged) {
|
||||||
this->updateTextSizes();
|
this->updateTextSizes();
|
||||||
|
this->buffer = nullptr;
|
||||||
}
|
}
|
||||||
if (widthChanged || wordMaskChanged) {
|
if (widthChanged || wordMaskChanged) {
|
||||||
this->buffer = nullptr;
|
this->buffer = nullptr;
|
||||||
|
|
|
@ -61,6 +61,10 @@ ChannelView::ChannelView(BaseWidget *parent)
|
||||||
this->goToBottom->getLabel().setText("Jump to bottom");
|
this->goToBottom->getLabel().setText("Jump to bottom");
|
||||||
this->goToBottom->setVisible(false);
|
this->goToBottom->setVisible(false);
|
||||||
|
|
||||||
|
this->fontChangedConnection = FontManager::getInstance().fontChanged.connect([this] {
|
||||||
|
this->layoutMessages(); //
|
||||||
|
});
|
||||||
|
|
||||||
connect(goToBottom, &RippleEffectLabel::clicked, this,
|
connect(goToBottom, &RippleEffectLabel::clicked, this,
|
||||||
[this] { QTimer::singleShot(180, [this] { this->scrollBar.scrollToBottom(); }); });
|
[this] { QTimer::singleShot(180, [this] { this->scrollBar.scrollToBottom(); }); });
|
||||||
|
|
||||||
|
@ -79,6 +83,7 @@ ChannelView::~ChannelView()
|
||||||
{
|
{
|
||||||
QObject::disconnect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged,
|
QObject::disconnect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged,
|
||||||
this, &ChannelView::wordTypeMaskChanged);
|
this, &ChannelView::wordTypeMaskChanged);
|
||||||
|
FontManager::getInstance().fontChanged.disconnect(this->fontChangedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelView::queueUpdate()
|
void ChannelView::queueUpdate()
|
||||||
|
@ -241,8 +246,9 @@ QString ChannelView::getSelectedText()
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex <
|
bool isSingleWord =
|
||||||
part.getCharacterLength();
|
isSingleMessage &&
|
||||||
|
this->selection.max.charIndex - charIndex < part.getCharacterLength();
|
||||||
|
|
||||||
if (isSingleWord) {
|
if (isSingleWord) {
|
||||||
// return single word
|
// return single word
|
||||||
|
@ -519,7 +525,8 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
|
||||||
// this->selectionMax.messageIndex >= messageIndex) {
|
// this->selectionMax.messageIndex >= messageIndex) {
|
||||||
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
||||||
//} else {
|
//} else {
|
||||||
painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab())
|
painter.fillRect(buffer->rect(),
|
||||||
|
(messageRef->getMessage()->getCanHighlightTab())
|
||||||
? this->colorScheme.ChatBackgroundHighlighted
|
? this->colorScheme.ChatBackgroundHighlighted
|
||||||
: this->colorScheme.ChatBackground);
|
: this->colorScheme.ChatBackground);
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -163,6 +163,8 @@ private:
|
||||||
boost::signals2::connection repaintGifsConnection;
|
boost::signals2::connection repaintGifsConnection;
|
||||||
boost::signals2::connection layoutConnection;
|
boost::signals2::connection layoutConnection;
|
||||||
|
|
||||||
|
pajlada::Signals::NoArgSignal::Connection fontChangedConnection;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void wordTypeMaskChanged()
|
void wordTypeMaskChanged()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue