mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 05:10:57 +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
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-19 14:54:11 +09:00 
				
			
			Author: https://github.com/awesomekling
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
	
	 Andreas Kling
						Andreas Kling