summaryrefslogtreecommitdiff
path: root/Applications/ChanViewer/ThreadCatalogModel.h
blob: ce1e30fbeb1822b9ae88e3267376c87078c767c5 (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
25
26
27
28
29
30
#pragma once

#include <AK/JsonArray.h>
#include <LibGUI/GModel.h>

class ThreadCatalogModel final : public GModel {
public:
    enum Column {
        ThreadNumber,
        Text,
        ReplyCount,
        ImageCount,
        __Count,
    };

    static NonnullRefPtr<ThreadCatalogModel> create() { return adopt(*new ThreadCatalogModel); }
    virtual ~ThreadCatalogModel() override;

    virtual int row_count(const GModelIndex& = GModelIndex()) const override;
    virtual int column_count(const GModelIndex& = GModelIndex()) const override { return Column::__Count; }
    virtual String column_name(int) const override;
    virtual ColumnMetadata column_metadata(int) const override;
    virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
    virtual void update() override;

private:
    ThreadCatalogModel();

    JsonArray m_catalog;
};