1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-245 config: fix initial display issues when no board is connected

also centralize the initialization code of all condig widgets
This commit is contained in:
Philippe Renon 2016-09-14 23:17:59 +02:00 committed by Philippe Renon
parent 167154c6a4
commit 0e7010e67e
24 changed files with 281 additions and 220 deletions

View File

@ -124,8 +124,9 @@ QStringList ConfigCcpmWidget::getChannelDescriptions()
}
ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) :
VehicleConfig(parent), m_aircraft(new Ui_CcpmConfigWidget())
VehicleConfig(parent)
{
m_aircraft = new Ui_CcpmConfigWidget();
m_aircraft->setupUi(this);
SwashLvlConfigurationInProgress = 0;

View File

@ -149,9 +149,11 @@ QStringList ConfigCustomWidget::getChannelDescriptions()
}
ConfigCustomWidget::ConfigCustomWidget(QWidget *parent) :
VehicleConfig(parent), m_aircraft(new Ui_CustomConfigWidget())
VehicleConfig(parent)
{
m_aircraft = new Ui_CustomConfigWidget();
m_aircraft->setupUi(this);
m_aircraft->customMixerTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
// Put combo boxes in line one of the custom mixer table:

View File

@ -109,8 +109,9 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions()
}
ConfigFixedWingWidget::ConfigFixedWingWidget(QWidget *parent) :
VehicleConfig(parent), m_aircraft(new Ui_FixedWingConfigWidget())
VehicleConfig(parent)
{
m_aircraft = new Ui_FixedWingConfigWidget();
m_aircraft->setupUi(this);
populateChannelComboBoxes();

View File

@ -73,8 +73,9 @@ QStringList ConfigGroundVehicleWidget::getChannelDescriptions()
}
ConfigGroundVehicleWidget::ConfigGroundVehicleWidget(QWidget *parent) :
VehicleConfig(parent), m_aircraft(new Ui_GroundConfigWidget())
VehicleConfig(parent)
{
m_aircraft = new Ui_GroundConfigWidget();
m_aircraft->setupUi(this);
populateChannelComboBoxes();

View File

@ -132,8 +132,9 @@ QStringList ConfigMultiRotorWidget::getChannelDescriptions()
}
ConfigMultiRotorWidget::ConfigMultiRotorWidget(QWidget *parent) :
VehicleConfig(parent), m_aircraft(new Ui_MultiRotorConfigWidget()), invertMotors(false)
VehicleConfig(parent), invertMotors(false)
{
m_aircraft = new Ui_MultiRotorConfigWidget();
m_aircraft->setupUi(this);
populateChannelComboBoxes();

View File

@ -162,7 +162,12 @@ class ConfigTaskWidget;
/*
* This class handles vehicle specific configuration UI and associated logic.
*
* This class derives from ConfigTaskWidget and overrides its the default "binding" mechanism.
* VehicleConfig derives from ConfigTaskWidget but is not a top level ConfigTaskWidget.
* VehicleConfig objects are nested within the ConfigVehicleConfigWidget and have particularities:
* - bindings are added to the parent (i.e. ConfigVehicleConfigWidget)
* - auto bindings are not supported
* - as a consequence things like dirty state management are bypassed and delegated to the parent class.
*
* It does not use the "dirty" state management directly and registers its relevant widgets with ConfigTaskWidget to do so.
*/
class VehicleConfig : public ConfigTaskWidget {

View File

@ -49,16 +49,23 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent)
m_telemetry = new Ui_CC_HW_Widget();
m_telemetry->setupUi(this);
// must be done before auto binding !
// setWikiURL("");
addAutoBindings();
connect(m_telemetry->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(m_telemetry->saveTelemetryToRAM, m_telemetry->saveTelemetryToSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
m_telemetry->saveTelemetryToRAM->setVisible(false);
}
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
int id = utilMngr->getBoardModel();
switch (id) {
case 0x0101:
m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0101.svg"));
@ -79,7 +86,7 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent)
m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg"));
break;
}
addApplySaveButtons(m_telemetry->saveTelemetryToRAM, m_telemetry->saveTelemetryToSD);
addWidgetBinding("HwSettings", "CC_FlexiPort", m_telemetry->cbFlexi);
addWidgetBinding("HwSettings", "CC_MainPort", m_telemetry->cbTele);
addWidgetBinding("HwSettings", "CC_RcvrPort", m_telemetry->cbRcvr);
@ -99,7 +106,6 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent)
addWidgetBinding("GPSSettings", "DataProtocol", m_telemetry->gpsProtocol);
}
connect(m_telemetry->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
enableSaveButtons(false);
}

View File

@ -23,8 +23,11 @@ ConfigAutotuneWidget::ConfigAutotuneWidget(QWidget *parent) :
m_autotune = new Ui_AutotuneWidget();
m_autotune->setupUi(this);
// Connect automatic signals
autoLoadWidgets();
// must be done before auto binding !
// setWikiURL("");
addAutoBindings();
disableMouseWheelEvents();
// Whenever any value changes compute new potential stabilization settings

View File

