Commit ebfb5af7 authored by Don Gagne's avatar Don Gagne

Merge pull request #2203 from DonLakeFlyer/ACTweaks

Use vehicle count instead of link count
parents 8e18ba15 92f92abb
......@@ -98,7 +98,7 @@ AirframeComponentController::~AirframeComponentController()
void AirframeComponentController::changeAutostart(void)
{
if (qgcApp()->toolbox()->multiVehicleManager()->vehicles().count() > 1) {
if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count() > 1) {
QGCMessageBox::warning("Airframe Config", "You cannot change airframe configuration while connected to multiple vehicles.");
return;
}
......
......@@ -246,16 +246,3 @@ Vehicle* MultiVehicleManager::getVehicleById(int vehicleId)
return NULL;
}
QList<Vehicle*> MultiVehicleManager::vehicles(void)
{
QList<Vehicle*> list;
for (int i=0; i< _vehicles.count(); i++) {
list += qobject_cast<Vehicle*>(_vehicles[i]);
}
return list;
}
......@@ -54,7 +54,7 @@ public:
Q_PROPERTY(bool activeVehicleAvailable READ activeVehicleAvailable NOTIFY activeVehicleAvailableChanged)
Q_PROPERTY(bool parameterReadyVehicleAvailable READ parameterReadyVehicleAvailable NOTIFY parameterReadyVehicleAvailableChanged)
Q_PROPERTY(Vehicle* activeVehicle READ activeVehicle WRITE setActiveVehicle NOTIFY activeVehicleChanged)
Q_PROPERTY(QmlObjectListModel* vehicles READ vehiclesModel CONSTANT)
Q_PROPERTY(QmlObjectListModel* vehicles READ vehicles CONSTANT)
// Methods
......@@ -70,8 +70,6 @@ public:
UAS* activeUas(void) { return _activeVehicle ? _activeVehicle->uas() : NULL; }
QList<Vehicle*> vehicles(void);
// Property accessors
bool activeVehicleAvailable(void) { return _activeVehicleAvailable; }
......@@ -81,7 +79,7 @@ public:
Vehicle* activeVehicle(void) { return _activeVehicle; }
void setActiveVehicle(Vehicle* vehicle);
QmlObjectListModel* vehiclesModel(void) { return &_vehicles; }
QmlObjectListModel* vehicles(void) { return &_vehicles; }
// Override from QGCTool
virtual void setToolbox(QGCToolbox *toolbox);
......
......@@ -443,7 +443,7 @@ void MainWindow::showStatusBarCallback(bool checked)
void MainWindow::closeEvent(QCloseEvent *event)
{
// Disallow window close if there are active connections
if (qgcApp()->toolbox()->linkManager()->anyConnectedLinks()) {
if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count()) {
QGCMessageBox::StandardButton button =
QGCMessageBox::warning(
tr("QGroundControl close"),
......
......@@ -41,8 +41,10 @@ MultiVehicleDockWidget::MultiVehicleDockWidget(const QString& title, QAction* ac
void MultiVehicleDockWidget::init(void)
{
foreach (Vehicle* vehicle, qgcApp()->toolbox()->multiVehicleManager()->vehicles()) {
_vehicleAdded(vehicle);
QmlObjectListModel* vehicles = qgcApp()->toolbox()->multiVehicleManager()->vehicles();
for (int i=0; i<vehicles->count(); i++) {
_vehicleAdded(qobject_cast<Vehicle*>(vehicles->get(i)));
}
if (qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment