mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 09:49:21 +00:00
SystemMonitor: Add sorting key to the devices model
This commit is contained in:
parent
eaeb793454
commit
2c1b244889
Notes:
sideshowbarker
2024-07-19 02:16:59 +09:00
Author: https://github.com/xTibor
Commit: 2c1b244889
Pull-request: https://github.com/SerenityOS/serenity/pull/3577
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