From a8f0bb6eb6b9179da62d578b64cfaf6cc35abafb Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Tue, 16 Sep 2014 19:27:18 +0200 Subject: [PATCH] OP-1222 Uncrustify --- .../calibration/sixpointcalibrationmodel.cpp | 8 ++--- .../calibration/sixpointcalibrationmodel.h | 4 +-- .../configmultirotorwidget.cpp | 2 +- .../config/configvehicletypewidget.cpp | 2 +- .../plugins/setupwizard/connectiondiagram.cpp | 10 ++++--- .../setupwizard/pages/airspeedpage.cpp | 9 +++--- .../plugins/setupwizard/pages/airspeedpage.h | 1 - .../plugins/setupwizard/pages/multipage.cpp | 2 +- .../plugins/setupwizard/pages/selectionpage.h | 6 ++-- .../resources/connection-diagrams.svg | 15 +++++----- .../src/plugins/setupwizard/setupwizard.cpp | 1 + .../plugins/setupwizard/setupwizardplugin.cpp | 9 +++--- .../vehicleconfigurationhelper.cpp | 29 +++++++++---------- .../src/plugins/uavobjects/uavobject.cpp | 7 +++-- .../src/plugins/uavobjects/uavobjectfield.cpp | 2 +- 15 files changed, 55 insertions(+), 52 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.cpp b/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.cpp index f877a44b5..0593600e0 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.cpp +++ b/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.cpp @@ -101,7 +101,7 @@ SixPointCalibrationModel::SixPointCalibrationModel(QObject *parent) : revoCalibration = RevoCalibration::GetInstance(getObjectManager()); Q_ASSERT(revoCalibration); - auxMagSettings = AuxMagSettings::GetInstance(getObjectManager()); + auxMagSettings = AuxMagSettings::GetInstance(getObjectManager()); Q_ASSERT(auxMagSettings); accelGyroSettings = AccelGyroSettings::GetInstance(getObjectManager()); @@ -440,7 +440,7 @@ void SixPointCalibrationModel::compute() double Be_length; RevoCalibration::DataFields revoCalibrationData = revoCalibration->getData(); - AuxMagSettings::DataFields auxCalibrationData = auxMagSettings->getData(); + AuxMagSettings::DataFields auxCalibrationData = auxMagSettings->getData(); AccelGyroSettings::DataFields accelGyroSettingsData = accelGyroSettings->getData(); HomeLocation::DataFields homeLocationData = homeLocation->getData(); @@ -521,8 +521,8 @@ void SixPointCalibrationModel::compute() if (good_calibration) { m_dirty = true; if (calibratingMag) { - result.revoCalibrationData = revoCalibrationData; - result.auxMagSettingsData = auxCalibrationData; + result.revoCalibrationData = revoCalibrationData; + result.auxMagSettingsData = auxCalibrationData; displayInstructions(tr("Magnetometer calibration completed successfully."), WizardModel::Success); } if (calibratingAccel) { diff --git a/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.h b/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.h index b398aeb0c..464a20de9 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.h +++ b/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.h @@ -92,14 +92,14 @@ public: UAVObject::Metadata accelStateMetadata; UAVObject::Metadata magSensorMetadata; UAVObject::Metadata auxMagSensorMetadata; - AuxMagSettings::DataFields auxMagSettings; + AuxMagSettings::DataFields auxMagSettings; RevoCalibration::DataFields revoCalibrationData; AccelGyroSettings::DataFields accelGyroSettingsData; } Memento; typedef struct { RevoCalibration::DataFields revoCalibrationData; - AuxMagSettings::DataFields auxMagSettingsData; + AuxMagSettings::DataFields auxMagSettingsData; AccelGyroSettings::DataFields accelGyroSettingsData; } Result; diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp index 8ce2c5167..193269b48 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp @@ -137,7 +137,7 @@ ConfigMultiRotorWidget::ConfigMultiRotorWidget(QWidget *parent) : m_aircraft->quadShape->setScene(scene); QStringList multiRotorTypes; - multiRotorTypes << "Tricopter Y" << "Quad +" << "Quad X" << "Quad H" << "Hexacopter" << "Hexacopter X" << "Hexacopter H" + multiRotorTypes << "Tricopter Y" << "Quad +" << "Quad X" << "Quad H" << "Hexacopter" << "Hexacopter X" << "Hexacopter H" << "Hexacopter Y6" << "Octocopter" << "Octocopter X" << "Octocopter V" << "Octo Coax +" << "Octo Coax X"; m_aircraft->multirotorFrameType->addItems(multiRotorTypes); diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp index 55f06b783..3affbb7b8 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp @@ -265,7 +265,7 @@ int ConfigVehicleTypeWidget::frameCategory(QString frameType) || frameType == "Elevon" || frameType == "FixedWingVtail" || frameType == "Vtail") { return ConfigVehicleTypeWidget::FIXED_WING; } else if (frameType == "Tri" || frameType == "Tricopter Y" || frameType == "QuadX" || frameType == "Quad X" - || frameType == "QuadP" || frameType == "Quad +" || frameType == "Quad H" || frameType == "QuadH" + || frameType == "QuadP" || frameType == "Quad +" || frameType == "Quad H" || frameType == "QuadH" || frameType == "Hexa" || frameType == "Hexacopter" || frameType == "HexaX" || frameType == "Hexacopter X" || frameType == "HexaCoax" || frameType == "HexaH" || frameType == "Hexacopter H" || frameType == "Hexacopter Y6" diff --git a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp index 940319c85..227d851bb 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp @@ -31,7 +31,7 @@ #include "connectiondiagram.h" #include "ui_connectiondiagram.h" -const char* ConnectionDiagram::FILE_NAME = ":/setupwizard/resources/connection-diagrams.svg"; +const char *ConnectionDiagram::FILE_NAME = ":/setupwizard/resources/connection-diagrams.svg"; const int ConnectionDiagram::IMAGE_PADDING = 10; ConnectionDiagram::ConnectionDiagram(QWidget *parent, VehicleConfigurationSource *configSource) : @@ -50,12 +50,14 @@ ConnectionDiagram::~ConnectionDiagram() void ConnectionDiagram::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); + fitInView(); } void ConnectionDiagram::showEvent(QShowEvent *event) { QWidget::showEvent(event); + fitInView(); } @@ -63,8 +65,8 @@ void ConnectionDiagram::fitInView() { ui->connectionDiagram->setSceneRect(m_scene->itemsBoundingRect()); ui->connectionDiagram->fitInView( - m_scene->itemsBoundingRect().adjusted(-IMAGE_PADDING,-IMAGE_PADDING, IMAGE_PADDING, IMAGE_PADDING), - Qt::KeepAspectRatio); + m_scene->itemsBoundingRect().adjusted(-IMAGE_PADDING, -IMAGE_PADDING, IMAGE_PADDING, IMAGE_PADDING), + Qt::KeepAspectRatio); } void ConnectionDiagram::setupGraphicsScene() @@ -210,7 +212,7 @@ void ConnectionDiagram::setupGraphicsScene() } if (m_configSource->getVehicleType() == VehicleConfigurationSource::VEHICLE_FIXEDWING && - m_configSource->getAirspeedType() != VehicleConfigurationSource::AIRSPEED_ESTIMATE) { + m_configSource->getAirspeedType() != VehicleConfigurationSource::AIRSPEED_ESTIMATE) { switch (m_configSource->getAirspeedType()) { case VehicleConfigurationSource::AIRSPEED_EAGLETREE: if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.cpp index f135d056b..c73989b3e 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.cpp @@ -40,14 +40,14 @@ void AirSpeedPage::initializePage(VehicleConfigurationSource *settings) // Enable all setItemDisabled(-1, false); if (settings->getInputType() == VehicleConfigurationSource::INPUT_SBUS || - settings->getInputType() == VehicleConfigurationSource::INPUT_DSM2 || - settings->getInputType() == VehicleConfigurationSource::INPUT_DSMX10 || - settings->getInputType() == VehicleConfigurationSource::INPUT_DSMX11) { + settings->getInputType() == VehicleConfigurationSource::INPUT_DSM2 || + settings->getInputType() == VehicleConfigurationSource::INPUT_DSMX10 || + settings->getInputType() == VehicleConfigurationSource::INPUT_DSMX11) { // Disable non estimated sensors if ports are taken by receivers setItemDisabled(VehicleConfigurationSource::AIRSPEED_EAGLETREE, true); setItemDisabled(VehicleConfigurationSource::AIRSPEED_MS4525, true); if (getSelectedItem()->id() == VehicleConfigurationSource::AIRSPEED_EAGLETREE || - getSelectedItem()->id() == VehicleConfigurationSource::AIRSPEED_MS4525) { + getSelectedItem()->id() == VehicleConfigurationSource::AIRSPEED_MS4525) { // If previously selected invalid sensor, reset to estimated setSelectedItem(VehicleConfigurationSource::AIRSPEED_ESTIMATE); } @@ -90,4 +90,3 @@ void AirSpeedPage::setupSelection(Selection *selection) "ms4525-speed-sensor", SetupWizard::AIRSPEED_MS4525); } - diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.h index e87838f7a..ff7d1ed2a 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/airspeedpage.h @@ -41,7 +41,6 @@ protected: void initializePage(VehicleConfigurationSource *settings); bool validatePage(SelectionItem *selectedItem); void setupSelection(Selection *selection); - }; #endif // AIRSPEEDPAGE_H diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.cpp index f649c7bf1..d1bd8c798 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.cpp @@ -79,7 +79,7 @@ void MultiPage::setupSelection(Selection *selection) selection->addItem(tr("Quadcopter H"), tr("Quadcopter H, Blackout miniH"), "quad-h", - SetupWizard::MULTI_ROTOR_QUAD_H); + SetupWizard::MULTI_ROTOR_QUAD_H); selection->addItem(tr("Hexacopter"), tr("A multirotor with six motors, one motor in front."), diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/selectionpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/selectionpage.h index 9a2126ef1..045998d42 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/selectionpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/selectionpage.h @@ -58,10 +58,12 @@ public: { return m_id; } - void setDisabled(bool disabled) { + void setDisabled(bool disabled) + { m_disabled = disabled; } - bool disabled() { + bool disabled() + { return m_disabled; } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg index a43ec2b2e..fefc1c59a 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg @@ -26,16 +26,16 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1280" - inkscape:window-height="928" + inkscape:window-width="593" + inkscape:window-height="439" id="namedview4616" showgrid="false" - inkscape:zoom="0.54491305" + inkscape:zoom="0.1891554" inkscape:cx="1013.827" inkscape:cy="514.92134" - inkscape:window-x="0" - inkscape:window-y="27" - inkscape:window-maximized="1" + inkscape:window-x="331" + inkscape:window-y="337" + inkscape:window-maximized="0" inkscape:current-layer="layer7" fit-margin-top="15" fit-margin-left="15" @@ -29307,7 +29307,8 @@ inkscape:groupmode="layer" id="layer7" inkscape:label="quad-h" - style="display:inline"> + style="display:inline" + sodipodi:insensitive="true"> addAction(cmd, "Wizard"); cmd = am->registerAction(new QAction(this), - "SetupWizardPlugin.ExportJSon", - QList() << - Core::Constants::C_GLOBAL_ID); + "SetupWizardPlugin.ExportJSon", + QList() << + Core::Constants::C_GLOBAL_ID); cmd->action()->setText(tr("Export Stabilization Settings")); connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(exportSettings())); @@ -114,12 +114,11 @@ void SetupWizardPlugin::exportSettings() ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); UAVObjectManager *uavoManager = pm->getObject(); - StabilizationSettings* settings = StabilizationSettings::GetInstance(uavoManager); + StabilizationSettings *settings = StabilizationSettings::GetInstance(uavoManager); settings->toJson(exportObject); QJsonDocument saveDoc(exportObject); saveFile.write(saveDoc.toJson()); - } void SetupWizardPlugin::wizardTerminated() diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index b6d8c360a..3840ac16a 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -116,6 +116,7 @@ void VehicleConfigurationHelper::clearModifiedObjects() void VehicleConfigurationHelper::applyHardwareConfiguration() { HwSettings *hwSettings = HwSettings::GetInstance(m_uavoManager); + Q_ASSERT(hwSettings); HwSettings::DataFields data = hwSettings->getData(); @@ -193,7 +194,6 @@ void VehicleConfigurationHelper::applyHardwareConfiguration() } if (m_configSource->getGpsType() != VehicleConfigurationSource::GPS_DISABLED) { - GPSSettings *gpsSettings = GPSSettings::GetInstance(m_uavoManager); Q_ASSERT(gpsSettings); GPSSettings::DataFields gpsData = gpsSettings->getData(); @@ -201,28 +201,28 @@ void VehicleConfigurationHelper::applyHardwareConfiguration() switch (m_configSource->getGpsType()) { case VehicleConfigurationSource::GPS_NMEA: data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1; - data.RM_MainPort = HwSettings::RM_MAINPORT_GPS; - data.GPSSpeed = HwSettings::GPSSPEED_57600; + data.RM_MainPort = HwSettings::RM_MAINPORT_GPS; + data.GPSSpeed = HwSettings::GPSSPEED_57600; gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_NMEA; break; case VehicleConfigurationSource::GPS_UBX: data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1; - data.RM_MainPort = HwSettings::RM_MAINPORT_GPS; - data.GPSSpeed = HwSettings::GPSSPEED_57600; + data.RM_MainPort = HwSettings::RM_MAINPORT_GPS; + data.GPSSpeed = HwSettings::GPSSPEED_57600; gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBX; break; case VehicleConfigurationSource::GPS_PLATINUM: data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 1; data.RM_MainPort = HwSettings::RM_MAINPORT_GPS; - data.GPSSpeed = HwSettings::GPSSPEED_115200; + data.GPSSpeed = HwSettings::GPSSPEED_115200; /* - gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBLOX; - AuxMagSettings *magSettings = AuxMagSettings::GetInstance(m_uavoManager); - AuxMagSettings::DataFields magsData = magSettings->getData(); - magsData.usage = AuxMagSettings::Both; - magSettings->setData(magsData); - addModifiedObject(magSettings, tr("Writing External Mag sensor settings")); - */ + gpsData.DataProtocol = GPSSettings::DATAPROTOCOL_UBLOX; + AuxMagSettings *magSettings = AuxMagSettings::GetInstance(m_uavoManager); + AuxMagSettings::DataFields magsData = magSettings->getData(); + magsData.usage = AuxMagSettings::Both; + magSettings->setData(magsData); + addModifiedObject(magSettings, tr("Writing External Mag sensor settings")); + */ break; default: data.OptionalModules[HwSettings::OPTIONALMODULES_GPS] = 0; @@ -234,8 +234,7 @@ void VehicleConfigurationHelper::applyHardwareConfiguration() } if (m_configSource->getVehicleType() == VehicleConfigurationSource::VEHICLE_FIXEDWING && - m_configSource->getAirspeedType() != VehicleConfigurationSource::AIRSPEED_DISABLED) { - + m_configSource->getAirspeedType() != VehicleConfigurationSource::AIRSPEED_DISABLED) { AirspeedSettings *airspeedSettings = AirspeedSettings::GetInstance(m_uavoManager); Q_ASSERT(airspeedSettings); AirspeedSettings::DataFields airspeedData = airspeedSettings->getData(); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp index dbf303c88..d72f7dfdc 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp @@ -542,7 +542,7 @@ void UAVObject::fromXML(QXmlStreamReader *xmlReader) Q_ASSERT(xmlReader->attributes().value("name") == getName()); Q_ASSERT(xmlReader->attributes().value("instance") == QString("%1").arg(getInstID())); QXmlStreamReader::TokenType token = xmlReader->readNext(); - if(token == QXmlStreamReader::StartElement && xmlReader->name() == "fields") { + if (token == QXmlStreamReader::StartElement && xmlReader->name() == "fields") { while (xmlReader->readNextStartElement()) { if (xmlReader->name() == "field") { QStringRef fieldName = xmlReader->attributes().value("name"); @@ -556,12 +556,13 @@ void UAVObject::fromXML(QXmlStreamReader *xmlReader) void UAVObject::toJson(QJsonObject &jsonObject) { - jsonObject["name"] = getName(); - jsonObject["id"] = QString("%1").arg(getObjID(), 1, 16).toUpper(); + jsonObject["name"] = getName(); + jsonObject["id"] = QString("%1").arg(getObjID(), 1, 16).toUpper(); jsonObject["instance"] = (int)getInstID(); QJsonArray jSonFields; foreach(UAVObjectField * field, fields) { QJsonObject jSonField; + field->toJson(jSonField); jSonFields.append(jSonField); } diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index a9eecb5c9..76ab6296c 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -698,7 +698,7 @@ void UAVObjectField::toJson(QJsonObject &jsonObject) QJsonArray values; for (unsigned int n = 0; n < numElements; ++n) { QJsonObject value; - value["name"] = getElementNames().at(n); + value["name"] = getElementNames().at(n); value["value"] = QJsonValue::fromVariant(getValue(n)); values.append(value); }