SystemMonitor: Add sorting key to the devices model

This commit is contained in:
Tibor Nagy 2020-09-22 00:20:35 +02:00 committed by Andreas Kling
parent eaeb793454
commit 2c1b244889
Notes: sideshowbarker 2024-07-19 02:16:59 +09:00

View file

@ -93,6 +93,24 @@ GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
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) {
const DeviceInfo& device = m_devices[index.row()];
switch (index.column()) {