mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
Fixed updates of view when simulated aircraft values are updated.
* renamed view to simulated aircraft view * utility function for bool -> on/off
This commit is contained in:
@@ -396,12 +396,12 @@ QJsonObject BlackMisc::getIncrementalObject(const QJsonObject &previousObject, c
|
||||
QJsonObject BlackMisc::applyIncrementalObject(const QJsonObject &previousObject, const QJsonObject &incrementalObject)
|
||||
{
|
||||
QJsonObject currentObject = previousObject;
|
||||
for(const auto &key : incrementalObject.keys())
|
||||
for (const auto &key : incrementalObject.keys())
|
||||
{
|
||||
// If it is not an object, just insert the value
|
||||
if (!incrementalObject.value(key).isObject())
|
||||
{
|
||||
currentObject.insert(key,incrementalObject.value(key));
|
||||
currentObject.insert(key, incrementalObject.value(key));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -411,3 +411,17 @@ QJsonObject BlackMisc::applyIncrementalObject(const QJsonObject &previousObject,
|
||||
}
|
||||
return currentObject;
|
||||
}
|
||||
|
||||
|
||||
QString BlackMisc::boolToOnOff(bool v, bool i18n)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "on" : "off";
|
||||
}
|
||||
|
||||
|
||||
QString BlackMisc::boolToYesNo(bool v, bool i18n)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "yes" : "no";
|
||||
}
|
||||
|
||||
@@ -171,6 +171,12 @@ namespace BlackMisc
|
||||
//! A map converted to string
|
||||
template<class K, class V> QString qmapToString(const QMap<K, V> &map);
|
||||
|
||||
//! Bool to on/off
|
||||
QString boolToOnOff(bool v, bool i18n = false);
|
||||
|
||||
//! Bool to yes / no
|
||||
QString boolToYesNo(bool v, bool i18n = false);
|
||||
|
||||
//! Get local host name
|
||||
const QString &localHostName();
|
||||
|
||||
|
||||
@@ -154,10 +154,10 @@ namespace BlackMisc
|
||||
{
|
||||
QString s = CAircraft::convertToQString(i18n);
|
||||
s += " enabled: ";
|
||||
s += this->isEnabled() ? "yes" : "no";
|
||||
s += BlackMisc::boolToYesNo(this->isEnabled());
|
||||
s += " ";
|
||||
s += " rendered: ";
|
||||
s += this->isRendered() ? "yes" : "no";
|
||||
s += BlackMisc::boolToYesNo(this->isRendered());
|
||||
s += " ";
|
||||
s += this->m_model.toQString(i18n);
|
||||
s += " ";
|
||||
|
||||
Reference in New Issue
Block a user