this commit is too big

This commit is contained in:
fourtf
2018-08-02 14:23:27 +02:00
parent 3b3c5d8d75
commit c2e2dfb577
186 changed files with 3626 additions and 2656 deletions
+19 -19
View File
@@ -46,7 +46,7 @@ EmotePopup::EmotePopup()
void EmotePopup::loadChannel(ChannelPtr _channel)
{
this->setWindowTitle("Emotes from " + _channel->name);
this->setWindowTitle("Emotes from " + _channel->getName());
TwitchChannel *channel = dynamic_cast<TwitchChannel *>(_channel.get());
@@ -70,21 +70,19 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
builder2.getMessage()->flags |= Message::Centered;
builder2.getMessage()->flags |= Message::DisableCompactEmotes;
map.each([&](const QString &key, const EmoteData &value) {
builder2.append((new EmoteElement(value, MessageElement::Flags::AlwaysShow))
->setLink(Link(Link::InsertText, key)));
});
for (auto emote : map) {
builder2.append((new EmoteElement(emote.second, MessageElement::Flags::AlwaysShow))
->setLink(Link(Link::InsertText, emote.first.string)));
}
emoteChannel->addMessage(builder2.getMessage());
};
auto app = getApp();
QString userID = app->accounts->twitch.getCurrent()->getUserId();
// fourtf: the entire emote manager needs to be refactored so there's no point in trying to
// fix this pile of garbage
for (const auto &set : app->emotes->twitch.emotes[userID].emoteSets) {
for (const auto &set : app->accounts->twitch.getCurrent()->accessEmotes()->emoteSets) {
// TITLE
MessageBuilder builder1;
@@ -110,20 +108,22 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
builder2.getMessage()->flags |= Message::DisableCompactEmotes;
for (const auto &emote : set->emotes) {
[&](const QString &key, const EmoteData &value) {
builder2.append((new EmoteElement(value, MessageElement::Flags::AlwaysShow))
->setLink(Link(Link::InsertText, key)));
}(emote.code, app->emotes->twitch.getEmoteById(emote.id, emote.code));
builder2.append(
(new EmoteElement(app->emotes->twitch.getOrCreateEmote(emote.id, emote.name),
MessageElement::Flags::AlwaysShow))
->setLink(Link(Link::InsertText, emote.name.string)));
}
emoteChannel->addMessage(builder2.getMessage());
}
addEmotes(app->emotes->bttv.globalEmotes, "BetterTTV Global Emotes", "BetterTTV Global Emote");
addEmotes(channel->getBttvEmotes(), "BetterTTV Channel Emotes", "BetterTTV Channel Emote");
addEmotes(app->emotes->ffz.globalEmotes, "FrankerFaceZ Global Emotes",
"FrankerFaceZ Global Emote");
addEmotes(channel->getFfzEmotes(), "FrankerFaceZ Channel Emotes", "FrankerFaceZ Channel Emote");
addEmotes(*app->emotes->bttv.accessGlobalEmotes(), "BetterTTV Global Emotes",
"BetterTTV Global Emote");
addEmotes(*channel->accessBttvEmotes(), "BetterTTV Channel Emotes", "BetterTTV Channel Emote");
// addEmotes(*app->emotes->ffz.accessGlobalEmotes(), "FrankerFaceZ Global Emotes",
// "FrankerFaceZ Global Emote");
addEmotes(*channel->accessFfzEmotes(), "FrankerFaceZ Channel Emotes",
"FrankerFaceZ Channel Emote");
this->viewEmotes_->setChannel(emoteChannel);
}
@@ -146,9 +146,9 @@ void EmotePopup::loadEmojis()
builder.getMessage()->flags |= Message::Centered;
builder.getMessage()->flags |= Message::DisableCompactEmotes;
emojis.each([&builder](const QString &key, const auto &value) {
emojis.each([&builder](const auto &key, const auto &value) {
builder.append(
(new EmoteElement(value->emoteData, MessageElement::Flags::AlwaysShow))
(new EmoteElement(value->emote, MessageElement::Flags::AlwaysShow))
->setLink(Link(Link::Type::InsertText, ":" + value->shortCodes[0] + ":")));
});
emojiChannel->addMessage(builder.getMessage());
+7 -7
View File
@@ -34,7 +34,7 @@ void LogsPopup::setInfo(ChannelPtr channel, QString userName)
{
this->channel_ = channel;
this->userName_ = userName;
this->setWindowTitle(this->userName_ + "'s logs in #" + this->channel_->name);
this->setWindowTitle(this->userName_ + "'s logs in #" + this->channel_->getName());
this->getLogviewerLogs();
}
@@ -53,7 +53,7 @@ void LogsPopup::getLogviewerLogs()
return;
}
QString channelName = twitchChannel->name;
QString channelName = twitchChannel->getName();
QString url = QString("https://cbenni.com/api/logs/%1/?nick=%2&before=500")
.arg(channelName, this->userName_);
@@ -66,7 +66,7 @@ void LogsPopup::getLogviewerLogs()
return true;
});
req.onSuccess([this, channelName](auto result) {
req.onSuccess([this, channelName](auto result) -> Outcome {
auto data = result.parseJson();
std::vector<MessagePtr> messages;
ChannelPtr logsChannel(new Channel("logs", Channel::Type::None));
@@ -89,7 +89,7 @@ void LogsPopup::getLogviewerLogs()
};
this->setMessages(messages);
return true;
return Success;
});
req.execute();
@@ -102,7 +102,7 @@ void LogsPopup::getOverrustleLogs()
return;
}
QString channelName = twitchChannel->name;
QString channelName = twitchChannel->getName();
QString url = QString("https://overrustlelogs.net/api/v1/stalk/%1/%2.json?limit=500")
.arg(channelName, this->userName_);
@@ -120,7 +120,7 @@ void LogsPopup::getOverrustleLogs()
return true;
});
req.onSuccess([this, channelName](auto result) {
req.onSuccess([this, channelName](auto result) -> Outcome {
auto data = result.parseJson();
std::vector<MessagePtr> messages;
if (data.contains("lines")) {
@@ -141,7 +141,7 @@ void LogsPopup::getOverrustleLogs()
}
this->setMessages(messages);
return true;
return Success;
});
req.execute();
+1 -1
View File
@@ -154,7 +154,7 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
case Channel::Type::Twitch: {
this->ui_.notebook->selectIndex(TAB_TWITCH);
this->ui_.twitch.channel->setFocus();
this->ui_.twitch.channelName->setText(channel->name);
this->ui_.twitch.channelName->setText(channel->getName());
} break;
case Channel::Type::TwitchWatching: {
this->ui_.notebook->selectIndex(TAB_TWITCH);
+4 -2
View File
@@ -16,6 +16,8 @@
#include <QCheckBox>
#include <QDesktopServices>
#include <QLabel>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#define TEXT_FOLLOWERS "Followers: "
#define TEXT_VIEWS "Views: "
@@ -255,7 +257,7 @@ void UserInfoPopup::updateUserData()
auto request = NetworkRequest::twitchRequest(url);
request.setCaller(this);
request.onSuccess([this](auto result) {
request.onSuccess([this](auto result) -> Outcome {
auto obj = result.parseJson();
this->ui_.followerCountLabel->setText(TEXT_FOLLOWERS +
QString::number(obj.value("followers").toInt()));
@@ -266,7 +268,7 @@ void UserInfoPopup::updateUserData()
this->loadAvatar(QUrl(obj.value("logo").toString()));
return true;
return Success;
});
request.execute();