mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
25bb7a59ac
Finally we get some real use for the new GTabWidget. :^)
36 lines
950 B
C++
36 lines
950 B
C++
#include "ProcessTableView.h"
|
|
#include "ProcessModel.h"
|
|
#include <LibGUI/GSortingProxyModel.h>
|
|
#include <stdio.h>
|
|
|
|
ProcessTableView::ProcessTableView(GraphWidget& graph, GWidget* parent)
|
|
: GTableView(parent)
|
|
{
|
|
set_model(GSortingProxyModel::create(ProcessModel::create(graph)));
|
|
model()->set_key_column_and_sort_order(ProcessModel::Column::CPU, GSortOrder::Descending);
|
|
refresh();
|
|
}
|
|
|
|
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();
|
|
}
|