Added linux build and some UI minor fixes
This commit is contained in:
@@ -184,14 +184,20 @@ void BatteryController::setStatuses(const QVariantList& statuses)
|
||||
|
||||
void BatteryController::addStatus(const quint16 status)
|
||||
{
|
||||
QString description;
|
||||
auto appendDescription = [&description](const QString& subStatus)
|
||||
// QString description;
|
||||
// auto appendDescription = [&description](const QString& subStatus)
|
||||
// {
|
||||
// if (!description.isEmpty())
|
||||
// {
|
||||
// description += ", ";
|
||||
// }
|
||||
// description += subStatus;
|
||||
// };
|
||||
|
||||
QStringList descriptionList;
|
||||
auto appendDescription = [&descriptionList](const QString& subStatus)
|
||||
{
|
||||
if (!description.isEmpty())
|
||||
{
|
||||
description += ", ";
|
||||
}
|
||||
description += subStatus;
|
||||
descriptionList.append(subStatus);
|
||||
};
|
||||
|
||||
std::bitset<16> descriptionBitset(status);
|
||||
@@ -252,18 +258,23 @@ void BatteryController::addStatus(const quint16 status)
|
||||
appendDescription("Разночтение в токах");
|
||||
}
|
||||
|
||||
if (description.isEmpty())
|
||||
if (descriptionList.isEmpty())
|
||||
{
|
||||
appendDescription("Штатный режим");
|
||||
}
|
||||
|
||||
QVariantMap statusMap;
|
||||
statusMap.insert("time", QDateTime::currentDateTime().toString("hh:mm:ss dd-MM-yyyy"));
|
||||
statusMap.insert("status", "0x" + QString::number(status, 16).toUpper().rightJustified(2, '0'));
|
||||
statusMap.insert("description", description);
|
||||
|
||||
statuses_.clear();
|
||||
statuses_.append(statusMap);
|
||||
|
||||
for (const auto& description: descriptionList)
|
||||
{
|
||||
QVariantMap statusMap;
|
||||
statusMap.insert("time", QDateTime::currentDateTime().toString("hh:mm:ss dd-MM-yyyy"));
|
||||
statusMap.insert("status", "0x" + QString::number(status, 16).toUpper().rightJustified(2, '0'));
|
||||
statusMap.insert("description", description);
|
||||
|
||||
statuses_.append(statusMap);
|
||||
}
|
||||
|
||||
emit statusesChanged();
|
||||
|
||||
// if (statuses_.isEmpty() || statuses_.first().toMap()["status"] != statusMap["status"])
|
||||
|
||||
Reference in New Issue
Block a user