mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-04-22 04:53:18 +03:00
Show health percentage for NVMe drives
This commit is contained in:
@@ -223,6 +223,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
|
|||||||
QString userCapacityString = QString::number(static_cast<int>(userCapacityGB)) + "." + QString::number(static_cast<int>((userCapacityGB - static_cast<int>(userCapacityGB)) * 10)) + " GB";
|
QString userCapacityString = QString::number(static_cast<int>(userCapacityGB)) + "." + QString::number(static_cast<int>((userCapacityGB - static_cast<int>(userCapacityGB)) * 10)) + " GB";
|
||||||
QString totalReads = "----";
|
QString totalReads = "----";
|
||||||
QString totalWrites = "----";
|
QString totalWrites = "----";
|
||||||
|
QString percentage = "";
|
||||||
QString serialNumber = localObj["serial_number"].toString();
|
QString serialNumber = localObj["serial_number"].toString();
|
||||||
QJsonObject deviceObj = localObj["device"].toObject();
|
QJsonObject deviceObj = localObj["device"].toObject();
|
||||||
QString protocol = deviceObj["protocol"].toString();
|
QString protocol = deviceObj["protocol"].toString();
|
||||||
@@ -341,6 +342,9 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
|
|||||||
double dataUnitsRead = value.toDouble();
|
double dataUnitsRead = value.toDouble();
|
||||||
double totalGbRead = (dataUnitsRead * 512) / 1'000'000;
|
double totalGbRead = (dataUnitsRead * 512) / 1'000'000;
|
||||||
totalReads = QString::number(static_cast<int>(totalGbRead)) + " GB";
|
totalReads = QString::number(static_cast<int>(totalGbRead)) + " GB";
|
||||||
|
} else if (key == "percentage_used") {
|
||||||
|
int percentageUsed = 100 - value.toInt();
|
||||||
|
percentage = QString::number(percentageUsed) + " %";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -387,7 +391,11 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
|
|||||||
healthStatusValue->setStyleSheet("background-color: " + QColor(Qt::green).name() + ";");
|
healthStatusValue->setStyleSheet("background-color: " + QColor(Qt::green).name() + ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
healthStatusValue->setText("<html><head/><body><p><span style='" + labelStyle +"'>" + health + "</span></p></body></html>");
|
QString percentageText = "";
|
||||||
|
if (!percentage.isEmpty()) {
|
||||||
|
percentageText = "<br/>" + percentage;
|
||||||
|
}
|
||||||
|
healthStatusValue->setText("<html><head/><body><p><span style='" + labelStyle +"'>" + health + percentageText + "</span></p></body></html>");
|
||||||
healthStatusValue->setAlignment(Qt::AlignCenter);
|
healthStatusValue->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
if (protocol != "NVMe") {
|
if (protocol != "NVMe") {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
<string notr="true">background-color: rgb(0, 255, 0);</string>
|
<string notr="true">background-color: rgb(0, 255, 0);</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p align="center"><span style=" font-size:12pt; font-weight:700; color:#000000;">Good</span></p></body></html></string>
|
<string><html><head/><body><p align="center"><span style=" font-size:12pt; font-weight:700; color:#000000;">Good</span></p><p align="center"><span style=" font-size:12pt; font-weight:700; color:#000000;">100 %</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user