2019-02-28 10:57:09 +01:00
|
|
|
#include "ProcessTableView.h"
|
|
|
|
|
#include "ProcessTableModel.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProcessTableView::ProcessTableView(GWidget* parent)
|
|
|
|
|
: GTableView(parent)
|
|
|
|
|
{
|
|
|
|
|
set_model(make<ProcessTableModel>());
|
|
|
|
|
start_timer(1000);
|
|
|
|
|
model().update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProcessTableView::~ProcessTableView()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProcessTableView::timer_event(GTimerEvent&)
|
|
|
|
|
{
|
|
|
|
|
model().update();
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-28 21:30:17 +01:00
|
|
|
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()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-28 10:57:09 +01:00
|
|
|
pid_t ProcessTableView::selected_pid() const
|
|
|
|
|
{
|
|
|
|
|
return model().selected_pid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline ProcessTableModel& ProcessTableView::model()
|
|
|
|
|
{
|
|
|
|
|
return static_cast<ProcessTableModel&>(*GTableView::model());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline const ProcessTableModel& ProcessTableView::model() const
|
|
|
|
|
{
|
|
|
|
|
return static_cast<const ProcessTableModel&>(*GTableView::model());
|
|
|
|
|
}
|