1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

ProcessManager: Add CPU/memory usage graphs in a separate tab.

Finally we get some real use for the new GTabWidget. :^)
This commit is contained in:
Andreas Kling 2019-05-06 03:21:23 +02:00
parent 6df3df62be
commit 25bb7a59ac
10 changed files with 140 additions and 19 deletions

View file

@ -0,0 +1,24 @@
#include <LibGUI/GFrame.h>
#include <AK/CircularQueue.h>
class GraphWidget final : public GFrame {
public:
explicit GraphWidget(GWidget* parent);
virtual ~GraphWidget() override;
void set_max(int max) { m_max = max; }
void add_value(int);
void set_graph_color(Color color) { m_graph_color = color; }
void set_text_color(Color color) { m_text_color = color; }
Function<String(int value, int max)> text_formatter;
private:
virtual void paint_event(GPaintEvent&) override;
int m_max { 100 };
CircularQueue<int, 4000> m_values;
Color m_graph_color;
Color m_text_color;
};