mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-04-17 14:21:29 +03:00
Mark the whole drive as bad if one attribute is
This commit is contained in:
@@ -76,6 +76,7 @@ void MainWindow::scanDevices()
|
|||||||
QString temperature = "N/A";
|
QString temperature = "N/A";
|
||||||
bool healthPassed = localObj["smart_status"].toObject()["passed"].toBool();
|
bool healthPassed = localObj["smart_status"].toObject()["passed"].toBool();
|
||||||
bool caution = false;
|
bool caution = false;
|
||||||
|
bool bad = false;
|
||||||
QString health;
|
QString health;
|
||||||
QColor healthColor;
|
QColor healthColor;
|
||||||
|
|
||||||
@@ -94,9 +95,11 @@ void MainWindow::scanDevices()
|
|||||||
if (!isNvme) {
|
if (!isNvme) {
|
||||||
for (const QJsonValue &attr : attributes) {
|
for (const QJsonValue &attr : attributes) {
|
||||||
QJsonObject attrObj = attr.toObject();
|
QJsonObject attrObj = attr.toObject();
|
||||||
if (!isNvme && (attrObj["id"] == 5 || attrObj["id"] == 197 || attrObj["id"] == 198) && (attrObj["raw"].toObject()["value"].toInt() != 0)) {
|
if ((attrObj["id"] == 5 || attrObj["id"] == 197 || attrObj["id"] == 198) && attrObj["raw"].toObject()["value"].toInt() != 0) {
|
||||||
caution = true;
|
caution = true;
|
||||||
break;
|
}
|
||||||
|
if ((attrObj["thresh"].toInt() != 0) && (attrObj["value"].toInt() < attrObj["thresh"].toInt())) {
|
||||||
|
bad = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -104,10 +107,10 @@ void MainWindow::scanDevices()
|
|||||||
nvmeSmartOrdered = parser.parse(allOutput);
|
nvmeSmartOrdered = parser.parse(allOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (healthPassed && !caution) {
|
if (healthPassed && !caution && !bad) {
|
||||||
health = "Good";
|
health = "Good";
|
||||||
healthColor = Qt::green;
|
healthColor = Qt::green;
|
||||||
} else if (healthPassed && caution) {
|
} else if (healthPassed && caution && !bad) {
|
||||||
health = "Caution";
|
health = "Caution";
|
||||||
healthColor = Qt::yellow;
|
healthColor = Qt::yellow;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user