#2228, #2229 - Auto import pack icons and fixed to big version selection - Closes #2228, Closes #2229

This commit is contained in:
Janrupf
2018-04-07 16:15:58 +02:00
committed by Petr Mrázek
parent 38ed0c2a1f
commit 7e1c5d439a
8 changed files with 71 additions and 1 deletions

View File

@ -175,6 +175,9 @@ void FtbListModel::requestLogo(QString file)
auto fullPath = entry->getFullPath();
QObject::connect(job, &NetJob::finished, this, [this, file, fullPath]{
emit logoLoaded(file, QIcon(fullPath));
if(waitingCallbacks.contains(file)) {
waitingCallbacks.value(file)(fullPath);
}
});
QObject::connect(job, &NetJob::failed, this, [this, file]{
@ -185,3 +188,12 @@ void FtbListModel::requestLogo(QString file)
m_loadingLogos.append(file);
}
void FtbListModel::getLogo(const QString &logo, LogoCallback callback)
{
if(m_logoMap.contains(logo)) {
callback(ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
} else {
requestLogo(logo);
}
}