From ad3cd1355af05f179bbfbb309728962465072a08 Mon Sep 17 00:00:00 2001 From: Spiros Date: Tue, 4 Jun 2024 03:34:15 +0300 Subject: [PATCH] Fix adata --- mainwindow.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 3dda56a..fe71b72 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -339,9 +339,16 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal } else if (attrObj["name"] == "Media_Wearout_Indicator") { int percentageUsed = attrObj["value"].toInt(); percentage = QString::number(percentageUsed) + " %"; - } else if (attrObj["name"] == "Wear_Leveling_Count") { - int percentageUsed = attrObj["value"].toInt(); - percentage = QString::number(percentageUsed) + " %"; + } + } + if (percentage.isEmpty() && rotationRate == "---- (SSD)") { // Workaround for some drives which have this and another attribute + for (const QJsonValue &attr : attributes) { + QJsonObject attrObj = attr.toObject(); + if (attrObj["name"] == "Wear_Leveling_Count") { + int percentageUsed = attrObj["value"].toInt(); + percentage = QString::number(percentageUsed) + " %"; + break; + } } } } else {