@ -51,6 +51,13 @@ ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent
ui = new Ui_CameraStabilizationWidget();
ui->setupUi(this);
// must be done before auto binding !
setWikiURL("Camera+Stabilisation+Configuration");
addAutoBindings();
disableMouseWheelEvents();
addApplySaveButtons(ui->camerastabilizationSaveRAM, ui->camerastabilizationSaveSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
@ -59,14 +66,9 @@ ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent
ui->camerastabilizationSaveRAM->setVisible(false);
}
// These widgets don't have direct relation to UAVObjects
// and need special processing
QComboBox *outputs[] = {
ui->rollChannel,
ui->pitchChannel,
ui->yawChannel,
};
QComboBox *outputs[] = { ui->rollChannel, ui->pitchChannel, ui->yawChannel, };
const int NUM_OUTPUTS = sizeof(outputs) / sizeof(outputs[0]);
// Populate widgets with channel numbers
@ -78,11 +80,6 @@ ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent
}
}
setWikiURL("Camera+Stabilisation+Configuration");
// Load UAVObjects to widget relations from UI file
// using objrelation dynamic property
autoLoadWidgets();
// Add some widgets to track their UI dirty state and handle smartsave
addWidget(ui->enableCameraStabilization);
addWidget(ui->rollChannel);
@ -101,8 +98,6 @@ ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent
// To set special widgets to defaults when requested
connect(this, SIGNAL(defaultRequested(int)), this, SLOT(defaultRequestedSlot(int)));
disableMouseWheelEvents();
}
ConfigCameraStabilizationWidget::~ConfigCameraStabilizationWidget()

View File

@ -46,11 +46,19 @@
#include <QUrl>
ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) :
ConfigTaskWidget(parent),
ui(new Ui_ccattitude)
ConfigTaskWidget(parent), accelUpdates(0), gyroUpdates(0)
{
ui = new Ui_ccattitude(),
ui->setupUi(this);
connect(ui->zeroBias, SIGNAL(clicked()), this, SLOT(startAccelCalibration()));
// must be done before auto binding !
// setWikiURL("");
addAutoBindings();
connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(ui->applyButton, ui->saveButton);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
@ -58,13 +66,9 @@ ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) :
ui->applyButton->setVisible(false);
}
addApplySaveButtons(ui->applyButton, ui->saveButton);
addUAVObject("AttitudeSettings");
addUAVObject("AccelGyroSettings");
// Connect the help button
connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addWidgetBinding("AttitudeSettings", "ZeroDuringArming", ui->zeroGyroBiasOnArming);
addWidgetBinding("AttitudeSettings", "InitialZeroWhenBoardSteady", ui->initGyroWhenBoardSteady);
@ -74,6 +78,8 @@ ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) :
addWidgetBinding("AttitudeSettings", "BoardRotation", ui->pitchBias, AttitudeSettings::BOARDROTATION_PITCH);
addWidgetBinding("AttitudeSettings", "BoardRotation", ui->yawBias, AttitudeSettings::BOARDROTATION_YAW);
addWidget(ui->zeroBias);
connect(ui->zeroBias, SIGNAL(clicked()), this, SLOT(startAccelCalibration()));
}
ConfigCCAttitudeWidget::~ConfigCCAttitudeWidget()

View File

