changed technic icon name retrival

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-08-24 13:05:27 +03:00
parent bb4b89470d
commit f897b14e3e
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
3 changed files with 8 additions and 9 deletions

View File

@ -76,7 +76,7 @@ void ImportFTBPage::suggestCurrent()
}
dialog->setSuggestedPack(selected.name, new PackInstallTask(selected));
QString editedLogoName = QString("ftb_%1.jpg").arg(selected.id);
QString editedLogoName = QString("ftb_%1_%2,jpg").arg(selected.name, selected.id);
dialog->setSuggestedIconFromFile(FS::PathCombine(selected.path, "folder.jpg"), editedLogoName);
}

View File

@ -173,11 +173,9 @@ void Page::suggestCurrent()
}
dialog->setSuggestedPack(selected.name, selectedVersion, new PackInstallTask(APPLICATION->network(), selected, selectedVersion));
QString editedLogoName;
if (selected.logo.toLower().startsWith("ftb")) {
editedLogoName = selected.logo;
} else {
editedLogoName = "ftb_" + selected.logo;
QString editedLogoName = selected.logo;
if (!selected.logo.toLower().startsWith("ftb")) {
editedLogoName = "ftb_" + editedLogoName;
}
if (selected.type == PackType::Public) {

View File

@ -34,14 +34,15 @@
*/
#include "TechnicModel.h"
#include <QUrl>
#include "Application.h"
#include "BuildConfig.h"
#include "Json.h"
#include "net/ApiDownload.h"
#include <QFileInfo>
#include <QIcon>
#include <QUrl>
Technic::ListModel::ListModel(QObject* parent) : QAbstractListModel(parent) {}
@ -160,7 +161,7 @@ void Technic::ListModel::searchRequestFinished()
pack.logoName = "null";
} else {
pack.logoUrl = rawURL;
pack.logoName = QUrl(rawURL).fileName();
pack.logoName = pack.slug + "." + QFileInfo(QUrl(rawURL).fileName()).suffix();
}
pack.broken = false;
newList.append(pack);
@ -182,7 +183,7 @@ void Technic::ListModel::searchRequestFinished()
auto iconUrl = Json::requireString(iconObj, "url");
pack.logoUrl = iconUrl;
pack.logoName = QUrl(iconUrl).fileName();
pack.logoName = pack.slug + "." + QFileInfo(QUrl(iconUrl).fileName()).suffix();
} else {
pack.logoUrl = "null";
pack.logoName = "null";