1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

OP-1028 Fixed a bug with disabled controls.

This commit is contained in:
Fredrik Arvidsson 2013-06-25 13:41:15 +02:00
parent 023ee2b97e
commit a46dfbfb00
2 changed files with 13 additions and 6 deletions

View File

@ -84,7 +84,7 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent)
addUAVObjectToWidgetRelation("HwSettings", "GPSSpeed", m_telemetry->gpsSpeed);
addUAVObjectToWidgetRelation("HwSettings", "ComUsbBridgeSpeed", m_telemetry->comUsbBridgeSpeed);
connect(m_telemetry->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
enableControls(false);
enableSaveButtons(false);
populateWidgets();
refreshWidgetsValues();
forceConnectedState();
@ -108,26 +108,32 @@ void ConfigCCHWWidget::widgetsContentsChanged()
(m_telemetry->cbUsbVcp->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE)) ||
((m_telemetry->cbUsbVcp->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE) &&
(m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_DEBUGCONSOLE))) {
enableControls(false);
enableSaveButtons(false);
m_telemetry->problems->setText(tr("Warning: you have configured more than one DebugConsole, this currently is not supported"));
} else if (((m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_TELEMETRY) && (m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_TELEMETRY)) ||
((m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_GPS) && (m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_GPS)) ||
((m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_DEBUGCONSOLE) && (m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_DEBUGCONSOLE)) ||
((m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_COMBRIDGE) && (m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_COMBRIDGE))) {
enableControls(false);
enableSaveButtons(false);
m_telemetry->problems->setText(tr("Warning: you have configured both MainPort and FlexiPort for the same function, this currently is not supported"));
} else if ((m_telemetry->cbUsbHid->currentIndex() == HwSettings::USB_HIDPORT_USBTELEMETRY) && (m_telemetry->cbUsbVcp->currentIndex() == HwSettings::USB_VCPPORT_USBTELEMETRY)) {
enableControls(false);
enableSaveButtons(false);
m_telemetry->problems->setText(tr("Warning: you have configured both USB HID Port and USB VCP Port for the same function, this currently is not supported"));
} else if ((m_telemetry->cbUsbHid->currentIndex() != HwSettings::USB_HIDPORT_USBTELEMETRY) && (m_telemetry->cbUsbVcp->currentIndex() != HwSettings::USB_VCPPORT_USBTELEMETRY)) {
enableControls(false);
enableSaveButtons(false);
m_telemetry->problems->setText(tr("Warning: you have disabled USB Telemetry on both USB HID Port and USB VCP Port, this currently is not supported"));
} else {
m_telemetry->problems->setText("");
enableControls(true);
enableSaveButtons(true);
}
}
void ConfigCCHWWidget::enableSaveButtons(bool enable)
{
m_telemetry->saveTelemetryToRAM->setEnabled(enable);
m_telemetry->saveTelemetryToSD->setEnabled(enable);
}
void ConfigCCHWWidget::openHelp()
{
QDesktopServices::openUrl(QUrl("http://wiki.openpilot.org/x/D4AUAQ", QUrl::StrictMode));

View File

@ -46,6 +46,7 @@ private slots:
void openHelp();
void refreshValues();
void widgetsContentsChanged();
void enableSaveButtons(bool enable);
private:
Ui_CC_HW_Widget *m_telemetry;