keep the icon suffix
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
7e58b965b7
commit
97ff7afbe7
@ -284,28 +284,27 @@ QString NewInstanceDialog::iconKey() const
|
|||||||
|
|
||||||
void NewInstanceDialog::on_iconButton_clicked()
|
void NewInstanceDialog::on_iconButton_clicked()
|
||||||
{
|
{
|
||||||
importIconNow(); //so the user can switch back
|
importIconNow(); // so the user can switch back
|
||||||
IconPickerDialog dlg(this);
|
IconPickerDialog dlg(this);
|
||||||
dlg.execWithSelection(InstIconKey);
|
dlg.execWithSelection(InstIconKey);
|
||||||
|
|
||||||
if (dlg.result() == QDialog::Accepted)
|
if (dlg.result() == QDialog::Accepted) {
|
||||||
{
|
|
||||||
InstIconKey = dlg.selectedIconKey;
|
InstIconKey = dlg.selectedIconKey;
|
||||||
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
||||||
importIcon = false;
|
importIcon = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1)
|
void NewInstanceDialog::on_instNameTextBox_textChanged(const QString& arg1)
|
||||||
{
|
{
|
||||||
updateDialogState();
|
updateDialogState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewInstanceDialog::importIconNow()
|
void NewInstanceDialog::importIconNow()
|
||||||
{
|
{
|
||||||
if(importIcon) {
|
if (importIcon) {
|
||||||
APPLICATION->icons()->installIcon(importIconPath, importIconName);
|
APPLICATION->icons()->installIcon(importIconPath, importIconName);
|
||||||
InstIconKey = importIconName;
|
InstIconKey = importIconName.section('.', 0, 0);
|
||||||
importIcon = false;
|
importIcon = false;
|
||||||
}
|
}
|
||||||
APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
||||||
|
@ -137,8 +137,7 @@ void ListModel::requestFailed(QString reason)
|
|||||||
void ListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback)
|
void ListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback)
|
||||||
{
|
{
|
||||||
if (m_logoMap.contains(logo)) {
|
if (m_logoMap.contains(logo)) {
|
||||||
callback(
|
callback(APPLICATION->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(logo))->getFullPath());
|
||||||
APPLICATION->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
|
|
||||||
} else {
|
} else {
|
||||||
requestLogo(logo, logoUrl);
|
requestLogo(logo, logoUrl);
|
||||||
}
|
}
|
||||||
@ -168,7 +167,7 @@ void ListModel::requestLogo(QString file, QString url)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
|
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(file));
|
||||||
auto job = new NetJob(QString("ATLauncher Icon Download %1").arg(file), APPLICATION->network());
|
auto job = new NetJob(QString("ATLauncher Icon Download %1").arg(file), APPLICATION->network());
|
||||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||||
|
|
||||||
|
@ -40,14 +40,16 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
|
|||||||
return edit;
|
return edit;
|
||||||
}
|
}
|
||||||
return pack.description;
|
return pack.description;
|
||||||
} case Qt::DecorationRole: {
|
}
|
||||||
|
case Qt::DecorationRole: {
|
||||||
if (m_logoMap.contains(pack.logoName)) {
|
if (m_logoMap.contains(pack.logoName)) {
|
||||||
return (m_logoMap.value(pack.logoName));
|
return (m_logoMap.value(pack.logoName));
|
||||||
}
|
}
|
||||||
QIcon icon = APPLICATION->getThemedIcon("screenshot-placeholder");
|
QIcon icon = APPLICATION->getThemedIcon("screenshot-placeholder");
|
||||||
((ListModel*)this)->requestLogo(pack.logoName, pack.logoUrl);
|
((ListModel*)this)->requestLogo(pack.logoName, pack.logoUrl);
|
||||||
return icon;
|
return icon;
|
||||||
} case Qt::UserRole: {
|
}
|
||||||
|
case Qt::UserRole: {
|
||||||
QVariant v;
|
QVariant v;
|
||||||
v.setValue(pack);
|
v.setValue(pack);
|
||||||
return v;
|
return v;
|
||||||
@ -68,7 +70,7 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ListModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool ListModel::setData(const QModelIndex& index, const QVariant& value, int role)
|
||||||
{
|
{
|
||||||
int pos = index.row();
|
int pos = index.row();
|
||||||
if (pos >= modpacks.size() || pos < 0 || !index.isValid())
|
if (pos >= modpacks.size() || pos < 0 || !index.isValid())
|
||||||
@ -102,7 +104,7 @@ void ListModel::requestLogo(QString logo, QString url)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)));
|
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo));
|
||||||
auto job = new NetJob(QString("Flame Icon Download %1").arg(logo), APPLICATION->network());
|
auto job = new NetJob(QString("Flame Icon Download %1").arg(logo), APPLICATION->network());
|
||||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||||
|
|
||||||
@ -128,7 +130,7 @@ void ListModel::requestLogo(QString logo, QString url)
|
|||||||
void ListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback)
|
void ListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback)
|
||||||
{
|
{
|
||||||
if (m_logoMap.contains(logo)) {
|
if (m_logoMap.contains(logo)) {
|
||||||
callback(APPLICATION->metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
|
callback(APPLICATION->metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo))->getFullPath());
|
||||||
} else {
|
} else {
|
||||||
requestLogo(logo, logoUrl);
|
requestLogo(logo, logoUrl);
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@
|
|||||||
#include "FlameModel.h"
|
#include "FlameModel.h"
|
||||||
#include "InstanceImportTask.h"
|
#include "InstanceImportTask.h"
|
||||||
#include "Json.h"
|
#include "Json.h"
|
||||||
|
#include "modplatform/flame/FlameAPI.h"
|
||||||
#include "ui/dialogs/NewInstanceDialog.h"
|
#include "ui/dialogs/NewInstanceDialog.h"
|
||||||
#include "ui/widgets/ProjectItem.h"
|
#include "ui/widgets/ProjectItem.h"
|
||||||
#include "modplatform/flame/FlameAPI.h"
|
|
||||||
|
|
||||||
static FlameAPI api;
|
static FlameAPI api;
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ void FlamePage::suggestCurrent()
|
|||||||
|
|
||||||
dialog->setSuggestedPack(current.name, new InstanceImportTask(version.downloadUrl, this, std::move(extra_info)));
|
dialog->setSuggestedPack(current.name, new InstanceImportTask(version.downloadUrl, this, std::move(extra_info)));
|
||||||
QString editedLogoName;
|
QString editedLogoName;
|
||||||
editedLogoName = "curseforge_" + current.logoName.section(".", 0, 0);
|
editedLogoName = "curseforge_" + current.logoName;
|
||||||
listModel->getLogo(current.logoName, current.logoUrl,
|
listModel->getLogo(current.logoName, current.logoUrl,
|
||||||
[this, editedLogoName](QString logo) { dialog->setSuggestedIconFromFile(logo, editedLogoName); });
|
[this, editedLogoName](QString logo) { dialog->setSuggestedIconFromFile(logo, editedLogoName); });
|
||||||
}
|
}
|
||||||
@ -252,10 +252,8 @@ void FlamePage::updateUi()
|
|||||||
text += "<br>" + tr(" by ") + authorStrs.join(", ");
|
text += "<br>" + tr(" by ") + authorStrs.join(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(current.extraInfoLoaded) {
|
if (current.extraInfoLoaded) {
|
||||||
if (!current.extra.issuesUrl.isEmpty()
|
if (!current.extra.issuesUrl.isEmpty() || !current.extra.sourceUrl.isEmpty() || !current.extra.wikiUrl.isEmpty()) {
|
||||||
|| !current.extra.sourceUrl.isEmpty()
|
|
||||||
|| !current.extra.wikiUrl.isEmpty()) {
|
|
||||||
text += "<br><br>" + tr("External links:") + "<br>";
|
text += "<br><br>" + tr("External links:") + "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +265,6 @@ void FlamePage::updateUi()
|
|||||||
text += "- " + tr("Source code: <a href=%1>%1</a>").arg(current.extra.sourceUrl) + "<br>";
|
text += "- " + tr("Source code: <a href=%1>%1</a>").arg(current.extra.sourceUrl) + "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
text += "<hr>";
|
text += "<hr>";
|
||||||
text += api.getModDescription(current.addonId).toUtf8();
|
text += api.getModDescription(current.addonId).toUtf8();
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ void ListModel::requestLogo(QString file)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
|
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file));
|
||||||
NetJob* job = new NetJob(QString("FTB Icon Download for %1").arg(file), APPLICATION->network());
|
NetJob* job = new NetJob(QString("FTB Icon Download for %1").arg(file), APPLICATION->network());
|
||||||
job->addNetAction(Net::Download::makeCached(QUrl(QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry));
|
job->addNetAction(Net::Download::makeCached(QUrl(QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry));
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ void ListModel::requestLogo(QString file)
|
|||||||
void ListModel::getLogo(const QString& logo, LogoCallback callback)
|
void ListModel::getLogo(const QString& logo, LogoCallback callback)
|
||||||
{
|
{
|
||||||
if (m_logoMap.contains(logo)) {
|
if (m_logoMap.contains(logo)) {
|
||||||
callback(APPLICATION->metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
|
callback(APPLICATION->metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(logo))->getFullPath());
|
||||||
} else {
|
} else {
|
||||||
requestLogo(logo);
|
requestLogo(logo);
|
||||||
}
|
}
|
||||||
|
@ -218,9 +218,7 @@ void ModpackListModel::searchWithTerm(const QString& term, const int sort)
|
|||||||
void ModpackListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback)
|
void ModpackListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback)
|
||||||
{
|
{
|
||||||
if (m_logoMap.contains(logo)) {
|
if (m_logoMap.contains(logo)) {
|
||||||
callback(APPLICATION->metacache()
|
callback(APPLICATION->metacache()->resolveEntry(m_parent->metaEntryBase(), QString("logos/%1").arg(logo))->getFullPath());
|
||||||
->resolveEntry(m_parent->metaEntryBase(), QString("logos/%1").arg(logo.section(".", 0, 0)))
|
|
||||||
->getFullPath());
|
|
||||||
} else {
|
} else {
|
||||||
requestLogo(logo, logoUrl);
|
requestLogo(logo, logoUrl);
|
||||||
}
|
}
|
||||||
@ -232,8 +230,7 @@ void ModpackListModel::requestLogo(QString logo, QString url)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaEntryPtr entry =
|
MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry(m_parent->metaEntryBase(), QString("logos/%1").arg(logo));
|
||||||
APPLICATION->metacache()->resolveEntry(m_parent->metaEntryBase(), QString("logos/%1").arg(logo.section(".", 0, 0)));
|
|
||||||
auto job = new NetJob(QString("%1 Icon Download %2").arg(m_parent->debugName()).arg(logo), APPLICATION->network());
|
auto job = new NetJob(QString("%1 Icon Download %2").arg(m_parent->debugName()).arg(logo), APPLICATION->network());
|
||||||
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ void Technic::ListModel::searchRequestFinished()
|
|||||||
pack.logoName = "null";
|
pack.logoName = "null";
|
||||||
} else {
|
} else {
|
||||||
pack.logoUrl = rawURL;
|
pack.logoUrl = rawURL;
|
||||||
pack.logoName = rawURL.section(QLatin1Char('/'), -1).section(QLatin1Char('.'), 0, 0);
|
pack.logoName = rawURL.section(QLatin1Char('/'), -1);
|
||||||
}
|
}
|
||||||
pack.broken = false;
|
pack.broken = false;
|
||||||
newList.append(pack);
|
newList.append(pack);
|
||||||
@ -179,7 +179,7 @@ void Technic::ListModel::searchRequestFinished()
|
|||||||
auto iconUrl = Json::requireString(iconObj, "url");
|
auto iconUrl = Json::requireString(iconObj, "url");
|
||||||
|
|
||||||
pack.logoUrl = iconUrl;
|
pack.logoUrl = iconUrl;
|
||||||
pack.logoName = iconUrl.section(QLatin1Char('/'), -1).section(QLatin1Char('.'), 0, 0);
|
pack.logoName = iconUrl.section(QLatin1Char('/'), -1);
|
||||||
} else {
|
} else {
|
||||||
pack.logoUrl = "null";
|
pack.logoUrl = "null";
|
||||||
pack.logoName = "null";
|
pack.logoName = "null";
|
||||||
|
@ -129,14 +129,11 @@ void TechnicPage::suggestCurrent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString editedLogoName = "technic_" + current.logoName.section(".", 0, 0);
|
QString editedLogoName = "technic_" + current.logoName;
|
||||||
model->getLogo(current.logoName, current.logoUrl, [this, editedLogoName](QString logo)
|
model->getLogo(current.logoName, current.logoUrl,
|
||||||
{
|
[this, editedLogoName](QString logo) { dialog->setSuggestedIconFromFile(logo, editedLogoName); });
|
||||||
dialog->setSuggestedIconFromFile(logo, editedLogoName);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (current.metadataLoaded)
|
if (current.metadataLoaded) {
|
||||||
{
|
|
||||||
metadataLoaded();
|
metadataLoaded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user