Changeset View
Changeset View
Standalone View
Standalone View
src/core/smartparser.cpp
Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | 49 | { | |||
---|---|---|---|---|---|
86 | 86 | | |||
87 | QJsonObject smartStatus = smartJson[smart_status].toObject(); | 87 | QJsonObject smartStatus = smartJson[smart_status].toObject(); | ||
88 | 88 | | |||
89 | m_DiskInformation->setSmartStatus(smartStatus[passed].toBool()); | 89 | m_DiskInformation->setSmartStatus(smartStatus[passed].toBool()); | ||
90 | 90 | | |||
91 | m_DiskInformation->setModel(smartJson[model_name].toString()); | 91 | m_DiskInformation->setModel(smartJson[model_name].toString()); | ||
92 | m_DiskInformation->setFirmware(smartJson[firmware].toString()); | 92 | m_DiskInformation->setFirmware(smartJson[firmware].toString()); | ||
93 | m_DiskInformation->setSerial(smartJson[serial_number].toString()); | 93 | m_DiskInformation->setSerial(smartJson[serial_number].toString()); | ||
94 | | ||||
95 | if (smartJson[user_capacity].isObject()) { | ||||
96 | // smartmontools 7.0+ | ||||
97 | const auto user_capacity_object = smartJson[user_capacity].toObject(); | ||||
98 | QString user_capacity_bytes = QStringLiteral("bytes"); | ||||
99 | m_DiskInformation->setSize(user_capacity_object[user_capacity_bytes].toVariant().toULongLong()); | ||||
100 | } else { | ||||
94 | m_DiskInformation->setSize(smartJson[user_capacity].toVariant().toULongLong()); | 101 | m_DiskInformation->setSize(smartJson[user_capacity].toVariant().toULongLong()); | ||
102 | } | ||||
95 | 103 | | |||
96 | QJsonObject selfTest = smartJson[self_test].toObject(); | 104 | QJsonObject selfTest = smartJson[self_test].toObject(); | ||
97 | QJsonObject selfTestStatus = selfTest[status].toObject(); | 105 | QJsonObject selfTestStatus = selfTest[status].toObject(); | ||
98 | 106 | | |||
99 | m_DiskInformation->setSelfTestExecutionStatus(static_cast<SmartStatus::SelfTestStatus>(selfTestStatus[value].toInt())); | 107 | m_DiskInformation->setSelfTestExecutionStatus(static_cast<SmartStatus::SelfTestStatus>(selfTestStatus[value].toInt())); | ||
100 | 108 | | |||
101 | loadAttributes(); | 109 | loadAttributes(); | ||
102 | 110 | | |||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |