mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +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 :^)
		
			
				
	
	
		
			37 lines
		
	
	
	
		
			1,010 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			1,010 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/JsonValue.h>
 | |
| #include <LibGUI/GModel.h>
 | |
| 
 | |
| class RemoteObject;
 | |
| 
 | |
| class RemoteObjectPropertyModel final : public GModel {
 | |
| public:
 | |
|     virtual ~RemoteObjectPropertyModel() override {}
 | |
|     static NonnullRefPtr<RemoteObjectPropertyModel> create(RemoteObject& object)
 | |
|     {
 | |
|         return adopt(*new RemoteObjectPropertyModel(object));
 | |
|     }
 | |
| 
 | |
|     enum Column {
 | |
|         Name,
 | |
|         Value,
 | |
|         __Count,
 | |
|     };
 | |
| 
 | |
|     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 GVariant data(const GModelIndex&, Role = Role::Display) const override;
 | |
|     virtual void update() override;
 | |
| 
 | |
| private:
 | |
|     explicit RemoteObjectPropertyModel(RemoteObject&);
 | |
| 
 | |
|     RemoteObject& m_object;
 | |
|     struct NameAndValue {
 | |
|         JsonValue name;
 | |
|         JsonValue value;
 | |
|     };
 | |
|     Vector<NameAndValue> m_properties;
 | |
| };
 |