mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
This commit is contained in:
parent
2d39da5405
commit
c5bd9d4ed1
337 changed files with 5400 additions and 4816 deletions
|
@ -45,12 +45,12 @@ DevicesModel::~DevicesModel()
|
|||
{
|
||||
}
|
||||
|
||||
int DevicesModel::row_count(const GModelIndex&) const
|
||||
int DevicesModel::row_count(const GUI::ModelIndex&) const
|
||||
{
|
||||
return m_devices.size();
|
||||
}
|
||||
|
||||
int DevicesModel::column_count(const GModelIndex&) const
|
||||
int DevicesModel::column_count(const GUI::ModelIndex&) const
|
||||
{
|
||||
return Column::__Count;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ String DevicesModel::column_name(int column) const
|
|||
}
|
||||
}
|
||||
|
||||
GModel::ColumnMetadata DevicesModel::column_metadata(int column) const
|
||||
GUI::Model::ColumnMetadata DevicesModel::column_metadata(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Device:
|
||||
|
@ -91,7 +91,7 @@ GModel::ColumnMetadata DevicesModel::column_metadata(int column) const
|
|||
}
|
||||
}
|
||||
|
||||
GVariant DevicesModel::data(const GModelIndex& index, Role) const
|
||||
GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, Role) const
|
||||
{
|
||||
ASSERT(is_valid(index));
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <AK/Vector.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
class DevicesModel final : public GModel {
|
||||
class DevicesModel final : public GUI::Model {
|
||||
public:
|
||||
enum Column {
|
||||
Device = 0,
|
||||
|
@ -44,11 +44,11 @@ public:
|
|||
virtual ~DevicesModel() override;
|
||||
static NonnullRefPtr<DevicesModel> create();
|
||||
|
||||
virtual int row_count(const GModelIndex&) const override;
|
||||
virtual int column_count(const GModelIndex&) const override;
|
||||
virtual int row_count(const GUI::ModelIndex&) const override;
|
||||
virtual int column_count(const GUI::ModelIndex&) const override;
|
||||
virtual String column_name(int column) const override;
|
||||
virtual ColumnMetadata column_metadata(int column) const override;
|
||||
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
|
||||
virtual GUI::Variant data(const GUI::ModelIndex&, Role = Role::Display) const override;
|
||||
virtual void update() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "GraphWidget.h"
|
||||
#include <LibGUI/GPainter.h>
|
||||
|
||||
GraphWidget::GraphWidget(GWidget* parent)
|
||||
: GFrame(parent)
|
||||
GraphWidget::GraphWidget(GUI::Widget* parent)
|
||||
: GUI::Frame(parent)
|
||||
{
|
||||
set_frame_thickness(2);
|
||||
set_frame_shape(FrameShape::Container);
|
||||
|
@ -45,10 +45,10 @@ void GraphWidget::add_value(int value)
|
|||
update();
|
||||
}
|
||||
|
||||
void GraphWidget::paint_event(GPaintEvent& event)
|
||||
void GraphWidget::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GFrame::paint_event(event);
|
||||
GPainter painter(*this);
|
||||
GUI::Frame::paint_event(event);
|
||||
GUI::Painter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
painter.add_clip_rect(frame_inner_rect());
|
||||
painter.fill_rect(event.rect(), Color::Black);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <AK/CircularQueue.h>
|
||||
#include <LibGUI/GFrame.h>
|
||||
|
||||
class GraphWidget final : public GFrame {
|
||||
class GraphWidget final : public GUI::Frame {
|
||||
C_OBJECT(GraphWidget)
|
||||
public:
|
||||
virtual ~GraphWidget() override;
|
||||
|
@ -41,9 +41,9 @@ public:
|
|||
Function<String(int value, int max)> text_formatter;
|
||||
|
||||
private:
|
||||
explicit GraphWidget(GWidget* parent);
|
||||
explicit GraphWidget(GUI::Widget* parent);
|
||||
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
|
||||
int m_max { 100 };
|
||||
CircularQueue<int, 4000> m_values;
|
||||
|
|
|
@ -42,29 +42,29 @@ MemoryStatsWidget* MemoryStatsWidget::the()
|
|||
return s_the;
|
||||
}
|
||||
|
||||
MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph, GWidget* parent)
|
||||
: GWidget(parent)
|
||||
MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph, GUI::Widget* parent)
|
||||
: GUI::Widget(parent)
|
||||
, m_graph(graph)
|
||||
{
|
||||
ASSERT(!s_the);
|
||||
s_the = this;
|
||||
|
||||
set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
set_preferred_size(0, 72);
|
||||
|
||||
set_layout(make<GVBoxLayout>());
|
||||
set_layout(make<GUI::VBoxLayout>());
|
||||
layout()->set_margins({ 0, 8, 0, 0 });
|
||||
layout()->set_spacing(3);
|
||||
|
||||
auto build_widgets_for_label = [this](const String& description) -> RefPtr<GLabel> {
|
||||
auto container = GWidget::construct(this);
|
||||
container->set_layout(make<GHBoxLayout>());
|
||||
container->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
auto build_widgets_for_label = [this](const String& description) -> RefPtr<GUI::Label> {
|
||||
auto container = GUI::Widget::construct(this);
|
||||
container->set_layout(make<GUI::HBoxLayout>());
|
||||
container->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
container->set_preferred_size(275, 12);
|
||||
auto description_label = GLabel::construct(description, container);
|
||||
auto description_label = GUI::Label::construct(description, container);
|
||||
description_label->set_font(Font::default_bold_font());
|
||||
description_label->set_text_alignment(TextAlignment::CenterLeft);
|
||||
auto label = GLabel::construct(container);
|
||||
auto label = GUI::Label::construct(container);
|
||||
label->set_text_alignment(TextAlignment::CenterRight);
|
||||
return label;
|
||||
};
|
||||
|
|
|
@ -28,10 +28,13 @@
|
|||
|
||||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GLabel;
|
||||
namespace GUI {
|
||||
class Label;
|
||||
}
|
||||
|
||||
class GraphWidget;
|
||||
|
||||
class MemoryStatsWidget final : public GWidget {
|
||||
class MemoryStatsWidget final : public GUI::Widget {
|
||||
C_OBJECT(MemoryStatsWidget)
|
||||
public:
|
||||
static MemoryStatsWidget* the();
|
||||
|
@ -41,11 +44,11 @@ public:
|
|||
void refresh();
|
||||
|
||||
private:
|
||||
MemoryStatsWidget(GraphWidget& graph, GWidget* parent);
|
||||
MemoryStatsWidget(GraphWidget& graph, GUI::Widget* parent);
|
||||
|
||||
GraphWidget& m_graph;
|
||||
RefPtr<GLabel> m_user_physical_pages_label;
|
||||
RefPtr<GLabel> m_supervisor_physical_pages_label;
|
||||
RefPtr<GLabel> m_kmalloc_label;
|
||||
RefPtr<GLabel> m_kmalloc_count_label;
|
||||
RefPtr<GUI::Label> m_user_physical_pages_label;
|
||||
RefPtr<GUI::Label> m_supervisor_physical_pages_label;
|
||||
RefPtr<GUI::Label> m_kmalloc_label;
|
||||
RefPtr<GUI::Label> m_kmalloc_count_label;
|
||||
};
|
||||
|
|
|
@ -30,24 +30,24 @@
|
|||
#include <LibGUI/GJsonArrayModel.h>
|
||||
#include <LibGUI/GTableView.h>
|
||||
|
||||
NetworkStatisticsWidget::NetworkStatisticsWidget(GWidget* parent)
|
||||
: GLazyWidget(parent)
|
||||
NetworkStatisticsWidget::NetworkStatisticsWidget(GUI::Widget* parent)
|
||||
: GUI::LazyWidget(parent)
|
||||
{
|
||||
on_first_show = [this](auto&) {
|
||||
set_layout(make<GVBoxLayout>());
|
||||
set_layout(make<GUI::VBoxLayout>());
|
||||
layout()->set_margins({ 4, 4, 4, 4 });
|
||||
set_fill_with_background_color(true);
|
||||
|
||||
auto adapters_group_box = GGroupBox::construct("Adapters", this);
|
||||
adapters_group_box->set_layout(make<GVBoxLayout>());
|
||||
auto adapters_group_box = GUI::GroupBox::construct("Adapters", this);
|
||||
adapters_group_box->set_layout(make<GUI::VBoxLayout>());
|
||||
adapters_group_box->layout()->set_margins({ 6, 16, 6, 6 });
|
||||
adapters_group_box->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
adapters_group_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
adapters_group_box->set_preferred_size(0, 120);
|
||||
|
||||
m_adapter_table_view = GTableView::construct(adapters_group_box);
|
||||
m_adapter_table_view = GUI::TableView::construct(adapters_group_box);
|
||||
m_adapter_table_view->set_size_columns_to_fit_content(true);
|
||||
|
||||
Vector<GJsonArrayModel::FieldSpec> net_adapters_fields;
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> net_adapters_fields;
|
||||
net_adapters_fields.empend("name", "Name", TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("class_name", "Class", TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("mac_address", "MAC", TextAlignment::CenterLeft);
|
||||
|
@ -56,18 +56,18 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GWidget* parent)
|
|||
net_adapters_fields.empend("packets_out", "Pkt Out", TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("bytes_in", "Bytes In", TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("bytes_out", "Bytes Out", TextAlignment::CenterRight);
|
||||
m_adapter_table_view->set_model(GJsonArrayModel::create("/proc/net/adapters", move(net_adapters_fields)));
|
||||
m_adapter_table_view->set_model(GUI::JsonArrayModel::create("/proc/net/adapters", move(net_adapters_fields)));
|
||||
|
||||
auto sockets_group_box = GGroupBox::construct("Sockets", this);
|
||||
sockets_group_box->set_layout(make<GVBoxLayout>());
|
||||
auto sockets_group_box = GUI::GroupBox::construct("Sockets", this);
|
||||
sockets_group_box->set_layout(make<GUI::VBoxLayout>());
|
||||
sockets_group_box->layout()->set_margins({ 6, 16, 6, 6 });
|
||||
sockets_group_box->set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
|
||||
sockets_group_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fill);
|
||||
sockets_group_box->set_preferred_size(0, 0);
|
||||
|
||||
m_socket_table_view = GTableView::construct(sockets_group_box);
|
||||
m_socket_table_view = GUI::TableView::construct(sockets_group_box);
|
||||
m_socket_table_view->set_size_columns_to_fit_content(true);
|
||||
|
||||
Vector<GJsonArrayModel::FieldSpec> net_tcp_fields;
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> net_tcp_fields;
|
||||
net_tcp_fields.empend("peer_address", "Peer", TextAlignment::CenterLeft);
|
||||
net_tcp_fields.empend("peer_port", "Port", TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("local_address", "Local", TextAlignment::CenterLeft);
|
||||
|
@ -79,7 +79,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GWidget* parent)
|
|||
net_tcp_fields.empend("packets_out", "Pkt Out", TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("bytes_in", "Bytes In", TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("bytes_out", "Bytes Out", TextAlignment::CenterRight);
|
||||
m_socket_table_view->set_model(GJsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields)));
|
||||
m_socket_table_view->set_model(GUI::JsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields)));
|
||||
|
||||
m_update_timer = Core::Timer::construct(
|
||||
1000, [this] {
|
||||
|
|
|
@ -29,18 +29,20 @@
|
|||
#include <LibCore/CTimer.h>
|
||||
#include <LibGUI/GLazyWidget.h>
|
||||
|
||||
class GTableView;
|
||||
namespace GUI {
|
||||
class TableView;
|
||||
}
|
||||
|
||||
class NetworkStatisticsWidget final : public GLazyWidget {
|
||||
class NetworkStatisticsWidget final : public GUI::LazyWidget {
|
||||
C_OBJECT(NetworkStatisticsWidget)
|
||||
public:
|
||||
virtual ~NetworkStatisticsWidget() override;
|
||||
|
||||
private:
|
||||
explicit NetworkStatisticsWidget(GWidget* parent = nullptr);
|
||||
explicit NetworkStatisticsWidget(GUI::Widget* parent = nullptr);
|
||||
void update_models();
|
||||
|
||||
RefPtr<GTableView> m_adapter_table_view;
|
||||
RefPtr<GTableView> m_socket_table_view;
|
||||
RefPtr<GUI::TableView> m_adapter_table_view;
|
||||
RefPtr<GUI::TableView> m_socket_table_view;
|
||||
RefPtr<Core::Timer> m_update_timer;
|
||||
};
|
||||
|
|
|
@ -29,15 +29,15 @@
|
|||
#include <LibGUI/GJsonArrayModel.h>
|
||||
#include <LibGUI/GTableView.h>
|
||||
|
||||
ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget(GUI::Widget* parent)
|
||||
: GUI::Widget(parent)
|
||||
{
|
||||
set_layout(make<GVBoxLayout>());
|
||||
set_layout(make<GUI::VBoxLayout>());
|
||||
layout()->set_margins({ 4, 4, 4, 4 });
|
||||
m_table_view = GTableView::construct(this);
|
||||
m_table_view = GUI::TableView::construct(this);
|
||||
m_table_view->set_size_columns_to_fit_content(true);
|
||||
|
||||
Vector<GJsonArrayModel::FieldSpec> pid_fds_fields;
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> pid_fds_fields;
|
||||
pid_fds_fields.empend("fd", "FD", TextAlignment::CenterRight);
|
||||
pid_fds_fields.empend("class", "Class", TextAlignment::CenterLeft);
|
||||
pid_fds_fields.empend("offset", "Offset", TextAlignment::CenterRight);
|
||||
|
@ -58,7 +58,7 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget(GWidget* parent)
|
|||
return object.get("can_write").to_bool() ? "Yes" : "No";
|
||||
});
|
||||
|
||||
m_table_view->set_model(GJsonArrayModel::create({}, move(pid_fds_fields)));
|
||||
m_table_view->set_model(GUI::JsonArrayModel::create({}, move(pid_fds_fields)));
|
||||
}
|
||||
|
||||
ProcessFileDescriptorMapWidget::~ProcessFileDescriptorMapWidget()
|
||||
|
@ -70,5 +70,5 @@ void ProcessFileDescriptorMapWidget::set_pid(pid_t pid)
|
|||
if (m_pid == pid)
|
||||
return;
|
||||
m_pid = pid;
|
||||
static_cast<GJsonArrayModel*>(m_table_view->model())->set_json_path(String::format("/proc/%d/fds", m_pid));
|
||||
static_cast<GUI::JsonArrayModel*>(m_table_view->model())->set_json_path(String::format("/proc/%d/fds", m_pid));
|
||||
}
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
|
||||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GTableView;
|
||||
namespace GUI {
|
||||
class TableView;
|
||||
}
|
||||
|
||||
class ProcessFileDescriptorMapWidget final : public GWidget {
|
||||
class ProcessFileDescriptorMapWidget final : public GUI::Widget {
|
||||
C_OBJECT(ProcessFileDescriptorMapWidget);
|
||||
public:
|
||||
virtual ~ProcessFileDescriptorMapWidget() override;
|
||||
|
@ -38,8 +40,8 @@ public:
|
|||
void set_pid(pid_t);
|
||||
|
||||
private:
|
||||
explicit ProcessFileDescriptorMapWidget(GWidget* parent);
|
||||
explicit ProcessFileDescriptorMapWidget(GUI::Widget* parent);
|
||||
|
||||
RefPtr<GTableView> m_table_view;
|
||||
RefPtr<GUI::TableView> m_table_view;
|
||||
pid_t m_pid { -1 };
|
||||
};
|
||||
|
|
|
@ -31,14 +31,14 @@
|
|||
#include <LibGUI/GSortingProxyModel.h>
|
||||
#include <LibGUI/GTableView.h>
|
||||
|
||||
ProcessMemoryMapWidget::ProcessMemoryMapWidget(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
ProcessMemoryMapWidget::ProcessMemoryMapWidget(GUI::Widget* parent)
|
||||
: GUI::Widget(parent)
|
||||
{
|
||||
set_layout(make<GVBoxLayout>());
|
||||
set_layout(make<GUI::VBoxLayout>());
|
||||
layout()->set_margins({ 4, 4, 4, 4 });
|
||||
m_table_view = GTableView::construct(this);
|
||||
m_table_view = GUI::TableView::construct(this);
|
||||
m_table_view->set_size_columns_to_fit_content(true);
|
||||
Vector<GJsonArrayModel::FieldSpec> pid_vm_fields;
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields;
|
||||
pid_vm_fields.empend("Address", TextAlignment::CenterLeft, [](auto& object) {
|
||||
return String::format("%#x", object.get("address").to_u32());
|
||||
});
|
||||
|
@ -70,9 +70,9 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget(GWidget* parent)
|
|||
});
|
||||
pid_vm_fields.empend("cow_pages", "# CoW", TextAlignment::CenterRight);
|
||||
pid_vm_fields.empend("name", "Name", TextAlignment::CenterLeft);
|
||||
m_json_model = GJsonArrayModel::create({}, move(pid_vm_fields));
|
||||
m_table_view->set_model(GSortingProxyModel::create(*m_json_model));
|
||||
m_table_view->model()->set_key_column_and_sort_order(0, GSortOrder::Ascending);
|
||||
m_json_model = GUI::JsonArrayModel::create({}, move(pid_vm_fields));
|
||||
m_table_view->set_model(GUI::SortingProxyModel::create(*m_json_model));
|
||||
m_table_view->model()->set_key_column_and_sort_order(0, GUI::SortOrder::Ascending);
|
||||
m_timer = Core::Timer::construct(1000, [this] { refresh(); }, this);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,12 +31,14 @@
|
|||
namespace Core {
|
||||
class Timer;
|
||||
}
|
||||
namespace GUI {
|
||||
class JsonArrayModel;
|
||||
class TableView;
|
||||
}
|
||||
|
||||
class GJsonArrayModel;
|
||||
class GTableView;
|
||||
|
||||
class ProcessMemoryMapWidget final : public GWidget {
|
||||
class ProcessMemoryMapWidget final : public GUI::Widget {
|
||||
C_OBJECT(ProcessMemoryMapWidget);
|
||||
|
||||
public:
|
||||
virtual ~ProcessMemoryMapWidget() override;
|
||||
|
||||
|
@ -44,9 +46,9 @@ public:
|
|||
void refresh();
|
||||
|
||||
private:
|
||||
explicit ProcessMemoryMapWidget(GWidget* parent);
|
||||
RefPtr<GTableView> m_table_view;
|
||||
RefPtr<GJsonArrayModel> m_json_model;
|
||||
explicit ProcessMemoryMapWidget(GUI::Widget* parent);
|
||||
RefPtr<GUI::TableView> m_table_view;
|
||||
RefPtr<GUI::JsonArrayModel> m_json_model;
|
||||
pid_t m_pid { -1 };
|
||||
RefPtr<Core::Timer> m_timer;
|
||||
};
|
||||
|
|
|
@ -56,12 +56,12 @@ ProcessModel::~ProcessModel()
|
|||
{
|
||||
}
|
||||
|
||||
int ProcessModel::row_count(const GModelIndex&) const
|
||||
int ProcessModel::row_count(const GUI::ModelIndex&) const
|
||||
{
|
||||
return m_pids.size();
|
||||
}
|
||||
|
||||
int ProcessModel::column_count(const GModelIndex&) const
|
||||
int ProcessModel::column_count(const GUI::ModelIndex&) const
|
||||
{
|
||||
return Column::__Count;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ String ProcessModel::column_name(int column) const
|
|||
}
|
||||
}
|
||||
|
||||
GModel::ColumnMetadata ProcessModel::column_metadata(int column) const
|
||||
GUI::Model::ColumnMetadata ProcessModel::column_metadata(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Icon:
|
||||
|
@ -195,7 +195,7 @@ static String pretty_byte_size(size_t size)
|
|||
return String::format("%uK", size / 1024);
|
||||
}
|
||||
|
||||
GVariant ProcessModel::data(const GModelIndex& index, Role role) const
|
||||
GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, Role role) const
|
||||
{
|
||||
ASSERT(is_valid(index));
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ struct PidAndTid {
|
|||
int tid;
|
||||
};
|
||||
|
||||
class ProcessModel final : public GModel {
|
||||
class ProcessModel final : public GUI::Model {
|
||||
public:
|
||||
enum Column {
|
||||
Icon = 0,
|
||||
|
@ -81,11 +81,11 @@ public:
|
|||
static NonnullRefPtr<ProcessModel> create() { return adopt(*new ProcessModel); }
|
||||
virtual ~ProcessModel() override;
|
||||
|
||||
virtual int row_count(const GModelIndex&) const override;
|
||||
virtual int column_count(const GModelIndex&) const override;
|
||||
virtual int row_count(const GUI::ModelIndex&) const override;
|
||||
virtual int column_count(const GUI::ModelIndex&) const override;
|
||||
virtual String column_name(int column) const override;
|
||||
virtual ColumnMetadata column_metadata(int column) const override;
|
||||
virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
|
||||
virtual GUI::Variant data(const GUI::ModelIndex&, Role = Role::Display) const override;
|
||||
virtual void update() override;
|
||||
|
||||
Function<void(float)> on_new_cpu_data_point;
|
||||
|
|
|
@ -29,12 +29,12 @@
|
|||
#include <LibCore/CTimer.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
|
||||
ProcessStacksWidget::ProcessStacksWidget(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
ProcessStacksWidget::ProcessStacksWidget(GUI::Widget* parent)
|
||||
: GUI::Widget(parent)
|
||||
{
|
||||
set_layout(make<GVBoxLayout>());
|
||||
set_layout(make<GUI::VBoxLayout>());
|
||||
layout()->set_margins({ 4, 4, 4, 4 });
|
||||
m_stacks_editor = GTextEditor::construct(GTextEditor::Type::MultiLine, this);
|
||||
m_stacks_editor = GUI::TextEditor::construct(GUI::TextEditor::Type::MultiLine, this);
|
||||
m_stacks_editor->set_readonly(true);
|
||||
|
||||
m_timer = Core::Timer::construct(1000, [this] { refresh(); }, this);
|
||||
|
|
|
@ -33,10 +33,10 @@ namespace Core {
|
|||
class Timer;
|
||||
}
|
||||
|
||||
class ProcessStacksWidget final : public GWidget {
|
||||
class ProcessStacksWidget final : public GUI::Widget {
|
||||
C_OBJECT(ProcessStacksWidget)
|
||||
public:
|
||||
explicit ProcessStacksWidget(GWidget* parent);
|
||||
explicit ProcessStacksWidget(GUI::Widget* parent);
|
||||
virtual ~ProcessStacksWidget() override;
|
||||
|
||||
void set_pid(pid_t);
|
||||
|
@ -44,6 +44,6 @@ public:
|
|||
|
||||
private:
|
||||
pid_t m_pid { -1 };
|
||||
RefPtr<GTextEditor> m_stacks_editor;
|
||||
RefPtr<GUI::TextEditor> m_stacks_editor;
|
||||
RefPtr<Core::Timer> m_timer;
|
||||
};
|
||||
|
|
|
@ -29,12 +29,12 @@
|
|||
#include <LibGUI/GSortingProxyModel.h>
|
||||
#include <stdio.h>
|
||||
|
||||
ProcessTableView::ProcessTableView(GWidget* parent)
|
||||
: GTableView(parent)
|
||||
ProcessTableView::ProcessTableView(GUI::Widget* parent)
|
||||
: TableView(parent)
|
||||
{
|
||||
set_size_columns_to_fit_content(true);
|
||||
set_model(GSortingProxyModel::create(ProcessModel::create()));
|
||||
model()->set_key_column_and_sort_order(ProcessModel::Column::CPU, GSortOrder::Descending);
|
||||
set_model(GUI::SortingProxyModel::create(ProcessModel::create()));
|
||||
model()->set_key_column_and_sort_order(ProcessModel::Column::CPU, GUI::SortOrder::Descending);
|
||||
refresh();
|
||||
|
||||
on_selection = [this](auto&) {
|
||||
|
@ -56,5 +56,5 @@ pid_t ProcessTableView::selected_pid() const
|
|||
{
|
||||
if (selection().is_empty())
|
||||
return -1;
|
||||
return model()->data(model()->index(selection().first().row(), ProcessModel::Column::PID), GModel::Role::Sort).as_i32();
|
||||
return model()->data(model()->index(selection().first().row(), ProcessModel::Column::PID), GUI::Model::Role::Sort).as_i32();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
class GraphWidget;
|
||||
class ProcessModel;
|
||||
|
||||
class ProcessTableView final : public GTableView {
|
||||
class ProcessTableView final : public GUI::TableView {
|
||||
C_OBJECT(ProcessTableView)
|
||||
public:
|
||||
virtual ~ProcessTableView() override;
|
||||
|
@ -45,5 +45,5 @@ public:
|
|||
Function<void(pid_t)> on_process_selected;
|
||||
|
||||
private:
|
||||
explicit ProcessTableView(GWidget* parent = nullptr);
|
||||
explicit ProcessTableView(GUI::Widget* parent = nullptr);
|
||||
};
|
||||
|
|
|
@ -29,18 +29,18 @@
|
|||
#include <LibGUI/GJsonArrayModel.h>
|
||||
#include <LibGUI/GTableView.h>
|
||||
|
||||
ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget(GUI::Widget* parent)
|
||||
: GUI::Widget(parent)
|
||||
{
|
||||
set_layout(make<GVBoxLayout>());
|
||||
set_layout(make<GUI::VBoxLayout>());
|
||||
layout()->set_margins({ 4, 4, 4, 4 });
|
||||
m_table_view = GTableView::construct(this);
|
||||
m_table_view = GUI::TableView::construct(this);
|
||||
m_table_view->set_size_columns_to_fit_content(true);
|
||||
|
||||
Vector<GJsonArrayModel::FieldSpec> pid_unveil_fields;
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields;
|
||||
pid_unveil_fields.empend("path", "Path", TextAlignment::CenterLeft);
|
||||
pid_unveil_fields.empend("permissions", "Permissions", TextAlignment::CenterLeft);
|
||||
m_table_view->set_model(GJsonArrayModel::create({}, move(pid_unveil_fields)));
|
||||
m_table_view->set_model(GUI::JsonArrayModel::create({}, move(pid_unveil_fields)));
|
||||
}
|
||||
|
||||
ProcessUnveiledPathsWidget::~ProcessUnveiledPathsWidget()
|
||||
|
@ -52,5 +52,5 @@ void ProcessUnveiledPathsWidget::set_pid(pid_t pid)
|
|||
if (m_pid == pid)
|
||||
return;
|
||||
m_pid = pid;
|
||||
static_cast<GJsonArrayModel*>(m_table_view->model())->set_json_path(String::format("/proc/%d/unveil", m_pid));
|
||||
static_cast<GUI::JsonArrayModel*>(m_table_view->model())->set_json_path(String::format("/proc/%d/unveil", m_pid));
|
||||
}
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
|
||||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GTableView;
|
||||
namespace GUI {
|
||||
class TableView;
|
||||
}
|
||||
|
||||
class ProcessUnveiledPathsWidget final : public GWidget {
|
||||
class ProcessUnveiledPathsWidget final : public GUI::Widget {
|
||||
C_OBJECT(ProcessUnveiledPathsWidget);
|
||||
public:
|
||||
virtual ~ProcessUnveiledPathsWidget() override;
|
||||
|
@ -38,8 +40,8 @@ public:
|
|||
void set_pid(pid_t);
|
||||
|
||||
private:
|
||||
explicit ProcessUnveiledPathsWidget(GWidget* parent);
|
||||
explicit ProcessUnveiledPathsWidget(GUI::Widget* parent);
|
||||
|
||||
RefPtr<GTableView> m_table_view;
|
||||
RefPtr<GUI::TableView> m_table_view;
|
||||
pid_t m_pid { -1 };
|
||||
};
|
||||
|
|
|
@ -69,10 +69,10 @@ static String human_readable_size(u32 size)
|
|||
return String::format("%u GB", size / GB);
|
||||
}
|
||||
|
||||
static RefPtr<GWidget> build_file_systems_tab();
|
||||
static RefPtr<GWidget> build_pci_devices_tab();
|
||||
static RefPtr<GWidget> build_devices_tab();
|
||||
static NonnullRefPtr<GWidget> build_graphs_tab();
|
||||
static RefPtr<GUI::Widget> build_file_systems_tab();
|
||||
static RefPtr<GUI::Widget> build_pci_devices_tab();
|
||||
static RefPtr<GUI::Widget> build_devices_tab();
|
||||
static NonnullRefPtr<GUI::Widget> build_graphs_tab();
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
GApplication app(argc, argv);
|
||||
GUI::Application app(argc, argv);
|
||||
|
||||
if (pledge("stdio proc shared_buffer accept rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
|
@ -110,22 +110,22 @@ int main(int argc, char** argv)
|
|||
|
||||
unveil(nullptr, nullptr);
|
||||
|
||||
auto window = GWindow::construct();
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("System Monitor");
|
||||
window->set_rect(20, 200, 680, 400);
|
||||
|
||||
auto keeper = GWidget::construct();
|
||||
auto keeper = GUI::Widget::construct();
|
||||
window->set_main_widget(keeper);
|
||||
keeper->set_layout(make<GVBoxLayout>());
|
||||
keeper->set_layout(make<GUI::VBoxLayout>());
|
||||
keeper->set_fill_with_background_color(true);
|
||||
keeper->layout()->set_margins({ 4, 4, 4, 4 });
|
||||
|
||||
auto tabwidget = GTabWidget::construct(keeper);
|
||||
auto tabwidget = GUI::TabWidget::construct(keeper);
|
||||
|
||||
auto process_container_splitter = GSplitter::construct(Orientation::Vertical, nullptr);
|
||||
auto process_container_splitter = GUI::Splitter::construct(Orientation::Vertical, nullptr);
|
||||
tabwidget->add_widget("Processes", process_container_splitter);
|
||||
|
||||
auto process_table_container = GWidget::construct(process_container_splitter.ptr());
|
||||
auto process_table_container = GUI::Widget::construct(process_container_splitter.ptr());
|
||||
|
||||
tabwidget->add_widget("Graphs", build_graphs_tab());
|
||||
|
||||
|
@ -138,11 +138,11 @@ int main(int argc, char** argv)
|
|||
auto network_stats_widget = NetworkStatisticsWidget::construct(nullptr);
|
||||
tabwidget->add_widget("Network", network_stats_widget);
|
||||
|
||||
process_table_container->set_layout(make<GVBoxLayout>());
|
||||
process_table_container->set_layout(make<GUI::VBoxLayout>());
|
||||
process_table_container->layout()->set_margins({ 4, 0, 4, 4 });
|
||||
process_table_container->layout()->set_spacing(0);
|
||||
|
||||
auto toolbar = GToolBar::construct(process_table_container);
|
||||
auto toolbar = GUI::ToolBar::construct(process_table_container);
|
||||
toolbar->set_has_frame(false);
|
||||
auto process_table_view = ProcessTableView::construct(process_table_container);
|
||||
|
||||
|
@ -152,19 +152,19 @@ int main(int argc, char** argv)
|
|||
memory_stats_widget->refresh();
|
||||
}, window);
|
||||
|
||||
auto kill_action = GAction::create("Kill process", { Mod_Ctrl, Key_K }, GraphicsBitmap::load_from_file("/res/icons/kill16.png"), [process_table_view](const GAction&) {
|
||||
auto kill_action = GUI::Action::create("Kill process", { Mod_Ctrl, Key_K }, GraphicsBitmap::load_from_file("/res/icons/kill16.png"), [process_table_view](const GUI::Action&) {
|
||||
pid_t pid = process_table_view->selected_pid();
|
||||
if (pid != -1)
|
||||
kill(pid, SIGKILL);
|
||||
});
|
||||
|
||||
auto stop_action = GAction::create("Stop process", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/stop16.png"), [process_table_view](const GAction&) {
|
||||
auto stop_action = GUI::Action::create("Stop process", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/stop16.png"), [process_table_view](const GUI::Action&) {
|
||||
pid_t pid = process_table_view->selected_pid();
|
||||
if (pid != -1)
|
||||
kill(pid, SIGSTOP);
|
||||
});
|
||||
|
||||
auto continue_action = GAction::create("Continue process", { Mod_Ctrl, Key_C }, GraphicsBitmap::load_from_file("/res/icons/continue16.png"), [process_table_view](const GAction&) {
|
||||
auto continue_action = GUI::Action::create("Continue process", { Mod_Ctrl, Key_C }, GraphicsBitmap::load_from_file("/res/icons/continue16.png"), [process_table_view](const GUI::Action&) {
|
||||
pid_t pid = process_table_view->selected_pid();
|
||||
if (pid != -1)
|
||||
kill(pid, SIGCONT);
|
||||
|
@ -174,35 +174,35 @@ int main(int argc, char** argv)
|
|||
toolbar->add_action(stop_action);
|
||||
toolbar->add_action(continue_action);
|
||||
|
||||
auto menubar = make<GMenuBar>();
|
||||
auto app_menu = GMenu::construct("System Monitor");
|
||||
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
|
||||
GApplication::the().quit(0);
|
||||
auto menubar = make<GUI::MenuBar>();
|
||||
auto app_menu = GUI::Menu::construct("System Monitor");
|
||||
app_menu->add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||
GUI::Application::the().quit(0);
|
||||
return;
|
||||
}));
|
||||
menubar->add_menu(move(app_menu));
|
||||
|
||||
auto process_menu = GMenu::construct("Process");
|
||||
auto process_menu = GUI::Menu::construct("Process");
|
||||
process_menu->add_action(kill_action);
|
||||
process_menu->add_action(stop_action);
|
||||
process_menu->add_action(continue_action);
|
||||
menubar->add_menu(move(process_menu));
|
||||
|
||||
auto process_context_menu = GMenu::construct();
|
||||
auto process_context_menu = GUI::Menu::construct();
|
||||
process_context_menu->add_action(kill_action);
|
||||
process_context_menu->add_action(stop_action);
|
||||
process_context_menu->add_action(continue_action);
|
||||
process_table_view->on_context_menu_request = [&](const GModelIndex& index, const GContextMenuEvent& event) {
|
||||
process_table_view->on_context_menu_request = [&](const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) {
|
||||
(void)index;
|
||||
process_context_menu->popup(event.screen_position());
|
||||
};
|
||||
|
||||
auto frequency_menu = GMenu::construct("Frequency");
|
||||
GActionGroup frequency_action_group;
|
||||
auto frequency_menu = GUI::Menu::construct("Frequency");
|
||||
GUI::ActionGroup frequency_action_group;
|
||||
frequency_action_group.set_exclusive(true);
|
||||
|
||||
auto make_frequency_action = [&](auto& title, int interval, bool checked = false) {
|
||||
auto action = GAction::create(title, [&refresh_timer, interval](auto& action) {
|
||||
auto action = GUI::Action::create(title, [&refresh_timer, interval](auto& action) {
|
||||
refresh_timer->restart(interval);
|
||||
action.set_checked(true);
|
||||
});
|
||||
|
@ -220,15 +220,15 @@ int main(int argc, char** argv)
|
|||
|
||||
menubar->add_menu(move(frequency_menu));
|
||||
|
||||
auto help_menu = GMenu::construct("Help");
|
||||
help_menu->add_action(GAction::create("About", [&](const GAction&) {
|
||||
GAboutDialog::show("System Monitor", load_png("/res/icons/32x32/app-system-monitor.png"), window);
|
||||
auto help_menu = GUI::Menu::construct("Help");
|
||||
help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) {
|
||||
GUI::AboutDialog::show("System Monitor", load_png("/res/icons/32x32/app-system-monitor.png"), window);
|
||||
}));
|
||||
menubar->add_menu(move(help_menu));
|
||||
|
||||
app.set_menubar(move(menubar));
|
||||
|
||||
auto process_tab_widget = GTabWidget::construct(process_container_splitter);
|
||||
auto process_tab_widget = GUI::TabWidget::construct(process_container_splitter);
|
||||
|
||||
auto memory_map_widget = ProcessMemoryMapWidget::construct(nullptr);
|
||||
process_tab_widget->add_widget("Memory map", memory_map_widget);
|
||||
|
@ -256,16 +256,16 @@ int main(int argc, char** argv)
|
|||
return app.exec();
|
||||
}
|
||||
|
||||
class ProgressBarPaintingDelegate final : public GTableCellPaintingDelegate {
|
||||
class ProgressBarPaintingDelegate final : public GUI::TableCellPaintingDelegate {
|
||||
public:
|
||||
virtual ~ProgressBarPaintingDelegate() override {}
|
||||
|
||||
virtual void paint(GPainter& painter, const Rect& a_rect, const Palette& palette, const GModel& model, const GModelIndex& index) override
|
||||
virtual void paint(GUI::Painter& painter, const Rect& a_rect, const Palette& palette, const GUI::Model& model, const GUI::ModelIndex& index) override
|
||||
{
|
||||
auto rect = a_rect.shrunken(2, 2);
|
||||
auto percentage = model.data(index, GModel::Role::Custom).to_i32();
|
||||
auto percentage = model.data(index, GUI::Model::Role::Custom).to_i32();
|
||||
|
||||
auto data = model.data(index, GModel::Role::Display);
|
||||
auto data = model.data(index, GUI::Model::Role::Display);
|
||||
String text;
|
||||
if (data.is_string())
|
||||
text = data.as_string();
|
||||
|
@ -274,17 +274,17 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
RefPtr<GWidget> build_file_systems_tab()
|
||||
RefPtr<GUI::Widget> build_file_systems_tab()
|
||||
{
|
||||
auto fs_widget = GLazyWidget::construct();
|
||||
auto fs_widget = GUI::LazyWidget::construct();
|
||||
|
||||
fs_widget->on_first_show = [](auto& self) {
|
||||
self.set_layout(make<GVBoxLayout>());
|
||||
self.set_layout(make<GUI::VBoxLayout>());
|
||||
self.layout()->set_margins({ 4, 4, 4, 4 });
|
||||
auto fs_table_view = GTableView::construct(&self);
|
||||
auto fs_table_view = GUI::TableView::construct(&self);
|
||||
fs_table_view->set_size_columns_to_fit_content(true);
|
||||
|
||||
Vector<GJsonArrayModel::FieldSpec> df_fields;
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> df_fields;
|
||||
df_fields.empend("mount_point", "Mount point", TextAlignment::CenterLeft);
|
||||
df_fields.empend("class_name", "Class", TextAlignment::CenterLeft);
|
||||
df_fields.empend("device", "Device", TextAlignment::CenterLeft);
|
||||
|
@ -354,7 +354,7 @@ RefPtr<GWidget> build_file_systems_tab()
|
|||
df_fields.empend("free_inode_count", "Free inodes", TextAlignment::CenterRight);
|
||||
df_fields.empend("total_inode_count", "Total inodes", TextAlignment::CenterRight);
|
||||
df_fields.empend("block_size", "Block size", TextAlignment::CenterRight);
|
||||
fs_table_view->set_model(GSortingProxyModel::create(GJsonArrayModel::create("/proc/df", move(df_fields))));
|
||||
fs_table_view->set_model(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/proc/df", move(df_fields))));
|
||||
|
||||
fs_table_view->set_cell_painting_delegate(3, make<ProgressBarPaintingDelegate>());
|
||||
|
||||
|
@ -363,19 +363,19 @@ RefPtr<GWidget> build_file_systems_tab()
|
|||
return fs_widget;
|
||||
}
|
||||
|
||||
RefPtr<GWidget> build_pci_devices_tab()
|
||||
RefPtr<GUI::Widget> build_pci_devices_tab()
|
||||
{
|
||||
auto pci_widget = GLazyWidget::construct();
|
||||
auto pci_widget = GUI::LazyWidget::construct();
|
||||
|
||||
pci_widget->on_first_show = [](auto& self) {
|
||||
self.set_layout(make<GVBoxLayout>());
|
||||
self.set_layout(make<GUI::VBoxLayout>());
|
||||
self.layout()->set_margins({ 4, 4, 4, 4 });
|
||||
auto pci_table_view = GTableView::construct(&self);
|
||||
auto pci_table_view = GUI::TableView::construct(&self);
|
||||
pci_table_view->set_size_columns_to_fit_content(true);
|
||||
|
||||
auto db = PCIDB::Database::open();
|
||||
|
||||
Vector<GJsonArrayModel::FieldSpec> pci_fields;
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> pci_fields;
|
||||
pci_fields.empend(
|
||||
"Address", TextAlignment::CenterLeft,
|
||||
[](const JsonObject& object) {
|
||||
|
@ -414,44 +414,44 @@ RefPtr<GWidget> build_pci_devices_tab()
|
|||
return String::format("%02x", revision_id);
|
||||
});
|
||||
|
||||
pci_table_view->set_model(GSortingProxyModel::create(GJsonArrayModel::create("/proc/pci", move(pci_fields))));
|
||||
pci_table_view->set_model(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/proc/pci", move(pci_fields))));
|
||||
pci_table_view->model()->update();
|
||||
};
|
||||
|
||||
return pci_widget;
|
||||
}
|
||||
|
||||
RefPtr<GWidget> build_devices_tab()
|
||||
RefPtr<GUI::Widget> build_devices_tab()
|
||||
{
|
||||
auto devices_widget = GLazyWidget::construct();
|
||||
auto devices_widget = GUI::LazyWidget::construct();
|
||||
|
||||
devices_widget->on_first_show = [](auto& self) {
|
||||
self.set_layout(make<GVBoxLayout>());
|
||||
self.set_layout(make<GUI::VBoxLayout>());
|
||||
self.layout()->set_margins({ 4, 4, 4, 4 });
|
||||
|
||||
auto devices_table_view = GTableView::construct(&self);
|
||||
auto devices_table_view = GUI::TableView::construct(&self);
|
||||
devices_table_view->set_size_columns_to_fit_content(true);
|
||||
devices_table_view->set_model(GSortingProxyModel::create(DevicesModel::create()));
|
||||
devices_table_view->set_model(GUI::SortingProxyModel::create(DevicesModel::create()));
|
||||
devices_table_view->model()->update();
|
||||
};
|
||||
|
||||
return devices_widget;
|
||||
}
|
||||
|
||||
NonnullRefPtr<GWidget> build_graphs_tab()
|
||||
NonnullRefPtr<GUI::Widget> build_graphs_tab()
|
||||
{
|
||||
auto graphs_container = GLazyWidget::construct();
|
||||
auto graphs_container = GUI::LazyWidget::construct();
|
||||
|
||||
graphs_container->on_first_show = [](auto& self) {
|
||||
self.set_fill_with_background_color(true);
|
||||
self.set_background_role(ColorRole::Button);
|
||||
self.set_layout(make<GVBoxLayout>());
|
||||
self.set_layout(make<GUI::VBoxLayout>());
|
||||
self.layout()->set_margins({ 4, 4, 4, 4 });
|
||||
|
||||
auto cpu_graph_group_box = GGroupBox::construct("CPU usage", &self);
|
||||
cpu_graph_group_box->set_layout(make<GVBoxLayout>());
|
||||
auto cpu_graph_group_box = GUI::GroupBox::construct("CPU usage", &self);
|
||||
cpu_graph_group_box->set_layout(make<GUI::VBoxLayout>());
|
||||
cpu_graph_group_box->layout()->set_margins({ 6, 16, 6, 6 });
|
||||
cpu_graph_group_box->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
cpu_graph_group_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
cpu_graph_group_box->set_preferred_size(0, 120);
|
||||
auto cpu_graph = GraphWidget::construct(cpu_graph_group_box);
|
||||
cpu_graph->set_max(100);
|
||||
|
@ -465,10 +465,10 @@ NonnullRefPtr<GWidget> build_graphs_tab()
|
|||
graph->add_value(cpu_percent);
|
||||
};
|
||||
|
||||
auto memory_graph_group_box = GGroupBox::construct("Memory usage", &self);
|
||||
memory_graph_group_box->set_layout(make<GVBoxLayout>());
|
||||
auto memory_graph_group_box = GUI::GroupBox::construct("Memory usage", &self);
|
||||
memory_graph_group_box->set_layout(make<GUI::VBoxLayout>());
|
||||
memory_graph_group_box->layout()->set_margins({ 6, 16, 6, 6 });
|
||||
memory_graph_group_box->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
memory_graph_group_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
memory_graph_group_box->set_preferred_size(0, 120);
|
||||
auto memory_graph = GraphWidget::construct(memory_graph_group_box);
|
||||
memory_graph->set_text_color(Color::Cyan);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue