fix build

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2025-11-28 00:12:15 +02:00
parent 7ee4b35aee
commit 77f41a2a29
No known key found for this signature in database
GPG key ID: 55EF5DA53DB36318
6 changed files with 18 additions and 17 deletions

View file

@ -92,7 +92,7 @@ void PackInstallTask::executeTask()
auto searchUrl = QString(BuildConfig.FTB_API_BASE_URL + "/modpack/%1/%2").arg(m_pack.id).arg(version.id);
m_response.reset(new QByteArray());
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), m_response));
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), m_response.get()));
QObject::connect(netJob.get(), &NetJob::succeeded, this, &PackInstallTask::onManifestDownloadSucceeded);
QObject::connect(netJob.get(), &NetJob::failed, this, &PackInstallTask::onManifestDownloadFailed);
@ -233,9 +233,9 @@ void PackInstallTask::createInstance()
QCoreApplication::processEvents();
auto instanceConfigPath = FS::PathCombine(m_stagingPath, "instance.cfg");
auto instanceSettings = std::make_shared<INISettingsObject>(instanceConfigPath);
auto instanceSettings = std::make_unique<INISettingsObject>(instanceConfigPath);
MinecraftInstance instance(m_globalSettings, instanceSettings, m_stagingPath);
MinecraftInstance instance(m_globalSettings, std::move(instanceSettings), m_stagingPath);
auto components = instance.getPackProfile();
components->buildingFromScratch();

View file

@ -84,7 +84,7 @@ class PackInstallTask final : public InstanceTask {
QList<int> m_fileIds;
std::shared_ptr<QByteArray> m_response;
std::unique_ptr<QByteArray> m_response;
Modpack m_pack;
QString m_versionName;

View file

@ -60,7 +60,7 @@ static void loadArt(FTB::Art& a, QJsonObject& obj)
a.height = Json::requireInteger(obj, "height");
a.compressed = Json::requireBoolean(obj, "compressed");
a.sha1 = Json::requireString(obj, "sha1");
a.size = Json::ensureInteger(obj, "size");
a.size = obj["size"].toInt();
a.updated = Json::requireInteger(obj, "updated");
}
@ -95,7 +95,7 @@ void FTB::loadModpack(FTB::Modpack& m, QJsonObject& obj)
m.installs = Json::requireInteger(obj, "installs");
m.plays = Json::requireInteger(obj, "plays");
m.updated = Json::requireInteger(obj, "updated");
m.refreshed = Json::ensureInteger(obj, "refreshed");
m.refreshed = obj["refreshed"].toInt();
auto artArr = Json::requireArray(obj, "art");
for (QJsonValueRef artRaw : artArr) {
auto artObj = Json::requireObject(artRaw);
@ -143,16 +143,16 @@ static void loadVersionFile(FTB::VersionFile& a, QJsonObject& obj)
a.path = Json::requireString(obj, "path");
a.name = Json::requireString(obj, "name");
a.version = Json::requireString(obj, "version");
a.url = Json::ensureString(obj, "url"); // optional
a.url = obj["url"].toString(); // optional
a.sha1 = Json::requireString(obj, "sha1");
a.size = Json::ensureInteger(obj, "size");
a.size = obj["size"].toInt();
a.clientOnly = Json::requireBoolean(obj, "clientonly");
a.serverOnly = Json::requireBoolean(obj, "serveronly");
a.optional = Json::requireBoolean(obj, "optional");
a.updated = Json::requireInteger(obj, "updated");
auto curseforgeObj = Json::ensureObject(obj, "curseforge"); // optional
a.curseforge.project_id = Json::ensureInteger(curseforgeObj, "project");
a.curseforge.file_id = Json::ensureInteger(curseforgeObj, "file");
auto curseforgeObj = obj["curseforge"].toObject(); // optional
a.curseforge.project_id = curseforgeObj["project"].toInt();
a.curseforge.file_id = curseforgeObj["file"].toInt();
}
void FTB::loadVersion(FTB::Version& m, QJsonObject& obj)
@ -164,7 +164,7 @@ void FTB::loadVersion(FTB::Version& m, QJsonObject& obj)
m.installs = Json::requireInteger(obj, "installs");
m.plays = Json::requireInteger(obj, "plays");
m.updated = Json::requireInteger(obj, "updated");
m.refreshed = Json::ensureInteger(obj, "refreshed");
m.refreshed = obj["refreshed"].toInt();
auto specs = Json::requireObject(obj, "specs");
loadSpecs(m.specs, specs);
auto targetArr = Json::requireArray(obj, "targets");

View file

@ -51,7 +51,7 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
} else if (role == Qt::ToolTipRole) {
return pack.synopsis;
} else if (role == Qt::DecorationRole) {
QIcon placeholder = APPLICATION->getThemedIcon("screenshot-placeholder");
QIcon placeholder = QIcon::fromTheme("screenshot-placeholder");
auto iter = m_logoMap.find(pack.safeName);
if (iter != m_logoMap.end()) {
@ -97,7 +97,7 @@ void ListModel::request()
auto netJob = makeShared<NetJob>("Ftb::Request", APPLICATION->network());
auto url = QString(BuildConfig.FTB_API_BASE_URL + "/modpack/all");
m_response.reset(new QByteArray());
netJob->addNetAction(Net::Download::makeByteArray(QUrl(url), m_response));
netJob->addNetAction(Net::Download::makeByteArray(QUrl(url), m_response.get()));
m_jobPtr = netJob;
m_jobPtr->start();
@ -147,7 +147,7 @@ void ListModel::requestPack()
auto netJob = makeShared<NetJob>("Ftb::Search", APPLICATION->network());
auto searchUrl = QString(BuildConfig.FTB_API_BASE_URL + "/modpack/%1").arg(m_currentPack);
m_response.reset(new QByteArray());
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), m_response));
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), m_response.get()));
m_jobPtr = netJob;
m_jobPtr->start();

View file

@ -19,6 +19,7 @@
#include <QAbstractListModel>
#include <QIcon>
#include <memory>
#include "modplatform/ftb/FTBPackManifest.h"
#include "net/NetJob.h"
@ -76,7 +77,7 @@ class ListModel : public QAbstractListModel {
NetJob::Ptr m_jobPtr;
int m_currentPack;
QList<int> m_remainingPacks;
std::shared_ptr<QByteArray> m_response;
std::unique_ptr<QByteArray> m_response;
};
} // namespace Ftb

View file

@ -58,7 +58,7 @@ class FtbPage : public QWidget, public ModpackProviderBasePage {
explicit FtbPage(NewInstanceDialog* dialog, QWidget* parent = 0);
virtual ~FtbPage();
virtual QString displayName() const override { return "FTB"; }
virtual QIcon icon() const override { return APPLICATION->getThemedIcon("ftb_logo"); }
virtual QIcon icon() const override { return QIcon::fromTheme("ftb_logo"); }
virtual QString id() const override { return "ftb"; }
virtual QString helpPage() const override { return "FTB-platform"; }
virtual bool shouldDisplay() const override;