added tooltip to bit badges

This commit is contained in:
fourtf 2018-05-24 15:42:06 +02:00
parent 4de2a6b65f
commit 02b8c34de8
3 changed files with 8 additions and 13 deletions

View file

@ -34,7 +34,7 @@ namespace {
bool isBigEndian() bool isBigEndian()
{ {
int test = 1; int test = 1;
char *p = (char *)&test; char *p = reinterpret_cast<char *>(&test);
return p[0] == 0; return p[0] == 0;
} }
@ -268,11 +268,11 @@ void Application::runNativeMessagingHost()
} }
#endif #endif
char *b = (char *)malloc(size + 1); char *b = reinterpret_cast<char *>(malloc(size + 1));
std::cin.read(b, size); std::cin.read(b, size);
*(b + size) = '\0'; *(b + size) = '\0';
app->nativeMessaging->sendToGuiProcess(QByteArray(b, size)); app->nativeMessaging->sendToGuiProcess(QByteArray(b, static_cast<int32_t>(size)));
free(b); free(b);
} }

View file

@ -154,15 +154,8 @@ MessagePtr TwitchMessageBuilder::build()
this->appendTwitchEmote(ircMessage, emote, twitchEmotes); this->appendTwitchEmote(ircMessage, emote, twitchEmotes);
} }
struct { std::sort(twitchEmotes.begin(), twitchEmotes.end(),
bool operator()(const std::pair<long, util::EmoteData> &lhs, [](const auto &a, const auto &b) { return a.first < b.first; });
const std::pair<long, util::EmoteData> &rhs)
{
return lhs.first < rhs.first;
}
} customLess;
std::sort(twitchEmotes.begin(), twitchEmotes.end(), customLess);
} }
auto currentTwitchEmote = twitchEmotes.begin(); auto currentTwitchEmote = twitchEmotes.begin();
@ -588,7 +581,8 @@ void TwitchMessageBuilder::appendTwitchBadges()
// Try to fetch channel-specific bit badge // Try to fetch channel-specific bit badge
try { try {
const auto &badge = channelResources.badgeSets.at("bits").versions.at(versionKey); const auto &badge = channelResources.badgeSets.at("bits").versions.at(versionKey);
this->emplace<ImageElement>(badge.badgeImage1x, MessageElement::BadgeVanity); this->emplace<ImageElement>(badge.badgeImage1x, MessageElement::BadgeVanity)
->setTooltip(QString("Twitch Bits (") + cheerAmountQS + ")");
continue; continue;
} catch (const std::out_of_range &) { } catch (const std::out_of_range &) {
// Channel does not contain a special bit badge for this version // Channel does not contain a special bit badge for this version

View file

@ -2,6 +2,7 @@
#include "util/emotemap.hpp" #include "util/emotemap.hpp"
#include <QIcon>
#include <QRegularExpression> #include <QRegularExpression>
#include <map> #include <map>