mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-29 07:48:47 +00:00
ProcessManager: Make the toolbar actions work again.
We can't grab at the ProcessTableModel directly anymore since we have a sorting proxy model in the middle now.
This commit is contained in:
parent
2336d43abc
commit
0b32ab12f1
Notes:
sideshowbarker
2024-07-19 15:05:51 +09:00
Author: https://github.com/awesomekling
Commit: 0b32ab12f1
4 changed files with 8 additions and 22 deletions
|
@ -6,12 +6,10 @@
|
|||
ProcessTableView::ProcessTableView(GWidget* parent)
|
||||
: GTableView(parent)
|
||||
{
|
||||
auto process_model = make<ProcessTableModel>();
|
||||
m_model = process_model.ptr();
|
||||
set_model(make<GSortingProxyTableModel>(move(process_model)));
|
||||
GTableView::model()->set_key_column_and_sort_order(ProcessTableModel::Column::CPU, GSortOrder::Descending);
|
||||
set_model(make<GSortingProxyTableModel>(make<ProcessTableModel>()));
|
||||
model()->set_key_column_and_sort_order(ProcessTableModel::Column::CPU, GSortOrder::Descending);
|
||||
start_timer(1000);
|
||||
model().update();
|
||||
model()->update();
|
||||
}
|
||||
|
||||
ProcessTableView::~ProcessTableView()
|
||||
|
@ -20,19 +18,21 @@ ProcessTableView::~ProcessTableView()
|
|||
|
||||
void ProcessTableView::timer_event(GTimerEvent&)
|
||||
{
|
||||
model().update();
|
||||
model()->update();
|
||||
}
|
||||
|
||||
void ProcessTableView::model_notification(const GModelNotification& notification)
|
||||
{
|
||||
if (notification.type() == GModelNotification::ModelUpdated) {
|
||||
if (on_status_message)
|
||||
on_status_message(String::format("%d processes", model().row_count()));
|
||||
on_status_message(String::format("%d processes", model()->row_count()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pid_t ProcessTableView::selected_pid() const
|
||||
{
|
||||
return model().selected_pid();
|
||||
if (!model()->selected_index().is_valid())
|
||||
return -1;
|
||||
return model()->data({ model()->selected_index().row(), ProcessTableModel::Column::PID }, GTableModel::Role::Sort).as_int();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue