#pragma once #include #include #include class ThreadCatalogModel final : public GModel { public: enum Column { ThreadNumber, Subject, Text, ReplyCount, ImageCount, PostTime, __Count, }; static NonnullRefPtr 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; const String& board() const { return m_board; } void set_board(const String&); Function on_load_started; Function on_load_finished; private: ThreadCatalogModel(); String m_board { "g" }; JsonArray m_catalog; RefPtr m_pending_job; };