aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod
diff options
context:
space:
mode:
authorAlexandru Ionut Tripon <alexandru.tripon97@gmail.com>2023-08-12 12:42:30 +0300
committerGitHub <noreply@github.com>2023-08-12 12:42:30 +0300
commitb3b2e9df35222209b4920202d86091eeeb87f03f (patch)
treece44c3877ee36c21279d142b2af1c393e7b87780 /launcher/minecraft/mod
parentca061080c13042642fb3bd49a29a863756f45866 (diff)
parent3aba7f8fec45c7c87be486d8f6b5c96f69facf93 (diff)
downloadPrismLauncher-b3b2e9df35222209b4920202d86091eeeb87f03f.tar.gz
PrismLauncher-b3b2e9df35222209b4920202d86091eeeb87f03f.tar.bz2
PrismLauncher-b3b2e9df35222209b4920202d86091eeeb87f03f.zip
Merge branch 'develop' into feat/acknowledge_release_type
Signed-off-by: Alexandru Ionut Tripon <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/minecraft/mod')
-rw-r--r--launcher/minecraft/mod/DataPack.cpp10
-rw-r--r--launcher/minecraft/mod/MetadataHandler.h55
-rw-r--r--launcher/minecraft/mod/Mod.cpp95
-rw-r--r--launcher/minecraft/mod/Mod.h97
-rw-r--r--launcher/minecraft/mod/ModDetails.h109
-rw-r--r--launcher/minecraft/mod/ModFolderModel.cpp264
-rw-r--r--launcher/minecraft/mod/ModFolderModel.h107
-rw-r--r--launcher/minecraft/mod/Resource.cpp19
-rw-r--r--launcher/minecraft/mod/Resource.h23
-rw-r--r--launcher/minecraft/mod/ResourceFolderModel.cpp107
-rw-r--r--launcher/minecraft/mod/ResourceFolderModel.h29
-rw-r--r--launcher/minecraft/mod/ResourcePack.cpp4
-rw-r--r--launcher/minecraft/mod/ResourcePackFolderModel.cpp24
-rw-r--r--launcher/minecraft/mod/ResourcePackFolderModel.h23
-rw-r--r--launcher/minecraft/mod/ShaderPackFolderModel.h6
-rw-r--r--launcher/minecraft/mod/TexturePack.cpp4
-rw-r--r--launcher/minecraft/mod/TexturePack.h2
-rw-r--r--launcher/minecraft/mod/TexturePackFolderModel.cpp26
-rw-r--r--launcher/minecraft/mod/TexturePackFolderModel.h25
-rw-r--r--launcher/minecraft/mod/tasks/BasicFolderLoadTask.h12
-rw-r--r--launcher/minecraft/mod/tasks/LocalModParseTask.cpp33
-rw-r--r--launcher/minecraft/mod/tasks/LocalModUpdateTask.h30
-rw-r--r--launcher/minecraft/mod/tasks/LocalResourcePackParseTask.cpp10
-rw-r--r--launcher/minecraft/mod/tasks/LocalResourcePackParseTask.h2
-rw-r--r--launcher/minecraft/mod/tasks/LocalResourceParse.cpp38
-rw-r--r--launcher/minecraft/mod/tasks/LocalTexturePackParseTask.cpp13
-rw-r--r--launcher/minecraft/mod/tasks/LocalTexturePackParseTask.h2
-rw-r--r--launcher/minecraft/mod/tasks/LocalWorldSaveParseTask.cpp8
-rw-r--r--launcher/minecraft/mod/tasks/LocalWorldSaveParseTask.h2
-rw-r--r--launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp79
-rw-r--r--launcher/minecraft/mod/tasks/ModFolderLoadTask.h82
31 files changed, 624 insertions, 716 deletions
diff --git a/launcher/minecraft/mod/DataPack.cpp b/launcher/minecraft/mod/DataPack.cpp
index ca75cd2a..7bf5a311 100644
--- a/launcher/minecraft/mod/DataPack.cpp
+++ b/launcher/minecraft/mod/DataPack.cpp
@@ -30,10 +30,10 @@
// Values taken from:
// https://minecraft.fandom.com/wiki/Tutorials/Creating_a_data_pack#%22pack_format%22
static const QMap<int, std::pair<Version, Version>> s_pack_format_versions = {
- { 4, { Version("1.13"), Version("1.14.4") } }, { 5, { Version("1.15"), Version("1.16.1") } },
- { 6, { Version("1.16.2"), Version("1.16.5") } }, { 7, { Version("1.17"), Version("1.17.1") } },
- { 8, { Version("1.18"), Version("1.18.1") } }, { 9, { Version("1.18.2"), Version("1.18.2") } },
- { 10, { Version("1.19"), Version("1.19.3") } }, { 11, { Version("23w03a"), Version("23w05a") } },
+ { 4, { Version("1.13"), Version("1.14.4") } }, { 5, { Version("1.15"), Version("1.16.1") } },
+ { 6, { Version("1.16.2"), Version("1.16.5") } }, { 7, { Version("1.17"), Version("1.17.1") } },
+ { 8, { Version("1.18"), Version("1.18.1") } }, { 9, { Version("1.18.2"), Version("1.18.2") } },
+ { 10, { Version("1.19"), Version("1.19.3") } }, { 11, { Version("23w03a"), Version("23w05a") } },
{ 12, { Version("1.19.4"), Version("1.19.4") } }, { 13, { Version("23w12a"), Version("23w14a") } },
{ 14, { Version("23w16a"), Version("23w17a") } }, { 15, { Version("1.20"), Version("1.20") } },
};
@@ -74,6 +74,7 @@ std::pair<int, bool> DataPack::compare(const Resource& other, SortType type) con
auto res = Resource::compare(other, type);
if (res.first != 0)
return res;
+ break;
}
case SortType::PACK_FORMAT: {
auto this_ver = packFormat();
@@ -83,6 +84,7 @@ std::pair<int, bool> DataPack::compare(const Resource& other, SortType type) con
return { 1, type == SortType::PACK_FORMAT };
if (this_ver < other_ver)
return { -1, type == SortType::PACK_FORMAT };
+ break;
}
}
return { 0, false };
diff --git a/launcher/minecraft/mod/MetadataHandler.h b/launcher/minecraft/mod/MetadataHandler.h
index 39723b49..88e9ff2b 100644
--- a/launcher/minecraft/mod/MetadataHandler.h
+++ b/launcher/minecraft/mod/MetadataHandler.h
@@ -1,20 +1,20 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
-* PolyMC - Minecraft Launcher
-* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, version 3.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <https://www.gnu.org/licenses/>.
-*/
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
#pragma once
@@ -42,28 +42,13 @@ class Metadata {
return Packwiz::V1::createModFormat(index_dir, internal_mod, mod_slug);
}
- static void update(QDir& index_dir, ModStruct& mod)
- {
- Packwiz::V1::updateModIndex(index_dir, mod);
- }
+ static void update(QDir& index_dir, ModStruct& mod) { Packwiz::V1::updateModIndex(index_dir, mod); }
- static void remove(QDir& index_dir, QString mod_slug)
- {
- Packwiz::V1::deleteModIndex(index_dir, mod_slug);
- }
+ static void remove(QDir& index_dir, QString mod_slug) { Packwiz::V1::deleteModIndex(index_dir, mod_slug); }
- static void remove(QDir& index_dir, QVariant& mod_id)
- {
- Packwiz::V1::deleteModIndex(index_dir, mod_id);
- }
+ static void remove(QDir& index_dir, QVariant& mod_id) { Packwiz::V1::deleteModIndex(index_dir, mod_id); }
- static auto get(QDir& index_dir, QString mod_slug) -> ModStruct
- {
- return Packwiz::V1::getIndexForMod(index_dir, mod_slug);
- }
+ static auto get(QDir& index_dir, QString mod_slug) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, mod_slug); }
- static auto get(QDir& index_dir, QVariant& mod_id) -> ModStruct
- {
- return Packwiz::V1::getIndexForMod(index_dir, mod_id);
- }
+ static auto get(QDir& index_dir, QVariant& mod_id) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, mod_id); }
};
diff --git a/launcher/minecraft/mod/Mod.cpp b/launcher/minecraft/mod/Mod.cpp
index e613ddeb..ae3dea8d 100644
--- a/launcher/minecraft/mod/Mod.cpp
+++ b/launcher/minecraft/mod/Mod.cpp
@@ -1,45 +1,45 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
-* PolyMC - Minecraft Launcher
-* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
-* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, version 3.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <https://www.gnu.org/licenses/>.
-*
-* This file incorporates work covered by the following copyright and
-* permission notice:
-*
-* Copyright 2013-2021 MultiMC Contributors
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include "Mod.h"
#include <QDebug>
#include <QDir>
-#include <QString>
#include <QRegularExpression>
+#include <QString>
#include "MTPixmapCache.h"
#include "MetadataHandler.h"
@@ -54,8 +54,7 @@ Mod::Mod(const QFileInfo& file) : Resource(file), m_local_details()
m_enabled = (file.suffix() != "disabled");
}
-Mod::Mod(const QDir& mods_dir, const Metadata::ModStruct& metadata)
- : Mod(mods_dir.absoluteFilePath(metadata.filename))
+Mod::Mod(const QDir& mods_dir, const Metadata::ModStruct& metadata) : Mod(mods_dir.absoluteFilePath(metadata.filename))
{
m_name = metadata.name;
m_local_details.metadata = std::make_shared<Metadata::ModStruct>(std::move(metadata));
@@ -73,7 +72,8 @@ void Mod::setMetadata(std::shared_ptr<Metadata::ModStruct>&& metadata)
m_local_details.metadata = metadata;
}
-void Mod::setDetails(const ModDetails& details) {
+void Mod::setDetails(const ModDetails& details)
+{
m_local_details = details;
}
@@ -91,6 +91,7 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
auto res = Resource::compare(other, type);
if (res.first != 0)
return res;
+ break;
}
case SortType::VERSION: {
auto this_ver = Version(version());
@@ -99,11 +100,14 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
return { 1, type == SortType::VERSION };
if (this_ver < other_ver)
return { -1, type == SortType::VERSION };
+ break;
}
case SortType::PROVIDER: {
- auto compare_result = QString::compare(provider().value_or("Unknown"), cast_other->provider().value_or("Unknown"), Qt::CaseInsensitive);
+ auto compare_result =
+ QString::compare(provider().value_or("Unknown"), cast_other->provider().value_or("Unknown"), Qt::CaseInsensitive);
if (compare_result != 0)
return { compare_result, type == SortType::PROVIDER };
+ break;
}
}
return { 0, false };
@@ -123,7 +127,7 @@ bool Mod::applyFilter(QRegularExpression filter) const
return Resource::applyFilter(filter);
}
-auto Mod::destroy(QDir& index_dir, bool preserve_metadata) -> bool
+auto Mod::destroy(QDir& index_dir, bool preserve_metadata, bool attempt_trash) -> bool
{
if (!preserve_metadata) {
qDebug() << QString("Destroying metadata for '%1' on purpose").arg(name());
@@ -136,7 +140,7 @@ auto Mod::destroy(QDir& index_dir, bool preserve_metadata) -> bool
}
}
- return Resource::destroy();
+ return Resource::destroy(attempt_trash);
}
auto Mod::details() const -> const ModDetails&
@@ -166,6 +170,13 @@ auto Mod::homeurl() const -> QString
return details().homeurl;
}
+auto Mod::metaurl() const -> QString
+{
+ if (metadata() == nullptr)
+ return homeurl();
+ return ModPlatform::getMetaURL(metadata()->provider, metadata()->project_id);
+}
+
auto Mod::description() const -> QString
{
return details().description;
@@ -220,7 +231,7 @@ auto Mod::licenses() const -> const QList<ModLicense>&
return details().licenses;
}
- auto Mod::issueTracker() const -> QString
+auto Mod::issueTracker() const -> QString
{
return details().issue_tracker;
}
@@ -235,7 +246,7 @@ void Mod::setIcon(QImage new_image) const
PixmapCache::remove(m_pack_image_cache_key.key);
// scale the image to avoid flooding the pixmapcache
- auto pixmap = QPixmap::fromImage(new_image.scaled({64, 64}, Qt::AspectRatioMode::KeepAspectRatioByExpanding));
+ auto pixmap = QPixmap::fromImage(new_image.scaled({ 64, 64 }, Qt::AspectRatioMode::KeepAspectRatioByExpanding));
m_pack_image_cache_key.key = PixmapCache::insert(pixmap);
m_pack_image_cache_key.was_ever_used = true;
diff --git a/launcher/minecraft/mod/Mod.h b/launcher/minecraft/mod/Mod.h
index d4e419f4..ca3ee11f 100644
--- a/launcher/minecraft/mod/Mod.h
+++ b/launcher/minecraft/mod/Mod.h
@@ -1,75 +1,75 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
-* PolyMC - Minecraft Launcher
-* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, version 3.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <https://www.gnu.org/licenses/>.
-*
-* This file incorporates work covered by the following copyright and
-* permission notice:
-*
-* Copyright 2013-2021 MultiMC Contributors
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#pragma once
#include <QDateTime>
#include <QFileInfo>
-#include <QList>
#include <QImage>
+#include <QList>
#include <QMutex>
#include <QPixmap>
#include <QPixmapCache>
#include <optional>
-#include "Resource.h"
#include "ModDetails.h"
+#include "Resource.h"
-class Mod : public Resource
-{
+class Mod : public Resource {
Q_OBJECT
-public:
+ public:
using Ptr = shared_qobject_ptr<Mod>;
using WeakPtr = QPointer<Mod>;
Mod() = default;
- Mod(const QFileInfo &file);
+ Mod(const QFileInfo& file);
Mod(const QDir& mods_dir, const Metadata::ModStruct& metadata);
Mod(QString file_path) : Mod(QFileInfo(file_path)) {}
- auto details() const -> const ModDetails&;
- auto name() const -> QString override;
- auto version() const -> QString;
- auto homeurl() const -> QString;
+ auto details() const -> const ModDetails&;
+ auto name() const -> QString override;
+ auto version() const -> QString;
+ auto homeurl() const -> QString;
auto description() const -> QString;
- auto authors() const -> QStringList;
- auto status() const -> ModStatus;
- auto provider() const -> std::optional<QString>;
- auto licenses() const -> const QList<ModLicense>&;
+ auto authors() const -> QStringList;
+ auto status() const -> ModStatus;
+ auto provider() const -> std::optional<QString>;
+ auto licenses() const -> const QList<ModLicense>&;
auto issueTracker() const -> QString;
+ auto metaurl() const -> QString;
/** Get the intneral path to the mod's icon file*/
QString iconPath() const { return m_local_details.icon_file; };
@@ -92,11 +92,11 @@ public:
[[nodiscard]] bool applyFilter(QRegularExpression filter) const override;
// Delete all the files of this mod
- auto destroy(QDir& index_dir, bool preserve_metadata = false) -> bool;
+ auto destroy(QDir& index_dir, bool preserve_metadata = false, bool attempt_trash = true) -> bool;
void finishResolvingWithDetails(ModDetails&& details);
-protected:
+ protected:
ModDetails m_local_details;
mutable QMutex m_data_lock;
@@ -106,5 +106,4 @@ protected:
bool was_ever_used = false;
bool was_read_attempt = false;
} mutable m_pack_image_cache_key;
-
};
diff --git a/launcher/minecraft/mod/ModDetails.h b/launcher/minecraft/mod/ModDetails.h
index b4e59d52..6a15219a 100644
--- a/launcher/minecraft/mod/ModDetails.h
+++ b/launcher/minecraft/mod/ModDetails.h
@@ -1,37 +1,37 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
-* PolyMC - Minecraft Launcher
-* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, version 3.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <https://www.gnu.org/licenses/>.
-*
-* This file incorporates work covered by the following copyright and
-* permission notice:
-*
-* Copyright 2013-2021 MultiMC Contributors
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#pragma once
@@ -44,10 +44,10 @@
#include "minecraft/mod/MetadataHandler.h"
enum class ModStatus {
- Installed, // Both JAR and Metadata are present
- NotInstalled, // Only the Metadata is present
- NoMetadata, // Only the JAR is present
- Unknown, // Default status
+ Installed, // Both JAR and Metadata are present
+ NotInstalled, // Only the Metadata is present
+ NoMetadata, // Only the JAR is present
+ Unknown, // Default status
};
struct ModLicense {
@@ -58,11 +58,12 @@ struct ModLicense {
ModLicense() {}
- ModLicense(const QString license) {
- // FIXME: come up with a better license parseing.
+ ModLicense(const QString license)
+ {
+ // FIXME: come up with a better license parseing.
// handle SPDX identifiers? https://spdx.org/licenses/
auto parts = license.split(' ');
- QStringList notNameParts = {};
+ QStringList notNameParts = {};
for (auto part : parts) {
auto url = QUrl(part);
if (part.startsWith("(") && part.endsWith(")"))
@@ -78,7 +79,7 @@ struct ModLicense {
for (auto part : notNameParts) {
parts.removeOne(part);
}
-
+
auto licensePart = parts.join(' ');
this->name = licensePart;
this->description = licensePart;
@@ -86,22 +87,17 @@ struct ModLicense {
if (parts.size() == 1) {
this->id = parts.first();
}
-
}
- ModLicense(const QString name, const QString id, const QString url, const QString description) {
+ ModLicense(const QString name, const QString id, const QString url, const QString description)
+ {
this->name = name;
this->id = id;
this->url = url;
this->description = description;
}
- ModLicense(const ModLicense& other)
- : name(other.name)
- , id(other.id)
- , url(other.url)
- , description(other.description)
- {}
+ ModLicense(const ModLicense& other) : name(other.name), id(other.id), url(other.url), description(other.description) {}
ModLicense& operator=(const ModLicense& other)
{
@@ -123,28 +119,25 @@ struct ModLicense {
return *this;
}
- bool isEmpty() {
- return this->name.isEmpty() && this->id.isEmpty() && this->url.isEmpty() && this->description.isEmpty();
- }
+ bool isEmpty() { return this->name.isEmpty() && this->id.isEmpty() && this->url.isEmpty() && this->description.isEmpty(); }
};
-struct ModDetails
-{
+struct ModDetails {
/* Mod ID as defined in the ModLoader-specific metadata */
QString mod_id = {};
-
+
/* Human-readable name */
QString name = {};
-
+
/* Human-readable mod version */
QString version = {};
-
+
/* Human-readable minecraft version */
QString mcversion = {};
-
+
/* URL for mod's home page */
QString homeurl = {};
-
+
/* Human-readable description */
QString description = {};
diff --git a/launcher/minecraft/mod/ModFolderModel.cpp b/launcher/minecraft/mod/ModFolderModel.cpp
index af98d834..8dbe583d 100644
--- a/launcher/minecraft/mod/ModFolderModel.cpp
+++ b/launcher/minecraft/mod/ModFolderModel.cpp
@@ -1,38 +1,38 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
-* PolyMC - Minecraft Launcher
-* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
-* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, version 3.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <https://www.gnu.org/licenses/>.
-*
-* This file incorporates work covered by the following copyright and
-* permission notice:
-*
-* Copyright 2013-2021 MultiMC Contributors
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the L