mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
@boldUsernames now work dynamically with the setting (#607)
This commit is contained in:
parent
12a21b7b1a
commit
9dda0a05fa
5 changed files with 19 additions and 7 deletions
|
@ -92,6 +92,10 @@ public:
|
|||
// used in the ChannelView class to make the collapse buttons visible if needed
|
||||
Collapsed = (1 << 26),
|
||||
|
||||
// used for dynamic bold usernames
|
||||
BoldUsername = (1 << 27),
|
||||
NonBoldUsername = (1 << 28),
|
||||
|
||||
Default = Timestamp | Badges | Username | BitsStatic | FfzEmoteImage | BttvEmoteImage |
|
||||
TwitchEmoteImage | BitsAmount | Text | AlwaysShow,
|
||||
};
|
||||
|
|
|
@ -218,7 +218,7 @@ MessagePtr TwitchMessageBuilder::build()
|
|||
QString linkString = this->matchLink(string);
|
||||
auto fontStyle = FontStyle::ChatMedium;
|
||||
|
||||
if (string.startsWith('@') && app->settings->usernameBold) {
|
||||
if (string.startsWith('@') && app->settings->enableUsernameBold) {
|
||||
fontStyle = FontStyle::ChatMediumBold;
|
||||
}
|
||||
|
||||
|
@ -246,10 +246,17 @@ MessagePtr TwitchMessageBuilder::build()
|
|||
link = Link(Link::Url, linkString);
|
||||
textColor = MessageColor(MessageColor::Link);
|
||||
}
|
||||
|
||||
this->emplace<TextElement>(string, MessageElement::Text, textColor,
|
||||
fontStyle) //
|
||||
if (string.startsWith('@')) {
|
||||
this->emplace<TextElement>(string, TextElement::BoldUsername, textColor,
|
||||
FontStyle::ChatMediumBold) //
|
||||
->setLink(link);
|
||||
this->emplace<TextElement>(string, TextElement::NonBoldUsername, textColor) //
|
||||
->setLink(link);
|
||||
} else {
|
||||
this->emplace<TextElement>(string, TextElement::Text, textColor) //
|
||||
->setLink(link);
|
||||
}
|
||||
|
||||
} else { // is emoji
|
||||
this->emplace<EmoteElement>(emoteData, EmoteElement::EmojiAll);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
BoolSetting enableSmoothScrolling = {"/appearance/smoothScrolling", true};
|
||||
BoolSetting enableSmoothScrollingNewMessages = {"/appearance/smoothScrollingNewMessages",
|
||||
false};
|
||||
BoolSetting enableUsernameBold = {"/appearence/messages/boldUsernames", false};
|
||||
// BoolSetting useCustomWindowFrame = {"/appearance/useCustomWindowFrame", false};
|
||||
|
||||
/// Behaviour
|
||||
|
@ -108,8 +109,6 @@ public:
|
|||
|
||||
BoolSetting inlineWhispers = {"/whispers/enableInlineWhispers", true};
|
||||
|
||||
BoolSetting usernameBold = {"/appearence/messages/boldUsernames", false};
|
||||
|
||||
/// External tools
|
||||
// Streamlink
|
||||
BoolSetting streamlinkUseCustomPath = {"/external/streamlink/useCustomPath", false};
|
||||
|
|
|
@ -68,6 +68,7 @@ WindowManager::WindowManager()
|
|||
this->wordFlagsListener_.addSetting(settings->enableEmojis);
|
||||
this->wordFlagsListener_.addSetting(settings->enableFfzEmotes);
|
||||
this->wordFlagsListener_.addSetting(settings->enableTwitchEmotes);
|
||||
this->wordFlagsListener_.addSetting(settings->enableUsernameBold);
|
||||
this->wordFlagsListener_.cb = [this](auto) {
|
||||
this->updateWordTypeMask(); //
|
||||
};
|
||||
|
@ -110,6 +111,7 @@ void WindowManager::updateWordTypeMask()
|
|||
// misc
|
||||
flags |= MEF::AlwaysShow;
|
||||
flags |= MEF::Collapsed;
|
||||
flags |= settings->enableUsernameBold ? MEF::BoldUsername : MEF::NonBoldUsername;
|
||||
|
||||
// update flags
|
||||
MessageElement::Flags newFlags = static_cast<MessageElement::Flags>(flags);
|
||||
|
|
|
@ -143,7 +143,7 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
|
|||
// lowercase links
|
||||
layout.append(this->createCheckBox("Lowercase domains", getSettings()->lowercaseLink));
|
||||
// bold usernames
|
||||
layout.append(this->createCheckBox("Bold @usernames", getSettings()->usernameBold));
|
||||
layout.append(this->createCheckBox("Bold @usernames", getSettings()->enableUsernameBold));
|
||||
|
||||
// collapsing
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue