Skip to content

Commit

Permalink
update versions & categories
Browse files Browse the repository at this point in the history
  • Loading branch information
kaniol-lck committed May 29, 2024
1 parent 4bf3e22 commit c8dfe02
Show file tree
Hide file tree
Showing 21 changed files with 97 additions and 28 deletions.
11 changes: 9 additions & 2 deletions src/curseforge/curseforgecategoryinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,19 @@ CurseforgeCategoryInfo CurseforgeCategoryInfo::fromVariant(const QVariant &varia
{ "Creation", QObject::tr("Creation") },
{ "Survival", QObject::tr("Survival") },
{ "Adventure", QObject::tr("Adventure") },
{ "Puzzle", QObject::tr("Puzzle") }
{ "Puzzle", QObject::tr("Puzzle") },
{ "KubeJS", QObject::tr("KubeJS") },
{ "Bug Fixes", QObject::tr("Bug Fixes") },
{ "Create", QObject::tr("Create") },
{ "Performance", QObject::tr("Performance") },
{ "Education", QObject::tr("Education") },
{ "Galacticraft", QObject::tr("Galacticraft") },
{ "Integrated Dynamics", QObject::tr("Integrated Dynamics") }
};
if(replaceMap.contains(info.name_))
info.name_ = replaceMap.value(info.name_);
else
qDebug() << "Untranslated category:" << info.name_;
qDebug() << "Untranslated Curseforge category:" << info.name_;

return info;
}
Expand Down
8 changes: 8 additions & 0 deletions src/gameversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ QList<GameVersion> GameVersion::mojangVersionList_;
QList<GameVersion> GameVersion::curseforgeVersionList_;

QList<GameVersion> GameVersion::cachedVersionList_{
GameVersion(1, 20, 6),
GameVersion(1, 20, 5),
GameVersion(1, 20, 4),
GameVersion(1, 20, 3),
GameVersion(1, 20, 2),
GameVersion(1, 20, 1),
GameVersion(1, 20),
GameVersion(1, 19, 4),
GameVersion(1, 19, 3),
GameVersion(1, 19, 2),
GameVersion(1, 19, 1),
Expand Down
11 changes: 10 additions & 1 deletion src/images/image.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,23 @@
<file>modrinth/food.svg</file>
<file>modrinth/library.svg</file>
<file>modrinth/magic.svg</file>
<file>modrinth/misc.svg</file>
<file>modrinth/storage.svg</file>
<file>modrinth/technology.svg</file>
<file>modrinth/utility.svg</file>
<file>modrinth/worldgen.svg</file>
<file>modmanager.png</file>
<file>gitlab.svg</file>
<file>modrinth/optimization.svg</file>
<file>neoforge.png</file>
<file>quilt.svg</file>
<file>modrinth/economy.svg</file>
<file>modrinth/management.svg</file>
<file>modrinth/minigame.svg</file>
<file>modrinth/mobs.svg</file>
<file>modrinth/social.svg</file>
<file>modrinth/transportation.svg</file>
<file>liteloader.png</file>
<file>rift.png</file>
</qresource>
<qresource prefix="/"/>
</RCC>
Binary file added src/images/liteloader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/images/modrinth/adventure.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/modrinth/economy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/images/modrinth/magic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/modrinth/management.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/modrinth/minigame.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/images/modrinth/misc.svg

This file was deleted.

5 changes: 5 additions & 0 deletions src/images/modrinth/mobs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/modrinth/social.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/modrinth/transportation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/neoforge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/quilt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/rift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/modloadertype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ ModLoaderType::Type ModLoaderType::fromString(const QString &str)
return Type::Fabric;
else if(str.toLower() == "forge")
return Type::Forge;
else if(str.toLower() == "liteloader")
return Type::LiteLoader;
else if(str.toLower() == "neoforge")
return Type::Neoforge;
else if(str.toLower() == "quilt")
return Type::Quilt;
else if(str.toLower() == "rift")
return Type::Rift;
else
Expand All @@ -23,6 +29,12 @@ QString ModLoaderType::toString(Type loaderType)
return "Fabric";
case Type::Forge:
return "Forge";
case Type::LiteLoader:
return "LiteLoader";
case Type::Neoforge:
return "NeoForge";
case Type::Quilt:
return "Quilt";
case Type::Rift:
return "Rift";
default:
Expand All @@ -36,5 +48,13 @@ QIcon ModLoaderType::icon(Type type)
return QIcon(":/image/fabric.png");
if(type == Forge)
return QIcon(":/image/forge.svg");
if(type == LiteLoader)
return QIcon(":/image/liteloader.png");
if(type == Neoforge)
return QIcon(":/image/neoforge.png");
if(type == Quilt)
return QIcon(":/image/quilt.svg");
if(type == Rift)
return QIcon(":/image/rift.png");
return QIcon();
}
5 changes: 4 additions & 1 deletion src/modloadertype.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ enum Type{
Any,
Fabric,
Forge,
LiteLoader,
Neoforge,
Quilt,
Rift
};

Expand All @@ -20,7 +23,7 @@ QString toString(Type loaderType);
QIcon icon(Type type);

