1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +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:
Andreas Kling 2019-08-19 20:29:52 +02:00
parent 736dc5f6c0
commit 4f3234148a
10 changed files with 252 additions and 76 deletions

View file

@ -1,6 +1,11 @@
#include "RemoteObject.h"
#include "RemoteObjectGraphModel.h"
#include "RemoteObjectPropertyModel.h"
#include "RemoteProcess.h"
#include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GSplitter.h>
#include <LibGUI/GTableView.h>
#include <LibGUI/GTreeView.h>
#include <LibGUI/GWindow.h>
#include <stdio.h>
@ -32,10 +37,23 @@ int main(int argc, char** argv)
widget->set_fill_with_background_color(true);
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
auto* tree_view = new GTreeView(widget);
tree_view->set_model(RemoteObjectGraphModel::create_with_pid(pid));
tree_view->model()->update();
auto* splitter = new GSplitter(Orientation::Horizontal, widget);
RemoteProcess remote_process(pid);
auto* tree_view = new GTreeView(splitter);
tree_view->set_model(remote_process.object_graph_model());
tree_view->set_activates_on_selection(true);
auto* properties_table_view = new GTableView(splitter);
properties_table_view->set_size_columns_to_fit_content(true);
tree_view->on_activation = [&](auto& index) {
auto* remote_object = static_cast<RemoteObject*>(index.internal_data());
properties_table_view->set_model(remote_object->property_model());
};
window->show();
remote_process.update();
return app.exec();
}