#include #include "ParameterInterface.h" #include "ParamTreeModel.h" #include "UASManager.h" #include "ui_ParameterInterface.h" #include ParameterInterface::ParameterInterface(QWidget *parent) : QWidget(parent), paramWidgets(new QMap()), curr(-1), m_ui(new Ui::parameterWidget) { m_ui->setupUi(this); // 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"; } } void ParameterInterface::changeEvent(QEvent *e) { switch (e->type()) { case QEvent::LanguageChange: m_ui->retranslateUi(this); break; default: break; } }