From 252f61bb8eac1aeab350f686bfa581b30cadb246 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Fri, 11 May 2012 19:31:01 -0500 Subject: [PATCH] A bit of preliminary cleanup and removing unused code to map gadget --- .../src/plugins/opmap/opmapgadgetwidget.cpp | 59 ++++--------------- 1 file changed, 12 insertions(+), 47 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp index 8cb4670f4..d1e778267 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp @@ -282,26 +282,19 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) // ************** // connect to the UAVObject updates we require to become a bit aware of our environment: - if (pm) - { - // Register for Home Location state changes - if (obm) - { - UAVDataObject *obj = dynamic_cast(obm->getObject(QString("HomeLocation"))); - if (obj) - { - connect(obj, SIGNAL(objectUpdated(UAVObject *)), this , SLOT(homePositionUpdated(UAVObject *))); - } - } + Q_ASSERT(pm); + Q_ASSERT(obm); - // Listen to telemetry connection events - TelemetryManager *telMngr = pm->getObject(); - if (telMngr) - { - connect(telMngr, SIGNAL(connected()), this, SLOT(onTelemetryConnect())); - connect(telMngr, SIGNAL(disconnected()), this, SLOT(onTelemetryDisconnect())); - } - } + // Register for Home Location state changes + HomeLocation *obj = HomeLocation::GetInstance(obm); + Q_ASSERT(obj != NULL); + connect(obj, SIGNAL(objectUpdated(UAVObject *)), this , SLOT(homePositionUpdated(UAVObject *))); + + // Listen to telemetry connection events + TelemetryManager *telMngr = pm->getObject(); + Q_ASSERT(telMngr); + connect(telMngr, SIGNAL(connected()), this, SLOT(onTelemetryConnect())); + connect(telMngr, SIGNAL(disconnected()), this, SLOT(onTelemetryDisconnect())); // ************** // create the desired timers @@ -332,29 +325,6 @@ OPMapGadgetWidget::~OPMapGadgetWidget() m_map->SetShowUAV(false); // " " } - - // this destructor doesn't appear to be called at shutdown??? - - // #if defined(Q_OS_MAC) - // #elif defined(Q_OS_WIN) - // saveComboBoxLines(m_widget->comboBoxFindPlace, QCoreApplication::applicationDirPath() + "/opmap_find_place_history.txt"); - // #else - // #endif - - m_waypoint_list_mutex.lock(); - foreach (t_waypoint *wp, m_waypoint_list) - { - if (!wp) continue; - - - // todo: - - - delete wp->map_wp_item; - } - m_waypoint_list_mutex.unlock(); - m_waypoint_list.clear(); - if (m_map) { delete m_map; @@ -472,11 +442,6 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event) menu.addSeparator(); - /* - menu.addAction(findPlaceAct); - - menu.addSeparator(); - */ QMenu safeArea("Safety Area definitions"); // menu.addAction(showSafeAreaAct); QMenu safeAreaSubMenu(tr("Safe Area Radius") + " (" + QString::number(m_map->Home->SafeArea()) + "m)", this);