aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/modrinth/ModrinthModel.h
blob: 9137190d98bf7d853bdbdfbad1ed73dbbb7d7015 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include "ModrinthPage.h"
#include "modplatform/modrinth/ModrinthPackIndex.h"

namespace Modrinth {

class ListModel : public ModPlatform::ListModel {
    Q_OBJECT

   public:
    ListModel(ModrinthPage* parent) : ModPlatform::ListModel(parent){};
    virtual ~ListModel() = default;

   private:
    void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override { Modrinth::loadIndexedPack(m, obj); };

    QJsonArray documentToArray(QJsonDocument& obj) const override { return obj.object().value("hits").toArray(); };

    static const char* sorts[5];
    const char** getSorts() const override { return sorts; };
};

}  // namespace Modrinth