mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Added higher tier information to sub badge tooltip (#1759)
This commit is contained in:
parent
0b0fdb4ba2
commit
b66c2478a0
1 changed files with 10 additions and 1 deletions
|
@ -995,8 +995,17 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||||
auto badgeInfoIt = badgeInfos.find(badge.key_);
|
auto badgeInfoIt = badgeInfos.find(badge.key_);
|
||||||
if (badgeInfoIt != badgeInfos.end())
|
if (badgeInfoIt != badgeInfos.end())
|
||||||
{
|
{
|
||||||
|
// badge.value_ is 4 chars long if user is subbed on higher tier
|
||||||
|
// (tier + amount of months with leading zero if less than 100)
|
||||||
|
// e.g. 3054 - tier 3 4,5-year sub. 2108 - tier 2 9-year sub
|
||||||
|
const auto &subTier =
|
||||||
|
badge.value_.length() > 3 ? badge.value_.front() : '1';
|
||||||
const auto &subMonths = badgeInfoIt->second;
|
const auto &subMonths = badgeInfoIt->second;
|
||||||
tooltip += QString(" (%0 months)").arg(subMonths);
|
tooltip +=
|
||||||
|
QString(" (%1%2 months)")
|
||||||
|
.arg(subTier != '1' ? QString("Tier %1, ").arg(subTier)
|
||||||
|
: "")
|
||||||
|
.arg(subMonths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue