mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 02:55:07 +00:00
LibGUI: Start working on a GFileSystemModel and hook that up in FileManager.
This is a read-only model for the tree view, at least initially. We'll see where we take it from there once it's more polished.
This commit is contained in:
parent
f249c40aaa
commit
4d3c5fd83e
7 changed files with 205 additions and 6 deletions
31
LibGUI/GFileSystemModel.h
Normal file
31
LibGUI/GFileSystemModel.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
class GFileSystemModel : public GModel {
|
||||
friend class Node;
|
||||
public:
|
||||
static Retained<GFileSystemModel> create(const String& root_path = "/")
|
||||
{
|
||||
return adopt(*new GFileSystemModel(root_path));
|
||||
}
|
||||
virtual ~GFileSystemModel() override;
|
||||
|
||||
String root_path() const { return m_root_path; }
|
||||
|
||||
virtual int row_count(const GModelIndex& = GModelIndex()) const override;
|
||||
virtual int column_count(const GModelIndex& = GModelIndex()) const override;
|
||||
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
|
||||
virtual void update() override;
|
||||
virtual GModelIndex parent_index(const GModelIndex&) const override;
|
||||
virtual GModelIndex index(int row, int column = 0, const GModelIndex& = GModelIndex()) const override;
|
||||
virtual void activate(const GModelIndex&) override;
|
||||
|
||||
private:
|
||||
explicit GFileSystemModel(const String& root_path);
|
||||
|
||||
String m_root_path;
|
||||
|
||||
struct Node;
|
||||
Node* m_root { nullptr };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue