From 147366bc0a905869f41bd8577337354bc7894e88 Mon Sep 17 00:00:00 2001
From: Trial97 <alexandru.tripon97@gmail.com>
Date: Thu, 15 Jun 2023 22:59:41 +0300
Subject: Made ByteSynkArray to use shared_ptr

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
---
 launcher/modplatform/modrinth/ModrinthAPI.cpp      | 22 +++++-----------------
 launcher/modplatform/modrinth/ModrinthAPI.h        | 18 +++++++-----------
 .../modplatform/modrinth/ModrinthCheckUpdate.cpp   |  2 +-
 .../modrinth/ModrinthPackExportTask.cpp            |  4 ++--
 .../modplatform/modrinth/ModrinthPackExportTask.h  |  2 +-
 5 files changed, 16 insertions(+), 32 deletions(-)

(limited to 'launcher/modplatform/modrinth')

diff --git a/launcher/modplatform/modrinth/ModrinthAPI.cpp b/launcher/modplatform/modrinth/ModrinthAPI.cpp
index 29e3d129..364cf3f3 100644
--- a/launcher/modplatform/modrinth/ModrinthAPI.cpp
+++ b/launcher/modplatform/modrinth/ModrinthAPI.cpp
@@ -9,19 +9,17 @@
 #include "net/NetJob.h"
 #include "net/Upload.h"
 
-Task::Ptr ModrinthAPI::currentVersion(QString hash, QString hash_format, QByteArray* response)
+Task::Ptr ModrinthAPI::currentVersion(QString hash, QString hash_format, std::shared_ptr<QByteArray> response)
 {
     auto netJob = makeShared<NetJob>(QString("Modrinth::GetCurrentVersion"), APPLICATION->network());
 
     netJob->addNetAction(Net::Download::makeByteArray(
         QString(BuildConfig.MODRINTH_PROD_URL + "/version_file/%1?algorithm=%2").arg(hash, hash_format), response));
 
-    QObject::connect(netJob.get(), &NetJob::finished, [response] { delete response; });
-
     return netJob;
 }
 
-Task::Ptr ModrinthAPI::currentVersions(const QStringList& hashes, QString hash_format, QByteArray* response)
+Task::Ptr ModrinthAPI::currentVersions(const QStringList& hashes, QString hash_format, std::shared_ptr<QByteArray> response)
 {
     auto netJob = makeShared<NetJob>(QString("Modrinth::GetCurrentVersions"), APPLICATION->network());
 
@@ -35,8 +33,6 @@ Task::Ptr ModrinthAPI::currentVersions(const QStringList& hashes, QString hash_f
 
     netJob->addNetAction(Net::Upload::makeByteArray(QString(BuildConfig.MODRINTH_PROD_URL + "/version_files"), response, body_raw));
 
-    QObject::connect(netJob.get(), &NetJob::finished, [response] { delete response; });
-
     return netJob;
 }
 
@@ -44,7 +40,7 @@ Task::Ptr ModrinthAPI::latestVersion(QString hash,
                                      QString hash_format,
                                      std::optional<std::list<Version>> mcVersions,
                                      std::optional<ModLoaderTypes> loaders,
-                                     QByteArray* response)
+                                     std::shared_ptr<QByteArray> response)
 {
     auto netJob = makeShared<NetJob>(QString("Modrinth::GetLatestVersion"), APPLICATION->network());
 
@@ -67,8 +63,6 @@ Task::Ptr ModrinthAPI::latestVersion(QString hash,
     netJob->addNetAction(Net::Upload::makeByteArray(
         QString(BuildConfig.MODRINTH_PROD_URL + "/version_file/%1/update?algorithm=%2").arg(hash, hash_format), response, body_raw));
 
-    QObject::connect(netJob.get(), &NetJob::finished, [response] { delete response; });
-
     return netJob;
 }
 
@@ -76,7 +70,7 @@ Task::Ptr ModrinthAPI::latestVersions(const QStringList& hashes,
                                       QString hash_format,
                                       std::optional<std::list<Version>> mcVersions,
                                       std::optional<ModLoaderTypes> loaders,
-                                      QByteArray* response)
+                                      std::shared_ptr<QByteArray> response)
 {
     auto netJob = makeShared<NetJob>(QString("Modrinth::GetLatestVersions"), APPLICATION->network());
 
@@ -101,22 +95,16 @@ Task::Ptr ModrinthAPI::latestVersions(const QStringList& hashes,
 
     netJob->addNetAction(Net::Upload::makeByteArray(QString(BuildConfig.MODRINTH_PROD_URL + "/version_files/update"), response, body_raw));
 
-    QObject::connect(netJob.get(), &NetJob::finished, [response] { delete response; });
-
     return netJob;
 }
 
-Task::Ptr ModrinthAPI::getProjects(QStringList addonIds, QByteArray* response) const
+Task::Ptr ModrinthAPI::getProjects(QStringList addonIds, std::shared_ptr<QByteArray> response) const
 {
     auto netJob = makeShared<NetJob>(QString("Modrinth::GetProjects"), APPLICATION->network());
     auto searchUrl = getMultipleModInfoURL(addonIds);
 
     netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), response));
 
-    QObject::connect(netJob.get(), &NetJob::finished, [response, netJob] {
-        delete response;
-    });
-
     return netJob;
 }
 
diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h
index b91ac5c1..98f20b51 100644
--- a/launcher/modplatform/modrinth/ModrinthAPI.h
+++ b/launcher/modplatform/modrinth/ModrinthAPI.h
@@ -12,27 +12,23 @@
 
 class ModrinthAPI : public NetworkResourceAPI {
    public:
-    auto currentVersion(QString hash,
-                        QString hash_format,
-                        QByteArray* response) -> Task::Ptr;
+    auto currentVersion(QString hash, QString hash_format, std::shared_ptr<QByteArray> response) -> Task::Ptr;
 
-    auto currentVersions(const QStringList& hashes,
-                         QString hash_format,
-                         QByteArray* response) -> Task::Ptr;
+    auto currentVersions(const QStringList& hashes, QString hash_format, std::shared_ptr<QByteArray> response) -> Task::Ptr;
 
     auto latestVersion(QString hash,
                        QString hash_format,
                        std::optional<std::list<Version>> mcVersions,
                        std::optional<ModLoaderTypes> loaders,
-                       QByteArray* response) -> Task::Ptr;
+                       std::shared_ptr<QByteArray> response) -> Task::Ptr;
 
     auto latestVersions(const QStringList& hashes,
                         QString hash_format,
-                       std::optional<std::list<Version>> mcVersions,
-                       std::optional<ModLoaderTypes> loaders,
-                        QByteArray* response) -> Task::Ptr;
+                        std::optional<std::list<Version>> mcVersions,
+                        std::optional<ModLoaderTypes> loaders,
+                        std::shared_ptr<QByteArray> response) -> Task::Ptr;
 
-    Task::Ptr getProjects(QStringList addonIds, QByteArray* response) const override;
+    Task::Ptr getProjects(QStringList addonIds, std::shared_ptr<QByteArray> response) const override;
 
    public:
     [[nodiscard]] auto getSortingMethods() const -> QList<ResourceAPI::SortingMethod> override;
diff --git a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
index 4fe91ce7..6a3f12f9 100644
--- a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
+++ b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
@@ -71,7 +71,7 @@ void ModrinthCheckUpdate::executeTask()
     hashing_task.start();
     loop.exec();
 
-    auto* response = new QByteArray();
+    auto response = std::make_shared<QByteArray>();
     auto job = api.latestVersions(hashes, best_hash_type, m_game_versions, m_loaders, response);
 
     QEventLoop lock;
diff --git a/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp b/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp
index bff9bf42..c607bb89 100644
--- a/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp
+++ b/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp
@@ -157,7 +157,7 @@ void ModrinthPackExportTask::makeApiRequest()
     if (pendingHashes.isEmpty())
         buildZip();
     else {
-        QByteArray* response = new QByteArray;
+        auto response = std::make_shared<QByteArray>();
         task = api.currentVersions(pendingHashes.values(), "sha512", response);
         connect(task.get(), &NetJob::succeeded, [this, response]() { parseApiResponse(response); });
         connect(task.get(), &NetJob::failed, this, &ModrinthPackExportTask::emitFailed);
@@ -165,7 +165,7 @@ void ModrinthPackExportTask::makeApiRequest()
     }
 }
 
-void ModrinthPackExportTask::parseApiResponse(const QByteArray* response)
+void ModrinthPackExportTask::parseApiResponse(const std::shared_ptr<QByteArray> response)
 {
     task = nullptr;
 
diff --git a/launcher/modplatform/modrinth/ModrinthPackExportTask.h b/launcher/modplatform/modrinth/ModrinthPackExportTask.h
index af00ffaa..96f292c1 100644
--- a/launcher/modplatform/modrinth/ModrinthPackExportTask.h
+++ b/launcher/modplatform/modrinth/ModrinthPackExportTask.h
@@ -69,7 +69,7 @@ class ModrinthPackExportTask : public Task {
     void collectFiles();
     void collectHashes();
     void makeApiRequest();
-    void parseApiResponse(const QByteArray* response);
+    void parseApiResponse(const std::shared_ptr<QByteArray> response);
     void buildZip();
     void finish();
 
-- 
cgit 


From 0161520b332f485483f57acc305ad71a00d63fbc Mon Sep 17 00:00:00 2001
From: Trial97 <alexandru.tripon97@gmail.com>
Date: Sun, 18 Jun 2023 23:27:26 +0300
Subject: Fixed leaks

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
---
 launcher/modplatform/EnsureMetadataTask.cpp        |   9 +-
 .../modplatform/atlauncher/ATLPackInstallTask.h    |  40 ++++----
 launcher/modplatform/helpers/HashUtils.cpp         |  14 +--
 launcher/modplatform/helpers/HashUtils.h           |   6 ++
 .../modplatform/modrinth/ModrinthCheckUpdate.cpp   |   5 +-
 launcher/ui/dialogs/NewsDialog.cpp                 |   2 +-
 .../pages/modplatform/atlauncher/AtlListModel.cpp  |  91 +++++++----------
 .../atlauncher/AtlUserInteractionSupportImpl.h     |   8 +-
 .../ui/pages/modplatform/legacy_ftb/ListModel.cpp  | 112 ++++++++-------------
 .../ui/pages/modplatform/technic/TechnicModel.cpp  | 106 +++++++------------
 10 files changed, 164 insertions(+), 229 deletions(-)

(limited to 'launcher/modplatform/modrinth')

diff --git a/launcher/modplatform/EnsureMetadataTask.cpp b/launcher/modplatform/EnsureMetadataTask.cpp
index 080dd580..a04a2534 100644
--- a/launcher/modplatform/EnsureMetadataTask.cpp
+++ b/launcher/modplatform/EnsureMetadataTask.cpp
@@ -10,6 +10,7 @@
 
 #include "modplatform/flame/FlameAPI.h"
 #include "modplatform/flame/FlameModIndex.h"
+#include "modplatform/helpers/HashUtils.h"
 #include "modplatform/modrinth/ModrinthAPI.h"
 #include "modplatform/modrinth/ModrinthPackIndex.h"
 
@@ -24,8 +25,8 @@ EnsureMetadataTask::EnsureMetadataTask(Mod* mod, QDir dir, ModPlatform::Resource
     auto hash_task = createNewHash(mod);
     if (!hash_task)
         return;
-    connect(hash_task.get(), &Task::succeeded, [this, hash_task, mod] { m_mods.insert(hash_task->getResult(), mod); });
-    connect(hash_task.get(), &Task::failed, [this, hash_task, mod] { emitFail(mod, "", RemoveFromList::No); });
+    connect(hash_task.get(), &Hashing::Hasher::getResults, [this, mod](QString hash) { m_mods.insert(hash, mod); });
+    connect(hash_task.get(), &Task::failed, [this, mod] { emitFail(mod, "", RemoveFromList::No); });
     hash_task->start();
 }
 
@@ -37,8 +38,8 @@ EnsureMetadataTask::EnsureMetadataTask(QList<Mod*>& mods, QDir dir, ModPlatform:
         auto hash_task = createNewHash(mod);
         if (!hash_task)
             continue;
-        connect(hash_task.get(), &Task::succeeded, [this, hash_task, mod] { m_mods.insert(hash_task->getResult(), mod); });
-        connect(hash_task.get(), &Task::failed, [this, hash_task, mod] { emitFail(mod, "", RemoveFromList::No); });
+        connect(hash_task.get(), &Hashing::Hasher::getResults, [this, mod](QString hash) { m_mods.insert(hash, mod); });
+        connect(hash_task.get(), &Task::failed, [this, mod] { emitFail(mod, "", RemoveFromList::No); });
         m_hashing_task->addTask(hash_task);
     }
 }
diff --git a/launcher/modplatform/atlauncher/ATLPackInstallTask.h b/launcher/modplatform/atlauncher/ATLPackInstallTask.h
index bfe4d90a..b82f523f 100644
--- a/launcher/modplatform/atlauncher/ATLPackInstallTask.h
+++ b/launcher/modplatform/atlauncher/ATLPackInstallTask.h
@@ -58,8 +58,7 @@ enum class InstallMode {
 };
 
 class UserInteractionSupport {
-
-public:
+   public:
     /**
      * Requests a user interaction to select which optional mods should be installed.
      */
@@ -75,23 +74,27 @@ public:
      * Requests a user interaction to display a message.
      */
     virtual void displayMessage(QString message) = 0;
+
+    virtual ~UserInteractionSupport() = default;
 };
 
-class PackInstallTask : public InstanceTask
-{
-Q_OBJECT
+class PackInstallTask : public InstanceTask {
+    Q_OBJECT
 
-public:
-    explicit PackInstallTask(UserInteractionSupport *support, QString packName, QString version, InstallMode installMode = InstallMode::Install);
-    virtual ~PackInstallTask(){}
+   public:
+    explicit PackInstallTask(UserInteractionSupport* support,
+                             QString packName,
+                             QString version,
+                             InstallMode installMode = InstallMode::Install);
+    virtual ~PackInstallTask() { delete m_support; }
 
     bool canAbort() const override { return true; }
     bool abort() override;
 
-protected:
+   protected:
     virtual void executeTask() override;
 
-private slots:
+   private slots:
     void onDownloadSucceeded();
     void onDownloadFailed(QString reason);
     void onDownloadAborted();
@@ -99,7 +102,7 @@ private slots:
     void onModsDownloaded();
     void onModsExtracted();
 
-private:
+   private:
     QString getDirForModType(ModType type, QString raw);
     QString getVersionForLoader(QString uid);
     QString detectLibrary(VersionLibrary library);
@@ -111,15 +114,13 @@ private:
     void installConfigs();
     void extractConfigs();
     void downloadMods();
-    bool extractMods(
-        const QMap<QString, VersionMod> &toExtract,
-        const QMap<QString, VersionMod> &toDecomp,
-        const QMap<QString, QString> &toCopy
-    );
+    bool extractMods(const QMap<QString, VersionMod>& toExtract,
+                     const QMap<QString, VersionMod>& toDecomp,
+                     const QMap<QString, QString>& toCopy);
     void install();
 
-private:
-    UserInteractionSupport *m_support;
+   private:
+    UserInteractionSupport* m_support;
 
     bool abortable = false;
 
@@ -146,7 +147,6 @@ private:
 
     QFuture<bool> m_modExtractFuture;
     QFutureWatcher<bool> m_modExtractFutureWatcher;
-
 };
 
-}
+}  // namespace ATLauncher
diff --git a/launcher/modplatform/helpers/HashUtils.cpp b/launcher/modplatform/helpers/HashUtils.cpp
index 81c94e1b..6df1eaf9 100644
--- a/launcher/modplatform/helpers/HashUtils.cpp
+++ b/launcher/modplatform/helpers/HashUtils.cpp
@@ -71,6 +71,7 @@ void ModrinthHasher::executeTask()
         emitFailed("Empty hash!");
     } else {
         emitSucceeded();
+        emit getResults(m_hash);
     }
 }
 
