From 429a45b5be5204c546dbe5ab4159035ecad643af Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Mon, 13 Oct 2014 17:47:40 +0200 Subject: [PATCH] OP-1538 Added some Vogon poetry. --- .../uavobjectbrowserwidget.cpp | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp index ed64c1b1c..c7209a333 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp @@ -280,7 +280,65 @@ void UAVObjectBrowserWidget::splitterMoved() QString UAVObjectBrowserWidget::createObjectDescription(UAVObject *object) { - return object->getDescription(); + QString indent("        "); + QString description; + description.append(""); + description.append("").append(tr("Name:")).append(" ").append(object->getName()) + .append("
"); + description.append("").append(tr("Type:")).append(" ") + .append(object->isSettingsObject() ? tr("Settings") : object->isMetaDataObject() ? tr("Metadata") : tr("Data")) + .append(indent); + description.append("").append(tr("Category:")).append(" ").append(object->getCategory()) + .append("

"); + description.append("").append(tr("Description:")).append(" ").append(object->getDescription().replace("@ref", "")) + .append("



"); + description.append("").append(tr("Fields:")).append(" ") + .append("
"); + + foreach (UAVObjectField *field, object->getFields()) { + description.append(indent).append("").append(tr("Name:")).append(" ").append(field->getName()) + .append(indent); + description.append("").append(tr("Size:")).append(" ").append(tr("%1 bytes").arg(field->getNumBytes())) + .append(indent); + + description.append("").append(tr("Type:")).append(" ").append(field->getTypeAsString()); + int elements = field->getNumElements(); + if (elements > 1) { + description.append("[").append(QString("%1").arg(field->getNumElements())).append("]"); + } + + description.append(indent).append("").append(tr("Unit:")).append(" ").append(field->getUnits()); + + description.append("
"); + if (field->getDescription() != "") { + description.append(indent).append("").append(tr("Description:")).append(" ").append(field->getDescription()); + description.append("
"); + } + + if (elements > 1) { + description.append(indent).append("").append(tr("Elements:")).append(" ").append("
"); + QStringList names = field->getElementNames(); + for (uint i = 0; i < field->getNumElements(); i++) { + description.append(indent).append(indent).append("").append(tr("Name:")).append(" ").append(names.at(i)) + .append(indent); + if (field->getMinLimit(i).toString() != "" && field->getMaxLimit(i).toString() != "") { + description.append("").append(tr("Limits:")).append(" ") + .append(QString("%1 - %2").arg(field->getMinLimit(i).toString(), field->getMaxLimit(i).toString())); + } + description.append("
"); + } + description.append("

"); + } else { + if (field->getMinLimit(0).toString() != "" && field->getMaxLimit(0).toString() != "") { + description.append(indent).append("").append(tr("Limits:")).append(" ") + .append(QString("%1 - %2").arg(field->getMinLimit(0).toString(), field->getMaxLimit(0).toString())); + description.append("

"); + } + } + } + + description.append(""); + return description; } void UAVObjectBrowserWidget::enableSendRequest(bool enable)