1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00
serenity/Applications/ChanViewer/ThreadCatalogModel.h
Andreas Kling 7a63277115 ChanViewer: Fetch the list of boards and allow switching the board
We put the list of boards in a combo box and allow the user to switch
boards that way. :^)
2019-08-05 18:43:36 +02:00

35 lines
972 B
C++

#pragma once
#include <AK/JsonArray.h>
#include <LibGUI/GModel.h>
class ThreadCatalogModel final : public GModel {
public:
enum Column {
ThreadNumber,
Subject,
Text,
ReplyCount,
ImageCount,
PostTime,
__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;
void set_board(const String&);
private:
ThreadCatalogModel();
String m_board { "g" };
JsonArray m_catalog;
};