@ -77,51 +77,57 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new DefaultHwSettingsWidget(this);
stackWidget->insertTab(ConfigGadgetWidget::hardware, widget, *icon, QString("Hardware"));
stackWidget->insertTab(ConfigGadgetWidget::Hardware, widget, *icon, QString("Hardware"));
icon = new QIcon();
icon->addFile(":/configgadget/images/vehicle_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/vehicle_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigVehicleTypeWidget(this);
stackWidget->insertTab(ConfigGadgetWidget::aircraft, widget, *icon, QString("Vehicle"));
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::Aircraft, widget, *icon, QString("Vehicle"));
icon = new QIcon();
icon->addFile(":/configgadget/images/input_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/input_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigInputWidget(this);
stackWidget->insertTab(ConfigGadgetWidget::input, widget, *icon, QString("Input"));
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::Input, widget, *icon, QString("Input"));
icon = new QIcon();
icon->addFile(":/configgadget/images/output_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/output_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigOutputWidget(this);
stackWidget->insertTab(ConfigGadgetWidget::output, widget, *icon, QString("Output"));
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::Output, widget, *icon, QString("Output"));
icon = new QIcon();
icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/ins_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new DefaultAttitudeWidget(this);
stackWidget->insertTab(ConfigGadgetWidget::sensors, widget, *icon, QString("Attitude"));
stackWidget->insertTab(ConfigGadgetWidget::Sensors, widget, *icon, QString("Attitude"));
icon = new QIcon();
icon->addFile(":/configgadget/images/stabilization_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/stabilization_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigStabilizationWidget(this);
stackWidget->insertTab(ConfigGadgetWidget::stabilization, widget, *icon, QString("Stabilization"));
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::Stabilization, widget, *icon, QString("Stabilization"));
icon = new QIcon();
icon->addFile(":/configgadget/images/camstab_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/camstab_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigCameraStabilizationWidget(this);
stackWidget->insertTab(ConfigGadgetWidget::camerastabilization, widget, *icon, QString("Gimbal"));
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::CameraStabilization, widget, *icon, QString("Gimbal"));
icon = new QIcon();
icon->addFile(":/configgadget/images/txpid_normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/txpid_selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigTxPIDWidget(this);
stackWidget->insertTab(ConfigGadgetWidget::txpid, widget, *icon, QString("TxPID"));
static_cast<ConfigTaskWidget *>(widget)->bind();
stackWidget->insertTab(ConfigGadgetWidget::TxPid, widget, *icon, QString("TxPID"));
stackWidget->setCurrentIndex(ConfigGadgetWidget::hardware);
stackWidget->setCurrentIndex(ConfigGadgetWidget::Hardware);
// connect to autopilot connection events
TelemetryManager *tm = pm->getObject<TelemetryManager>();
@ -152,8 +158,8 @@ ConfigGadgetWidget::~ConfigGadgetWidget()
void ConfigGadgetWidget::startInputWizard()
{
stackWidget->setCurrentIndex(ConfigGadgetWidget::input);
ConfigInputWidget *inputWidget = dynamic_cast<ConfigInputWidget *>(stackWidget->getWidget(ConfigGadgetWidget::input));
stackWidget->setCurrentIndex(ConfigGadgetWidget::Input);
ConfigInputWidget *inputWidget = dynamic_cast<ConfigInputWidget *>(stackWidget->getWidget(ConfigGadgetWidget::Input));
Q_ASSERT(inputWidget);
inputWidget->startInputWizard();
}
@ -176,33 +182,33 @@ void ConfigGadgetWidget::onAutopilotConnect()
// CopterControl family
ConfigTaskWidget *widget;
widget = new ConfigCCAttitudeWidget(this);
widget->forceConnectedState();
stackWidget->replaceTab(ConfigGadgetWidget::sensors, widget);
widget->bind();
stackWidget->replaceTab(ConfigGadgetWidget::Sensors, widget);
widget = new ConfigCCHWWidget(this);
widget->forceConnectedState();
stackWidget->replaceTab(ConfigGadgetWidget::hardware, widget);
widget->bind();
stackWidget->replaceTab(ConfigGadgetWidget::Hardware, widget);
} else if ((board & 0xff00) == 0x0900) {
// Revolution family
ConfigTaskWidget *widget;
widget = new ConfigRevoWidget(this);
widget->forceConnectedState();
stackWidget->replaceTab(ConfigGadgetWidget::sensors, widget);
widget->bind();
stackWidget->replaceTab(ConfigGadgetWidget::Sensors, widget);
if (board == 0x0903 || board == 0x0904) {
widget = new ConfigRevoHWWidget(this);
} else if (board == 0x0905) {
widget = new ConfigRevoNanoHWWidget(this);
}
widget->forceConnectedState();
stackWidget->replaceTab(ConfigGadgetWidget::hardware, widget);
widget->bind();
stackWidget->replaceTab(ConfigGadgetWidget::Hardware, widget);
} else if ((board & 0xff00) == 0x9200) {
// Sparky2
ConfigTaskWidget *widget;
widget = new ConfigRevoWidget(this);
widget->forceConnectedState();
stackWidget->replaceTab(ConfigGadgetWidget::sensors, widget);
widget->bind();
stackWidget->replaceTab(ConfigGadgetWidget::Sensors, widget);
widget = new ConfigSparky2HWWidget(this);
widget->forceConnectedState();
stackWidget->replaceTab(ConfigGadgetWidget::hardware, widget);
widget->bind();
stackWidget->replaceTab(ConfigGadgetWidget::Hardware, widget);
} else {
// Unknown board
qDebug() << "Unknown board " << board;
@ -216,10 +222,10 @@ void ConfigGadgetWidget::onAutopilotDisconnect()
QWidget *widget;
widget = new DefaultAttitudeWidget(this);
stackWidget->replaceTab(ConfigGadgetWidget::sensors, widget);
stackWidget->replaceTab(ConfigGadgetWidget::Sensors, widget);
widget = new DefaultHwSettingsWidget(this);
stackWidget->replaceTab(ConfigGadgetWidget::hardware, widget);
stackWidget->replaceTab(ConfigGadgetWidget::Hardware, widget);
}
void ConfigGadgetWidget::onOPLinkConnect()
@ -233,18 +239,18 @@ void ConfigGadgetWidget::onOPLinkConnect()
icon->addFile(":/configgadget/images/pipx-normal.png", QSize(), QIcon::Normal, QIcon::Off);
icon->addFile(":/configgadget/images/pipx-selected.png", QSize(), QIcon::Selected, QIcon::Off);
widget = new ConfigOPLinkWidget(this);
widget->forceConnectedState();
stackWidget->insertTab(ConfigGadgetWidget::oplink, widget, *icon, QString("OPLink"));
widget->bind();
stackWidget->insertTab(ConfigGadgetWidget::OPLink, widget, *icon, QString("OPLink"));
}
void ConfigGadgetWidget::onOPLinkDisconnect()
{
qDebug() << "ConfigGadgetWidget::onOPLinkDisconnect";
if (stackWidget->currentIndex() == ConfigGadgetWidget::oplink) {
if (stackWidget->currentIndex() == ConfigGadgetWidget::OPLink) {
stackWidget->setCurrentIndex(0);
}
stackWidget->removeTab(ConfigGadgetWidget::oplink);
stackWidget->removeTab(ConfigGadgetWidget::OPLink);
}
void ConfigGadgetWidget::tabAboutToChange(int i, bool *proceed)

View File

@ -37,7 +37,7 @@ class ConfigGadgetWidget : public QWidget {
Q_OBJECT
public:
enum widgetTabs { hardware = 0, aircraft, input, output, sensors, stabilization, camerastabilization, txpid, oplink };
enum WidgetTabs { Hardware = 0, Aircraft, Input, Output, Sensors, Stabilization, CameraStabilization, TxPid, OPLink };
ConfigGadgetWidget(QWidget *parent = 0);
~ConfigGadgetWidget();

View File

@ -85,6 +85,24 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) :
accessoryDesiredObj2(NULL),
accessoryDesiredObj3(NULL)
{
ui = new Ui_InputWidget();
ui->setupUi(this);
// must be done before auto binding !
// setWikiURL("");
addAutoBindings();
connect(ui->inputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(ui->saveRCInputToRAM, ui->saveRCInputToSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
ui->saveRCInputToRAM->setVisible(false);
}
manualCommandObj = ManualControlCommand::GetInstance(getObjectManager());
manualSettingsObj = ManualControlSettings::GetInstance(getObjectManager());
flightModeSettingsObj = FlightModeSettings::GetInstance(getObjectManager());
@ -101,22 +119,6 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) :
// The other instances are populated lazily.
Q_ASSERT(accessoryDesiredObj0);
ui = new Ui_InputWidget();
ui->setupUi(this);
wizardUi = new Ui_InputWizardWidget();
wizardUi->setupUi(ui->wizard);
addApplySaveButtons(ui->saveRCInputToRAM, ui->saveRCInputToSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
ui->saveRCInputToRAM->setVisible(false);
}
addApplySaveButtons(ui->saveRCInputToRAM, ui->saveRCInputToSD);
// Generate the rows of buttons in the input channel form GUI
quint32 index = 0;
quint32 indexRT = 0;
@ -203,10 +205,6 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) :
connect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(disableWizardButton(int)));
connect(ui->runCalibration, SIGNAL(toggled(bool)), this, SLOT(simpleCalibration(bool)));
connect(wizardUi->wzNext, SIGNAL(clicked()), this, SLOT(wzNext()));
connect(wizardUi->wzCancel, SIGNAL(clicked()), this, SLOT(wzCancel()));
connect(wizardUi->wzBack, SIGNAL(clicked()), this, SLOT(wzBack()));
connect(ReceiverActivity::GetInstance(getObjectManager()), SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateReceiverActivityStatus()));
ui->receiverActivityStatus->setStyleSheet("QLabel { background-color: darkGreen; color: rgb(255, 255, 255); \
border: 1px solid grey; border-radius: 5; margin:1px; font:bold;}");
@ -264,10 +262,13 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) :
addWidget(ui->runCalibration);
addWidget(ui->failsafeFlightModeCb);
autoLoadWidgets();
// Wizard
wizardUi = new Ui_InputWizardWidget();
wizardUi->setupUi(ui->wizard);
// Connect the help button
connect(ui->inputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
connect(wizardUi->wzNext, SIGNAL(clicked()), this, SLOT(wzNext()));
connect(wizardUi->wzCancel, SIGNAL(clicked()), this, SLOT(wzCancel()));
connect(wizardUi->wzBack, SIGNAL(clicked()), this, SLOT(wzBack()));
wizardUi->graphicsView->setScene(new QGraphicsScene(this));
wizardUi->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);

View File

@ -31,7 +31,6 @@
#include "ui_oplink.h"
#include <coreplugin/generalsettings.h>
#include <uavobjectmanager.h>
#include <uavobjectutilmanager.h>
@ -39,7 +38,6 @@
#include <oplinkstatus.h>
#include <QMessageBox>
#include <QDateTime>
#include <QDebug>
// Channel range and Frequency display
@ -53,18 +51,26 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren
m_oplink = new Ui_OPLinkWidget();
m_oplink->setupUi(this);
oplinkStatusObj = dynamic_cast<OPLinkStatus *>(getObject("OPLinkStatus"));
Q_ASSERT(oplinkStatusObj);
// must be done before auto binding !
setWikiURL("OPLink+Configuration");
oplinkSettingsObj = dynamic_cast<OPLinkSettings *>(getObject("OPLinkSettings"));
Q_ASSERT(oplinkSettingsObj);
addAutoBindings();
disableMouseWheelEvents();
addApplySaveButtons(m_oplink->Apply, m_oplink->Save);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
m_oplink->Apply->setVisible(false);
}
addApplySaveButtons(m_oplink->Apply, m_oplink->Save);
oplinkStatusObj = dynamic_cast<OPLinkStatus *>(getObject("OPLinkStatus"));
Q_ASSERT(oplinkStatusObj);
oplinkSettingsObj = dynamic_cast<OPLinkSettings *>(getObject("OPLinkSettings"));
Q_ASSERT(oplinkSettingsObj);
addWidget(m_oplink->FirmwareVersion);
addWidget(m_oplink->SerialNumber);
@ -130,11 +136,6 @@ ConfigOPLinkWidget::ConfigOPLinkWidget(QWidget *parent) : ConfigTaskWidget(paren
m_oplink->MaximumChannel->setMaximum(MAX_CHANNEL_NUM);
m_oplink->MinimumChannel->setMaximum(MAX_CHANNEL_NUM - MIN_CHANNEL_RANGE);
setWikiURL("OPLink+Configuration");
disableMouseWheelEvents();
autoLoadWidgets();
}
ConfigOPLinkWidget::~ConfigOPLinkWidget()

View File

@ -61,7 +61,15 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
m_ui = new Ui_OutputWidget();
m_ui->setupUi(this);
m_ui->gvFrame->setVisible(false);
// must be done before auto binding !
// setWikiURL("");
addAutoBindings();
// Connect the help button
connect(m_ui->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(m_ui->saveRCOutputToRAM, m_ui->saveRCOutputToSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
@ -69,16 +77,14 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
m_ui->saveRCOutputToRAM->setVisible(false);
}
m_ui->gvFrame->setVisible(false);
UAVSettingsImportExportFactory *importexportplugin = pm->getObject<UAVSettingsImportExportFactory>();
connect(importexportplugin, SIGNAL(importAboutToBegin()), this, SLOT(stopTests()));
connect(m_ui->channelOutTest, SIGNAL(clicked(bool)), this, SLOT(runChannelTests(bool)));
// Configure the task widget
// Connect the help button
connect(m_ui->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(m_ui->saveRCOutputToRAM, m_ui->saveRCOutputToSD);
// Track the ActuatorSettings object
addUAVObject("ActuatorSettings");
@ -99,7 +105,6 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
addWidget(form->ui->actuatorLink);
}
// Associate the buttons with their UAVO fields
addWidget(m_ui->spinningArmed);
connect(m_ui->spinningArmed, SIGNAL(clicked(bool)), this, SLOT(updateSpinStabilizeCheckComboBoxes()));

View File

@ -45,6 +45,15 @@ ConfigRevoHWWidget::ConfigRevoHWWidget(QWidget *parent) : ConfigTaskWidget(paren
m_ui = new Ui_RevoHWWidget();
m_ui->setupUi(this);
// must be done before auto binding !
// setWikiURL("");
addAutoBindings();
connect(m_ui->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(m_ui->saveTelemetryToRAM, m_ui->saveTelemetryToSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
@ -52,8 +61,6 @@ ConfigRevoHWWidget::ConfigRevoHWWidget(QWidget *parent) : ConfigTaskWidget(paren
m_ui->saveTelemetryToRAM->setVisible(false);
}
addApplySaveButtons(m_ui->saveTelemetryToRAM, m_ui->saveTelemetryToSD);
addWidgetBinding("HwSettings", "RM_FlexiPort", m_ui->cbFlexi);
addWidgetBinding("HwSettings", "RM_MainPort", m_ui->cbMain);
addWidgetBinding("HwSettings", "RM_RcvrPort", m_ui->cbRcvr);
@ -75,8 +82,6 @@ ConfigRevoHWWidget::ConfigRevoHWWidget(QWidget *parent) : ConfigTaskWidget(paren
addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbFlexiGPSProtocol);
addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbRcvrGPSProtocol);
connect(m_ui->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
setupCustomCombos();
}

View File

@ -45,6 +45,15 @@ ConfigRevoNanoHWWidget::ConfigRevoNanoHWWidget(QWidget *parent) : ConfigTaskWidg
m_ui = new Ui_RevoNanoHWWidget();
m_ui->setupUi(this);
// must be done before auto binding !
// setWikiURL("");
addAutoBindings();
connect(m_ui->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(m_ui->saveTelemetryToRAM, m_ui->saveTelemetryToSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
@ -52,8 +61,6 @@ ConfigRevoNanoHWWidget::ConfigRevoNanoHWWidget(QWidget *parent) : ConfigTaskWidg
m_ui->saveTelemetryToRAM->setVisible(false);
}
addApplySaveButtons(m_ui->saveTelemetryToRAM, m_ui->saveTelemetryToSD);
addWidgetBinding("HwSettings", "RM_FlexiPort", m_ui->cbFlexi);
addWidgetBinding("HwSettings", "RM_MainPort", m_ui->cbMain);
addWidgetBinding("HwSettings", "RM_RcvrPort", m_ui->cbRcvr, 0, 1, true);
@ -71,7 +78,6 @@ ConfigRevoNanoHWWidget::ConfigRevoNanoHWWidget(QWidget *parent) : ConfigTaskWidg
addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol);
addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbFlexiGPSProtocol);
connect(m_ui->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
setupCustomCombos();
}

View File

@ -78,13 +78,20 @@ public:
};
ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
ConfigTaskWidget(parent),
m_ui(new Ui_RevoSensorsWidget()),
isBoardRotationStored(false)
ConfigTaskWidget(parent), isBoardRotationStored(false)
{
m_ui = new Ui_RevoSensorsWidget();
m_ui->setupUi(this);
m_ui->tabWidget->setCurrentIndex(0);
// must be done before auto binding !
// setWikiURL("");
addAutoBindings();
// Connect the help button
connect(m_ui->attitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(m_ui->revoCalSettingsSaveRAM, m_ui->revoCalSettingsSaveSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
@ -108,7 +115,6 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
addUAVObject("RevoSettings");
addUAVObject("AccelGyroSettings");
addUAVObject("AuxMagSettings");
autoLoadWidgets();
// accel calibration
m_accelCalibrationModel = new OpenPilot::SixPointCalibrationModel(this);
@ -223,9 +229,6 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
displayMagError = false;
// Connect the help button
connect(m_ui->attitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
enableAllCalibrations();
}

View File

@ -45,6 +45,15 @@ ConfigSparky2HWWidget::ConfigSparky2HWWidget(QWidget *parent) : ConfigTaskWidget
m_ui = new Ui_Sparky2HWWidget();
m_ui->setupUi(this);
// must be done before auto binding !
// setWikiURL("");
addAutoBindings();
connect(m_ui->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(m_ui->saveTelemetryToRAM, m_ui->saveTelemetryToSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
@ -52,8 +61,6 @@ ConfigSparky2HWWidget::ConfigSparky2HWWidget(QWidget *parent) : ConfigTaskWidget
m_ui->saveTelemetryToRAM->setVisible(false);
}
addApplySaveButtons(m_ui->saveTelemetryToRAM, m_ui->saveTelemetryToSD);
addWidgetBinding("HwSettings", "SPK2_FlexiPort", m_ui->cbFlexi);
addWidgetBinding("HwSettings", "SPK2_MainPort", m_ui->cbMain);
addWidgetBinding("HwSettings", "SPK2_RcvrPort", m_ui->cbRcvr);
@ -72,8 +79,6 @@ ConfigSparky2HWWidget::ConfigSparky2HWWidget(QWidget *parent) : ConfigTaskWidget
addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbMainGPSProtocol);
addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbFlexiGPSProtocol);
connect(m_ui->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
setupCustomCombos();
}

View File

@ -62,20 +62,21 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
ui = new Ui_StabilizationWidget();
ui->setupUi(this);
// must be done before auto binding !
setupStabBanksGUI();
setWikiURL("Stabilization+Configuration");
setupExpoPlot();
addAutoBindings();
setupStabBanksGUI();
disableMouseWheelEvents();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
ui->saveStabilizationToRAM_6->setVisible(false);
}
autoLoadWidgets();
setupExpoPlot();
realtimeUpdates = new QTimer(this);
connect(realtimeUpdates, SIGNAL(timeout()), this, SLOT(apply()));
@ -122,6 +123,7 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
addWidget(ui->basicResponsivenessGroupBox);
addWidget(ui->basicResponsivenessCheckBox);
connect(ui->basicResponsivenessCheckBox, SIGNAL(toggled(bool)), this, SLOT(linkCheckBoxes(bool)));
addWidget(ui->advancedResponsivenessGroupBox);
addWidget(ui->advancedResponsivenessCheckBox);
connect(ui->advancedResponsivenessCheckBox, SIGNAL(toggled(bool)), this, SLOT(linkCheckBoxes(bool)));
@ -150,8 +152,6 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
connect(ui->expoSpinnerYaw, SIGNAL(valueChanged(int)), this, SLOT(replotExpoYaw(int)));
ui->AltitudeHold->setEnabled(false);
disableMouseWheelEvents();
}
void ConfigStabilizationWidget::setupStabBanksGUI()

View File

@ -46,14 +46,20 @@ ConfigTxPIDWidget::ConfigTxPIDWidget(QWidget *parent) : ConfigTaskWidget(parent)
m_txpid = new Ui_TxPIDWidget();
m_txpid->setupUi(this);
// must be done before auto binding !
setWikiURL("TxPID");
addAutoBindings();
disableMouseWheelEvents();
addApplySaveButtons(m_txpid->Apply, m_txpid->Save);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
m_txpid->Apply->setVisible(false);
}
autoLoadWidgets();
addApplySaveButtons(m_txpid->Apply, m_txpid->Save);
// Cannot use addUAVObjectToWidgetRelation() for OptionaModules enum because
// QCheckBox returns bool (0 or -1) and this value is then set to enum instead
@ -98,8 +104,6 @@ ConfigTxPIDWidget::ConfigTxPIDWidget(QWidget *parent) : ConfigTaskWidget(parent)
addWidget(m_txpid->TxPIDEnable);
addWidget(m_txpid->enableAutoCalcYaw);
disableMouseWheelEvents();
}
ConfigTxPIDWidget::~ConfigTxPIDWidget()

View File

@ -120,6 +120,17 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
m_aircraft = new Ui_AircraftWidget();
m_aircraft->setupUi(this);
// must be done before auto binding !
setWikiURL("TxPID");
addAutoBindings();
disableMouseWheelEvents();
connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(m_aircraft->saveAircraftToRAM, m_aircraft->saveAircraftToSD);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
@ -133,28 +144,22 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
Q_ASSERT(syssettings);
m_aircraft->nameEdit->setMaxLength(syssettings->VEHICLENAME_NUMELEM);
addApplySaveButtons(m_aircraft->saveAircraftToRAM, m_aircraft->saveAircraftToSD);
addUAVObject("SystemSettings");
addUAVObject("MixerSettings");
addUAVObject("ActuatorSettings");
addWidget(m_aircraft->nameEdit);
// The order of the tabs is important since they correspond with the AirframeCategory enum
m_aircraft->aircraftType->addTab(tr("Multirotor"));
m_aircraft->aircraftType->addTab(tr("Fixed Wing"));
m_aircraft->aircraftType->addTab(tr("Helicopter"));
m_aircraft->aircraftType->addTab(tr("Ground"));
m_aircraft->aircraftType->addTab(tr("Custom"));
// switchAirframeType(0);
// Connect aircraft type selection dropbox to callback function
connect(m_aircraft->aircraftType, SIGNAL(currentChanged(int)), this, SLOT(switchAirframeType(int)));
// Connect the help pushbutton
connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addWidget(m_aircraft->nameEdit);
disableMouseWheelEvents();
}
/**
@ -302,41 +307,54 @@ int ConfigVehicleTypeWidget::frameCategory(QString frameType)
VehicleConfig *ConfigVehicleTypeWidget::getVehicleConfigWidget(int frameCategory)
{
VehicleConfig *vehiculeConfig;
VehicleConfig *vehicleConfig;
if (!m_vehicleIndexMap.contains(frameCategory)) {
// create config widget
vehiculeConfig = createVehicleConfigWidget(frameCategory);
// bind config widget "field" to this ConfigTaskWodget
// this is necessary to get "dirty" state management
vehiculeConfig->registerWidgets(*this);
vehicleConfig = createVehicleConfigWidget(frameCategory);
// add config widget to UI
int index = m_aircraft->airframesWidget->insertWidget(m_aircraft->airframesWidget->count(), vehiculeConfig);
int index = m_aircraft->airframesWidget->insertWidget(m_aircraft->airframesWidget->count(), vehicleConfig);
m_vehicleIndexMap[frameCategory] = index;
// and enable controls (needed?)
updateEnableControls();
}
int index = m_vehicleIndexMap.value(frameCategory);
vehiculeConfig = (VehicleConfig *)m_aircraft->airframesWidget->widget(index);
return vehiculeConfig;
vehicleConfig = (VehicleConfig *)m_aircraft->airframesWidget->widget(index);
return vehicleConfig;
}
VehicleConfig *ConfigVehicleTypeWidget::createVehicleConfigWidget(int frameCategory)
{
if (frameCategory == ConfigVehicleTypeWidget::FIXED_WING) {
return new ConfigFixedWingWidget();
} else if (frameCategory == ConfigVehicleTypeWidget::MULTIROTOR) {
return new ConfigMultiRotorWidget();
} else if (frameCategory == ConfigVehicleTypeWidget::HELICOPTER) {
return new ConfigCcpmWidget();
} else if (frameCategory == ConfigVehicleTypeWidget::GROUND) {
return new ConfigGroundVehicleWidget();
} else if (frameCategory == ConfigVehicleTypeWidget::CUSTOM) {
return new ConfigCustomWidget();
VehicleConfig *vehicleConfig;
switch (frameCategory) {
case ConfigVehicleTypeWidget::FIXED_WING:
vehicleConfig = new ConfigFixedWingWidget();
break;
case ConfigVehicleTypeWidget::MULTIROTOR:
vehicleConfig = new ConfigMultiRotorWidget();
break;
case ConfigVehicleTypeWidget::HELICOPTER:
vehicleConfig = new ConfigCcpmWidget();
break;
case ConfigVehicleTypeWidget::GROUND:
vehicleConfig = new ConfigGroundVehicleWidget();
break;
case ConfigVehicleTypeWidget::CUSTOM:
vehicleConfig = new ConfigCustomWidget();
break;
default:
vehicleConfig = NULL;
break;
}
return NULL;
if (vehicleConfig) {
// bind config widget "field" to this ConfigTaskWodget
// this is necessary to get "dirty" state management
vehicleConfig->registerWidgets(*this);
}
return vehicleConfig;
}
/**

View File

@ -72,6 +72,23 @@ ConfigTaskWidget::ConfigTaskWidget(QWidget *parent, bool autopilot) : QWidget(pa
}
}
ConfigTaskWidget::~ConfigTaskWidget()
{
if (m_saveButton) {
delete m_saveButton;
}
QSet<WidgetBinding *> deleteSet = m_widgetBindingsPerWidget.values().toSet();
foreach(WidgetBinding * binding, deleteSet) {
if (binding) {
delete binding;
}
}
if (m_realtimeUpdateTimer) {
delete m_realtimeUpdateTimer;
m_realtimeUpdateTimer = NULL;
}
}
void ConfigTaskWidget::addWidget(QWidget *widget)
{
addWidgetBinding("", "", widget);
@ -148,10 +165,14 @@ void ConfigTaskWidget::addWidgetBinding(QString objectName, QString fieldName, Q
void ConfigTaskWidget::doAddWidgetBinding(QString objectName, QString fieldName, QWidget *widget, int index, double scale,
bool isLimited, QList<int> *reloadGroupIDs, quint32 instID)
{
// add a shadow binding to an existing binding (if any)
if (addShadowWidgetBinding(objectName, fieldName, widget, index, scale, isLimited, reloadGroupIDs, instID)) {
// no need to go further if successful
return;
}
// qDebug() << "ConfigTaskWidget::doAddWidgetBinding - add binding for " << objectName << fieldName << widget;
UAVObject *object = NULL;
UAVObjectField *field = NULL;
if (!objectName.isEmpty()) {
@ -218,23 +239,6 @@ void ConfigTaskWidget::setWidgetBindingObjectEnabled(QString objectName, bool en
m_refreshing = true;
}
ConfigTaskWidget::~ConfigTaskWidget()
{
if (m_saveButton) {
delete m_saveButton;
}
QSet<WidgetBinding *> deleteSet = m_widgetBindingsPerWidget.values().toSet();
foreach(WidgetBinding * binding, deleteSet) {
if (binding) {
delete binding;
}
}
if (m_realtimeUpdateTimer) {
delete m_realtimeUpdateTimer;
m_realtimeUpdateTimer = NULL;
}
}
bool ConfigTaskWidget::isComboboxOptionSelected(QComboBox *combo, int optionValue)
{
bool ok;
@ -307,9 +311,14 @@ bool ConfigTaskWidget::isConnected() const
}
// dynamic widgets don't receive the connected signal. This should be called instead.
void ConfigTaskWidget::forceConnectedState()
void ConfigTaskWidget::bind()
{
onConnect();
if (isConnected()) {
onConnect();
} else {
refreshWidgetsValues();
updateEnableControls();
}
}
void ConfigTaskWidget::onConnect()
@ -317,24 +326,27 @@ void ConfigTaskWidget::onConnect()
if (m_autopilot) {
m_currentBoardId = m_objectUtilManager->getBoardModel();
}
invalidateObjects();
m_isConnected = true;
invalidateObjects();
resetLimits();
setDirty(false);
refreshWidgetsValues();
updateEnableControls();
// call specific implementation
onConnectImpl();
setDirty(false);
refreshWidgetsValues();
updateEnableControls();
}
void ConfigTaskWidget::onDisconnect()
{
m_isConnected = false;
enableControls(false);
updateEnableControls();
invalidateObjects();
// call specific implementation
@ -430,6 +442,7 @@ void ConfigTaskWidget::enableControls(bool enable)
}
}
}
emit enableControlsChanged(enable);
}
@ -439,28 +452,6 @@ bool ConfigTaskWidget::shouldObjectBeSaved(UAVObject *object)
return true;
}
void ConfigTaskWidget::forceShadowUpdates()
{
foreach(WidgetBinding * binding, m_widgetBindingsPerObject) {
if (!binding->isEnabled()) {
continue;
}
QVariant widgetValue = getVariantFromWidget(binding->widget(), binding);
foreach(ShadowWidgetBinding * shadow, binding->shadows()) {
disconnectWidgetUpdatesToSlot(shadow->widget(), SLOT(widgetsContentsChanged()));
checkWidgetsLimits(shadow->widget(), binding->field(), binding->index(), shadow->isLimited(), widgetValue, shadow->scale());
WidgetBinding tmpBinding(shadow->widget(), binding->object(), binding->field(), binding->index(), shadow->scale(), shadow->isLimited());
setWidgetFromVariant(shadow->widget(), widgetValue, &tmpBinding);
emit widgetContentsChanged(shadow->widget());
connectWidgetUpdatesToSlot(shadow->widget(), SLOT(widgetsContentsChanged()));
}
}
setDirty(true);
}
void ConfigTaskWidget::widgetsContentsChanged()
{
@ -616,6 +607,7 @@ bool ConfigTaskWidget::addShadowWidgetBinding(QString objectName, QString fieldN
continue;
}
if (binding->matches(objectName, fieldName, index, instID)) {
// qDebug() << "ConfigTaskWidget::addShadowWidgetBinding - add shadow binding for " << objectName << fieldName << widget;
binding->addShadow(widget, scale, isLimited);
m_widgetBindingsPerWidget.insert(widget, binding);
@ -632,8 +624,10 @@ bool ConfigTaskWidget::addShadowWidgetBinding(QString objectName, QString fieldN
return false;
}
void ConfigTaskWidget::autoLoadWidgets()
void ConfigTaskWidget::addAutoBindings()
{
// qDebug() << "ConfigTaskWidget::addAutoBindings() - auto binding" << this;
QPushButton *saveButtonWidget = NULL;
QPushButton *applyButtonWidget = NULL;
@ -691,7 +685,7 @@ void ConfigTaskWidget::autoLoadWidgets()
uiRelation.url = str.mid(str.indexOf(":") + 1);
}
}
if (!(uiRelation.buttonType == none)) {
if (uiRelation.buttonType != none) {
QPushButton *button = NULL;
switch (uiRelation.buttonType) {
case save_button:
@ -740,11 +734,7 @@ void ConfigTaskWidget::autoLoadWidgets()
}
}
}
// TODO is this refresh necessary ?
refreshWidgetsValues();
// TODO is this necessary ?
forceShadowUpdates();
// qDebug() << "ConfigTaskWidget::addAutoBindings() - auto binding done for" << this;
}
void ConfigTaskWidget::dumpBindings()
@ -1298,9 +1288,6 @@ QVariant WidgetBinding::value() const
void WidgetBinding::setValue(const QVariant &value)
{
m_value = value;
// if (m_object && m_field) {
// qDebug() << "WidgetBinding" << m_object->getName() << ":" << m_field->getName() << "value =" << value.toString();
// }
}
void WidgetBinding::updateObjectFieldFromValue()

View File

@ -102,7 +102,7 @@ public:
ConfigTaskWidget(QWidget *parent = 0, bool autopilot = true);
virtual ~ConfigTaskWidget();
void forceConnectedState();
void bind();
bool isDirty();
void setDirty(bool value);
@ -136,6 +136,8 @@ public:
bool isLimited = false, QList<int> *reloadGroupIDs = 0, quint32 instID = 0);
protected:
void addAutoBindings();
void addWidgetBinding(QString objectName, QString fieldName, QWidget *widget, QString elementName, double scale,
bool isLimited = false, QList<int> *reloadGroupIDs = 0, quint32 instID = 0);
void addWidgetBinding(UAVObject *object, UAVObjectField *field, QWidget *widget, QString elementName, double scale,
@ -153,8 +155,6 @@ protected:
bool addShadowWidgetBinding(QString objectName, QString fieldName, QWidget *widget, int index = 0, double scale = 1,
bool isLimited = false, QList<int> *m_reloadGroups = NULL, quint32 instID = 0);
void autoLoadWidgets();
bool allObjectsUpdated();
void setOutOfLimitsStyle(QString style)
{
@ -162,7 +162,6 @@ protected:
}
void addHelpButton(QPushButton *button, QString url);
void setWikiURL(QString url);
void forceShadowUpdates();
protected slots:
void apply();