1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

HackStudio: Show the project file list in a tree view

Replace the boring list view with an awesome tree view :^)
This commit is contained in:
Andreas Kling 2019-12-23 00:14:24 +01:00
parent c1b4e8aef0
commit d9706ee882
Notes: sideshowbarker 2024-07-19 10:45:54 +09:00
3 changed files with 187 additions and 15 deletions

View file

@ -4,12 +4,15 @@
#include <AK/Noncopyable.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/OwnPtr.h>
#include <LibGUI/GIcon.h>
#include <LibGUI/GModel.h>
class Project {
AK_MAKE_NONCOPYABLE(Project)
AK_MAKE_NONMOVABLE(Project)
public:
~Project();
static OwnPtr<Project> load_from_file(const String& path);
[[nodiscard]] bool add_file(const String& filename);
@ -26,12 +29,22 @@ public:
}
}
private:
friend class ProjectModel;
struct ProjectTreeNode;
explicit Project(const String& path, Vector<String>&& files);
const ProjectTreeNode& root_node() const { return *m_root_node; }
void rebuild_tree();
String m_path;
RefPtr<GModel> m_model;
NonnullRefPtrVector<ProjectFile> m_files;
OwnPtr<ProjectTreeNode> m_root_node;
GIcon m_directory_icon;
GIcon m_file_icon;
GIcon m_cplusplus_icon;
GIcon m_header_icon;
GIcon m_project_icon;
};