Changeset View
Changeset View
Standalone View
Standalone View
Modules/devinfo/soldevice.cpp
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Line(s) | |||||
145 | QString SolDevice::udi() const | 145 | QString SolDevice::udi() const | ||
146 | { | 146 | { | ||
147 | return tiedDevice.udi(); | 147 | return tiedDevice.udi(); | ||
148 | } | 148 | } | ||
149 | 149 | | |||
150 | // Is | 150 | // Is | ||
151 | 151 | | |||
152 | bool SolDevice::isDeviceSet() | 152 | bool SolDevice::isDeviceSet() | ||
153 | { | 153 | { | ||
broulik: Coding style: brace on the same line, also no need for explicit `nullptr` check:
```
if… | |||||
154 | return deviceSet; | 154 | return deviceSet; | ||
155 | } | 155 | } | ||
156 | | ||||
157 | bool SolDevice::operator< ( const QTreeWidgetItem & other ) const | ||||
158 | { | ||||
159 | const SolDevice * otherDevice = dynamic_cast<const SolDevice*>(&other); | ||||
160 | if (otherDevice) { | ||||
161 | if (deviceType() != otherDevice->deviceType()) { | ||||
162 | return deviceType() < otherDevice->deviceType(); | ||||
163 | } | ||||
164 | switch (deviceType()) { | ||||
165 | case Solid::DeviceInterface::Processor: { | ||||
anthonyfieroni: left->number() < right->number() ? | |||||
This is reversed as it's sorted in the opposite order (ascending) to the other entries (descending) isaact: This is reversed as it's sorted in the opposite order (ascending) to the other entries… | |||||
166 | const Solid::Processor *left = tiedDevice.as<const Solid::Processor>(); | ||||
167 | const Solid::Processor *right = otherDevice->tiedDevice.as<const Solid::Processor>(); | ||||
168 | // Processors are sorted in ascending order, so this is reversed | ||||
169 | return left->number() > right->number(); | ||||
anthonyfieroni: Reverse again ? | |||||
These are also sorted in ascending order, so that it goes from sda1, sda2, etc. isaact: These are also sorted in ascending order, so that it goes from sda1, sda2, etc. | |||||
170 | } | ||||
171 | case Solid::DeviceInterface::StorageVolume: { | ||||
172 | // Storage volumes are sorted in ascending order (i.e. sda, sda1, sda2...) | ||||
173 | return text(0) > other.text(0); | ||||
174 | } | ||||
175 | default: | ||||
176 | break; | ||||
177 | } | ||||
anthonyfieroni: Add a new line. | |||||
178 | } | ||||
179 | return text(0) < other.text(0); | ||||
180 | } |
Coding style: brace on the same line, also no need for explicit nullptr check: