mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
OP-984 Refactoring.
This commit is contained in:
parent
1ea13ba161
commit
ab27f41734
@ -213,7 +213,7 @@ void ConfigTaskWidget::addWidgetBinding(QString object, QString field, QWidget *
|
||||
} else {
|
||||
connectWidgetUpdatesToSlot(widget, SLOT(widgetsContentsChanged()));
|
||||
if (defaultReloadGroups) {
|
||||
addWidgetToDefaultReloadGroups(widget, defaultReloadGroups);
|
||||
addWidgetToReloadGroups(widget, defaultReloadGroups);
|
||||
}
|
||||
m_shadowBindings.insert(widget, binding);
|
||||
loadWidgetLimits(widget, _field, index, isLimited, scale);
|
||||
@ -669,7 +669,7 @@ bool ConfigTaskWidget::addShadowWidgetBinding(QString object, QString field, QWi
|
||||
m_shadowBindings.insert(widget, binding);
|
||||
connectWidgetUpdatesToSlot(widget, SLOT(widgetsContentsChanged()));
|
||||
if (defaultReloadGroups) {
|
||||
addWidgetToDefaultReloadGroups(widget, defaultReloadGroups);
|
||||
addWidgetToReloadGroups(widget, defaultReloadGroups);
|
||||
}
|
||||
loadWidgetLimits(widget, binding->field(), binding->index(), isLimited, scale);
|
||||
return true;
|
||||
@ -691,7 +691,7 @@ void ConfigTaskWidget::autoLoadWidgets()
|
||||
QVariant info = widget->property("objrelation");
|
||||
|
||||
if (info.isValid()) {
|
||||
uiRelationAutomation uiRelation;
|
||||
bindingStruct uiRelation;
|
||||
uiRelation.buttonType = none;
|
||||
uiRelation.scale = 1;
|
||||
uiRelation.element = QString();
|
||||
@ -803,7 +803,7 @@ void ConfigTaskWidget::autoLoadWidgets()
|
||||
* @param widget pointer to the widget to be added to the groups
|
||||
* @param groups list of the groups on which to add the widget
|
||||
*/
|
||||
void ConfigTaskWidget::addWidgetToDefaultReloadGroups(QWidget *widget, QList<int> *groups)
|
||||
void ConfigTaskWidget::addWidgetToReloadGroups(QWidget *widget, QList<int> *groups)
|
||||
{
|
||||
foreach(WidgetBinding *binding, m_widgetBindings) {
|
||||
bool addBinding = false;
|
||||
@ -890,10 +890,10 @@ void ConfigTaskWidget::reloadButtonClicked()
|
||||
connect(m_realtimeUpdateTimer, SIGNAL(timeout()), eventLoop, SLOT(quit()));
|
||||
connect(objper, SIGNAL(objectUpdated(UAVObject *)), eventLoop, SLOT(quit()));
|
||||
|
||||
QList<temphelper> temp;
|
||||
QList<objectComparator> temp;
|
||||
foreach(WidgetBinding *binding, *bindings) {
|
||||
if (binding->object() != NULL) {
|
||||
temphelper value;
|
||||
objectComparator value;
|
||||
value.objid = binding->object()->getObjID();
|
||||
value.objinstid = binding->object()->getInstID();
|
||||
if (temp.contains(value)) {
|
||||
|
@ -87,27 +87,6 @@ class UAVOBJECTWIDGETUTILS_EXPORT ConfigTaskWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct temphelper {
|
||||
quint32 objid;
|
||||
quint32 objinstid;
|
||||
bool operator==(const temphelper & lhs)
|
||||
{
|
||||
return lhs.objid == this->objid && lhs.objinstid == this->objinstid;
|
||||
}
|
||||
};
|
||||
|
||||
enum buttonTypeEnum { none, save_button, apply_button, reload_button, default_button, help_button };
|
||||
struct uiRelationAutomation {
|
||||
QString objname;
|
||||
QString fieldname;
|
||||
QString element;
|
||||
QString url;
|
||||
buttonTypeEnum buttonType;
|
||||
QList<int> buttonGroup;
|
||||
double scale;
|
||||
bool haslimits;
|
||||
};
|
||||
|
||||
ConfigTaskWidget(QWidget *parent = 0);
|
||||
virtual ~ConfigTaskWidget();
|
||||
|
||||
@ -186,6 +165,27 @@ private slots:
|
||||
void reloadButtonClicked();
|
||||
|
||||
private:
|
||||
struct objectComparator {
|
||||
quint32 objid;
|
||||
quint32 objinstid;
|
||||
bool operator==(const objectComparator & lhs)
|
||||
{
|
||||
return lhs.objid == this->objid && lhs.objinstid == this->objinstid;
|
||||
}
|
||||
};
|
||||
|
||||
enum buttonTypeEnum { none, save_button, apply_button, reload_button, default_button, help_button };
|
||||
struct bindingStruct {
|
||||
QString objname;
|
||||
QString fieldname;
|
||||
QString element;
|
||||
QString url;
|
||||
buttonTypeEnum buttonType;
|
||||
QList<int> buttonGroup;
|
||||
double scale;
|
||||
bool haslimits;
|
||||
};
|
||||
|
||||
int m_currentBoardId;
|
||||
bool m_isConnected;
|
||||
bool m_isWidgetUpdatesAllowed;
|
||||
|
Loading…
x
Reference in New Issue
Block a user