forked from MrBesen/lolautoaccept
Compare commits
3 Commits
12a2d71762
...
5d0795dbd0
Author | SHA1 | Date |
---|---|---|
Oliver | 5d0795dbd0 | |
Oliver | 9f2b175502 | |
Oliver | 2fdb7544c8 |
|
@ -18,7 +18,7 @@
|
||||||
static const QString BASEURL = "https://ddragon.leagueoflegends.com/";
|
static const QString BASEURL = "https://ddragon.leagueoflegends.com/";
|
||||||
const DataDragon::ChampData DataDragon::EMPTYCHAMP;
|
const DataDragon::ChampData DataDragon::EMPTYCHAMP;
|
||||||
|
|
||||||
DataDragon::DataDragon(const QString& locale) : RestClient(BASEURL), locale(locale), cache({{"square", ".png"}, {"loading", "_0.jpg"}, {"splash", "_0.jpg"}}) {
|
DataDragon::DataDragon(const QString& locale) : RestClient(BASEURL), locale(locale), cache{{"square", ".png"}, {"loading", "_0.jpg"}, {"splash", "_0.jpg"}} {
|
||||||
this->setObjectName("DataDragon");
|
this->setObjectName("DataDragon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,12 +321,11 @@ void DataDragon::getChampsInternal() {
|
||||||
|
|
||||||
QJsonObject obj = jchamps.object();
|
QJsonObject obj = jchamps.object();
|
||||||
auto it = obj.constFind("data");
|
auto it = obj.constFind("data");
|
||||||
if(it != obj.constEnd() && it.value().isObject()) {
|
if(it != obj.constEnd() && it->isObject()) {
|
||||||
QJsonObject jchampsdata = it.value().toObject();
|
for(auto&& champdata : it->toObject()) {
|
||||||
for(auto champit = jchampsdata.constBegin(); champit != jchampsdata.constEnd(); champit++) {
|
if(champdata.isObject()) {
|
||||||
if(champit.value().isObject()) {
|
auto& dataobj = champs.emplace_back(champdata.toObject());
|
||||||
champs.emplace_back(champit.value().toObject());
|
notDownloadedImages.insert(dataobj.id);
|
||||||
notDownloadedImages.insert(champs.back().id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,8 +368,7 @@ void DataDragon::threadLoop() {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
auto it = notDownloadedImages.begin();
|
auto it = notDownloadedImages.begin();
|
||||||
QString champid = *it;
|
auto champid = std::move(notDownloadedImages.extract(it).value());
|
||||||
notDownloadedImages.erase(it);
|
|
||||||
|
|
||||||
prefetchChampImage(champid, ImageType::SQUARE);
|
prefetchChampImage(champid, ImageType::SQUARE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue