added namespaces

This commit is contained in:
fourtf
2017-01-18 21:30:23 +01:00
parent 82338baaa3
commit 2e8dc63a95
82 changed files with 681 additions and 459 deletions
+17 -11
View File
@@ -1,17 +1,21 @@
#include "emotes.h"
#include "resources.h"
namespace chatterino {
QString Emotes::twitchEmoteTemplate(
"https://static-cdn.jtvnw.net/emoticons/v1/{id}/{scale}.0");
ConcurrentMap<QString, TwitchEmoteValue *> Emotes::twitchEmotes;
ConcurrentMap<QString, LazyLoadedImage *> Emotes::bttvEmotes;
ConcurrentMap<QString, LazyLoadedImage *> Emotes::ffzEmotes;
ConcurrentMap<QString, LazyLoadedImage *> Emotes::chatterinoEmotes;
ConcurrentMap<QString, LazyLoadedImage *> Emotes::bttvChannelEmoteFromCaches;
ConcurrentMap<QString, LazyLoadedImage *> Emotes::ffzChannelEmoteFromCaches;
ConcurrentMap<long, LazyLoadedImage *> Emotes::twitchEmoteFromCache;
ConcurrentMap<QString, LazyLoadedImage *> Emotes::miscImageFromCache;
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::bttvEmotes;
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::ffzEmotes;
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::chatterinoEmotes;
ConcurrentMap<QString, messages::LazyLoadedImage *>
Emotes::bttvChannelEmoteFromCaches;
ConcurrentMap<QString, messages::LazyLoadedImage *>
Emotes::ffzChannelEmoteFromCaches;
ConcurrentMap<long, messages::LazyLoadedImage *> Emotes::twitchEmoteFromCache;
ConcurrentMap<QString, messages::LazyLoadedImage *> Emotes::miscImageFromCache;
int Emotes::generation = 0;
@@ -19,13 +23,14 @@ Emotes::Emotes()
{
}
LazyLoadedImage *
messages::LazyLoadedImage *
Emotes::getTwitchEmoteById(const QString &name, long id)
{
return Emotes::twitchEmoteFromCache.getOrAdd(id, [&name, id] {
qreal scale;
QString url = getTwitchEmoteLink(id, scale);
return new LazyLoadedImage(url, scale, name, name + "\nTwitch Emote");
return new messages::LazyLoadedImage(url, scale, name,
name + "\nTwitch Emote");
});
}
@@ -38,14 +43,14 @@ Emotes::getTwitchEmoteLink(long id, qreal &scale)
.replace("{scale}", "2");
}
LazyLoadedImage *
messages::LazyLoadedImage *
Emotes::getCheerImage(long long amount, bool animated)
{
// TODO: fix this xD
return getCheerBadge(amount);
}
LazyLoadedImage *
messages::LazyLoadedImage *
Emotes::getCheerBadge(long long amount)
{
if (amount >= 100000) {
@@ -62,3 +67,4 @@ Emotes::getCheerBadge(long long amount)
return Resources::getCheerBadge1();
}
}
}