mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:47:35 +00:00
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. :^)
This commit is contained in:
parent
6311a617be
commit
7a63277115
6 changed files with 145 additions and 1 deletions
27
Applications/ChanViewer/BoardListModel.h
Normal file
27
Applications/ChanViewer/BoardListModel.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/JsonArray.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
class BoardListModel final : public GModel {
|
||||
public:
|
||||
enum Column {
|
||||
Board,
|
||||
__Count,
|
||||
};
|
||||
|
||||
static NonnullRefPtr<BoardListModel> create() { return adopt(*new BoardListModel); }
|
||||
virtual ~BoardListModel() 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:
|
||||
BoardListModel();
|
||||
|
||||
JsonArray m_boards;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue