mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
ProcessManager: Add ProcessTableView::on_process_selected() callback.
This will be useful for doing something in response to the user selecting a different process.
This commit is contained in:
parent
f1af5f26eb
commit
c452528952
2 changed files with 7 additions and 0 deletions
|
@ -9,6 +9,11 @@ ProcessTableView::ProcessTableView(GraphWidget& graph, GWidget* parent)
|
||||||
set_model(GSortingProxyModel::create(ProcessModel::create(graph)));
|
set_model(GSortingProxyModel::create(ProcessModel::create(graph)));
|
||||||
model()->set_key_column_and_sort_order(ProcessModel::Column::CPU, GSortOrder::Descending);
|
model()->set_key_column_and_sort_order(ProcessModel::Column::CPU, GSortOrder::Descending);
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
on_selection = [this](auto&) {
|
||||||
|
if (on_process_selected)
|
||||||
|
on_process_selected(selected_pid());
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessTableView::~ProcessTableView()
|
ProcessTableView::~ProcessTableView()
|
||||||
|
|
|
@ -16,6 +16,8 @@ public:
|
||||||
|
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
|
Function<void(pid_t)> on_process_selected;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void model_notification(const GModelNotification&) override;
|
virtual void model_notification(const GModelNotification&) override;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue