QGCUnconnectedInfoWidget.cc 1.24 KB
Newer Older
1
#include "QGCUnconnectedInfoWidget.h"
2 3 4 5
#include "LinkInterface.h"
#include "LinkManager.h"
#include "MAVLinkSimulationLink.h"
#include "MainWindow.h"
6 7 8 9 10 11 12
#include "ui_QGCUnconnectedInfoWidget.h"

QGCUnconnectedInfoWidget::QGCUnconnectedInfoWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::QGCUnconnectedInfoWidget)
{
    ui->setupUi(this);
13
    //connect(ui->simulationButton, SIGNAL(clicked()), this, SLOT(simulate()));
14
    //connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(addLink()));
15 16 17 18 19 20
}

QGCUnconnectedInfoWidget::~QGCUnconnectedInfoWidget()
{
    delete ui;
}
21 22 23 24 25 26

/**
 * @brief Starts the system simulation
 */
void QGCUnconnectedInfoWidget::simulate()
{
27
    // TODO What is this?
28 29
    // Try to get reference to MAVLinkSimulationlink
    QList<LinkInterface*> links = LinkManager::instance()->getLinks();
30
    foreach(LinkInterface* link, links) {
31
        MAVLinkSimulationLink* sim = dynamic_cast<MAVLinkSimulationLink*>(link);
32
        if (sim) {
33
            LinkManager::instance()->connectLink(sim);
34 35 36 37 38 39 40 41 42
        }
    }
}

/**
 * @return Opens a "Connect new Link" popup
 */
void QGCUnconnectedInfoWidget::addLink()
{
43 44
    // TODO This doesn't make sense. If you want to connect, use the connect on the toolbar
    //MainWindow::instance()->addLink();
45
}