mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
SystemMonitor: Add a devices tab
This tab combines info from /proc/devices with device file paths from /dev.
This commit is contained in:
parent
0f8b45c015
commit
ccdeafdefb
4 changed files with 214 additions and 0 deletions
44
Applications/SystemMonitor/DevicesModel.h
Normal file
44
Applications/SystemMonitor/DevicesModel.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
class DevicesModel final : public GModel {
|
||||
public:
|
||||
enum Column {
|
||||
Device = 0,
|
||||
Major,
|
||||
Minor,
|
||||
ClassName,
|
||||
Type,
|
||||
__Count
|
||||
};
|
||||
|
||||
virtual ~DevicesModel() override;
|
||||
static NonnullRefPtr<DevicesModel> create();
|
||||
|
||||
virtual int row_count(const GModelIndex&) const override;
|
||||
virtual int column_count(const GModelIndex&) 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 void update() override;
|
||||
|
||||
private:
|
||||
DevicesModel();
|
||||
|
||||
struct DeviceInfo {
|
||||
String path;
|
||||
unsigned major;
|
||||
unsigned minor;
|
||||
String class_name;
|
||||
enum Type {
|
||||
Block,
|
||||
Character
|
||||
};
|
||||
Type type;
|
||||
};
|
||||
|
||||
Vector<DeviceInfo> m_devices;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue