Commit 94fcdaa3 authored by Lorenz Meier's avatar Lorenz Meier

Instatiation / state fixes

parent 107d7167
......@@ -22,6 +22,7 @@ QGCConfigView::QGCConfigView(QWidget *parent) :
ui->gridLayout->removeWidget(ui->waitingLabel);
ui->waitingLabel->setVisible(false);
delete ui->waitingLabel;
ui->waitingLabel = NULL;
config = new QGCPX4VehicleConfig();
ui->gridLayout->addWidget(config);
......@@ -48,10 +49,12 @@ void QGCConfigView::activeUASChanged(UASInterface* uas)
type = mav->getAutopilotType();
mav = uas;
if (NULL != uas && type != uas->getAutopilotType()) {
if (uas && type != uas->getAutopilotType()) {
ui->gridLayout->removeWidget(ui->waitingLabel);
ui->waitingLabel->setVisible(false);
if (ui->waitingLabel) {
ui->gridLayout->removeWidget(ui->waitingLabel);
ui->waitingLabel->setVisible(false);
}
//remove all child widgets since they could contain stale data
//for example, when we switch from one PX4 UAS to another UAS
......
......@@ -32,6 +32,7 @@ This file is part of the QGROUNDCONTROL project
QGCToolBar::QGCToolBar(QWidget *parent) :
QToolBar(parent),
mav(NULL),
userBaudChoice(false),
changed(true),
batteryPercent(0),
batteryVoltage(0),
......@@ -180,7 +181,7 @@ void QGCToolBar::createUI()
baudcomboBox->addItem("921600", 921600);
baudcomboBox->setCurrentIndex(baudcomboBox->findData(57600));
addWidget(baudcomboBox);
connect(baudcomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(baudSelected(int)));
connectButton = new QPushButton(tr("Connect"), this);
......@@ -251,6 +252,11 @@ void QGCToolBar::resetToolbarUI()
symbolLabel->clear();
}
void QGCToolBar::baudSelected(int index)
{
userBaudChoice = true;
}
void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
{
if (actions.count() > 1)
......@@ -679,7 +685,12 @@ void QGCToolBar::updateComboBox()
portComboBox->setEditText(tr("No serial port found"));
}
}
baudcomboBox->setCurrentIndex(baudcomboBox->findData(slink->getBaudRate()));
if (!userBaudChoice) {
int index = baudcomboBox->findData(slink->getBaudRate());
if (index > 0)
baudcomboBox->setCurrentIndex(index);
}
}
}
......
......@@ -87,6 +87,12 @@ public slots:
void advancedActivityTriggered(QAction* action);
void updateComboBox();
/**
* @brief User selected baud rate
* @param index The current index of the combo box
*/
void baudSelected(int index);
protected:
void storeSettings();
void loadSettings();
......@@ -110,6 +116,7 @@ protected:
QComboBox *portComboBox;
QComboBox *baudcomboBox;
QTimer portBoxTimer;
bool userBaudChoice;
bool changed;
float batteryPercent;
float batteryVoltage;
......
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