mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
SystemMonitor: Use system color themes for graph widgets
This commit is contained in:
parent
feb66564d2
commit
e47af3044a
Notes:
sideshowbarker
2024-07-18 22:23:45 +09:00
Author: https://github.com/ccapitalK
Commit: e47af3044a
Pull-request: https://github.com/SerenityOS/serenity/pull/5241
3 changed files with 10 additions and 16 deletions
|
@ -573,6 +573,8 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
|
|||
auto graphs_container = GUI::LazyWidget::construct();
|
||||
|
||||
graphs_container->on_first_show = [](GUI::LazyWidget& self) {
|
||||
const auto system_palette = GUI::Application::the()->palette();
|
||||
|
||||
self.set_fill_with_background_color(true);
|
||||
self.set_background_role(ColorRole::Button);
|
||||
self.set_layout<GUI::VerticalBoxLayout>();
|
||||
|
@ -586,17 +588,14 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
|
|||
for (size_t i = 0; i < ProcessModel::the().cpus().size(); i++) {
|
||||
auto& cpu_graph = cpu_graph_group_box.add<GraphWidget>();
|
||||
cpu_graph.set_max(100);
|
||||
cpu_graph.set_background_color(Color::White);
|
||||
cpu_graph.set_value_format(0, {
|
||||
.line_color = Color::Blue,
|
||||
.background_color = Color::from_rgb(0xaaaaff),
|
||||
.line_color = system_palette.syntax_preprocessor_statement(),
|
||||
.text_formatter = [](int value) {
|
||||
return String::formatted("Total: {}%", value);
|
||||
},
|
||||
});
|
||||
cpu_graph.set_value_format(1, {
|
||||
.line_color = Color::Red,
|
||||
.background_color = Color::from_rgb(0xffaaaa),
|
||||
.line_color = system_palette.syntax_preprocessor_value(),
|
||||
.text_formatter = [](int value) {
|
||||
return String::formatted("Kernel: {}%", value);
|
||||
},
|
||||
|
@ -613,25 +612,21 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
|
|||
memory_graph_group_box.layout()->set_margins({ 6, 16, 6, 6 });
|
||||
memory_graph_group_box.set_fixed_height(120);
|
||||
auto& memory_graph = memory_graph_group_box.add<GraphWidget>();
|
||||
memory_graph.set_background_color(Color::White);
|
||||
memory_graph.set_stack_values(true);
|
||||
memory_graph.set_value_format(0, {
|
||||
.line_color = Color::from_rgb(0x619910),
|
||||
.background_color = Color::from_rgb(0xbbffbb),
|
||||
.line_color = system_palette.syntax_comment(),
|
||||
.text_formatter = [&memory_graph](int value) {
|
||||
return String::formatted("Committed: {} KiB", value);
|
||||
},
|
||||
});
|
||||
memory_graph.set_value_format(1, {
|
||||
.line_color = Color::Blue,
|
||||
.background_color = Color::from_rgb(0xaaaaff),
|
||||
.line_color = system_palette.syntax_preprocessor_statement(),
|
||||
.text_formatter = [&memory_graph](int value) {
|
||||
return String::formatted("Allocated: {} KiB", value);
|
||||
},
|
||||
});
|
||||
memory_graph.set_value_format(2, {
|
||||
.line_color = Color::Red,
|
||||
.background_color = Color::from_rgb(0xffaaaa),
|
||||
.line_color = system_palette.syntax_preprocessor_value(),
|
||||
.text_formatter = [&memory_graph](int value) {
|
||||
return String::formatted("Kernel heap: {} KiB", value);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue