2022-05-11 04:27:47 +05:30
|
|
|
// 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/>.
|
|
|
|
*/
|
|
|
|
|
2022-03-03 03:05:59 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
#include <QMetaType>
|
|
|
|
#include <QString>
|
|
|
|
#include <QVariant>
|
|
|
|
#include <QVector>
|
|
|
|
|
2022-07-24 07:41:09 +05:30
|
|
|
class QIODevice;
|
|
|
|
|
2022-03-03 03:05:59 +05:30
|
|
|
namespace ModPlatform {
|
|
|
|
|
2022-04-22 00:15:20 +05:30
|
|
|
enum class Provider {
|
2022-04-14 03:46:36 +05:30
|
|
|
MODRINTH,
|
|
|
|
FLAME
|
|
|
|
};
|
|
|
|
|
|
|
|
class ProviderCapabilities {
|
|
|
|
public:
|
2022-04-20 05:40:12 +05:30
|
|
|
auto name(Provider) -> const char*;
|
2022-05-06 21:12:01 +05:30
|
|
|
auto readableName(Provider) -> QString;
|
|
|
|
auto hashType(Provider) -> QStringList;
|
2022-07-24 07:41:09 +05:30
|
|
|
auto hash(Provider, QIODevice*, QString type = "") -> QString;
|
2022-04-14 03:46:36 +05:30
|
|
|
};
|
|
|
|
|
2022-03-03 03:05:59 +05:30
|
|
|
struct ModpackAuthor {
|
|
|
|
QString name;
|
|
|
|
QString url;
|
|
|
|
};
|
|
|
|
|
2022-05-24 18:08:48 +05:30
|
|
|
struct DonationData {
|
|
|
|
QString id;
|
|
|
|
QString platform;
|
|
|
|
QString url;
|
|
|
|
};
|
|
|
|
|
2022-03-03 03:05:59 +05:30
|
|
|
struct IndexedVersion {
|
|
|
|
QVariant addonId;
|
|
|
|
QVariant fileId;
|
|
|
|
QString version;
|
2022-06-04 05:56:26 +05:30
|
|
|
QString version_number = {};
|
2022-06-19 23:01:44 +05:30
|
|
|
QStringList mcVersion;
|
2022-03-03 03:05:59 +05:30
|
|
|
QString downloadUrl;
|
|
|
|
QString date;
|
|
|
|
QString fileName;
|
2022-06-19 23:01:44 +05:30
|
|
|
QStringList loaders = {};
|
2022-05-06 21:12:01 +05:30
|
|
|
QString hash_type;
|
2022-04-22 00:15:20 +05:30
|
|
|
QString hash;
|
2022-06-04 03:34:49 +05:30
|
|
|
bool is_preferred = true;
|
2022-06-04 05:15:44 +05:30
|
|
|
QString changelog;
|
2022-03-03 03:05:59 +05:30
|
|
|
};
|
|
|
|
|
2022-05-24 18:08:48 +05:30
|
|
|
struct ExtraPackData {
|
|
|
|
QList<DonationData> donate;
|
2022-05-24 20:28:11 +05:30
|
|
|
|
|
|
|
QString issuesUrl;
|
|
|
|
QString sourceUrl;
|
|
|
|
QString wikiUrl;
|
|
|
|
QString discordUrl;
|
2022-05-24 18:08:48 +05:30
|
|
|
};
|
|
|
|
|
2022-03-03 03:05:59 +05:30
|
|
|
struct IndexedPack {
|
|
|
|
QVariant addonId;
|
2022-04-14 03:46:36 +05:30
|
|
|
Provider provider;
|
2022-03-03 03:05:59 +05:30
|
|
|
QString name;
|
2022-06-19 23:01:44 +05:30
|
|
|
QString slug;
|
2022-03-03 03:05:59 +05:30
|
|
|
QString description;
|
|
|
|
QList<ModpackAuthor> authors;
|
|
|
|
QString logoName;
|
|
|
|
QString logoUrl;
|
|
|
|
QString websiteUrl;
|
|
|
|
|
|
|
|
bool versionsLoaded = false;
|
|
|
|
QVector<IndexedVersion> versions;
|
2022-05-24 18:08:48 +05:30
|
|
|
|
|
|
|
// Don't load by default, since some modplatform don't have that info
|
|
|
|
bool extraDataLoaded = true;
|
|
|
|
ExtraPackData extraData;
|
2022-03-03 03:05:59 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ModPlatform
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(ModPlatform::IndexedPack)
|
2022-04-14 03:46:36 +05:30
|
|
|
Q_DECLARE_METATYPE(ModPlatform::Provider)
|