mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:52:43 +00:00 
			
		
		
		
	 4f3234148a
			
		
	
	
		4f3234148a
		
	
	
	
	
		
			
			This patch expands the object model of this program quite a bit. We now have a RemoteProcess object that contains a list of remote root RemoteObject objects. The RemoteProcess vends a RemoteObjectGraphModel&, and indices in that model have internal_data() pointing to a corresponding RemoteObject. RemoteObjects in turn vend a RemoteObjectPropertyModel&, which is what we use to show the object properties. This is pretty cool :^)
		
			
				
	
	
		
			34 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/JsonArray.h>
 | |
| #include <AK/JsonObject.h>
 | |
| #include <AK/NonnullOwnPtrVector.h>
 | |
| #include <LibCore/CLocalSocket.h>
 | |
| #include <LibGUI/GModel.h>
 | |
| 
 | |
| class RemoteProcess;
 | |
| 
 | |
| class RemoteObjectGraphModel final : public GModel {
 | |
| public:
 | |
|     static NonnullRefPtr<RemoteObjectGraphModel> create(RemoteProcess& process)
 | |
|     {
 | |
|         return adopt(*new RemoteObjectGraphModel(process));
 | |
|     }
 | |
| 
 | |
|     virtual ~RemoteObjectGraphModel() override;
 | |
| 
 | |
|     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 GModelIndex index(int row, int column, const GModelIndex& parent = GModelIndex()) const override;
 | |
|     virtual GModelIndex parent_index(const GModelIndex&) const override;
 | |
|     virtual void update() override;
 | |
| 
 | |
| private:
 | |
|     explicit RemoteObjectGraphModel(RemoteProcess&);
 | |
| 
 | |
|     RemoteProcess& m_process;
 | |
| 
 | |
|     GIcon m_object_icon;
 | |
|     GIcon m_window_icon;
 | |
| };
 |