mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
Status message fix, copy timestamp in assigmnet operator
* the timestamp of status message was not copied, so every time a status message was sorted or otherwise assigned the ts got lost or wrongly assigned. * this meant the log messages were in wrong order, leading to very confusing results in the log screen or file. * also added new timestamp formatter * new function "BlackMisc::CVariant displayRole(const PQ &pq) const" which can be used if the PQ is already available
This commit is contained in:
@@ -275,6 +275,9 @@ namespace BlackGui
|
||||
//! Hour minute second
|
||||
static const QString &formatHms() { static const QString f = "HH:mm:ss"; return f; }
|
||||
|
||||
//! Hour minute second and milliseconds
|
||||
static const QString &formatHmsz() { static const QString f = "HH:mm:ss.zzz"; return f; }
|
||||
|
||||
private:
|
||||
QString m_formatString = "yyyy-MM-dd HH:mm"; //!< how the value is displayed
|
||||
};
|
||||
@@ -333,12 +336,8 @@ namespace BlackGui
|
||||
{
|
||||
if (physicalQuantity.canConvert<PQ>())
|
||||
{
|
||||
PQ pq = physicalQuantity.value<PQ>();
|
||||
if (!m_unit.isNull())
|
||||
{
|
||||
pq.switchUnit(m_unit);
|
||||
}
|
||||
return pq.valueRoundedWithUnit(m_digits, m_useI18n);
|
||||
const PQ pq = physicalQuantity.value<PQ>();
|
||||
return this->displayRole(pq);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -347,6 +346,13 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
//! Version if value is already available as PQ
|
||||
BlackMisc::CVariant displayRole(const PQ &pq) const
|
||||
{
|
||||
if (m_unit.isNull()) { return pq.valueRoundedWithUnit(m_digits, m_useI18n); }
|
||||
return pq.valueRoundedWithUnit(m_unit, m_digits, m_useI18n);
|
||||
}
|
||||
|
||||
//! Set unit
|
||||
virtual void setUnit(const MU &unit) { m_unit = unit; }
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace BlackGui
|
||||
break;
|
||||
case Simplified:
|
||||
{
|
||||
this->m_columns.addColumn(CColumn("time", CStatusMessage::IndexUtcTimestamp, new CDateTimeFormatter(CDateTimeFormatter::formatHms())));
|
||||
m_columns.addColumn(CColumn("time", CStatusMessage::IndexUtcTimestamp, new CDateTimeFormatter(CDateTimeFormatter::formatHmsz())));
|
||||
CColumn col = CColumn("severity", CStatusMessage::IndexIcon);
|
||||
col.setSortPropertyIndex(CStatusMessage::IndexSeverityAsString);
|
||||
m_columns.addColumn(col);
|
||||
|
||||
Reference in New Issue
Block a user