mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
ChanViewer: Start working on a simple read-only 4Chan viewer
Since they are nice enough to provide a JSON API over HTTP, this makes for a perfect way to exercise our networking code a bit. :^)
This commit is contained in:
parent
210550d4b3
commit
030891531b
6 changed files with 177 additions and 0 deletions
30
Applications/ChanViewer/ThreadCatalogModel.h
Normal file
30
Applications/ChanViewer/ThreadCatalogModel.h
Normal file
|
@ -0,0 +1,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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue