mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
d6abfbdc5a
Now that CObject is fully ref-counted, just use RefPtr everywhere! :^)
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <AK/JsonArray.h>
|
|
#include <LibCore/CHttpJob.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;
|
|
|
|
const String& board() const { return m_board; }
|
|
void set_board(const String&);
|
|
|
|
Function<void()> on_load_started;
|
|
Function<void(bool success)> on_load_finished;
|
|
|
|
private:
|
|
ThreadCatalogModel();
|
|
|
|
String m_board { "g" };
|
|
JsonArray m_catalog;
|
|
RefPtr<CHttpJob> m_pending_job;
|
|
};
|