chore: reformat

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2023-08-14 18:16:53 +02:00
parent 779f70057b
commit 91ba4cf75e
603 changed files with 15840 additions and 16257 deletions

View File

@ -182,7 +182,7 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString license = "";
if (auto licenseDatum = tomlData["license"].as_string()) {
license = QString::fromStdString(licenseDatum->get());
} else if (auto licenseDatumMods =(*modsTable)["license"].as_string()) {
} else if (auto licenseDatumMods = (*modsTable)["license"].as_string()) {
license = QString::fromStdString(licenseDatumMods->get());
}
if (!license.isEmpty())
@ -191,7 +191,7 @@ ModDetails ReadMCModTOML(QByteArray contents)
QString logoFile = "";
if (auto logoFileDatum = tomlData["logoFile"].as_string()) {
logoFile = QString::fromStdString(logoFileDatum->get());
} else if (auto logoFileDatumMods =(*modsTable)["logoFile"].as_string()) {
} else if (auto logoFileDatumMods = (*modsTable)["logoFile"].as_string()) {
logoFile = QString::fromStdString(logoFileDatumMods->get());
}
details.icon_file = logoFile;
@ -272,7 +272,7 @@ ModDetails ReadFabricModInfo(QByteArray contents)
if (largest > 0) {
auto key = QString::number(largest) + "x" + QString::number(largest);
details.icon_file = obj.value(key).toString();
} else { // parsing the sizes failed
} else { // parsing the sizes failed
// take the first
for (auto i : obj) {
details.icon_file = i.toString();
@ -359,7 +359,7 @@ ModDetails ReadQuiltModInfo(QByteArray contents)
if (largest > 0) {
auto key = QString::number(largest) + "x" + QString::number(largest);
details.icon_file = obj.value(key).toString();
} else { // parsing the sizes failed
} else { // parsing the sizes failed
// take the first
for (auto i : obj) {
details.icon_file = i.toString();
@ -659,7 +659,8 @@ bool processIconPNG(const Mod& mod, QByteArray&& raw_data)
return true;
}
bool loadIconFile(const Mod& mod) {
bool loadIconFile(const Mod& mod)
{
if (mod.iconPath().isEmpty()) {
qWarning() << "No Iconfile set, be sure to parse the mod first";
return false;
@ -671,15 +672,14 @@ bool loadIconFile(const Mod& mod) {
};
switch (mod.type()) {
case ResourceType::FOLDER:
{
case ResourceType::FOLDER: {
QFileInfo icon_info(FS::PathCombine(mod.fileinfo().filePath(), mod.iconPath()));
if (icon_info.exists() && icon_info.isFile()) {
QFile icon(icon_info.filePath());
if (!icon.open(QIODevice::ReadOnly))
return false;
auto data = icon.readAll();
bool icon_result = ModUtils::processIconPNG(mod, std::move(data));
icon.close();
@ -689,8 +689,7 @@ bool loadIconFile(const Mod& mod) {
}
}
}
case ResourceType::ZIPFILE:
{
case ResourceType::ZIPFILE: {
QuaZip zip(mod.fileinfo().filePath());
if (!zip.open(QuaZip::mdUnzip))
return false;
@ -716,9 +715,8 @@ bool loadIconFile(const Mod& mod) {
return png_invalid(); // could not set icon as current file.
}
}
case ResourceType::LITEMOD:
{
return false; // can lightmods even have icons?
case ResourceType::LITEMOD: {
return false; // can lightmods even have icons?
}
default:
qWarning() << "Invalid type for mod, can not load icon.";