removed old NetworkRequest api

This commit is contained in:
fourtf
2019-08-20 21:50:36 +02:00
parent a7cd1fbf97
commit 7697ec01b4
23 changed files with 954 additions and 1101 deletions
+22 -25
View File
@@ -554,34 +554,31 @@ void Split::showViewerList()
}
auto loadingLabel = new QLabel("Loading...");
auto request = NetworkRequest::twitchRequest(
"https://tmi.twitch.tv/group/user/" + this->getChannel()->getName() +
"/chatters");
NetworkRequest::twitchRequest("https://tmi.twitch.tv/group/user/" +
this->getChannel()->getName() + "/chatters")
.caller(this)
.onSuccess([=](auto result) -> Outcome {
auto obj = result.parseJson();
QJsonObject chattersObj = obj.value("chatters").toObject();
request.setCaller(this);
request.onSuccess([=](auto result) -> Outcome {
auto obj = result.parseJson();
QJsonObject chattersObj = obj.value("chatters").toObject();
loadingLabel->hide();
for (int i = 0; i < jsonLabels.size(); i++)
{
auto currentCategory =
chattersObj.value(jsonLabels.at(i)).toArray();
// If current category of chatters is empty, dont show this
// category.
if (currentCategory.empty())
continue;
loadingLabel->hide();
for (int i = 0; i < jsonLabels.size(); i++)
{
auto currentCategory =
chattersObj.value(jsonLabels.at(i)).toArray();
// If current category of chatters is empty, dont show this
// category.
if (currentCategory.empty())
continue;
chattersList->addItem(labelList.at(i));
foreach (const QJsonValue &v, currentCategory)
chattersList->addItem(v.toString());
}
chattersList->addItem(labelList.at(i));
foreach (const QJsonValue &v, currentCategory)
chattersList->addItem(v.toString());
}
return Success;
});
request.execute();
return Success;
})
.execute();
searchBar->setPlaceholderText("Search User...");
QObject::connect(searchBar, &QLineEdit::textEdited, this, [=]() {