Remove ensure JSON helpers

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2025-11-09 18:30:07 +00:00
parent 7e8cf628e8
commit e42c9d2a1d
38 changed files with 228 additions and 239 deletions

View File

@@ -21,7 +21,6 @@
#include <QPainter>
#include "FileSystem.h"
#include "Json.h"
static QImage improveSkin(const QImage& skin)
{
@@ -102,11 +101,11 @@ SkinModel::SkinModel(QString path) : m_path(path), m_texture(getSkin(path)), m_m
}
SkinModel::SkinModel(QDir skinDir, QJsonObject obj)
: m_capeId(Json::ensureString(obj, "capeId")), m_model(Model::CLASSIC), m_url(Json::ensureString(obj, "url"))
: m_capeId(obj["capeId"].toString()), m_model(Model::CLASSIC), m_url(obj["url"].toString())
{
auto name = Json::ensureString(obj, "name");
auto name = obj["name"].toString();
if (auto model = Json::ensureString(obj, "model"); model == "SLIM") {
if (auto model = obj["model"].toString(); model == "SLIM") {
m_model = Model::SLIM;
}
m_path = skinDir.absoluteFilePath(name) + ".png";