mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
SystemMonitor: Wrap file descriptor and unveiled paths model into a SortingProxyModel
This commit is contained in:
parent
f910cdcdb7
commit
3bd6142918
Notes:
sideshowbarker
2024-07-19 02:16:49 +09:00
Author: https://github.com/xTibor Commit: https://github.com/SerenityOS/serenity/commit/3bd61429188 Pull-request: https://github.com/SerenityOS/serenity/pull/3577
4 changed files with 11 additions and 4 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "ProcessFileDescriptorMapWidget.h"
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/JsonArrayModel.h>
|
||||
#include <LibGUI/SortingProxyModel.h>
|
||||
#include <LibGUI/TableView.h>
|
||||
|
||||
ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget()
|
||||
|
@ -56,7 +57,8 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget()
|
|||
return object.get("can_write").to_bool() ? "Yes" : "No";
|
||||
});
|
||||
|
||||
m_table_view->set_model(GUI::JsonArrayModel::create({}, move(pid_fds_fields)));
|
||||
m_model = GUI::JsonArrayModel::create({}, move(pid_fds_fields));
|
||||
m_table_view->set_model(GUI::SortingProxyModel::create(*m_model));
|
||||
}
|
||||
|
||||
ProcessFileDescriptorMapWidget::~ProcessFileDescriptorMapWidget()
|
||||
|
@ -68,5 +70,5 @@ void ProcessFileDescriptorMapWidget::set_pid(pid_t pid)
|
|||
if (m_pid == pid)
|
||||
return;
|
||||
m_pid = pid;
|
||||
static_cast<GUI::JsonArrayModel*>(m_table_view->model())->set_json_path(String::format("/proc/%d/fds", m_pid));
|
||||
m_model->set_json_path(String::format("/proc/%d/fds", m_pid));
|
||||
}
|
||||
|
|
|
@ -39,5 +39,6 @@ private:
|
|||
ProcessFileDescriptorMapWidget();
|
||||
|
||||
RefPtr<GUI::TableView> m_table_view;
|
||||
RefPtr<GUI::JsonArrayModel> m_model;
|
||||
pid_t m_pid { -1 };
|
||||
};
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "ProcessUnveiledPathsWidget.h"
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/JsonArrayModel.h>
|
||||
#include <LibGUI/SortingProxyModel.h>
|
||||
#include <LibGUI/TableView.h>
|
||||
|
||||
ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget()
|
||||
|
@ -38,7 +39,9 @@ ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget()
|
|||
Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields;
|
||||
pid_unveil_fields.empend("path", "Path", Gfx::TextAlignment::CenterLeft);
|
||||
pid_unveil_fields.empend("permissions", "Permissions", Gfx::TextAlignment::CenterLeft);
|
||||
m_table_view->set_model(GUI::JsonArrayModel::create({}, move(pid_unveil_fields)));
|
||||
|
||||
m_model = GUI::JsonArrayModel::create({}, move(pid_unveil_fields));
|
||||
m_table_view->set_model(GUI::SortingProxyModel::create(*m_model));
|
||||
}
|
||||
|
||||
ProcessUnveiledPathsWidget::~ProcessUnveiledPathsWidget()
|
||||
|
@ -50,5 +53,5 @@ void ProcessUnveiledPathsWidget::set_pid(pid_t pid)
|
|||
if (m_pid == pid)
|
||||
return;
|
||||
m_pid = pid;
|
||||
static_cast<GUI::JsonArrayModel*>(m_table_view->model())->set_json_path(String::format("/proc/%d/unveil", m_pid));
|
||||
m_model->set_json_path(String::format("/proc/%d/unveil", m_pid));
|
||||
}
|
||||
|
|
|
@ -39,5 +39,6 @@ private:
|
|||
ProcessUnveiledPathsWidget();
|
||||
|
||||
RefPtr<GUI::TableView> m_table_view;
|
||||
RefPtr<GUI::JsonArrayModel> m_model;
|
||||
pid_t m_pid { -1 };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue