mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-04-21 08:13:19 +03:00
Support nvme messages
This commit is contained in:
@@ -467,6 +467,8 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
|
|||||||
|
|
||||||
void MainWindow::addNvmeLogTable(const QVector<QPair<QString, int>>& nvmeLogOrdered)
|
void MainWindow::addNvmeLogTable(const QVector<QPair<QString, int>>& nvmeLogOrdered)
|
||||||
{
|
{
|
||||||
|
QString warningMessage = "";
|
||||||
|
|
||||||
tableWidget->setColumnCount(4);
|
tableWidget->setColumnCount(4);
|
||||||
tableWidget->setHorizontalHeaderLabels({"", "ID", "Attribute Name", "Raw Values"});
|
tableWidget->setHorizontalHeaderLabels({"", "ID", "Attribute Name", "Raw Values"});
|
||||||
tableWidget->verticalHeader()->setVisible(false);
|
tableWidget->verticalHeader()->setVisible(false);
|
||||||
@@ -500,6 +502,19 @@ void MainWindow::addNvmeLogTable(const QVector<QPair<QString, int>>& nvmeLogOrde
|
|||||||
|
|
||||||
if (id == "01" && rawInt) {
|
if (id == "01" && rawInt) {
|
||||||
statusColor = badColor;
|
statusColor = badColor;
|
||||||
|
if (rawInt == 1) { // Still need to figure out if this is DEC or HEX in JSON
|
||||||
|
warningMessage = tr("Available spare capacity has fallen below the threshold"); // THX to CrystalDiskInfo for the messages
|
||||||
|
} else if (rawInt == 2) {
|
||||||
|
warningMessage = tr("Temperature error (Overheat or Overcool)");
|
||||||
|
} else if (rawInt == 4) {
|
||||||
|
warningMessage = tr("NVM subsystem reliability has been degraded");
|
||||||
|
} else if (rawInt == 8) {
|
||||||
|
warningMessage = tr("Media has been placed in Read Only Mode");
|
||||||
|
} else if (rawInt == 10) {
|
||||||
|
warningMessage = tr("Volatile memory backup device has Failed");
|
||||||
|
} else if (rawInt == 20) {
|
||||||
|
warningMessage = tr("Persistent memory region has become Read-Only");
|
||||||
|
}
|
||||||
} else if (id == "03") {
|
} else if (id == "03") {
|
||||||
int availableSpareThreshold = nvmeLogOrdered.at(3).second;
|
int availableSpareThreshold = nvmeLogOrdered.at(3).second;
|
||||||
if (availableSpareThreshold > 100) { // Thx to crystaldiskinfo for these workarounds
|
if (availableSpareThreshold > 100) { // Thx to crystaldiskinfo for these workarounds
|
||||||
@@ -537,6 +552,10 @@ void MainWindow::addNvmeLogTable(const QVector<QPair<QString, int>>& nvmeLogOrde
|
|||||||
|
|
||||||
++row;
|
++row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!warningMessage.isEmpty()) {
|
||||||
|
QMessageBox::warning(nullptr, tr("Critical Warning"), warningMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addSmartAttributesTable(const QJsonArray &attributes)
|
void MainWindow::addSmartAttributesTable(const QJsonArray &attributes)
|
||||||
@@ -657,7 +676,7 @@ QString MainWindow::getSmartctlOutput(const QStringList &arguments, bool root)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!commandExists("smartctl")) {
|
if (!commandExists("smartctl")) {
|
||||||
QMessageBox::critical(nullptr, tr("KDiskInfo Error"), tr("smartctl was not found, please install it!"));
|
QMessageBox::critical(this, tr("KDiskInfo Error"), tr("smartctl was not found, please install it!"));
|
||||||
QTimer::singleShot(0, qApp, &QApplication::quit);
|
QTimer::singleShot(0, qApp, &QApplication::quit);
|
||||||
} else {
|
} else {
|
||||||
commandArgs.append(arguments);
|
commandArgs.append(arguments);
|
||||||
@@ -666,7 +685,7 @@ QString MainWindow::getSmartctlOutput(const QStringList &arguments, bool root)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (process.exitCode() == 127) {
|
if (process.exitCode() == 127) {
|
||||||
QMessageBox::critical(nullptr, tr("KDiskInfo Error"), tr("KDiskInfo needs root access in order to read S.M.A.R.T. data!"));
|
QMessageBox::critical(this, tr("KDiskInfo Error"), tr("KDiskInfo needs root access in order to read S.M.A.R.T. data!"));
|
||||||
QTimer::singleShot(0, qApp, &QApplication::quit);
|
QTimer::singleShot(0, qApp, &QApplication::quit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user