mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fixed verified badges
Refactor more underscores into this->
This commit is contained in:
parent
59d383c161
commit
e7282b5097
BIN
resources/images/verified.png
Normal file
BIN
resources/images/verified.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -8,6 +8,7 @@
|
||||||
<file>images/cheer10000.png</file>
|
<file>images/cheer10000.png</file>
|
||||||
<file>images/cheer100000.png</file>
|
<file>images/cheer100000.png</file>
|
||||||
<file>images/cheer5000.png</file>
|
<file>images/cheer5000.png</file>
|
||||||
|
<file>images/verified.png</file>
|
||||||
<file>images/CopyLongTextToClipboard_16x.png</file>
|
<file>images/CopyLongTextToClipboard_16x.png</file>
|
||||||
<file>images/CustomActionEditor_16x.png</file>
|
<file>images/CustomActionEditor_16x.png</file>
|
||||||
<file>images/Emoji_Color_1F60A_19.png</file>
|
<file>images/Emoji_Color_1F60A_19.png</file>
|
||||||
|
|
|
@ -21,67 +21,66 @@ namespace chatterino {
|
||||||
namespace messages {
|
namespace messages {
|
||||||
|
|
||||||
Message::Message(const QString &text)
|
Message::Message(const QString &text)
|
||||||
: _text(text)
|
: text(text)
|
||||||
, _words()
|
|
||||||
{
|
{
|
||||||
_words.push_back(
|
this->words.push_back(
|
||||||
Word(text, Word::Text, ColorScheme::getInstance().SystemMessageColor, text, QString()));
|
Word(text, Word::Text, ColorScheme::getInstance().SystemMessageColor, text, QString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Message::Message(const QString &text, const std::vector<Word> &words)
|
Message::Message(const QString &text, const std::vector<Word> &words)
|
||||||
: _text(text)
|
: text(text)
|
||||||
, _words(words)
|
, words(words)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Message::getCanHighlightTab() const
|
bool Message::getCanHighlightTab() const
|
||||||
{
|
{
|
||||||
return _highlightTab;
|
return this->highlightTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &Message::getTimeoutUser() const
|
const QString &Message::getTimeoutUser() const
|
||||||
{
|
{
|
||||||
return _timeoutUser;
|
return this->timeoutUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Message::getTimeoutCount() const
|
int Message::getTimeoutCount() const
|
||||||
{
|
{
|
||||||
return _timeoutCount;
|
return this->timeoutCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &Message::getUserName() const
|
const QString &Message::getUserName() const
|
||||||
{
|
{
|
||||||
return _userName;
|
return this->userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &Message::getDisplayName() const
|
const QString &Message::getDisplayName() const
|
||||||
{
|
{
|
||||||
return _displayName;
|
return this->displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &Message::getContent() const
|
const QString &Message::getContent() const
|
||||||
{
|
{
|
||||||
return _content;
|
return this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::chrono::time_point<std::chrono::system_clock> &Message::getParseTime() const
|
const std::chrono::time_point<std::chrono::system_clock> &Message::getParseTime() const
|
||||||
{
|
{
|
||||||
return _parseTime;
|
return this->parseTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Word> &Message::getWords()
|
std::vector<Word> &Message::getWords()
|
||||||
{
|
{
|
||||||
return _words;
|
return this->words;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Message::isDisabled() const
|
bool Message::isDisabled() const
|
||||||
{
|
{
|
||||||
return _isDisabled;
|
return this->disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &Message::getId() const
|
const QString &Message::getId() const
|
||||||
{
|
{
|
||||||
return _id;
|
return this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace messages
|
} // namespace messages
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
bool isDisabled() const;
|
bool isDisabled() const;
|
||||||
const QString &getId() const;
|
const QString &getId() const;
|
||||||
|
|
||||||
const QString _text;
|
const QString text;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static LazyLoadedImage *badgeStaff;
|
static LazyLoadedImage *badgeStaff;
|
||||||
|
@ -50,18 +50,18 @@ private:
|
||||||
|
|
||||||
static QRegularExpression *cheerRegex;
|
static QRegularExpression *cheerRegex;
|
||||||
|
|
||||||
bool _highlightTab = false;
|
bool highlightTab = false;
|
||||||
QString _timeoutUser = "";
|
QString timeoutUser = "";
|
||||||
int _timeoutCount = 0;
|
int timeoutCount = 0;
|
||||||
bool _isDisabled = false;
|
bool disabled = false;
|
||||||
std::chrono::time_point<std::chrono::system_clock> _parseTime;
|
std::chrono::time_point<std::chrono::system_clock> parseTime;
|
||||||
|
|
||||||
QString _userName = "";
|
QString userName = "";
|
||||||
QString _displayName = "";
|
QString displayName = "";
|
||||||
QString _content;
|
QString content;
|
||||||
QString _id = "";
|
QString id = "";
|
||||||
|
|
||||||
std::vector<Word> _words;
|
std::vector<Word> words;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace messages
|
} // namespace messages
|
||||||
|
|
|
@ -44,17 +44,18 @@ public:
|
||||||
BadgePremium = (1 << 20),
|
BadgePremium = (1 << 20),
|
||||||
BadgeChatterino = (1 << 21),
|
BadgeChatterino = (1 << 21),
|
||||||
BadgeCheer = (1 << 22),
|
BadgeCheer = (1 << 22),
|
||||||
|
BadgeVerified = (1 << 23),
|
||||||
Badges = BadgeStaff | BadgeAdmin | BadgeGlobalMod | BadgeModerator | BadgeTurbo |
|
Badges = BadgeStaff | BadgeAdmin | BadgeGlobalMod | BadgeModerator | BadgeTurbo |
|
||||||
BadgeBroadcaster | BadgePremium | BadgeChatterino | BadgeCheer,
|
BadgeBroadcaster | BadgePremium | BadgeChatterino | BadgeCheer | BadgeVerified,
|
||||||
|
|
||||||
Username = (1 << 23),
|
Username = (1 << 24),
|
||||||
BitsAmount = (1 << 24),
|
BitsAmount = (1 << 25),
|
||||||
|
|
||||||
ButtonBan = (1 << 25),
|
ButtonBan = (1 << 26),
|
||||||
ButtonTimeout = (1 << 26),
|
ButtonTimeout = (1 << 27),
|
||||||
|
|
||||||
EmojiImage = (1 << 27),
|
EmojiImage = (1 << 28),
|
||||||
EmojiText = (1 << 28),
|
EmojiText = (1 << 29),
|
||||||
|
|
||||||
Default = TimestampNoSeconds | Badges | Username | BitsStatic | FfzEmoteImage |
|
Default = TimestampNoSeconds | Badges | Username | BitsStatic | FfzEmoteImage |
|
||||||
BttvEmoteImage | BttvGifEmoteImage | TwitchEmoteImage | BitsAmount | Text |
|
BttvEmoteImage | BttvGifEmoteImage | TwitchEmoteImage | BitsAmount | Text |
|
||||||
|
|
|
@ -25,6 +25,7 @@ Resources::Resources(EmoteManager &emoteManager, WindowManager &windowManager)
|
||||||
, badgeTurbo(lli(emoteManager, windowManager, ":/images/turbo_bg.png"))
|
, badgeTurbo(lli(emoteManager, windowManager, ":/images/turbo_bg.png"))
|
||||||
, badgeBroadcaster(lli(emoteManager, windowManager, ":/images/broadcaster_bg.png"))
|
, badgeBroadcaster(lli(emoteManager, windowManager, ":/images/broadcaster_bg.png"))
|
||||||
, badgePremium(lli(emoteManager, windowManager, ":/images/twitchprime_bg.png"))
|
, badgePremium(lli(emoteManager, windowManager, ":/images/twitchprime_bg.png"))
|
||||||
|
, badgeVerified(lli(emoteManager, windowManager, ":/images/verified.png"))
|
||||||
, cheerBadge100000(lli(emoteManager, windowManager, ":/images/cheer100000"))
|
, cheerBadge100000(lli(emoteManager, windowManager, ":/images/cheer100000"))
|
||||||
, cheerBadge10000(lli(emoteManager, windowManager, ":/images/cheer10000"))
|
, cheerBadge10000(lli(emoteManager, windowManager, ":/images/cheer10000"))
|
||||||
, cheerBadge5000(lli(emoteManager, windowManager, ":/images/cheer5000"))
|
, cheerBadge5000(lli(emoteManager, windowManager, ":/images/cheer5000"))
|
||||||
|
|
|
@ -19,6 +19,7 @@ public:
|
||||||
messages::LazyLoadedImage *badgeTurbo;
|
messages::LazyLoadedImage *badgeTurbo;
|
||||||
messages::LazyLoadedImage *badgeBroadcaster;
|
messages::LazyLoadedImage *badgeBroadcaster;
|
||||||
messages::LazyLoadedImage *badgePremium;
|
messages::LazyLoadedImage *badgePremium;
|
||||||
|
messages::LazyLoadedImage *badgeVerified;
|
||||||
|
|
||||||
messages::LazyLoadedImage *cheerBadge100000;
|
messages::LazyLoadedImage *cheerBadge100000;
|
||||||
messages::LazyLoadedImage *cheerBadge10000;
|
messages::LazyLoadedImage *cheerBadge10000;
|
||||||
|
|
|
@ -335,6 +335,10 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges, const R
|
||||||
EmoteManager &emoteManager)
|
EmoteManager &emoteManager)
|
||||||
{
|
{
|
||||||
for (QString badge : badges) {
|
for (QString badge : badges) {
|
||||||
|
if (badge.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (badge.startsWith("bits/")) {
|
if (badge.startsWith("bits/")) {
|
||||||
long long int cheer = std::strtoll(badge.mid(5).toStdString().c_str(), nullptr, 10);
|
long long int cheer = std::strtoll(badge.mid(5).toStdString().c_str(), nullptr, 10);
|
||||||
appendWord(Word(emoteManager.getCheerBadge(cheer), Word::BadgeCheer, QString(),
|
appendWord(Word(emoteManager.getCheerBadge(cheer), Word::BadgeCheer, QString(),
|
||||||
|
@ -349,8 +353,8 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges, const R
|
||||||
appendWord(Word(resources.badgeGlobalModerator, Word::BadgeGlobalMod, QString(),
|
appendWord(Word(resources.badgeGlobalModerator, Word::BadgeGlobalMod, QString(),
|
||||||
QString("Global Moderator")));
|
QString("Global Moderator")));
|
||||||
} else if (badge == "moderator/1") {
|
} else if (badge == "moderator/1") {
|
||||||
// TODO: implement this xD
|
// TODO: Implement custom FFZ moderator badge
|
||||||
appendWord(Word(resources.badgeTurbo, Word::BadgeModerator, QString(),
|
appendWord(Word(resources.badgeModerator, Word::BadgeModerator, QString(),
|
||||||
QString("Channel Moderator"))); // custom badge
|
QString("Channel Moderator"))); // custom badge
|
||||||
} else if (badge == "turbo/1") {
|
} else if (badge == "turbo/1") {
|
||||||
appendWord(Word(resources.badgeStaff, Word::BadgeTurbo, QString(),
|
appendWord(Word(resources.badgeStaff, Word::BadgeTurbo, QString(),
|
||||||
|
@ -361,6 +365,28 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges, const R
|
||||||
} else if (badge == "premium/1") {
|
} else if (badge == "premium/1") {
|
||||||
appendWord(Word(resources.badgePremium, Word::BadgePremium, QString(),
|
appendWord(Word(resources.badgePremium, Word::BadgePremium, QString(),
|
||||||
QString("Twitch Prime")));
|
QString("Twitch Prime")));
|
||||||
|
|
||||||
|
} else if (badge.startsWith("partner/")) {
|
||||||
|
int index = badge.midRef(8).toInt();
|
||||||
|
switch (index) {
|
||||||
|
case 1: {
|
||||||
|
appendWord(Word(resources.badgeVerified, Word::BadgeVerified, QString(),
|
||||||
|
"Twitch Verified"));
|
||||||
|
} break;
|
||||||
|
default: {
|
||||||
|
printf("[TwitchMessageBuilder] Unhandled partner badge index: %d\n", index);
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} else if (badge.startsWith("subscriber/")) {
|
||||||
|
int index = badge.midRef(11).toInt();
|
||||||
|
// TODO: Implement subscriber badges here
|
||||||
|
switch (index) {
|
||||||
|
default: {
|
||||||
|
// printf("[TwitchMessageBuilder] Unhandled subscriber badge index: %d\n", index);
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("[TwitchMessageBuilder] Unhandled badge: %s\n", qPrintable(badge));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue