made release type visible
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
9e85297f7a
commit
9aac8e389f
@ -47,6 +47,7 @@
|
|||||||
#include "minecraft/mod/ModDetails.h"
|
#include "minecraft/mod/ModDetails.h"
|
||||||
#include "minecraft/mod/Resource.h"
|
#include "minecraft/mod/Resource.h"
|
||||||
#include "minecraft/mod/tasks/LocalModParseTask.h"
|
#include "minecraft/mod/tasks/LocalModParseTask.h"
|
||||||
|
#include "modplatform/ModIndex.h"
|
||||||
|
|
||||||
static ModPlatform::ProviderCapabilities ProviderCaps;
|
static ModPlatform::ProviderCapabilities ProviderCaps;
|
||||||
|
|
||||||
@ -132,6 +133,13 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
|
|||||||
return { compare_result, type == SortType::MC_VERSIONS };
|
return { compare_result, type == SortType::MC_VERSIONS };
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SortType::RELEASE_TYPE: {
|
||||||
|
if (releaseType() > cast_other->releaseType())
|
||||||
|
return { 1, type == SortType::RELEASE_TYPE };
|
||||||
|
else if (releaseType() < cast_other->releaseType())
|
||||||
|
return { -1, type == SortType::RELEASE_TYPE };
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return { 0, false };
|
return { 0, false };
|
||||||
}
|
}
|
||||||
@ -262,6 +270,13 @@ auto Mod::side() const -> Metadata::ModSide
|
|||||||
return Metadata::ModSide::UniversalSide;
|
return Metadata::ModSide::UniversalSide;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Mod::releaseType() const -> ModPlatform::IndexedVersionType
|
||||||
|
{
|
||||||
|
if (metadata())
|
||||||
|
return metadata()->releaseType;
|
||||||
|
return ModPlatform::IndexedVersionType::VersionType::Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
auto Mod::loaders() const -> ModPlatform::ModLoaderTypes
|
auto Mod::loaders() const -> ModPlatform::ModLoaderTypes
|
||||||
{
|
{
|
||||||
if (metadata())
|
if (metadata())
|
||||||
|
@ -74,6 +74,7 @@ class Mod : public Resource {
|
|||||||
auto side() const -> Metadata::ModSide;
|
auto side() const -> Metadata::ModSide;
|
||||||
auto loaders() const -> ModPlatform::ModLoaderTypes;
|
auto loaders() const -> ModPlatform::ModLoaderTypes;
|
||||||
auto mcVersions() const -> QStringList;
|
auto mcVersions() const -> QStringList;
|
||||||
|
auto releaseType() const -> ModPlatform::IndexedVersionType;
|
||||||
|
|
||||||
/** Get the intneral path to the mod's icon file*/
|
/** Get the intneral path to the mod's icon file*/
|
||||||
QString iconPath() const { return m_local_details.icon_file; }
|
QString iconPath() const { return m_local_details.icon_file; }
|
||||||
|
@ -64,16 +64,17 @@
|
|||||||
ModFolderModel::ModFolderModel(const QString& dir, BaseInstance* instance, bool is_indexed, bool create_dir)
|
ModFolderModel::ModFolderModel(const QString& dir, BaseInstance* instance, bool is_indexed, bool create_dir)
|
||||||
: ResourceFolderModel(QDir(dir), instance, nullptr, create_dir), m_is_indexed(is_indexed)
|
: ResourceFolderModel(QDir(dir), instance, nullptr, create_dir), m_is_indexed(is_indexed)
|
||||||
{
|
{
|
||||||
m_column_names =
|
m_column_names = QStringList(
|
||||||
QStringList({ "Enable", "Image", "Name", "Version", "Last Modified", "Provider", "Side", "Loaders", "Miecraft Versions" });
|
{ "Enable", "Image", "Name", "Version", "Last Modified", "Provider", "Side", "Loaders", "Miecraft Versions", "Release Type" });
|
||||||
m_column_names_translated = QStringList({ tr("Enable"), tr("Image"), tr("Name"), tr("Version"), tr("Last Modified"), tr("Provider"),
|
m_column_names_translated = QStringList({ tr("Enable"), tr("Image"), tr("Name"), tr("Version"), tr("Last Modified"), tr("Provider"),
|
||||||
tr("Side"), tr("Loaders"), tr("Miecraft Versions") });
|
tr("Side"), tr("Loaders"), tr("Miecraft Versions"), tr("Release Type") });
|
||||||
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::NAME, SortType::VERSION, SortType::DATE,
|
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::NAME, SortType::VERSION, SortType::DATE,
|
||||||
SortType::PROVIDER, SortType::SIDE, SortType::LOADERS, SortType::MC_VERSIONS };
|
SortType::PROVIDER, SortType::SIDE, SortType::LOADERS, SortType::MC_VERSIONS, SortType::RELEASE_TYPE };
|
||||||
m_column_resize_modes = { QHeaderView::ResizeToContents, QHeaderView::Interactive, QHeaderView::Stretch,
|
m_column_resize_modes = { QHeaderView::ResizeToContents, QHeaderView::Interactive, QHeaderView::Stretch,
|
||||||
QHeaderView::ResizeToContents, QHeaderView::ResizeToContents, QHeaderView::ResizeToContents,
|
QHeaderView::ResizeToContents, QHeaderView::ResizeToContents, QHeaderView::ResizeToContents,
|
||||||
QHeaderView::ResizeToContents, QHeaderView::ResizeToContents, QHeaderView::ResizeToContents };
|
QHeaderView::ResizeToContents, QHeaderView::ResizeToContents, QHeaderView::ResizeToContents,
|
||||||
m_columnsHideable = { false, true, false, true, true, true, true, true, true };
|
QHeaderView::ResizeToContents };
|
||||||
|
m_columnsHideable = { false, true, false, true, true, true, true, true, true, true };
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ModFolderModel::data(const QModelIndex& index, int role) const
|
QVariant ModFolderModel::data(const QModelIndex& index, int role) const
|
||||||
@ -128,6 +129,9 @@ QVariant ModFolderModel::data(const QModelIndex& index, int role) const
|
|||||||
case McVersionsColumn: {
|
case McVersionsColumn: {
|
||||||
return at(row)->mcVersions().join(", ");
|
return at(row)->mcVersions().join(", ");
|
||||||
}
|
}
|
||||||
|
case ReleaseTypeColumn: {
|
||||||
|
return at(row)->releaseType().toString();
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -180,6 +184,7 @@ QVariant ModFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientatio
|
|||||||
case SideColumn:
|
case SideColumn:
|
||||||
case LoadersColumn:
|
case LoadersColumn:
|
||||||
case McVersionsColumn:
|
case McVersionsColumn:
|
||||||
|
case ReleaseTypeColumn:
|
||||||
return columnNames().at(section);
|
return columnNames().at(section);
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@ -203,6 +208,8 @@ QVariant ModFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientatio
|
|||||||
return tr("The mod loader.");
|
return tr("The mod loader.");
|
||||||
case McVersionsColumn:
|
case McVersionsColumn:
|
||||||
return tr("The supported minecraft versions.");
|
return tr("The supported minecraft versions.");
|
||||||
|
case ReleaseTypeColumn:
|
||||||
|
return tr("The release type.");
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ class ModFolderModel : public ResourceFolderModel {
|
|||||||
SideColumn,
|
SideColumn,
|
||||||
LoadersColumn,
|
LoadersColumn,
|
||||||
McVersionsColumn,
|
McVersionsColumn,
|
||||||
|
ReleaseTypeColumn,
|
||||||
NUM_COLUMNS
|
NUM_COLUMNS
|
||||||
};
|
};
|
||||||
enum ModStatusAction { Disable, Enable, Toggle };
|
enum ModStatusAction { Disable, Enable, Toggle };
|
||||||
|
@ -15,7 +15,7 @@ enum class ResourceType {
|
|||||||
LITEMOD, //!< The resource is a litemod
|
LITEMOD, //!< The resource is a litemod
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SortType { NAME, DATE, VERSION, ENABLED, PACK_FORMAT, PROVIDER, SIDE, LOADERS, MC_VERSIONS };
|
enum class SortType { NAME, DATE, VERSION, ENABLED, PACK_FORMAT, PROVIDER, SIDE, LOADERS, MC_VERSIONS, RELEASE_TYPE };
|
||||||
|
|
||||||
enum class EnableAction { ENABLE, DISABLE, TOGGLE };
|
enum class EnableAction { ENABLE, DISABLE, TOGGLE };
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ auto V1::createModFormat([[maybe_unused]] QDir& index_dir, ModPlatform::IndexedP
|
|||||||
mod.loaders = mod_version.loaders;
|
mod.loaders = mod_version.loaders;
|
||||||
mod.mcVersions = mod_version.mcVersion;
|
mod.mcVersions = mod_version.mcVersion;
|
||||||
mod.mcVersions.sort();
|
mod.mcVersions.sort();
|
||||||
|
mod.releaseType = mod_version.version_type;
|
||||||
|
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
@ -209,6 +210,7 @@ void V1::updateModIndex(QDir& index_dir, Mod& mod)
|
|||||||
{ "side", sideToString(mod.side).toStdString() },
|
{ "side", sideToString(mod.side).toStdString() },
|
||||||
{ "loaders", loaders },
|
{ "loaders", loaders },
|
||||||
{ "mcVersions", mcVersions },
|
{ "mcVersions", mcVersions },
|
||||||
|
{ "releaseType", mod.releaseType.toString().toStdString() },
|
||||||
{ "download",
|
{ "download",
|
||||||
toml::table{
|
toml::table{
|
||||||
{ "mode", mod.mode.toStdString() },
|
{ "mode", mod.mode.toStdString() },
|
||||||
@ -293,6 +295,7 @@ auto V1::getIndexForMod(QDir& index_dir, QString slug) -> Mod
|
|||||||
mod.name = stringEntry(table, "name");
|
mod.name = stringEntry(table, "name");
|
||||||
mod.filename = stringEntry(table, "filename");
|
mod.filename = stringEntry(table, "filename");
|
||||||
mod.side = stringToSide(stringEntry(table, "side"));
|
mod.side = stringToSide(stringEntry(table, "side"));
|
||||||
|
mod.releaseType = ModPlatform::IndexedVersionType(stringEntry(table, "releaseType"));
|
||||||
if (auto loaders = table["loaders"]; loaders && loaders.is_array()) {
|
if (auto loaders = table["loaders"]; loaders && loaders.is_array()) {
|
||||||
for (auto&& loader : *loaders.as_array()) {
|
for (auto&& loader : *loaders.as_array()) {
|
||||||
if (loader.is_string()) {
|
if (loader.is_string()) {
|
||||||
|
@ -43,6 +43,7 @@ class V1 {
|
|||||||
Side side{ Side::UniversalSide };
|
Side side{ Side::UniversalSide };
|
||||||
ModPlatform::ModLoaderTypes loaders;
|
ModPlatform::ModLoaderTypes loaders;
|
||||||
QStringList mcVersions;
|
QStringList mcVersions;
|
||||||
|
ModPlatform::IndexedVersionType releaseType;
|
||||||
|
|
||||||
// [download]
|
// [download]
|
||||||
QString mode{};
|
QString mode{};
|
||||||
|
@ -148,7 +148,7 @@ void ModFilterWidget::onIncludeSnapshotsChanged()
|
|||||||
m_versions_proxy->setFilter(BaseVersionList::TypeRole, new RegexpFilter(filter, false));
|
m_versions_proxy->setFilter(BaseVersionList::TypeRole, new RegexpFilter(filter, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModFilterWidget::onVersionFilterChanged()
|
void ModFilterWidget::onVersionFilterChanged(int)
|
||||||
{
|
{
|
||||||
auto versions = ui->versionsCb->checkedItems();
|
auto versions = ui->versionsCb->checkedItems();
|
||||||
m_filter->versions.clear();
|
m_filter->versions.clear();
|
||||||
|
@ -52,7 +52,7 @@ class ModFilterWidget : public QTabWidget {
|
|||||||
void prepareBasicFilter();
|
void prepareBasicFilter();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onVersionFilterChanged();
|
void onVersionFilterChanged(int);
|
||||||
void onVersionFilterTextChanged(QString version);
|
void onVersionFilterTextChanged(QString version);
|
||||||
void onReleaseFilterChanged();
|
void onReleaseFilterChanged();
|
||||||
void onLoadersFilterChanged();
|
void onLoadersFilterChanged();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user