const QList<Type> curseforge{ Any, Fabric, Forge/*, Rift*/ };
const QList<Type> modrinth{ Any, Fabric, Forge };
const QList<Type> modrinth{ Any, Fabric, Forge, LiteLoader, Neoforge, Quilt, Rift };
const QList<Type> replay{ Any, Fabric, Forge };
const QList<Type> local{ Any, Fabric, Forge };

Expand Down
23 changes: 14 additions & 9 deletions src/modrinth/modrinthapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,24 @@ Reply<ModrinthFileInfo> ModrinthAPI::getVersionFileBySha1(const QString sha1)
const QList<std::tuple<QString, QString> > &ModrinthAPI::getCategories()
{
static const QList<std::tuple<QString, QString>> categories{
{ tr("World generation"), "worldgen" },
{ tr("Technology"), "technology" },
{ tr("Adventure"), "adventure" },
{ tr("Cursed"), "cursed" },
{ tr("Decoration"), "decoration" },
{ tr("Economy"), "economy" },
{ tr("Equipment"), "equipment" },
{ tr("Food"), "food" },
{ tr("Library"), "library" },
{ tr("Magic"), "magic" },
{ tr("Management"), "management" },
{ tr("Minigame"), "minigame" },
{ tr("Mobs"), "mobs" },
{ tr("Optimization"), "optimization" },
{ tr("Social"), "social" },
{ tr("Storage"), "storage" },
{ tr("Library"), "library" },
{ tr("Adventure"), "adventure" },
{ tr("Technology"), "technology" },
{ tr("Transportation"), "transportation" },
{ tr("Utility"), "utility" },
{ tr("Decoration"), "decoration" },
{ tr("Miscellaneous"), "misc" },
{ tr("Optimization"), "optimization" },
{ tr("Equipment"), "equipment" },
{ tr("Cursed"), "cursed" }
{ tr("World generation"), "worldgen" },
};
return categories;
}
25 changes: 13 additions & 12 deletions src/modrinth/modrinthmodinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ ModrinthModInfo ModrinthModInfo::fromSearchVariant(const QVariant &variant)
if(it != ModrinthAPI::getCategories().end()){
auto [name, iconName] = *it;
modInfo.importTag(Tag(name, TagCategory::ModrinthCategory, ":/image/modrinth/" + iconName));
} else if(categoryId == "fabric")
modInfo.loaderTypes_ << ModLoaderType::Fabric;
else if(categoryId == "forge")
modInfo.loaderTypes_ << ModLoaderType::Forge;
else
qDebug() << "UNKNOWN MODRINTH CATEGORY ID:" << categoryId;
} else if(auto loaderType = ModLoaderType::fromString(categoryId);
loaderType != ModLoaderType::Any && ModLoaderType::modrinth.contains(loaderType)){
modInfo.loaderTypes_ << loaderType;
} else{
// qDebug() << "UNKNOWN MODRINTH CATEGORY ID:" << categoryId;
// qDebug() << modInfo.name() << modInfo.categories();
}
}

return modInfo;
Expand Down Expand Up @@ -84,12 +85,12 @@ ModrinthModInfo ModrinthModInfo::fromVariant(const QVariant &variant)
if(it != ModrinthAPI::getCategories().end()){
auto [name, iconName] = *it;
modInfo.importTag(Tag(name, TagCategory::ModrinthCategory, ":/image/modrinth/" + iconName));
} else if(categoryId == "fabric")
modInfo.loaderTypes_ << ModLoaderType::Fabric;
else if(categoryId == "forge")
modInfo.loaderTypes_ << ModLoaderType::Forge;
else
qDebug() << "UNKNOWN MODRINTH CATEGORY ID:" << categoryId;
} else if(auto loaderType = ModLoaderType::fromString(categoryId);
loaderType != ModLoaderType::Any && ModLoaderType::modrinth.contains(loaderType)){
modInfo.loaderTypes_ << loaderType;
} else{
// qDebug() << "UNKNOWN MODRINTH CATEGORY ID:" << categoryId;
}
}

return modInfo;
Expand Down
8 changes: 8 additions & 0 deletions src/ui/modrinth/modrinthmoditemwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ ModrinthModItemWidget::ModrinthModItemWidget(ModrinthModBrowser *parent, Modrint
label->setText(QString(R"(<img src=":/image/fabric.png" height="22" width="22"/>)"));
else if(loaderType == ModLoaderType::Forge)
label->setText(QString(R"(<img src=":/image/forge.svg" height="22" width="22"/>)"));
else if(loaderType == ModLoaderType::LiteLoader)
label->setText(QString(R"(<img src=":/image/liteloader.png" height="22" width="22"/>)"));
else if(loaderType == ModLoaderType::Neoforge)
label->setText(QString(R"(<img src=":/image/neoforge.png" height="22" width="22"/>)"));
else if(loaderType == ModLoaderType::Quilt)
label->setText(QString(R"(<img src=":/image/quilt.svg" height="22" width="22"/>)"));
else if(loaderType == ModLoaderType::Rift)
label->setText(QString(R"(<img src=":/image/rift.png" height="22" width="22"/>)"));
else
label->setText(ModLoaderType::toString(loaderType));
label->setToolTip(ModLoaderType::toString(loaderType));
Expand Down

0 comments on commit c8dfe02

Please sign in to comment.