From 02b8c34de8723d51dd60fc4bee1498df3390b42e Mon Sep 17 00:00:00 2001 From: fourtf Date: Thu, 24 May 2018 15:42:06 +0200 Subject: [PATCH] added tooltip to bit badges --- src/application.cpp | 6 +++--- src/providers/twitch/twitchmessagebuilder.cpp | 14 ++++---------- src/singletons/resourcemanager.hpp | 1 + 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/application.cpp b/src/application.cpp index 7a4bc8453..36edd2039 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -34,7 +34,7 @@ namespace { bool isBigEndian() { int test = 1; - char *p = (char *)&test; + char *p = reinterpret_cast(&test); return p[0] == 0; } @@ -268,11 +268,11 @@ void Application::runNativeMessagingHost() } #endif - char *b = (char *)malloc(size + 1); + char *b = reinterpret_cast(malloc(size + 1)); std::cin.read(b, size); *(b + size) = '\0'; - app->nativeMessaging->sendToGuiProcess(QByteArray(b, size)); + app->nativeMessaging->sendToGuiProcess(QByteArray(b, static_cast(size))); free(b); } diff --git a/src/providers/twitch/twitchmessagebuilder.cpp b/src/providers/twitch/twitchmessagebuilder.cpp index 07e2dee00..ca81711f1 100644 --- a/src/providers/twitch/twitchmessagebuilder.cpp +++ b/src/providers/twitch/twitchmessagebuilder.cpp @@ -154,15 +154,8 @@ MessagePtr TwitchMessageBuilder::build() this->appendTwitchEmote(ircMessage, emote, twitchEmotes); } - struct { - bool operator()(const std::pair &lhs, - const std::pair &rhs) - { - return lhs.first < rhs.first; - } - } customLess; - - std::sort(twitchEmotes.begin(), twitchEmotes.end(), customLess); + std::sort(twitchEmotes.begin(), twitchEmotes.end(), + [](const auto &a, const auto &b) { return a.first < b.first; }); } auto currentTwitchEmote = twitchEmotes.begin(); @@ -588,7 +581,8 @@ void TwitchMessageBuilder::appendTwitchBadges() // Try to fetch channel-specific bit badge try { const auto &badge = channelResources.badgeSets.at("bits").versions.at(versionKey); - this->emplace(badge.badgeImage1x, MessageElement::BadgeVanity); + this->emplace(badge.badgeImage1x, MessageElement::BadgeVanity) + ->setTooltip(QString("Twitch Bits (") + cheerAmountQS + ")"); continue; } catch (const std::out_of_range &) { // Channel does not contain a special bit badge for this version diff --git a/src/singletons/resourcemanager.hpp b/src/singletons/resourcemanager.hpp index 2da506583..487b0f410 100644 --- a/src/singletons/resourcemanager.hpp +++ b/src/singletons/resourcemanager.hpp @@ -2,6 +2,7 @@ #include "util/emotemap.hpp" +#include #include #include