Newer
Older
#include <QTreeWidget>
#include "ParamTreeModel.h"
#include <QDebug>
QWidget(parent),
paramWidgets(new QMap<int, QGCParamWidget*>()),
curr(-1),
m_ui(new Ui::parameterWidget)
// Setup UI connections
connect(m_ui->vehicleComboBox, SIGNAL(activated(int)), this, SLOT(selectUAS(int)));
// Setup MAV connections
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addUAS(UASInterface*)));
}
ParameterInterface::~ParameterInterface()
{
delete m_ui;
}
void ParameterInterface::selectUAS(int index)
{
m_ui->stackedWidget->setCurrentIndex(index);
curr = index;
}
/**
*
* @param uas System to add to list
*/
void ParameterInterface::addUAS(UASInterface* uas)
{
m_ui->vehicleComboBox->addItem(uas->getUASName());
QGCParamWidget* param = new QGCParamWidget(uas, this);
paramWidgets->insert(uas->getUASID(), param);
m_ui->stackedWidget->addWidget(param);
if (curr == -1)
{
m_ui->stackedWidget->setCurrentWidget(param);
curr = uas->getUASID();
qDebug() << "first widget";
}