7#include "SensorGroup_p.h"
9#include <KLocalizedString>
11#include <QRegularExpression>
15SensorGroup::SensorGroup()
20SensorGroup::~SensorGroup()
24void SensorGroup::retranslate()
26 m_sensorNames.
clear();
27 m_segmentNames.
clear();
29 m_sensorNames[QStringLiteral(
"cpu/cpu\\d+/usage")] =
i18nc(
"Total load sensor of all cores",
"[Group] Total Usage");
30 m_sensorNames[QStringLiteral(
"cpu/cpu\\d+/user")] =
i18nc(
"All cores user load sensors",
"[Group] User Usage");
31 m_sensorNames[QStringLiteral(
"cpu/cpu\\d+/system")] =
i18nc(
"All cores user system sensors",
"[Group] System Usage");
32 m_sensorNames[QStringLiteral(
"cpu/cpu\\d+/wait")] =
i18nc(
"All cores wait load sensors",
"[Group] Wait Usage");
33 m_sensorNames[QStringLiteral(
"cpu/cpu\\d+/frequency")] =
i18nc(
"All cores clock frequency sensors",
"[Group] Clock Frequency");
34 m_sensorNames[QStringLiteral(
"cpu/cpu\\d+/temperature")] =
i18nc(
"All cores temperature sensors",
"[Group] Temperature");
35 m_sensorNames[QStringLiteral(
"cpu/cpu\\d+/name")] =
i18nc(
"All cores names",
"[Group] Name");
37 m_sensorNames[QStringLiteral(
"partitions/(?!all).*/usedspace")] =
i18n(
"[Group] Used");
38 m_sensorNames[QStringLiteral(
"partitions/(?!all).*/freespace")] =
i18n(
"[Group] Available");
39 m_sensorNames[QStringLiteral(
"partitions/(?!all).*/filllevel")] =
i18n(
"[Group] Percentage Used");
40 m_sensorNames[QStringLiteral(
"partitions/(?!all).*/total")] =
i18n(
"[Group] Total Size");
42 m_sensorNames[QStringLiteral(
"network/(?!all).*/network")] =
i18n(
"[Group] Network Name");
43 m_sensorNames[QStringLiteral(
"network/(?!all).*/ipv4address")] =
i18n(
"[Group] IPv4 Address");
44 m_sensorNames[QStringLiteral(
"network/(?!all).*/ipv6address")] =
i18n(
"[Group] IPv6 Address");
45 m_sensorNames[QStringLiteral(
"network/(?!all).*/signal")] =
i18n(
"[Group] Signal Strength");
46 m_sensorNames[QStringLiteral(
"network/(?!all).*/download")] =
i18n(
"[Group] Download Rate");
47 m_sensorNames[QStringLiteral(
"network/(?!all).*/downloadBits")] =
i18n(
"[Group] Download Rate");
48 m_sensorNames[QStringLiteral(
"network/(?!all).*/totalDownload")] =
i18n(
"[Group] Total Downloaded");
49 m_sensorNames[QStringLiteral(
"network/(?!all).*/upload")] =
i18n(
"[Group] Upload Rate");
50 m_sensorNames[QStringLiteral(
"network/(?!all).*/uploadBits")] =
i18n(
"[Group] Upload Rate");
51 m_sensorNames[QStringLiteral(
"network/(?!all).*/totalUpload")] =
i18n(
"[Group] Total Uploaded");
53 m_sensorNames[QStringLiteral(
"disk/(?!all).*/name")] =
i18n(
"[Group] Name");
54 m_sensorNames[QStringLiteral(
"disk/(?!all).*/total")] =
i18n(
"[Group] Total Space");
55 m_sensorNames[QStringLiteral(
"disk/(?!all).*/used")] =
i18n(
"[Group] Used Space");
56 m_sensorNames[QStringLiteral(
"disk/(?!all).*/free")] =
i18n(
"[Group] Free Space");
57 m_sensorNames[QStringLiteral(
"disk/(?!all).*/read")] =
i18n(
"[Group] Read Rate");
58 m_sensorNames[QStringLiteral(
"disk/(?!all).*/write")] =
i18n(
"[Group] Write Rate");
59 m_sensorNames[QStringLiteral(
"disk/(?!all).*/usedPercent")] =
i18n(
"[Group] Percentage Used");
60 m_sensorNames[QStringLiteral(
"disk/(?!all).*/freePercent")] =
i18n(
"[Group] Percentage Free");
76 return expr.
replace(cpuExpr, QStringLiteral(
"cpu/cpu\\d+/\\1"));
80 return expr.
replace(netExpr, QStringLiteral(
"network/(?!all).*/\\1"));
82 }
else if (key.
contains(partitionsExpr)) {
84 return expr.
replace(partitionsExpr, QStringLiteral(
"partitions/(?!all).*/\\1"));
88 return expr.
replace(diskExpr, QStringLiteral(
"disk/(?!all).*/\\1"));
97 return m_sensorNames.
value(expr);
105 if (m_segmentNames.
contains(expr)) {
106 return m_segmentNames.
value(expr);
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
bool contains(const Key &key) const const
T value(const Key &key) const const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)