Skip to content

Commit

Permalink
SystemMonitor: Add sorting key to the devices model
Browse files Browse the repository at this point in the history
  • Loading branch information
xTibor authored and awesomekling committed Sep 22, 2020
1 parent eaeb793 commit 2c1b244
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Applications/SystemMonitor/DevicesModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 2c1b244

Please sign in to comment.