From 5ec5d936c83b90e461ad58a27bb0613f6a721e65 Mon Sep 17 00:00:00 2001 From: lm Date: Wed, 21 Sep 2011 06:45:16 +0200 Subject: [PATCH] Changed braces --- src/uas/UASWaypointManager.cc | 5 +++-- src/ui/WaypointList.cc | 15 ++++++++++----- src/ui/map/QGCMapWidget.cc | 27 ++++++++++++++++++--------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 03a3e2e5a..d555b58c7 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -305,7 +305,8 @@ int UASWaypointManager::setCurrentWaypoint(quint16 seq) */ void UASWaypointManager::addWaypoint(Waypoint *wp, bool enforceFirstActive) { - if (wp) { + if (wp) + { wp->setId(waypoints.size()); if (enforceFirstActive && waypoints.size() == 0) { @@ -315,8 +316,8 @@ void UASWaypointManager::addWaypoint(Waypoint *wp, bool enforceFirstActive) waypoints.insert(waypoints.size(), wp); connect(wp, SIGNAL(changed(Waypoint*)), this, SLOT(notifyOfChange(Waypoint*))); - emit waypointListChanged(); emit waypointListChanged(uas.getUASID()); + emit waypointListChanged(); } } diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 8eef12ffe..9c3c58406 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -118,7 +118,8 @@ void WaypointList::updateAttitude(UASInterface* uas, double roll, double pitch, void WaypointList::setUAS(UASInterface* uas) { - if (this->uas == NULL && uas != NULL) { + if (this->uas == NULL && uas != NULL) + { this->uas = uas; connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updatePosition(UASInterface*,double,double,double,quint64))); @@ -136,7 +137,8 @@ void WaypointList::setUAS(UASInterface* uas) void WaypointList::saveWaypoints() { - if (uas) { + if (uas) + { QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "./waypoints.txt", tr("Waypoint File (*.txt)")); uas->getWaypointManager()->saveWaypoints(fileName); } @@ -144,7 +146,8 @@ void WaypointList::saveWaypoints() void WaypointList::loadWaypoints() { - if (uas) { + if (uas) + { QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)")); uas->getWaypointManager()->loadWaypoints(fileName); } @@ -152,14 +155,16 @@ void WaypointList::loadWaypoints() void WaypointList::transmit() { - if (uas) { + if (uas) + { uas->getWaypointManager()->writeWaypoints(); } } void WaypointList::read() { - if (uas) { + if (uas) + { uas->getWaypointManager()->readWaypoints(); } } diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index 62cfca8a8..e8abd3fdf 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -427,9 +427,11 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp) // Currently only accept waypoint updates from the UAS in focus // this has to be changed to accept read-only updates from other systems as well. UASInterface* uasInstance = UASManager::instance()->getUASForId(uas); - if (uasInstance->getWaypointManager() == currWPManager || uas == -1) { + if (uasInstance->getWaypointManager() == currWPManager || uas == -1) + { // Only accept waypoints in global coordinate frame - if (((wp->getFrame() == MAV_FRAME_GLOBAL) || (wp->getFrame() == MAV_FRAME_GLOBAL_RELATIVE_ALT)) && wp->isNavigationType()) { + if (((wp->getFrame() == MAV_FRAME_GLOBAL) || (wp->getFrame() == MAV_FRAME_GLOBAL_RELATIVE_ALT)) && wp->isNavigationType()) + { // We're good, this is a global waypoint // Get the index of this waypoint @@ -442,7 +444,8 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp) firingWaypointChange = wp; // Check if wp exists yet in map - if (!waypointsToIcons.contains(wp)) { + if (!waypointsToIcons.contains(wp)) + { // Create icon for new WP QColor wpColor(Qt::red); if (uasInstance) wpColor = uasInstance->getColor(); @@ -473,7 +476,9 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp) } } } - } else { + } + else + { // Waypoint exists, block it's signals and update it mapcontrol::WayPointItem* icon = waypointsToIcons.value(wp); // Make sure we don't die on a null pointer @@ -504,12 +509,15 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp) firingWaypointChange = NULL; - } else { + } + else + { // Check if the index of this waypoint is larger than the global // waypoint list. This implies that the coordinate frame of this // waypoint was changed and the list containing only global // waypoints was shortened. Thus update the whole list - if (waypointsToIcons.size() > currWPManager->getGlobalFrameAndNavTypeCount()) { + if (waypointsToIcons.size() > currWPManager->getGlobalFrameAndNavTypeCount()) + { updateWaypointList(uas); } } @@ -526,7 +534,8 @@ void QGCMapWidget::updateWaypointList(int uas) // Currently only accept waypoint updates from the UAS in focus // this has to be changed to accept read-only updates from other systems as well. UASInterface* uasInstance = UASManager::instance()->getUASForId(uas); - if ((uasInstance && (uasInstance->getWaypointManager() == currWPManager)) || uas == -1) { + if ((uasInstance && (uasInstance->getWaypointManager() == currWPManager)) || uas == -1) + { // ORDER MATTERS HERE! // TWO LOOPS ARE NEEDED - INFINITY LOOP ELSE @@ -535,10 +544,10 @@ void QGCMapWidget::updateWaypointList(int uas) QVector wps = currWPManager->getGlobalFrameAndNavTypeWaypointList(); foreach (Waypoint* wp, waypointsToIcons.keys()) { - // Get icon to work on - mapcontrol::WayPointItem* icon = waypointsToIcons.value(wp); if (!wps.contains(wp)) { + // Get icon to work on + mapcontrol::WayPointItem* icon = waypointsToIcons.value(wp); waypointsToIcons.remove(wp); iconsToWaypoints.remove(icon); WPDelete(icon); -- 2.22.0