@@ -91,10 +92,9 @@ void FlameHasher::executeTask()
     }
 }
 
-
-BlockedModHasher::BlockedModHasher(QString file_path, ModPlatform::ResourceProvider provider)
-    : Hasher(file_path), provider(provider) { 
-    setObjectName(QString("BlockedModHasher: %1").arg(file_path)); 
+BlockedModHasher::BlockedModHasher(QString file_path, ModPlatform::ResourceProvider provider) : Hasher(file_path), provider(provider)
+{
+    setObjectName(QString("BlockedModHasher: %1").arg(file_path));
     hash_type = ProviderCaps.hashType(provider).first();
 }
 
@@ -123,11 +123,13 @@ void BlockedModHasher::executeTask()
     }
 }
 
-QStringList BlockedModHasher::getHashTypes() {
+QStringList BlockedModHasher::getHashTypes()
+{
     return ProviderCaps.hashType(provider);
 }
 
-bool BlockedModHasher::useHashType(QString type) {
+bool BlockedModHasher::useHashType(QString type)
+{
     auto types = ProviderCaps.hashType(provider);
     if (types.contains(type)) {
         hash_type = type;
diff --git a/launcher/modplatform/helpers/HashUtils.h b/launcher/modplatform/helpers/HashUtils.h
index 91146a52..f3b9e030 100644
--- a/launcher/modplatform/helpers/HashUtils.h
+++ b/launcher/modplatform/helpers/HashUtils.h
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <qtmetamacros.h>
 #include <QString>
 
 #include "modplatform/ModIndex.h"
@@ -8,6 +9,7 @@
 namespace Hashing {
 
 class Hasher : public Task {
+    Q_OBJECT
    public:
     using Ptr = shared_qobject_ptr<Hasher>;
 
@@ -21,6 +23,9 @@ class Hasher : public Task {
     QString getResult() const { return m_hash; };
     QString getPath() const { return m_path; };
 
+   signals:
+    void getResults(QString hash);
+
    protected:
     QString m_hash;
     QString m_path;
@@ -48,6 +53,7 @@ class BlockedModHasher : public Hasher {
 
     QStringList getHashTypes();
     bool useHashType(QString type);
+
    private:
     ModPlatform::ResourceProvider provider;
     QString hash_type;
diff --git a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
index 6a3f12f9..36002bad 100644
--- a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
+++ b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
@@ -53,12 +53,11 @@ void ModrinthCheckUpdate::executeTask()
         // (though it will rarely happen, if at all)
         if (mod->metadata()->hash_format != best_hash_type) {
             auto hash_task = Hashing::createModrinthHasher(mod->fileinfo().absoluteFilePath());
-            connect(hash_task.get(), &Task::succeeded, [&] {
-                QString hash(hash_task->getResult());
+            connect(hash_task.get(), &Hashing::Hasher::getResults, [&hashes, &mappings, mod](QString hash) {
                 hashes.append(hash);
                 mappings.insert(hash, mod);
             });
-            connect(hash_task.get(), &Task::failed, [this, hash_task] { failed("Failed to generate hash"); });
+            connect(hash_task.get(), &Task::failed, [this] { failed("Failed to generate hash"); });
             hashing_task.addTask(hash_task);
         } else {
             hashes.append(hash);
diff --git a/launcher/ui/dialogs/NewsDialog.cpp b/launcher/ui/dialogs/NewsDialog.cpp
index e1b5dd74..b646e391 100644
--- a/launcher/ui/dialogs/NewsDialog.cpp
+++ b/launcher/ui/dialogs/NewsDialog.cpp
@@ -32,7 +32,7 @@ NewsDialog::~NewsDialog()
 
 void NewsDialog::selectedArticleChanged(const QString& new_title)
 {
-    auto const& article_entry = m_entries.constFind(new_title).value();
+    auto article_entry = m_entries.constFind(new_title).value();
 
     ui->articleTitleLabel->setText(QString("<a href='%1'>%2</a>").arg(article_entry->link, new_title));
 
diff --git a/launcher/ui/pages/modplatform/atlauncher/AtlListModel.cpp b/launcher/ui/pages/modplatform/atlauncher/AtlListModel.cpp
index 2ab86529..c6b087d6 100644
--- a/launcher/ui/pages/modplatform/atlauncher/AtlListModel.cpp
+++ b/launcher/ui/pages/modplatform/atlauncher/AtlListModel.cpp
@@ -16,62 +16,49 @@
 
 #include "AtlListModel.h"
 
-#include <BuildConfig.h>
 #include <Application.h>
+#include <BuildConfig.h>
 #include <Json.h>
 
 namespace Atl {
 
-ListModel::ListModel(QObject *parent) : QAbstractListModel(parent)
-{
-}
+ListModel::ListModel(QObject* parent) : QAbstractListModel(parent) {}
 
-ListModel::~ListModel()
-{
-}
+ListModel::~ListModel() {}
 
-int ListModel::rowCount(const QModelIndex &parent) const
+int ListModel::rowCount(const QModelIndex& parent) const
 {
     return parent.isValid() ? 0 : modpacks.size();
 }
 
-int ListModel::columnCount(const QModelIndex &parent) const
+int ListModel::columnCount(const QModelIndex& parent) const
 {
     return parent.isValid() ? 0 : 1;
 }
 
-QVariant ListModel::data(const QModelIndex &index, int role) const
+QVariant ListModel::data(const QModelIndex& index, int role) const
 {
     int pos = index.row();
-    if(pos >= modpacks.size() || pos < 0 || !index.isValid())
-    {
+    if (pos >= modpacks.size() || pos < 0 || !index.isValid()) {
         return QString("INVALID INDEX %1").arg(pos);
     }
 
     ATLauncher::IndexedPack pack = modpacks.at(pos);
-    if(role == Qt::DisplayRole)
-    {
+    if (role == Qt::DisplayRole) {
         return pack.name;
-    }
-    else if (role == Qt::ToolTipRole)
-    {
+    } else if (role == Qt::ToolTipRole) {
         return pack.name;
-    }
-    else if(role == Qt::DecorationRole)
-    {
-        if(m_logoMap.contains(pack.safeName))
-        {
+    } else if (role == Qt::DecorationRole) {
+        if (m_logoMap.contains(pack.safeName)) {
             return (m_logoMap.value(pack.safeName));
         }
         auto icon = APPLICATION->getThemedIcon("atlauncher-placeholder");
 
         auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "launcher/images/%1.png").arg(pack.safeName.toLower());
-        ((ListModel *)this)->requestLogo(pack.safeName, url);
+        ((ListModel*)this)->requestLogo(pack.safeName, url);
 
         return icon;
-    }
-    else if(role == Qt::UserRole)
-    {
+    } else if (role == Qt::UserRole) {
         QVariant v;
         v.setValue(pack);
         return v;
@@ -102,7 +89,7 @@ void ListModel::requestFinished()
 
     QJsonParseError parse_error;
     QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
-    if(parse_error.error != QJsonParseError::NoError) {
+    if (parse_error.error != QJsonParseError::NoError) {
         qWarning() << "Error while parsing JSON response from ATL at " << parse_error.offset << " reason: " << parse_error.errorString();
         qWarning() << *response;
         return;
@@ -111,26 +98,28 @@ void ListModel::requestFinished()
     QList<ATLauncher::IndexedPack> newList;
 
     auto packs = doc.array();
-    for(auto packRaw : packs) {
+    for (auto packRaw : packs) {
         auto packObj = packRaw.toObject();
 
         ATLauncher::IndexedPack pack;
 
         try {
             ATLauncher::loadIndexedPack(pack, packObj);
-        }
-        catch (const JSONValidationError &e) {
+        } catch (const JSONValidationError& e) {
             qDebug() << QString::fromUtf8(*response);
             qWarning() << "Error while reading pack manifest from ATLauncher: " << e.cause();
             return;
         }
 
         // ignore packs without a published version
-        if(pack.versions.length() == 0) continue;
+        if (pack.versions.length() == 0)
+            continue;
         // only display public packs (for now)
-        if(pack.type != ATLauncher::PackType::Public) continue;
+        if (pack.type != ATLauncher::PackType::Public)
+            continue;
         // ignore "system" packs (Vanilla, Vanilla with Forge, etc)
-        if(pack.system) continue;
+        if (pack.system)
+            continue;
 
         newList.append(pack);
     }
@@ -145,14 +134,12 @@ void ListModel::requestFailed(QString reason)
     jobPtr.reset();
 }
 
-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))
-    {
-        callback(APPLICATION->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
-    }
-    else
-    {
+    if (m_logoMap.contains(logo)) {
+        callback(
+            APPLICATION->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
+    } else {
         requestLogo(logo, logoUrl);
     }
 }
@@ -168,36 +155,34 @@ void ListModel::logoLoaded(QString logo, QIcon out)
     m_loadingLogos.removeAll(logo);
     m_logoMap.insert(logo, out);
 
-    for(int i = 0; i < modpacks.size(); i++) {
-        if(modpacks[i].safeName == logo) {
-            emit dataChanged(createIndex(i, 0), createIndex(i, 0), {Qt::DecorationRole});
+    for (int i = 0; i < modpacks.size(); i++) {
+        if (modpacks[i].safeName == logo) {
+            emit dataChanged(createIndex(i, 0), createIndex(i, 0), { Qt::DecorationRole });
         }
     }
 }
 
 void ListModel::requestLogo(QString file, QString url)
 {
-    if(m_loadingLogos.contains(file) || m_failedLogos.contains(file))
-    {
+    if (m_loadingLogos.contains(file) || m_failedLogos.contains(file)) {
         return;
     }
 
     MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
-    NetJob *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));
 
     auto fullPath = entry->getFullPath();
-    QObject::connect(job, &NetJob::succeeded, this, [this, file, fullPath]
-    {
+    QObject::connect(job, &NetJob::succeeded, this, [this, file, fullPath, job] {
+        job->deleteLater();
         emit logoLoaded(file, QIcon(fullPath));
-        if(waitingCallbacks.contains(file))
-        {
+        if (waitingCallbacks.contains(file)) {
             waitingCallbacks.value(file)(fullPath);
         }
     });
 
-    QObject::connect(job, &NetJob::failed, this, [this, file]
-    {
+    QObject::connect(job, &NetJob::failed, this, [this, file, job] {
+        job->deleteLater();
         emit logoFailed(file);
     });
 
@@ -206,4 +191,4 @@ void ListModel::requestLogo(QString file, QString url)
     m_loadingLogos.append(file);
 }
 
-}
+}  // namespace Atl
diff --git a/launcher/ui/pages/modplatform/atlauncher/AtlUserInteractionSupportImpl.h b/launcher/ui/pages/modplatform/atlauncher/AtlUserInteractionSupportImpl.h
index 37010b3f..adeb53cb 100644
--- a/launcher/ui/pages/modplatform/atlauncher/AtlUserInteractionSupportImpl.h
+++ b/launcher/ui/pages/modplatform/atlauncher/AtlUserInteractionSupportImpl.h
@@ -42,15 +42,15 @@
 class AtlUserInteractionSupportImpl : public QObject, public ATLauncher::UserInteractionSupport {
     Q_OBJECT
 
-public:
+   public:
     AtlUserInteractionSupportImpl(QWidget* parent);
+    virtual ~AtlUserInteractionSupportImpl() = default;
 
-private:
+   private:
     QString chooseVersion(Meta::VersionList::Ptr vlist, QString minecraftVersion) override;
     std::optional<QVector<QString>> chooseOptionalMods(ATLauncher::PackVersion version, QVector<ATLauncher::VersionMod> mods) override;
     void displayMessage(QString message) override;
 
-private:
+   private:
     QWidget* m_parent;
-
 };
diff --git a/launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp b/launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp
index 2343b79f..a3e29201 100644
--- a/launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp
+++ b/launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp
@@ -35,14 +35,15 @@
 
 #include "ListModel.h"
 #include "Application.h"
+#include "QObjectPtr.h"
 #include "net/HttpMetaCache.h"
 #include "net/NetJob.h"
 
-#include "StringUtils.h"
 #include <Version.h>
+#include "StringUtils.h"
 
-#include <QtMath>
 #include <QLabel>
+#include <QtMath>
 
 #include <RWStorage.h>
 
@@ -50,33 +51,33 @@
 
 namespace LegacyFTB {
 
-FilterModel::FilterModel(QObject *parent) : QSortFilterProxyModel(parent)
+FilterModel::FilterModel(QObject* parent) : QSortFilterProxyModel(parent)
 {
     currentSorting = Sorting::ByGameVersion;
     sortings.insert(tr("Sort by Name"), Sorting::ByName);
     sortings.insert(tr("Sort by Game Version"), Sorting::ByGameVersion);
 }
 
-bool FilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+bool FilterModel::lessThan(const QModelIndex& left, const QModelIndex& right) const
 {
     Modpack leftPack = sourceModel()->data(left, Qt::UserRole).value<Modpack>();
     Modpack rightPack = sourceModel()->data(right, Qt::UserRole).value<Modpack>();
 
-    if(currentSorting == Sorting::ByGameVersion) {
+    if (currentSorting == Sorting::ByGameVersion) {
         Version lv(leftPack.mcVersion);
         Version rv(rightPack.mcVersion);
         return lv < rv;
 
-    } else if(currentSorting == Sorting::ByName) {
+    } else if (currentSorting == Sorting::ByName) {
         return StringUtils::naturalCompare(leftPack.name, rightPack.name, Qt::CaseSensitive) >= 0;
     }
 
-    //UHM, some inavlid value set?!
+    // UHM, some inavlid value set?!
     qWarning() << "Invalid sorting set!";
     return true;
 }
 
-bool FilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+bool FilterModel::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const
 {
     return true;
 }
@@ -102,18 +103,13 @@ FilterModel::Sorting FilterModel::getCurrentSorting()
     return currentSorting;
 }
 
-ListModel::ListModel(QObject *parent) : QAbstractListModel(parent)
-{
-}
+ListModel::ListModel(QObject* parent) : QAbstractListModel(parent) {}
 
-ListModel::~ListModel()
-{
-}
+ListModel::~ListModel() {}
 
 QString ListModel::translatePackType(PackType type) const
 {
-    switch(type)
-    {
+    switch (type) {
         case PackType::Public:
             return tr("Public Modpack");
         case PackType::ThirdParty:
@@ -125,67 +121,51 @@ QString ListModel::translatePackType(PackType type) const
     return QString();
 }
 
-int ListModel::rowCount(const QModelIndex &parent) const
+int ListModel::rowCount(const QModelIndex& parent) const
 {
     return parent.isValid() ? 0 : modpacks.size();
 }
 
-int ListModel::columnCount(const QModelIndex &parent) const
+int ListModel::columnCount(const QModelIndex& parent) const
 {
     return parent.isValid() ? 0 : 1;
 }
 
-QVariant ListModel::data(const QModelIndex &index, int role) const
+QVariant ListModel::data(const QModelIndex& index, int role) const
 {
     int pos = index.row();
-    if(pos >= modpacks.size() || pos < 0 || !index.isValid())
-    {
+    if (pos >= modpacks.size() || pos < 0 || !index.isValid()) {
         return QString("INVALID INDEX %1").arg(pos);
     }
 
     Modpack pack = modpacks.at(pos);
-    if(role == Qt::DisplayRole)
-    {
+    if (role == Qt::DisplayRole) {
         return pack.name + "\n" + translatePackType(pack.type);
-    }
-    else if (role == Qt::ToolTipRole)
-    {
-        if(pack.description.length() > 100)
-        {
-            //some magic to prevent to long tooltips and replace html linebreaks
+    } else if (role == Qt::ToolTipRole) {
+        if (pack.description.length() > 100) {
+            // some magic to prevent to long tooltips and replace html linebreaks
             QString edit = pack.description.left(97);
             edit = edit.left(edit.lastIndexOf("<br>")).left(edit.lastIndexOf(" ")).append("...");
             return edit;
-
         }
         return pack.description;
-    }
-    else if(role == Qt::DecorationRole)
-    {
-        if(m_logoMap.contains(pack.logo))
-        {
+    } else if (role == Qt::DecorationRole) {
+        if (m_logoMap.contains(pack.logo)) {
             return (m_logoMap.value(pack.logo));
         }
         QIcon icon = APPLICATION->getThemedIcon("screenshot-placeholder");
-        ((ListModel *)this)->requestLogo(pack.logo);
+        ((ListModel*)this)->requestLogo(pack.logo);
         return icon;
-    }
-    else if(role == Qt::ForegroundRole)
-    {
-        if(pack.broken)
-        {
-            //FIXME: Hardcoded color
+    } else if (role == Qt::ForegroundRole) {
+        if (pack.broken) {
+            // FIXME: Hardcoded color
             return QColor(255, 0, 50);
-        }
-        else if(pack.bugged)
-        {
-            //FIXME: Hardcoded color
-            //bugged pack, currently only indicates bugged xml
+        } else if (pack.bugged) {
+            // FIXME: Hardcoded color
+            // bugged pack, currently only indicates bugged xml
             return QColor(244, 229, 66);
         }
-    }
-    else if(role == Qt::UserRole)
-    {
+    } else if (role == Qt::UserRole) {
         QVariant v;
         v.setValue(pack);
         return v;
@@ -222,8 +202,7 @@ Modpack ListModel::at(int row)
 
 void ListModel::remove(int row)
 {
-    if(row < 0 || row >= modpacks.size())
-    {
+    if (row < 0 || row >= modpacks.size()) {
         qWarning() << "Attempt to remove FTB modpacks with invalid row" << row;
         return;
     }
@@ -247,27 +226,25 @@ void ListModel::logoFailed(QString logo)
 
 void ListModel::requestLogo(QString file)
 {
-    if(m_loadingLogos.contains(file) || m_failedLogos.contains(file))
-    {
+    if (m_loadingLogos.contains(file) || m_failedLogos.contains(file)) {
         return;
     }
 
     MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
-    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));
 
     auto fullPath = entry->getFullPath();
-    QObject::connect(job, &NetJob::finished, this, [this, file, fullPath]
-    {
+    QObject::connect(job, &NetJob::finished, this, [this, file, fullPath, job] {
+        job->deleteLater();
         emit logoLoaded(file, QIcon(fullPath));
-        if(waitingCallbacks.contains(file))
-        {
+        if (waitingCallbacks.contains(file)) {
             waitingCallbacks.value(file)(fullPath);
         }
     });
 
-    QObject::connect(job, &NetJob::failed, this, [this, file]
-    {
+    QObject::connect(job, &NetJob::failed, this, [this, file, job] {
+        job->deleteLater();
         emit logoFailed(file);
     });
 
@@ -276,21 +253,18 @@ void ListModel::requestLogo(QString file)
     m_loadingLogos.append(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());
-    }
-    else
-    {
+    } else {
         requestLogo(logo);
     }
 }
 
-Qt::ItemFlags ListModel::flags(const QModelIndex &index) const
+Qt::ItemFlags ListModel::flags(const QModelIndex& index) const
 {
     return QAbstractListModel::flags(index);
 }
 
-}
+}  // namespace LegacyFTB
diff --git a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp
index 7975fd58..f08eb289 100644
--- a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp
+++ b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp
@@ -40,39 +40,28 @@
 
 #include <QIcon>
 
-Technic::ListModel::ListModel(QObject *parent) : QAbstractListModel(parent)
-{
-}
+Technic::ListModel::ListModel(QObject* parent) : QAbstractListModel(parent) {}
 
-Technic::ListModel::~ListModel()
-{
-}
+Technic::ListModel::~ListModel() {}
 
 QVariant Technic::ListModel::data(const QModelIndex& index, int role) const
 {
     int pos = index.row();
-    if(pos >= modpacks.size() || pos < 0 || !index.isValid())
-    {
+    if (pos >= modpacks.size() || pos < 0 || !index.isValid()) {
         return QString("INVALID INDEX %1").arg(pos);
     }
 
     Modpack pack = modpacks.at(pos);
-    if(role == Qt::DisplayRole)
-    {
+    if (role == Qt::DisplayRole) {
         return pack.name;
-    }
-    else if(role == Qt::DecorationRole)
-    {
-        if(m_logoMap.contains(pack.logoName))
-        {
+    } else if (role == Qt::DecorationRole) {
+        if (m_logoMap.contains(pack.logoName)) {
             return (m_logoMap.value(pack.logoName));
         }
         QIcon icon = APPLICATION->getThemedIcon("screenshot-placeholder");
-        ((ListModel *)this)->requestLogo(pack.logoName, pack.logoUrl);
+        ((ListModel*)this)->requestLogo(pack.logoName, pack.logoUrl);
         return icon;
-    }
-    else if(role == Qt::UserRole)
-    {
+    } else if (role == Qt::UserRole) {
         QVariant v;
         v.setValue(pack);
         return v;
@@ -92,16 +81,15 @@ int Technic::ListModel::rowCount(const QModelIndex& parent) const
 
 void Technic::ListModel::searchWithTerm(const QString& term)
 {
-    if(currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull()) {
+    if (currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull()) {
         return;
     }
     currentSearchTerm = term;
-    if(jobPtr) {
+    if (jobPtr) {
         jobPtr->abort();
         searchState = ResetRequested;
         return;
-    }
-    else {
+    } else {
         beginResetModel();
         modpacks.clear();
         endResetModel();
@@ -115,23 +103,17 @@ void Technic::ListModel::performSearch()
     auto netJob = makeShared<NetJob>("Technic::Search", APPLICATION->network());
     QString searchUrl = "";
     if (currentSearchTerm.isEmpty()) {
-        searchUrl = QString("%1trending?build=%2")
-                .arg(BuildConfig.TECHNIC_API_BASE_URL, BuildConfig.TECHNIC_API_BUILD);
+        searchUrl = QString("%1trending?build=%2").arg(BuildConfig.TECHNIC_API_BASE_URL, BuildConfig.TECHNIC_API_BUILD);
         searchMode = List;
-    }
-    else if (currentSearchTerm.startsWith("http://api.technicpack.net/modpack/")) {
-        searchUrl = QString("https://%1?build=%2")
-                .arg(currentSearchTerm.mid(7), BuildConfig.TECHNIC_API_BUILD);
+    } else if (currentSearchTerm.startsWith("http://api.technicpack.net/modpack/")) {
+        searchUrl = QString("https://%1?build=%2").arg(currentSearchTerm.mid(7), BuildConfig.TECHNIC_API_BUILD);
         searchMode = Single;
-    }
-    else if (currentSearchTerm.startsWith("https://api.technicpack.net/modpack/")) {
+    } else if (currentSearchTerm.startsWith("https://api.technicpack.net/modpack/")) {
         searchUrl = QString("%1?build=%2").arg(currentSearchTerm, BuildConfig.TECHNIC_API_BUILD);
         searchMode = Single;
-    }
-    else {
-        searchUrl = QString(
-            "%1search?build=%2&q=%3"
-        ).arg(BuildConfig.TECHNIC_API_BASE_URL, BuildConfig.TECHNIC_API_BUILD, currentSearchTerm);
+    } else {
+        searchUrl =
+            QString("%1search?build=%2&q=%3").arg(BuildConfig.TECHNIC_API_BASE_URL, BuildConfig.TECHNIC_API_BUILD, currentSearchTerm);
         searchMode = List;
     }
     netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), response));
@@ -161,7 +143,7 @@ void Technic::ListModel::searchRequestFinished()
         switch (searchMode) {
             case List: {
                 auto objs = Json::requireArray(root, "modpacks");
-                for (auto technicPack: objs) {
+                for (auto technicPack : objs) {
                     Modpack pack;
                     auto technicPackObject = Json::requireObject(technicPack);
                     pack.name = Json::requireString(technicPackObject, "name");
@@ -170,11 +152,10 @@ void Technic::ListModel::searchRequestFinished()
                         continue;
 
                     auto rawURL = Json::ensureString(technicPackObject, "iconUrl", "null");
-                    if(rawURL == "null") {
+                    if (rawURL == "null") {
                         pack.logoUrl = "null";
                         pack.logoName = "null";
-                    }
-                    else {
+                    } else {
                         pack.logoUrl = rawURL;
                         pack.logoName = rawURL.section(QLatin1Char('/'), -1).section(QLatin1Char('.'), 0, 0);
                     }
@@ -199,8 +180,7 @@ void Technic::ListModel::searchRequestFinished()
 
                     pack.logoUrl = iconUrl;
                     pack.logoName = iconUrl.section(QLatin1Char('/'), -1).section(QLatin1Char('.'), 0, 0);
-                }
-                else {
+                } else {
                     pack.logoUrl = "null";
                     pack.logoName = "null";
                 }
@@ -210,10 +190,8 @@ void Technic::ListModel::searchRequestFinished()
                 break;
             }
         }
-    }
-    catch (const JSONValidationError &err)
-    {
-        qCritical() << "Couldn't parse technic search results:" << err.cause() ;
+    } catch (const JSONValidationError& err) {
+        qCritical() << "Couldn't parse technic search results:" << err.cause();
         return;
     }
     searchState = Finished;
@@ -229,12 +207,9 @@ void Technic::ListModel::searchRequestFinished()
 
 void Technic::ListModel::getLogo(const QString& logo, const QString& logoUrl, Technic::LogoCallback callback)
 {
-    if(m_logoMap.contains(logo))
-    {
+    if (m_logoMap.contains(logo)) {
         callback(APPLICATION->metacache()->resolveEntry("TechnicPacks", QString("logos/%1").arg(logo))->getFullPath());
-    }
-    else
-    {
+    } else {
         requestLogo(logo, logoUrl);
     }
 }
@@ -243,30 +218,24 @@ void Technic::ListModel::searchRequestFailed()
 {
     jobPtr.reset();
 
-    if(searchState == ResetRequested)
-    {
+    if (searchState == ResetRequested) {
         beginResetModel();
         modpacks.clear();
         endResetModel();
 
         performSearch();
-    }
-    else
-    {
+    } else {
         searchState = Finished;
     }
 }
 
-
 void Technic::ListModel::logoLoaded(QString logo, QString out)
 {
     m_loadingLogos.removeAll(logo);
     m_logoMap.insert(logo, QIcon(out));
-    for(int i = 0; i < modpacks.size(); i++)
-    {
-        if(modpacks[i].logoName == logo)
-        {
-            emit dataChanged(createIndex(i, 0), createIndex(i, 0), {Qt::DecorationRole});
+    for (int i = 0; i < modpacks.size(); i++) {
+        if (modpacks[i].logoName == logo) {
+            emit dataChanged(createIndex(i, 0), createIndex(i, 0), { Qt::DecorationRole });
         }
     }
 }
@@ -279,24 +248,23 @@ void Technic::ListModel::logoFailed(QString logo)
 
 void Technic::ListModel::requestLogo(QString logo, QString url)
 {
-    if(m_loadingLogos.contains(logo) || m_failedLogos.contains(logo) || logo == "null")
-    {
+    if (m_loadingLogos.contains(logo) || m_failedLogos.contains(logo) || logo == "null") {
         return;
     }
 
     MetaEntryPtr entry = APPLICATION->metacache()->resolveEntry("TechnicPacks", QString("logos/%1").arg(logo));
-    NetJob *job = new NetJob(QString("Technic Icon Download %1").arg(logo), APPLICATION->network());
+    auto job = new NetJob(QString("Technic Icon Download %1").arg(logo), APPLICATION->network());
     job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
 
     auto fullPath = entry->getFullPath();
 
-    QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath]
-    {
+    QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath, job] {
+        job->deleteLater();
         logoLoaded(logo, fullPath);
     });
 
-    QObject::connect(job, &NetJob::failed, this, [this, logo]
-    {
+    QObject::connect(job, &NetJob::failed, this, [this, logo, job] {
+        job->deleteLater();
         logoFailed(logo);
     });
 
-- 
cgit 


From 009623823d6036ea22b34b21812758666fb8f7ba Mon Sep 17 00:00:00 2001
From: James Beddek <telans@posteo.de>
Date: Tue, 20 Jun 2023 23:00:13 +1200
Subject: Modrinth: use default icon for non-managed packs

Fixes: #317
Signed-off-by: James Beddek <telans@posteo.de>
---
 launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'launcher/modplatform/modrinth')

diff --git a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
index bb8227aa..76f07277 100644
--- a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
+++ b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
@@ -214,7 +214,7 @@ bool ModrinthCreationTask::createInstance()
 
     if (m_instIcon != "default") {
         instance.setIconKey(m_instIcon);
-    } else {
+    } else if (!m_managed_id.isEmpty()) {
         instance.setIconKey("modrinth");
     }
 
-- 
cgit 


From 67db141203864123f65d93723e7eed43328b8d97 Mon Sep 17 00:00:00 2001
From: Trial97 <alexandru.tripon97@gmail.com>
Date: Fri, 23 Jun 2023 14:38:23 +0300
Subject: Renamed getResults to resultsReady

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
---
 launcher/modplatform/EnsureMetadataTask.cpp            | 4 ++--
 launcher/modplatform/atlauncher/ATLPackInstallTask.cpp | 2 +-
 launcher/modplatform/helpers/HashUtils.cpp             | 2 +-
 launcher/modplatform/helpers/HashUtils.h               | 2 +-
 launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp  | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

(limited to 'launcher/modplatform/modrinth')

diff --git a/launcher/modplatform/EnsureMetadataTask.cpp b/launcher/modplatform/EnsureMetadataTask.cpp
index a04a2534..93b5ce76 100644
--- a/launcher/modplatform/EnsureMetadataTask.cpp
+++ b/launcher/modplatform/EnsureMetadataTask.cpp
@@ -25,7 +25,7 @@ EnsureMetadataTask::EnsureMetadataTask(Mod* mod, QDir dir, ModPlatform::Resource
     auto hash_task = createNewHash(mod);
     if (!hash_task)
         return;
-    connect(hash_task.get(), &Hashing::Hasher::getResults, [this, mod](QString hash) { m_mods.insert(hash, mod); });
+    connect(hash_task.get(), &Hashing::Hasher::resultsReady, [this, mod](QString hash) { m_mods.insert(hash, mod); });
     connect(hash_task.get(), &Task::failed, [this, mod] { emitFail(mod, "", RemoveFromList::No); });
     hash_task->start();
 }
@@ -38,7 +38,7 @@ EnsureMetadataTask::EnsureMetadataTask(QList<Mod*>& mods, QDir dir, ModPlatform:
         auto hash_task = createNewHash(mod);
         if (!hash_task)
             continue;
-        connect(hash_task.get(), &Hashing::Hasher::getResults, [this, mod](QString hash) { m_mods.insert(hash, mod); });
+        connect(hash_task.get(), &Hashing::Hasher::resultsReady, [this, mod](QString hash) { m_mods.insert(hash, mod); });
         connect(hash_task.get(), &Task::failed, [this, mod] { emitFail(mod, "", RemoveFromList::No); });
         m_hashing_task->addTask(hash_task);
     }
diff --git a/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp b/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp
index 2522020d..22ea02da 100644
--- a/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp
+++ b/launcher/modplatform/atlauncher/ATLPackInstallTask.cpp
@@ -100,7 +100,7 @@ void PackInstallTask::onDownloadSucceeded()
     jobPtr.reset();
 
     QJsonParseError parse_error{};
-    QJsonDocument doc = QJsonDocument::fromJson(*response.get(), &parse_error);
+    QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
     if (parse_error.error != QJsonParseError::NoError) {
         qWarning() << "Error while parsing JSON response from ATLauncher at " << parse_error.offset
                    << " reason: " << parse_error.errorString();
diff --git a/launcher/modplatform/helpers/HashUtils.cpp b/launcher/modplatform/helpers/HashUtils.cpp
index 6df1eaf9..7d188a2f 100644
--- a/launcher/modplatform/helpers/HashUtils.cpp
+++ b/launcher/modplatform/helpers/HashUtils.cpp
@@ -71,7 +71,7 @@ void ModrinthHasher::executeTask()
         emitFailed("Empty hash!");
     } else {
         emitSucceeded();
-        emit getResults(m_hash);
+        emit resultsReady(m_hash);
     }
 }
 
diff --git a/launcher/modplatform/helpers/HashUtils.h b/launcher/modplatform/helpers/HashUtils.h
index a541ae8f..73a2435a 100644
--- a/launcher/modplatform/helpers/HashUtils.h
+++ b/launcher/modplatform/helpers/HashUtils.h
@@ -23,7 +23,7 @@ class Hasher : public Task {
     QString getPath() const { return m_path; };
 
    signals:
-    void getResults(QString hash);
+    void resultsReady(QString hash);
 
    protected:
     QString m_hash;
diff --git a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
index 36002bad..a7c22832 100644
--- a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
+++ b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
@@ -53,7 +53,7 @@ void ModrinthCheckUpdate::executeTask()
         // (though it will rarely happen, if at all)
         if (mod->metadata()->hash_format != best_hash_type) {
             auto hash_task = Hashing::createModrinthHasher(mod->fileinfo().absoluteFilePath());
-            connect(hash_task.get(), &Hashing::Hasher::getResults, [&hashes, &mappings, mod](QString hash) {
+            connect(hash_task.get(), &Hashing::Hasher::resultsReady, [&hashes, &mappings, mod](QString hash) {
                 hashes.append(hash);
                 mappings.insert(hash, mod);
             });
-- 
cgit