mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
Inspector: Show remote object properties in a table view
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 :^)
This commit is contained in:
parent
736dc5f6c0
commit
4f3234148a
10 changed files with 252 additions and 76 deletions
|
@ -1,15 +1,18 @@
|
|||
#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_with_pid(pid_t pid)
|
||||
static NonnullRefPtr<RemoteObjectGraphModel> create(RemoteProcess& process)
|
||||
{
|
||||
return adopt(*new RemoteObjectGraphModel(pid));
|
||||
return adopt(*new RemoteObjectGraphModel(process));
|
||||
}
|
||||
|
||||
virtual ~RemoteObjectGraphModel() override;
|
||||
|
@ -22,22 +25,10 @@ public:
|
|||
virtual void update() override;
|
||||
|
||||
private:
|
||||
struct RemoteObject {
|
||||
RemoteObject* parent { nullptr };
|
||||
Vector<OwnPtr<RemoteObject>> children;
|
||||
explicit RemoteObjectGraphModel(RemoteProcess&);
|
||||
|
||||
String address;
|
||||
String parent_address;
|
||||
String class_name;
|
||||
String name;
|
||||
};
|
||||
RemoteProcess& m_process;
|
||||
|
||||
explicit RemoteObjectGraphModel(pid_t);
|
||||
|
||||
pid_t m_pid { -1 };
|
||||
CLocalSocket m_socket;
|
||||
JsonArray m_json;
|
||||
NonnullOwnPtrVector<RemoteObject> m_remote_roots;
|
||||
GIcon m_object_icon;
|
||||
GIcon m_window_icon;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue