From a46dfbfb00129db700e7c2b134bd8eb56b144a84 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Tue, 25 Jun 2013 13:41:15 +0200 Subject: [PATCH] OP-1028 Fixed a bug with disabled controls. --- .../src/plugins/config/config_cc_hw_widget.cpp | 18 ++++++++++++------ .../src/plugins/config/config_cc_hw_widget.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp index f0762ff51..76f7fc5bb 100644 --- a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp +++ b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp @@ -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)); diff --git a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.h b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.h index 503955f0b..9acfa676e 100644 --- a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.h +++ b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.h @@ -46,6 +46,7 @@ private slots: void openHelp(); void refreshValues(); void widgetsContentsChanged(); + void enableSaveButtons(bool enable); private: Ui_CC_HW_Widget *m_telemetry;