Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Plasma
libksysguard
Commits
24255e92
Commit
24255e92
authored
Oct 01, 2020
by
David Redondo
🏎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also convert /partitions/all to disk/all
parent
f287e60a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
autotests/sensorfacecontrollertest.cpp
autotests/sensorfacecontrollertest.cpp
+12
-0
faces/SensorFaceController.cpp
faces/SensorFaceController.cpp
+6
-1
No files found.
autotests/sensorfacecontrollertest.cpp
View file @
24255e92
...
...
@@ -91,6 +91,18 @@ private Q_SLOTS:
{
newPrefix
+
QStringLiteral
(
"/used"
)},
};
}
QTest
::
addRow
(
"paritionsall"
)
<<
QJsonArray
{
QStringLiteral
(
"partitions/all/total"
),
QStringLiteral
(
"partitions/all/freespace"
),
QStringLiteral
(
"partitions/all/filllevel"
),
QStringLiteral
(
"partitions/all/usedspace"
),
}
<<
QJsonArray
{
QStringLiteral
(
"disk/all/total"
),
QStringLiteral
(
"disk/all/free"
),
QStringLiteral
(
"disk/all/usedPercent"
),
QStringLiteral
(
"disk/all/used"
),
};
}
void
testSensorIdConversion
()
{
...
...
faces/SensorFaceController.cpp
View file @
24255e92
...
...
@@ -192,13 +192,18 @@ QString SensorFaceControllerPrivate::replacePartitionId(const QString &entryName
if
(
!
match
.
hasMatch
())
{
return
entryName
;
}
QString
sensorId
=
entryName
;
if
(
match
.
captured
(
1
)
==
QLatin1String
(
"/all"
))
{
return
sensorId
.
replace
(
match
.
captured
(
0
),
QStringLiteral
(
"disk/all/"
));
}
const
QString
filePath
=
match
.
captured
(
1
)
==
QLatin1String
(
"/__root__"
)
?
QStringLiteral
(
"/"
)
:
match
.
captured
(
1
);
const
Solid
::
Predicate
predicate
(
Solid
::
DeviceInterface
::
StorageAccess
,
QStringLiteral
(
"filePath"
),
filePath
);
const
auto
devices
=
Solid
::
Device
::
listFromQuery
(
predicate
);
if
(
devices
.
empty
())
{
return
entryName
;
}
QString
sensorId
=
entryName
;
const
auto
volume
=
devices
[
0
].
as
<
Solid
::
StorageVolume
>
();
const
QString
id
=
volume
->
uuid
().
isEmpty
()
?
volume
->
label
()
:
volume
->
uuid
();
return
sensorId
.
replace
(
match
.
captured
(
0
),
QStringLiteral
(
"disk/%1/"
).
arg
(
id
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment