mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
plasma: kSensorType() function optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
de790c85e0
commit
b4842e533e
1 changed files with 13 additions and 10 deletions
|
@ -59,21 +59,24 @@ static KSensorType kSensorType(const QByteArray &sensor)
|
|||
if (sensor == "cpu/system/TotalLoad") {
|
||||
return KSensorType::CPUSensor;
|
||||
// any network receiver or transmitter except loopback
|
||||
} else if (sensor.startsWith("network/interfaces/") && sensor.endsWith("/receiver/data")) {
|
||||
} else if (sensor.startsWith("network/interfaces/")) {
|
||||
if (sensor.contains("/interfaces/lo/")) {
|
||||
return KSensorType::UnknownSensor;
|
||||
}
|
||||
return KSensorType::NetReceiverSensor;
|
||||
} else if (sensor.startsWith("network/interfaces/") && sensor.endsWith("/transmitter/data")) {
|
||||
if (sensor.contains("/interfaces/lo/")) {
|
||||
return KSensorType::UnknownSensor;
|
||||
if (sensor.endsWith("/receiver/data")) {
|
||||
return KSensorType::NetReceiverSensor;
|
||||
} else if (sensor.endsWith("/transmitter/data")) {
|
||||
return KSensorType::NetTransmitterSensor;
|
||||
}
|
||||
return KSensorType::NetTransmitterSensor;
|
||||
return KSensorType::UnknownSensor;
|
||||
// any partition
|
||||
} else if (sensor.startsWith("partitions/") && sensor.endsWith("/freespace")) {
|
||||
return KSensorType::PartitionFreeSensor;
|
||||
} else if (sensor.startsWith("partitions/") && sensor.endsWith("/usedspace")) {
|
||||
return KSensorType::PartitionUsedSensor;
|
||||
} else if (sensor.startsWith("partitions/")) {
|
||||
if (sensor.endsWith("/freespace")) {
|
||||
return KSensorType::PartitionFreeSensor;
|
||||
} else if (sensor.endsWith("/usedspace")) {
|
||||
return KSensorType::PartitionUsedSensor;
|
||||
}
|
||||
return KSensorType::UnknownSensor;
|
||||
// any thermal zone or lmsensor except fans
|
||||
} else if (sensor.startsWith("acpi/Thermal_Zone/") || sensor.startsWith("lmsensors/")) {
|
||||
if (sensor.contains("fan")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue