mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 09:18:52 +00:00
ProcessManager: Rename it to SystemMonitor
This is a more appropriate name now that it does a lot more than just manage processes ^)
This commit is contained in:
parent
c7040cee62
commit
cbdda91065
Notes:
sideshowbarker
2024-07-19 12:41:14 +09:00
Author: https://github.com/bugaevc
Commit: cbdda91065
Pull-request: https://github.com/SerenityOS/serenity/pull/453
Reviewed-by: https://github.com/awesomekling
23 changed files with 9 additions and 9 deletions
42
Applications/SystemMonitor/ProcessTableView.cpp
Normal file
42
Applications/SystemMonitor/ProcessTableView.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#include "ProcessTableView.h"
|
||||
#include "ProcessModel.h"
|
||||
#include <LibGUI/GSortingProxyModel.h>
|
||||
#include <stdio.h>
|
||||
|
||||
ProcessTableView::ProcessTableView(GraphWidget& graph, GWidget* parent)
|
||||
: GTableView(parent)
|
||||
{
|
||||
set_size_columns_to_fit_content(true);
|
||||
set_model(GSortingProxyModel::create(ProcessModel::create(graph)));
|
||||
model()->set_key_column_and_sort_order(ProcessModel::Column::CPU, GSortOrder::Descending);
|
||||
refresh();
|
||||
|
||||
on_selection = [this](auto&) {
|
||||
if (on_process_selected)
|
||||
on_process_selected(selected_pid());
|
||||
};
|
||||
}
|
||||
|
||||
ProcessTableView::~ProcessTableView()
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessTableView::refresh()
|
||||
{
|
||||
model()->update();
|
||||
}
|
||||
|
||||
void ProcessTableView::model_notification(const GModelNotification& notification)
|
||||
{
|
||||
if (notification.type() == GModelNotification::ModelUpdated) {
|
||||
// Do something?
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pid_t ProcessTableView::selected_pid() const
|
||||
{
|
||||
if (!model()->selected_index().is_valid())
|
||||
return -1;
|
||||
return model()->data(model()->index(model()->selected_index().row(), ProcessModel::Column::PID), GModel::Role::Sort).as_int();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue