refactor: move things around so that related things are close together

This also adds some comments around ModModel.cpp and ModPage.cpp to add
some ease of reading the code.

Also move some things from headers to cpp files.
This commit is contained in:
flow
2022-03-07 19:29:59 -03:00
parent b131d3b2ec
commit 9c57b54a81
12 changed files with 200 additions and 165 deletions

View File

@ -1,7 +1,24 @@
#include "ModrinthModel.h"
#include "modplatform/modrinth/ModrinthPackIndex.h"
namespace Modrinth {
const char* ListModel::sorts[5] { "relevance", "downloads", "follows", "updated", "newest" };
const char* ListModel::sorts[5]{ "relevance", "downloads", "follows", "updated", "newest" };
void ListModel::loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj)
{
Modrinth::loadIndexedPack(m, obj);
}
void ListModel::loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr)
{
Modrinth::loadIndexedPackVersions(m, arr, APPLICATION->network(), m_parent->m_instance);
};
QJsonArray ListModel::documentToArray(QJsonDocument& obj) const
{
return obj.object().value("hits").toArray();
}
} // namespace Modrinth