mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
messages refresh when toggeling the button
This commit is contained in:
parent
e694214243
commit
b3951262c8
|
@ -84,10 +84,10 @@ bool MessageLayout::layout(int width, float scale, MessageElement::Flags flags)
|
|||
this->fontGeneration = singletons::FontManager::getInstance().getGeneration();
|
||||
|
||||
// check if work mask changed
|
||||
bool wordMaskChanged =
|
||||
this->currentWordTypes != singletons::SettingManager::getInstance().getWordTypeMask();
|
||||
bool wordMaskChanged = this->currentWordFlags !=
|
||||
flags; // singletons::SettingManager::getInstance().getWordTypeMask();
|
||||
layoutRequired |= wordMaskChanged;
|
||||
this->currentWordTypes = singletons::SettingManager::getInstance().getWordTypeMask();
|
||||
this->currentWordFlags = flags; // singletons::SettingManager::getInstance().getWordTypeMask();
|
||||
|
||||
// check if dpi changed
|
||||
bool scaleChanged = this->scale != scale;
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
float scale = -1;
|
||||
unsigned int bufferUpdatedCount = 0;
|
||||
|
||||
MessageElement::Flags currentWordTypes = MessageElement::None;
|
||||
MessageElement::Flags currentWordFlags = MessageElement::None;
|
||||
|
||||
int collapsedHeight = 32;
|
||||
|
||||
|
|
|
@ -18,22 +18,22 @@ void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting)
|
|||
SettingManager::SettingManager()
|
||||
: snapshot(nullptr)
|
||||
{
|
||||
this->wordMaskListener.addSetting(this->showTimestamps);
|
||||
this->wordMaskListener.addSetting(this->showBadges);
|
||||
this->wordMaskListener.addSetting(this->enableBttvEmotes);
|
||||
this->wordMaskListener.addSetting(this->enableEmojis);
|
||||
this->wordMaskListener.addSetting(this->enableFfzEmotes);
|
||||
this->wordMaskListener.addSetting(this->enableTwitchEmotes);
|
||||
this->wordMaskListener.cb = [this](auto) {
|
||||
this->wordFlagsListener.addSetting(this->showTimestamps);
|
||||
this->wordFlagsListener.addSetting(this->showBadges);
|
||||
this->wordFlagsListener.addSetting(this->enableBttvEmotes);
|
||||
this->wordFlagsListener.addSetting(this->enableEmojis);
|
||||
this->wordFlagsListener.addSetting(this->enableFfzEmotes);
|
||||
this->wordFlagsListener.addSetting(this->enableTwitchEmotes);
|
||||
this->wordFlagsListener.cb = [this](auto) {
|
||||
this->updateWordTypeMask(); //
|
||||
};
|
||||
|
||||
this->moderationActions.connect([this](auto, auto) { this->updateModerationActions(); });
|
||||
}
|
||||
|
||||
MessageElement::Flags SettingManager::getWordTypeMask()
|
||||
MessageElement::Flags SettingManager::getWordFlags()
|
||||
{
|
||||
return this->wordTypeMask;
|
||||
return this->wordFlags;
|
||||
}
|
||||
|
||||
bool SettingManager::isIgnoredEmote(const QString &)
|
||||
|
@ -76,10 +76,10 @@ void SettingManager::updateWordTypeMask()
|
|||
|
||||
MessageElement::Flags newMask = static_cast<MessageElement::Flags>(newMaskUint);
|
||||
|
||||
if (newMask != this->wordTypeMask) {
|
||||
this->wordTypeMask = newMask;
|
||||
if (newMask != this->wordFlags) {
|
||||
this->wordFlags = newMask;
|
||||
|
||||
emit wordTypeMaskChanged();
|
||||
emit wordFlagsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class SettingManager : public QObject
|
|||
using QStringSetting = ChatterinoSetting<QString>;
|
||||
|
||||
public:
|
||||
messages::MessageElement::Flags getWordTypeMask();
|
||||
messages::MessageElement::Flags getWordFlags();
|
||||
bool isIgnoredEmote(const QString &emote);
|
||||
|
||||
void init();
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
std::vector<ModerationAction> getModerationActions() const;
|
||||
|
||||
signals:
|
||||
void wordTypeMaskChanged();
|
||||
void wordFlagsChanged();
|
||||
|
||||
private:
|
||||
std::vector<ModerationAction> _moderationActions;
|
||||
|
@ -119,9 +119,9 @@ private:
|
|||
|
||||
void updateModerationActions();
|
||||
|
||||
messages::MessageElement::Flags wordTypeMask = messages::MessageElement::Default;
|
||||
messages::MessageElement::Flags wordFlags = messages::MessageElement::Default;
|
||||
|
||||
pajlada::Settings::SettingListener wordMaskListener;
|
||||
pajlada::Settings::SettingListener wordFlagsListener;
|
||||
};
|
||||
|
||||
} // namespace singletons
|
||||
|
|
|
@ -43,8 +43,8 @@ ChannelView::ChannelView(BaseWidget *parent)
|
|||
this->setMouseTracking(true);
|
||||
|
||||
QObject::connect(&singletons::SettingManager::getInstance(),
|
||||
&singletons::SettingManager::wordTypeMaskChanged, this,
|
||||
&ChannelView::wordTypeMaskChanged);
|
||||
&singletons::SettingManager::wordFlagsChanged, this,
|
||||
&ChannelView::wordFlagsChanged);
|
||||
|
||||
this->scrollBar.getCurrentValueChanged().connect([this] {
|
||||
// Whenever the scrollbar value has been changed, re-render the ChatWidgetView
|
||||
|
@ -101,8 +101,8 @@ ChannelView::ChannelView(BaseWidget *parent)
|
|||
ChannelView::~ChannelView()
|
||||
{
|
||||
QObject::disconnect(&singletons::SettingManager::getInstance(),
|
||||
&singletons::SettingManager::wordTypeMaskChanged, this,
|
||||
&ChannelView::wordTypeMaskChanged);
|
||||
&singletons::SettingManager::wordFlagsChanged, this,
|
||||
&ChannelView::wordFlagsChanged);
|
||||
this->messageAppendedConnection.disconnect();
|
||||
this->messageRemovedConnection.disconnect();
|
||||
this->repaintGifsConnection.disconnect();
|
||||
|
@ -429,14 +429,11 @@ void ChannelView::setSelection(const SelectionItem &start, const SelectionItem &
|
|||
this->selection = Selection(start, end);
|
||||
|
||||
this->selectionChanged();
|
||||
|
||||
// qDebug() << min.messageIndex << ":" << min.charIndex << " " << max.messageIndex << ":"
|
||||
// << max.charIndex;
|
||||
}
|
||||
|
||||
messages::MessageElement::Flags ChannelView::getFlags() const
|
||||
{
|
||||
MessageElement::Flags flags = MessageElement::Default;
|
||||
MessageElement::Flags flags = singletons::SettingManager::getInstance().getWordFlags();
|
||||
|
||||
Split *split = dynamic_cast<Split *>(this->parentWidget());
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ private:
|
|||
std::unordered_set<std::shared_ptr<messages::MessageLayout>> messagesOnScreen;
|
||||
|
||||
private slots:
|
||||
void wordTypeMaskChanged()
|
||||
void wordFlagsChanged()
|
||||
{
|
||||
layoutMessages();
|
||||
update();
|
||||
|
|
|
@ -176,6 +176,7 @@ void Split::setModerationMode(bool value)
|
|||
if (value != this->moderationMode) {
|
||||
this->moderationMode = value;
|
||||
this->header.updateModerationModeIcon();
|
||||
this->view.layoutMessages();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue