mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
SystemMonitor: Add sorting key to the devices model
This commit is contained in:
parent
eaeb793454
commit
2c1b244889
1 changed files with 18 additions and 0 deletions
|
@ -93,6 +93,24 @@ GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (role == GUI::ModelRole::Sort) {
|
||||||
|
const DeviceInfo& device = m_devices[index.row()];
|
||||||
|
switch (index.column()) {
|
||||||
|
case Column::Device:
|
||||||
|
return device.path;
|
||||||
|
case Column::Major:
|
||||||
|
return device.major;
|
||||||
|
case Column::Minor:
|
||||||
|
return device.minor;
|
||||||
|
case Column::ClassName:
|
||||||
|
return device.class_name;
|
||||||
|
case Column::Type:
|
||||||
|
return device.type;
|
||||||
|
default:
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (role == GUI::ModelRole::Display) {
|
if (role == GUI::ModelRole::Display) {
|
||||||
const DeviceInfo& device = m_devices[index.row()];
|
const DeviceInfo& device = m_devices[index.row()];
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue