diff --git a/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.cpp b/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.cpp index b28453d38..6defa9a6a 100644 --- a/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.cpp @@ -56,14 +56,16 @@ ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent // using objrelation dynamic property autoLoadWidgets(); + QList reloadGroups; + reloadGroups<<1; // Add some widgets and UAVObjects to track widget dirty state // and monitor UAVObject changes in addition to autoloaded ones addWidget(m_camerastabilization->enableCameraStabilization); addWidget(m_camerastabilization->rollChannel); addWidget(m_camerastabilization->pitchChannel); addWidget(m_camerastabilization->yawChannel); - addUAVObject("HwSettings"); - addUAVObject("MixerSettings"); + addUAVObject("HwSettings",&reloadGroups); + addUAVObject("MixerSettings",&reloadGroups); // To set special widgets to defaults when requested connect(this, SIGNAL(defaultRequested(int)), this, SLOT(defaultRequestedSlot(int))); diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp index 1e0246882..a947ffe6e 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp @@ -57,9 +57,9 @@ void ConfigTaskWidget::addWidget(QWidget * widget) * Add an object to the management system * @param objectName name of the object to add to the management system */ -void ConfigTaskWidget::addUAVObject(QString objectName) +void ConfigTaskWidget::addUAVObject(QString objectName,QList * reloadGroups) { - addUAVObjectToWidgetRelation(objectName,"",NULL); + addUAVObjectToWidgetRelation(objectName,"",NULL,0,1,false,reloadGroups); } /** * Add an UAVObject field to widget relation to the management system @@ -148,7 +148,21 @@ void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString fiel } if(widget==NULL) { - // do nothing + if(defaultReloadGroups && obj) + { + foreach(int i,*defaultReloadGroups) + { + if(this->defaultReloadGroups.contains(i)) + { + this->defaultReloadGroups.value(i)->append(ow); + } + else + { + this->defaultReloadGroups.insert(i,new QList()); + this->defaultReloadGroups.value(i)->append(ow); + } + } + } } else { @@ -537,7 +551,7 @@ bool ConfigTaskWidget::addShadowWidget(QString object, QString field, QWidget *w { foreach(objectToWidget * oTw,objOfInterest) { - if(!oTw->object || !oTw->widget) + if(!oTw->object || !oTw->widget || !oTw->field) continue; if(oTw->object->getName()==object && oTw->field->getName()==field && oTw->index==index && oTw->object->getInstID()==instID) { @@ -772,7 +786,7 @@ void ConfigTaskWidget::defaultButtonClicked() QList * list=defaultReloadGroups.value(group); foreach(objectToWidget * oTw,*list) { - if(!oTw->object) + if(!oTw->object || !oTw->field) continue; UAVDataObject * temp=((UAVDataObject*)oTw->object)->dirtyClone(); setWidgetFromField(oTw->widget,temp->getField(oTw->field->getName()),oTw->index,oTw->scale,oTw->isLimited); @@ -810,7 +824,8 @@ void ConfigTaskWidget::reloadButtonClicked() if(timeOut->isActive()) { oTw->object->requestUpdate(); - setWidgetFromField(oTw->widget,oTw->field,oTw->index,oTw->scale,oTw->isLimited); + if(oTw->widget) + setWidgetFromField(oTw->widget,oTw->field,oTw->index,oTw->scale,oTw->isLimited); } timeOut->stop(); } diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h index 25281a942..f4f0b6b9c 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h @@ -93,7 +93,7 @@ public: UAVObjectManager* getObjectManager(); static double listMean(QList list); - void addUAVObject(QString objectName); + void addUAVObject(QString objectName, QList *reloadGroups=NULL); void addWidget(QWidget * widget); void addUAVObjectToWidgetRelation(QString object,QString field,QWidget * widget,int index=0,double scale=1,bool isLimited=false,QList* defaultReloadGroups=0,quint32 instID=0);