From b6a6fe96ffb5d2f7fd6d970d5fa6e406368c3011 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Tue, 24 Dec 2019 13:23:55 -0800 Subject: [PATCH] Remove unused code --- src/ui/MultiVehicleDockWidget.cc | 80 -------------------------------- src/ui/MultiVehicleDockWidget.h | 52 --------------------- src/ui/MultiVehicleDockWidget.ui | 27 ----------- 3 files changed, 159 deletions(-) delete mode 100644 src/ui/MultiVehicleDockWidget.cc delete mode 100644 src/ui/MultiVehicleDockWidget.h delete mode 100644 src/ui/MultiVehicleDockWidget.ui diff --git a/src/ui/MultiVehicleDockWidget.cc b/src/ui/MultiVehicleDockWidget.cc deleted file mode 100644 index 5d9cfdf60..000000000 --- a/src/ui/MultiVehicleDockWidget.cc +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -#include "MultiVehicleDockWidget.h" -#include "ui_MultiVehicleDockWidget.h" -#include "MultiVehicleManager.h" -#include "QGCApplication.h" - -MultiVehicleDockWidget::MultiVehicleDockWidget(const QString& title, QAction* action, QWidget *parent) - : QGCDockWidget(title, action, parent) - , _ui(new Ui::MultiVehicleDockWidget) -{ - _ui->setupUi(this); - - setWindowTitle(title); - - connect(qgcApp()->toolbox()->multiVehicleManager(), &MultiVehicleManager::activeVehicleChanged, this, &MultiVehicleDockWidget::_activeVehicleChanged); - connect(qgcApp()->toolbox()->multiVehicleManager(), &MultiVehicleManager::vehicleAdded, this, &MultiVehicleDockWidget::_vehicleAdded); - connect(qgcApp()->toolbox()->multiVehicleManager(), &MultiVehicleManager::vehicleRemoved, this, &MultiVehicleDockWidget::_vehicleRemoved); -} - -void MultiVehicleDockWidget::init(void) -{ - QmlObjectListModel* vehicles = qgcApp()->toolbox()->multiVehicleManager()->vehicles(); - - for (int i=0; icount(); i++) { - _vehicleAdded(qobject_cast(vehicles->get(i))); - } - - if (qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()) { - _activeVehicleChanged(qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()); - } -} - -MultiVehicleDockWidget::~MultiVehicleDockWidget() -{ - delete _ui; -} - -void MultiVehicleDockWidget::_vehicleRemoved(Vehicle* vehicle) -{ - int id = vehicle->id(); - - if (_vehicleWidgets.contains(id)) { - _vehicleWidgets[id]->deleteLater(); - _vehicleWidgets.remove(id); - } -} - -void MultiVehicleDockWidget::_vehicleAdded(Vehicle* vehicle) -{ - int id = vehicle->id(); - - if (!_vehicleWidgets.contains(id)) { - QWidget* vehicleWidget = _newVehicleWidget(vehicle, _ui->stackedWidget); - _vehicleWidgets[id] = vehicleWidget; - _ui->stackedWidget->addWidget(vehicleWidget); - } -} - -void MultiVehicleDockWidget::_activeVehicleChanged(Vehicle* vehicle) -{ - if (vehicle) { - int id = vehicle->id(); - - if (!_vehicleWidgets.contains(id)) { - _vehicleAdded(vehicle); - } - - QWidget* vehicleWidget = _vehicleWidgets[id]; - _ui->stackedWidget->setCurrentWidget(vehicleWidget); - } -} diff --git a/src/ui/MultiVehicleDockWidget.h b/src/ui/MultiVehicleDockWidget.h deleted file mode 100644 index 12557b103..000000000 --- a/src/ui/MultiVehicleDockWidget.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2018 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -#pragma once - -#include - -#include "QGCDockWidget.h" -#include "Vehicle.h" - -namespace Ui -{ - class MultiVehicleDockWidget; -} - -/// Provides a base class for a dock widget which automatically handles -/// Vehicles coming and going. It does this by using a stacked widget which -/// holds individual Vehicle specific widgets. -class MultiVehicleDockWidget : public QGCDockWidget -{ - Q_OBJECT - -public: - explicit MultiVehicleDockWidget(const QString& title, QAction* action, QWidget *parent = 0); - ~MultiVehicleDockWidget(); - - /// Must be called in the derived class contructor to initialize the base class - void init(void); - -protected: - /// Derived class must implement this to create the QWidget for the - /// specified Vehicle. - virtual QWidget* _newVehicleWidget(Vehicle* vehicle, QWidget* parent) = 0; - -private slots: - void _vehicleAdded(Vehicle* vehicle); - void _vehicleRemoved(Vehicle* vehicle); - void _activeVehicleChanged(Vehicle* vehicle); - -private: - QMap _vehicleWidgets; - - Ui::MultiVehicleDockWidget* _ui; -}; - diff --git a/src/ui/MultiVehicleDockWidget.ui b/src/ui/MultiVehicleDockWidget.ui deleted file mode 100644 index 64ae45242..000000000 --- a/src/ui/MultiVehicleDockWidget.ui +++ /dev/null @@ -1,27 +0,0 @@ - - - MultiVehicleDockWidget - - - - 0 - 0 - 200 - 300 - - - - Form - - - - 0 - - - - - - - - - -- 2.22.0