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/";
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -321,12 +321,11 @@ void DataDragon::getChampsInternal() {
|
|||
|
||||
QJsonObject obj = jchamps.object();
|
||||
auto it = obj.constFind("data");
|
||||
if(it != obj.constEnd() && it.value().isObject()) {
|
||||
QJsonObject jchampsdata = it.value().toObject();
|
||||
for(auto champit = jchampsdata.constBegin(); champit != jchampsdata.constEnd(); champit++) {
|
||||
if(champit.value().isObject()) {
|
||||
champs.emplace_back(champit.value().toObject());
|
||||
notDownloadedImages.insert(champs.back().id);
|
||||
if(it != obj.constEnd() && it->isObject()) {
|
||||
for(auto&& champdata : it->toObject()) {
|
||||
if(champdata.isObject()) {
|
||||
auto& dataobj = champs.emplace_back(champdata.toObject());
|
||||
notDownloadedImages.insert(dataobj.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -369,8 +368,7 @@ void DataDragon::threadLoop() {
|
|||
lock.unlock();
|
||||
|
||||
auto it = notDownloadedImages.begin();
|
||||
QString champid = *it;
|
||||
notDownloadedImages.erase(it);
|
||||
auto champid = std::move(notDownloadedImages.extract(it).value());
|
||||
|
||||
prefetchChampImage(champid, ImageType::SQUARE);
|
||||
|
||||
|
|
Loading…
Reference in New Issue