From 0d3e00134a4840a644eae68d311cdd9bd5746963 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Sat, 23 Mar 2013 16:53:24 +0100 Subject: [PATCH] OP-907 step 1: extract vehicle specific UIs from airframe.ui --- .../config/cfg_vehicletypes/airframe_ccpm.ui | 37 + .../cfg_vehicletypes/airframe_custom.ui | 713 ++++++++++++++ .../cfg_vehicletypes/airframe_fixedwing.ui | 530 +++++++++++ .../cfg_vehicletypes/airframe_ground.ui | 548 +++++++++++ .../cfg_vehicletypes/airframe_multirotor.ui | 868 ++++++++++++++++++ .../cfg_vehicletypes/configccpmwidget.cpp | 7 +- .../cfg_vehicletypes/configccpmwidget.h | 98 +- .../configfixedwingwidget.cpp | 20 +- .../cfg_vehicletypes/configfixedwingwidget.h | 8 +- .../configgroundvehiclewidget.cpp | 21 +- .../configgroundvehiclewidget.h | 9 +- .../configmultirotorwidget.cpp | 143 ++- .../cfg_vehicletypes/configmultirotorwidget.h | 10 +- .../config/cfg_vehicletypes/vehicleconfig.cpp | 1 - .../config/cfg_vehicletypes/vehicleconfig.h | 102 +- .../src/plugins/config/config.pro | 23 +- .../config/configvehicletypewidget.cpp | 345 ++++--- .../plugins/config/configvehicletypewidget.h | 32 +- 18 files changed, 3138 insertions(+), 377 deletions(-) create mode 100644 ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_ccpm.ui create mode 100644 ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_custom.ui create mode 100644 ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_fixedwing.ui create mode 100644 ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_ground.ui create mode 100644 ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_multirotor.ui diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_ccpm.ui b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_ccpm.ui new file mode 100644 index 000000000..d9d90ebd4 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_ccpm.ui @@ -0,0 +1,37 @@ + + + CcpmConfigWidget + + + + 0 + 0 + 880 + 608 + + + + Form + + + + 12 + + + + + + + + + ConfigCcpmWidget + QWidget +
cfg_vehicletypes/configccpmwidget.h
+ 1 +
+
+ + + + +
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_custom.ui b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_custom.ui new file mode 100644 index 000000000..684b73947 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_custom.ui @@ -0,0 +1,713 @@ + + + CustomConfigWidget + + + + 0 + 0 + 880 + 608 + + + + Form + + + + 12 + + + + + + + + + + 0 + 0 + + + + Curve 1 + + + + + + + 1 + 1 + + + + + 50 + 50 + + + + + 1000 + 1000 + + + + + 10 + 10 + + + + + 300 + 350 + + + + + + + + + + + Curve 2 + + + + + + + 1 + 1 + + + + + 50 + 50 + + + + + 1000 + 1000 + + + + + 10 + 10 + + + + + 300 + 350 + + + + + + + + + + + + + + 0 + 0 + + + + true + + + 50 + + + false + + + + Type + + + + + Curve 1 + + + + + Curve 2 + + + + + Roll + + + + + Pitch + + + + + Yaw + + + + + Ch 1 + + + + + Ch 2 + + + + + Ch 3 + + + + + Ch 4 + + + + + Ch 5 + + + + + Ch 6 + + + + + Ch 7 + + + + + Ch 8 + + + + + Ch 9 + + + + + Ch 10 + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + - + + + AlignHCenter|AlignVCenter|AlignCenter + + + + + + + + + + + MixerCurve + QWidget +
mixercurve.h
+ 1 +
+
+ + + + +
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_fixedwing.ui b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_fixedwing.ui new file mode 100644 index 000000000..9e871d695 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_fixedwing.ui @@ -0,0 +1,530 @@ + + + FixedWingConfigWidget + + + + 0 + 0 + 880 + 608 + + + + Form + + + + 9 + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Airplane type: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 0 + + + + + 230 + 100 + + + + Output Channel Assignments + + + + + + Engine + + + + + + + Select output channel for the engine + + + + + + + + 60 + 0 + + + + Aileron 1 + + + + + + + Select output channel for the first aileron (or elevon) + + + + + + + false + + + + 60 + 0 + + + + Aileron 2 + + + + + + + false + + + Select output channel for the second aileron (or elevon) + + + + + + + + 67 + 0 + + + + Elevator 1 + + + + + + + Select output channel for the first elevator + + + + + + + false + + + + 67 + 0 + + + + Elevator 2 + + + + + + + false + + + Select output channel for a secondary elevator + + + + + + + Rudder 1 + + + + + + + Select output channel for the first rudder + + + + + + + Rudder 2 + + + + + + + Select output channel for a secondary rudder + + + + + + + Qt::Vertical + + + + 20 + 20 + + + + + + + + + + + + 0 + 0 + + + + Elevon Mix + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 0 + 20 + + + + + + + + + + + + + 65 + 0 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Rudder % + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + 100 + + + 50 + + + Qt::Vertical + + + + + + + 50 + + + Qt::AlignCenter + + + + + + + + + + + + 50 + 0 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Pitch % + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + 100 + + + 50 + + + Qt::Vertical + + + + + + + 50 + + + Qt::AlignCenter + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 100 + + + + Throttle Curve + + + + + + + 1 + 1 + + + + + 0 + 0 + + + + + 500 + 500 + + + + + 10 + 10 + + + + + 300 + 350 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 75 + true + + + + Mixer OK + + + + + + + + + + MixerCurve + QWidget +
mixercurve.h
+ 1 +
+
+ + + + + + elevonSlider1 + valueChanged(int) + elevonSliderLabel1 + setNum(int) + + + 124 + 126 + + + 124 + 126 + + + + + elevonSlider2 + valueChanged(int) + elevonSliderLabel2 + setNum(int) + + + 362 + 299 + + + 124 + 126 + + + + +
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_ground.ui b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_ground.ui new file mode 100644 index 000000000..8dc27404a --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_ground.ui @@ -0,0 +1,548 @@ + + + GroundConfigWidget + + + + 0 + 0 + 880 + 608 + + + + Form + + + + 12 + + + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Vehicle type: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 75 + true + + + + Channel Assignment + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + Output channel asignmets + + + + + + + 77 + 0 + + + + Engine + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Select output channel for the engine + + + + + + + + 60 + 0 + + + + Aileron 1 + + + + + + + Select output channel for the first aileron (or elevon) + + + + + + + false + + + + 60 + 0 + + + + Aileron 2 + + + + + + + false + + + Select output channel for the second aileron (or elevon) + + + + + + + + 0 + 0 + + + + Motor + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Select output channel for the first motor + + + + + + + false + + + + 47 + 0 + + + + Motor 2 + + + + + + + false + + + Select output channel for a second motor + + + + + + + Front Steering + + + + + + + Select output channel for the first steering actuator + + + + + + + Rear Steering + + + + + + + Select output channel for a second steering actuator + + + + + + + + + + true + + + + 0 + 0 + + + + Differential Steering Mix + + + + + + + + + + + 65 + 0 + + + + Left % + + + + + + + 100 + + + 50 + + + Qt::Vertical + + + + + + + 50 + + + + + + + + + + + + 50 + 0 + + + + Right % + + + + + + + 100 + + + 50 + + + Qt::Vertical + + + + + + + 50 + + + + + + + + + + + + + + + 0 + 100 + + + + Front throttle curve + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 500 + 500 + + + + + 10 + 10 + + + + + 300 + 350 + + + + + + + + + + + + 0 + 0 + + + + Rear throttle curve + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 500 + 500 + + + + + 10 + 10 + + + + + 300 + 350 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 75 + true + + + + Mixer OK + + + + + + + + + + + + MixerCurve + QWidget +
mixercurve.h
+ 1 +
+
+ + + + + + differentialSteeringSlider1 + valueChanged(int) + gvDiffSteering1Label + setNum(int) + + + 124 + 126 + + + 315 + 391 + + + + + differentialSteeringSlider2 + valueChanged(int) + gvDiffSteering2Label + setNum(int) + + + 124 + 126 + + + 390 + 391 + + + + +
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_multirotor.ui b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_multirotor.ui new file mode 100644 index 000000000..a499cfacd --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/airframe_multirotor.ui @@ -0,0 +1,868 @@ + + + MultiRotorConfigWidget + + + + 0 + 0 + 880 + 608 + + + + Form + + + + 12 + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 0 + + + 6 + + + + + + 10 + 10 + + + + + 16777215 + 16777215 + + + + Frame Type + + + + 12 + + + + + QLayout::SetFixedSize + + + + + Qt::Horizontal + + + + 10 + 13 + + + + + + + + + 0 + 0 + + + + + 25 + 25 + + + + + 16777215 + 25 + + + + Select the Multirotor frame type here. + + + + + + + Qt::Horizontal + + + + 10 + 13 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + + 0 + 0 + + + + + 10 + 10 + + + + background:transparent + + + QFrame::NoFrame + + + QFrame::Plain + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + + + + + 16777215 + 16777215 + + + + Mix Level + + + + 0 + + + 12 + + + + + + + + 30 + 0 + + + + 100 + + + Qt::AlignCenter + + + + + + + + 35 + 0 + + + + Weight of Roll mixing in percent. +Typical values are 100% for + configuration and 50% for X configuration on quads. + + + 100 + + + 100 + + + Qt::Vertical + + + + + + + + 0 + 0 + + + + + 30 + 0 + + + + + 30 + 16777215 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Roll + + + Qt::AlignCenter + + + + + + + + + + + + 0 + 0 + + + + 100 + + + Qt::AlignCenter + + + + + + + + 35 + 0 + + + + Weight of Pitch mixing in percent. +Typical values are 100% for + configuration and 50% for X configuration on quads. + + + 100 + + + 100 + + + Qt::Vertical + + + + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Pitch + + + Qt::AlignCenter + + + + + + + + + + + + 0 + 0 + + + + 50 + + + Qt::AlignCenter + + + + + + + + 40 + 0 + + + + Weight of Yaw mixing in percent. +Typical value is 50% for + or X configuration on quads. + + + 0 + + + 100 + + + 50 + + + Qt::Vertical + + + + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Yaw + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Mixer OK + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + + + + + + + 0 + 0 + + + + + 10 + 10 + + + + + 16777215 + 16777215 + + + + Throttle Curve + + + + 12 + + + + + + 0 + 0 + + + + + 10 + 10 + + + + + 10 + 10 + + + + + 50 + 50 + + + + background:transparent + + + + + + + + + + + 0 + 0 + + + + + 0 + 140 + + + + Motor output channels + + + + 12 + + + + + QLayout::SetMaximumSize + + + QFormLayout::AllNonFixedFieldsGrow + + + 6 + + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + 1 + + + + + + + Assign your motor output channels using the drawing above as a reference. Respect propeller rotation. + + + + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + 2 + + + + + + + Assign your motor output channels using the drawing above as a reference. Respect propeller rotation. + + + + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + 3 + + + + + + + Assign your motor output channels using the drawing above as a reference. Respect propeller rotation. + + + + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + 4 + + + + + + + Assign your motor output channels using the drawing above as a reference. Respect propeller rotation. + + + + + + + + + QLayout::SetMaximumSize + + + QFormLayout::AllNonFixedFieldsGrow + + + 6 + + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + 5 + + + + + + + false + + + + 0 + 0 + + + + Assign your motor output channels using the drawing above as a reference. Respect propeller rotation. + + + + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + 6 + + + + + + + false + + + Assign your motor output channels using the drawing above as a reference. Respect propeller rotation. + + + + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + 7 + + + + + + + false + + + Assign your motor output channels using the drawing above as a reference. Respect propeller rotation. + + + + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + 8 + + + + + + + false + + + Assign your motor output channels using the drawing above as a reference. Respect propeller rotation. + + + + + + + + + + 0 + 0 + + + + Qt::Vertical + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Multirotor Motor Direction + + + Qt::AlignCenter + + + + + + + false + + + + 0 + 0 + + + + + 40 + 0 + + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +font: bold 12px; +margin:1px; + + + Tricopter Yaw Servo channel + + + Qt::AlignCenter + + + + + + + Reverse all motors + + + + + + + + + + + + + + MixerCurve + QWidget +
mixercurve.h
+ 1 +
+
+ + + + +
diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp index 4ea8dd670..69693f11b 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.cpp @@ -25,6 +25,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "configccpmwidget.h" +#include "mixersettings.h" +#include "systemsettings.h" +#include "actuatorcommand.h" #include #include @@ -36,10 +39,6 @@ #include #include -#include "mixersettings.h" -#include "systemsettings.h" -#include "actuatorcommand.h" - #define Pi 3.14159265358979323846 diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.h index 2d52eed8f..7f091c1fb 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configccpmwidget.h @@ -27,12 +27,13 @@ #ifndef CONFIGccpmWIDGET_H #define CONFIGccpmWIDGET_H +#include "cfg_vehicletypes/vehicleconfig.h" #include "ui_ccpm.h" #include "../uavobjectwidgetutils/configtaskwidget.h" -#include "cfg_vehicletypes/vehicleconfig.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" + #include #include #include @@ -63,66 +64,67 @@ public: friend class ConfigVehicleTypeWidget; private: - Ui_ccpmWidget *m_ccpm; - QGraphicsSvgItem *SwashplateImg; - QGraphicsSvgItem *CurveImg; - QGraphicsSvgItem *Servos[CCPM_MAX_SWASH_SERVOS]; - QGraphicsTextItem *ServosText[CCPM_MAX_SWASH_SERVOS]; - QGraphicsLineItem *ServoLines[CCPM_MAX_SWASH_SERVOS]; - QGraphicsEllipseItem *ServosTextCircles[CCPM_MAX_SWASH_SERVOS]; - QSpinBox *SwashLvlSpinBoxes[CCPM_MAX_SWASH_SERVOS]; + Ui_ccpmWidget *m_ccpm; + QGraphicsSvgItem *SwashplateImg; + QGraphicsSvgItem *CurveImg; + QGraphicsSvgItem *Servos[CCPM_MAX_SWASH_SERVOS]; + QGraphicsTextItem *ServosText[CCPM_MAX_SWASH_SERVOS]; + QGraphicsLineItem *ServoLines[CCPM_MAX_SWASH_SERVOS]; + QGraphicsEllipseItem *ServosTextCircles[CCPM_MAX_SWASH_SERVOS]; + QSpinBox *SwashLvlSpinBoxes[CCPM_MAX_SWASH_SERVOS]; - QString TypeText; + QString TypeText; - bool SwashLvlConfigurationInProgress; - UAVObject::Metadata SwashLvlaccInitialData; - int SwashLvlState; - int SwashLvlServoInterlock; + bool SwashLvlConfigurationInProgress; + UAVObject::Metadata SwashLvlaccInitialData; + int SwashLvlState; + int SwashLvlServoInterlock; - SwashplateServoSettingsStruct oldSwashLvlConfiguration; - SwashplateServoSettingsStruct newSwashLvlConfiguration; + SwashplateServoSettingsStruct oldSwashLvlConfiguration; + SwashplateServoSettingsStruct newSwashLvlConfiguration; - int MixerChannelData[6]; - int ShowDisclaimer(int messageID); - virtual void enableControls(bool enable) { Q_UNUSED(enable)}; // Not used by this widget + int MixerChannelData[6]; + int ShowDisclaimer(int messageID); + virtual void enableControls(bool enable) { Q_UNUSED(enable)}; // Not used by this widget - bool updatingFromHardware; - bool updatingToHardware; + bool updatingFromHardware; + bool updatingToHardware; - virtual void ResetActuators(GUIConfigDataUnion* configData); - static QStringList getChannelDescriptions(); + virtual void ResetActuators(GUIConfigDataUnion* configData); + static QStringList getChannelDescriptions(); - QString updateConfigObjects(); - private slots: - virtual void setupUI(QString airframeType); - virtual void refreshWidgetsValues(QString frameType); - virtual QString updateConfigObjectsFromWidgets(); - virtual bool throwConfigError(QString airframeType); + QString updateConfigObjects(); - void ccpmSwashplateUpdate(); - void ccpmSwashplateRedraw(); - void UpdateMixer(); - void UpdateType(); +private slots: + virtual void setupUI(QString airframeType); + virtual void refreshWidgetsValues(QString frameType); + virtual QString updateConfigObjectsFromWidgets(); + virtual bool throwConfigError(QString airframeType); - void SwashLvlStartButtonPressed(); - void SwashLvlNextButtonPressed(); - void SwashLvlCancelButtonPressed(); - void SwashLvlFinishButtonPressed(); + void ccpmSwashplateUpdate(); + void ccpmSwashplateRedraw(); + void UpdateMixer(); + void UpdateType(); - //void UpdateCCPMOptionsFromUI(); - //void UpdateCCPMUIFromOptions(); + void SwashLvlStartButtonPressed(); + void SwashLvlNextButtonPressed(); + void SwashLvlCancelButtonPressed(); + void SwashLvlFinishButtonPressed(); - void SetUIComponentVisibilities(); + //void UpdateCCPMOptionsFromUI(); + //void UpdateCCPMUIFromOptions(); - void enableSwashplateLevellingControl(bool state); - void setSwashplateLevel(int percent); - void SwashLvlSpinBoxChanged(int value); - virtual void refreshValues() {}; // Not used + void SetUIComponentVisibilities(); - public slots: - void getMixer(); - void setMixer(); - void saveccpmUpdate(); + void enableSwashplateLevellingControl(bool state); + void setSwashplateLevel(int percent); + void SwashLvlSpinBoxChanged(int value); + virtual void refreshValues() {}; // Not used + +public slots: + void getMixer(); + void setMixer(); + void saveccpmUpdate(); protected: void showEvent(QShowEvent *event); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp index ac6d91165..27a62ec9c 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp @@ -25,8 +25,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "configfixedwingwidget.h" -#include "configvehicletypewidget.h" +//#include "configvehicletypewidget.h" #include "mixersettings.h" +#include "systemsettings.h" +#include "actuatorsettings.h" +#include "actuatorcommand.h" #include #include @@ -38,16 +41,10 @@ #include #include -#include "mixersettings.h" -#include "systemsettings.h" -#include "actuatorsettings.h" -#include "actuatorcommand.h" - - /** Constructor */ -ConfigFixedWingWidget::ConfigFixedWingWidget(Ui_AircraftWidget *aircraft, QWidget *parent) : VehicleConfig(parent) +ConfigFixedWingWidget::ConfigFixedWingWidget(Ui_FixedWingConfigWidget *aircraft, QWidget *parent) : VehicleConfig(parent) { m_aircraft = aircraft; } @@ -60,7 +57,6 @@ ConfigFixedWingWidget::~ConfigFixedWingWidget() // Do nothing } - /** Virtual function to setup the UI */ @@ -70,7 +66,7 @@ void ConfigFixedWingWidget::setupUI(QString frameType) if (frameType == "FixedWing" || frameType == "Elevator aileron rudder") { // Setup the UI - setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Fixed Wing")); + //setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Fixed Wing")); setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevator aileron rudder")); m_aircraft->fwRudder1ChannelBox->setEnabled(true); m_aircraft->fwRudder1Label->setEnabled(true); @@ -92,7 +88,7 @@ void ConfigFixedWingWidget::setupUI(QString frameType) m_aircraft->elevonMixBox->setHidden(true); } else if (frameType == "FixedWingElevon" || frameType == "Elevon") { - setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Fixed Wing")); + //setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Fixed Wing")); setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevon")); m_aircraft->fwAileron1Label->setText("Elevon 1"); m_aircraft->fwAileron2Label->setText("Elevon 2"); @@ -111,7 +107,7 @@ void ConfigFixedWingWidget::setupUI(QString frameType) m_aircraft->elevonLabel2->setText("Pitch"); } else if (frameType == "FixedWingVtail" || frameType == "Vtail") { - setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Fixed Wing")); + //setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Fixed Wing")); setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Vtail")); m_aircraft->fwRudder1ChannelBox->setEnabled(false); m_aircraft->fwRudder1Label->setEnabled(false); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h index 7897829b3..282fc3447 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.h @@ -27,12 +27,14 @@ #ifndef CONFIGFIXEDWINGWIDGET_H #define CONFIGFIXEDWINGWIDGET_H -#include "ui_airframe.h" +#include "cfg_vehicletypes/vehicleconfig.h" +#include "ui_airframe_fixedwing.h" #include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" #include "uavtalk/telemetrymanager.h" + #include #include #include @@ -44,13 +46,13 @@ class ConfigFixedWingWidget: public VehicleConfig Q_OBJECT public: - ConfigFixedWingWidget(Ui_AircraftWidget *aircraft = 0, QWidget *parent = 0); + ConfigFixedWingWidget(Ui_FixedWingConfigWidget *aircraft = 0, QWidget *parent = 0); ~ConfigFixedWingWidget(); friend class ConfigVehicleTypeWidget; private: - Ui_AircraftWidget *m_aircraft; + Ui_FixedWingConfigWidget *m_aircraft; bool setupFrameFixedWing(QString airframeType); bool setupFrameElevon(QString airframeType); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp index a23b758df..01a7d3492 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp @@ -25,8 +25,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "configgroundvehiclewidget.h" -#include "configvehicletypewidget.h" +//#include "configvehicletypewidget.h" #include "mixersettings.h" +#include "systemsettings.h" +#include "actuatorsettings.h" +#include "actuatorcommand.h" #include #include @@ -38,23 +41,11 @@ #include #include -#include "mixersettings.h" -#include "systemsettings.h" -#include "actuatorsettings.h" -#include "actuatorcommand.h" - - -/** - Constructor - */ -ConfigGroundVehicleWidget::ConfigGroundVehicleWidget(Ui_AircraftWidget *aircraft, QWidget *parent) : VehicleConfig(parent) +ConfigGroundVehicleWidget::ConfigGroundVehicleWidget(Ui_GroundConfigWidget *aircraft, QWidget *parent) : VehicleConfig(parent) { m_aircraft = aircraft; } -/** - Destructor - */ ConfigGroundVehicleWidget::~ConfigGroundVehicleWidget() { // Do nothing @@ -68,7 +59,7 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->differentialSteeringMixBox->setHidden(true); //STILL NEEDS WORK // Setup the UI - setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Ground")); + //setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Ground")); m_aircraft->gvEngineChannelBox->setEnabled(false); m_aircraft->gvEngineLabel->setEnabled(false); diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h index fb6cc48b2..804b0bfa7 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.h @@ -27,12 +27,14 @@ #ifndef CONFIGGROUNDVEHICLEWIDGET_H #define CONFIGGROUNDVEHICLEWIDGET_H -#include "ui_airframe.h" +#include "cfg_vehicletypes/vehicleconfig.h" +#include "ui_airframe_ground.h" #include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" #include "uavtalk/telemetrymanager.h" + #include #include #include @@ -44,13 +46,13 @@ class ConfigGroundVehicleWidget: public VehicleConfig Q_OBJECT public: - ConfigGroundVehicleWidget(Ui_AircraftWidget *aircraft = 0, QWidget *parent = 0); + ConfigGroundVehicleWidget(Ui_GroundConfigWidget *aircraft = 0, QWidget *parent = 0); ~ConfigGroundVehicleWidget(); friend class ConfigVehicleTypeWidget; private: - Ui_AircraftWidget *m_aircraft; + Ui_GroundConfigWidget *m_aircraft; bool setupGroundVehicleCar(QString airframeType); bool setupGroundVehicleDifferential(QString airframeType); @@ -65,7 +67,6 @@ private slots: virtual QString updateConfigObjectsFromWidgets(); virtual bool throwConfigError(QString airframeType); - protected: }; diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp index 7db57f5d1..678688c6b 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp @@ -25,6 +25,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "configmultirotorwidget.h" +#include "mixersettings.h" +#include "systemsettings.h" +#include "actuatorsettings.h" +#include "actuatorcommand.h" #include #include @@ -37,46 +41,33 @@ #include #include -#include "mixersettings.h" -#include "systemsettings.h" -#include "actuatorsettings.h" -#include "actuatorcommand.h" - - const QString ConfigMultiRotorWidget::CHANNELBOXNAME = QString("multiMotorChannelBox"); - -/** - Constructor - */ -ConfigMultiRotorWidget::ConfigMultiRotorWidget(Ui_AircraftWidget *aircraft, QWidget *parent) : VehicleConfig(parent), invertMotors(1) +ConfigMultiRotorWidget::ConfigMultiRotorWidget(Ui_MultiRotorConfigWidget *aircraft, QWidget *parent) : VehicleConfig(parent), invertMotors(1) { m_aircraft = aircraft; } -/** - Destructor - */ ConfigMultiRotorWidget::~ConfigMultiRotorWidget() { // Do nothing } - void ConfigMultiRotorWidget::setupUI(QString frameType) { Q_ASSERT(m_aircraft); Q_ASSERT(uiowner); Q_ASSERT(quad); - int i; + qDebug() << "ConfigMultiRotorWidget::setupUI - begin"; + qDebug() << "ConfigMultiRotorWidget::setupUI - frame type" << frameType; // set aircraftType to Multirotor, disable triyaw channel - setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Multirotor")); + //setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Multirotor")); m_aircraft->triYawChannelBox->setEnabled(false); // disable all motor channel boxes - for (i=1; i <=8; i++) { + for (int i = 1; i <= 8; i++) { // do it manually so we can turn off any error decorations QComboBox *combobox = qFindChild(uiowner, "multiMotorChannelBox" + QString::number(i)); if (combobox) { @@ -118,8 +109,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) m_aircraft->mrPitchMixLevel->setValue(100); setYawMixLevel(50); } - else if (frameType == "Hexa" || frameType == "Hexacopter") - { + else if (frameType == "Hexa" || frameType == "Hexacopter") { setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter")); //Enable all necessary motor channel boxes... @@ -140,8 +130,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setYawMixLevel(33); } - else if (frameType == "HexaCoax" || frameType == "Hexacopter Y6") - { + else if (frameType == "HexaCoax" || frameType == "Hexacopter Y6") { setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter Y6")); //Enable all necessary motor channel boxes... @@ -152,8 +141,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setYawMixLevel(66); } - else if (frameType == "Octo" || frameType == "Octocopter") - { + else if (frameType == "Octo" || frameType == "Octocopter") { setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter")); //Enable all necessary motor channel boxes @@ -163,8 +151,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) m_aircraft->mrPitchMixLevel->setValue(33); setYawMixLevel(25); } - else if (frameType == "OctoV" || frameType == "Octocopter V") - { + else if (frameType == "OctoV" || frameType == "Octocopter V") { setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter V")); //Enable all necessary motor channel boxes @@ -175,8 +162,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setYawMixLevel(25); } - else if (frameType == "OctoCoaxP" || frameType == "Octo Coax +") - { + else if (frameType == "OctoCoaxP" || frameType == "Octo Coax +") { setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax +")); //Enable all necessary motor channel boxes @@ -187,8 +173,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setYawMixLevel(50); } - else if (frameType == "OctoCoaxX" || frameType == "Octo Coax X") - { + else if (frameType == "OctoCoaxX" || frameType == "Octo Coax X") { setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax X")); //Enable all necessary motor channel boxes @@ -199,82 +184,82 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setYawMixLevel(50); } - //Draw the appropriate airframe + // Draw the appropriate airframe drawAirframe(frameType); + qDebug() << "ConfigMultiRotorWidget::setupUI - end"; } -void ConfigMultiRotorWidget::drawAirframe(QString frameType){ +void ConfigMultiRotorWidget::drawAirframe(QString frameType) +{ + qDebug() << "ConfigMultiRotorWidget::drawAirframe - begin"; + qDebug() << "ConfigMultiRotorWidget::drawAirframe - frame type:" << frameType; - invertMotors = m_aircraft->MultirotorRevMixercheckBox->isChecked() ? -1:1; + invertMotors = m_aircraft->MultirotorRevMixercheckBox->isChecked() ? -1 : 1; if (frameType == "Tri" || frameType == "Tricopter Y") { - if(invertMotors > 0) + if (invertMotors > 0) { quad->setElementId("tri"); - else + } else { quad->setElementId("tri_reverse"); - } - else if (frameType == "QuadX" || frameType == "Quad X") { - if(invertMotors > 0) + } + } else if (frameType == "QuadX" || frameType == "Quad X") { + qDebug() << "ConfigMultiRotorWidget::drawAirframe - 1"; + if (invertMotors > 0) { quad->setElementId("quad-x"); - else + } else { quad->setElementId("quad-x_reverse"); - } - else if (frameType == "QuadP" || frameType == "Quad +") { - if(invertMotors > 0) + } + qDebug() << "ConfigMultiRotorWidget::drawAirframe - 2"; + } else if (frameType == "QuadP" || frameType == "Quad +") { + if (invertMotors > 0) { quad->setElementId("quad-plus"); - else + } else { quad->setElementId("quad-plus_reverse"); - } - else if (frameType == "Hexa" || frameType == "Hexacopter") - { - if(invertMotors > 0) + } + } else if (frameType == "Hexa" || frameType == "Hexacopter") { + if (invertMotors > 0) { quad->setElementId("quad-hexa"); - else + } else { quad->setElementId("quad-hexa_reverse"); - } - else if (frameType == "HexaX" || frameType == "Hexacopter X" ) { - if(invertMotors > 0) + } + } else if (frameType == "HexaX" || frameType == "Hexacopter X") { + if (invertMotors > 0) { quad->setElementId("quad-hexa-H"); - else + } else { quad->setElementId("quad-hexa-H_reverse"); - } - else if (frameType == "HexaCoax" || frameType == "Hexacopter Y6") - { - if(invertMotors > 0) + } + } else if (frameType == "HexaCoax" || frameType == "Hexacopter Y6") { + if (invertMotors > 0) { quad->setElementId("hexa-coax"); - else + } else { quad->setElementId("hexa-coax_reverse"); - } - else if (frameType == "Octo" || frameType == "Octocopter") - { - if(invertMotors > 0) + } + } else if (frameType == "Octo" || frameType == "Octocopter") { + if (invertMotors > 0) { quad->setElementId("quad-octo"); - else + } else { quad->setElementId("quad-octo_reverse"); - } - else if (frameType == "OctoV" || frameType == "Octocopter V") - { - if(invertMotors > 0) + } + } else if (frameType == "OctoV" || frameType == "Octocopter V") { + if (invertMotors > 0) { quad->setElementId("quad-octo-v"); - else + } else { quad->setElementId("quad-octo-v_reverse"); - } - else if (frameType == "OctoCoaxP" || frameType == "Octo Coax +") - { - if(invertMotors > 0) + } + } else if (frameType == "OctoCoaxP" || frameType == "Octo Coax +") { + if (invertMotors > 0) { quad->setElementId("octo-coax-P"); - else + } else { quad->setElementId("octo-coax-P_reverse"); - - } - else if (frameType == "OctoCoaxX" || frameType == "Octo Coax X") - { - if(invertMotors > 0) + } + } else if (frameType == "OctoCoaxX" || frameType == "Octo Coax X") { + if (invertMotors > 0) { quad->setElementId("octo-coax-X"); - else + } else { quad->setElementId("octo-coax-X_reverse"); - + } } + qDebug() << "ConfigMultiRotorWidget::drawAirframe - end"; } void ConfigMultiRotorWidget::ResetActuators(GUIConfigDataUnion* configData) diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h index 4ce10aae3..64b8dd388 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h @@ -27,14 +27,14 @@ #ifndef CONFIGMULTIROTORWIDGET_H #define CONFIGMULTIROTORWIDGET_H -#include "ui_airframe.h" -#include "../uavobjectwidgetutils/configtaskwidget.h" #include "cfg_vehicletypes/vehicleconfig.h" - +#include "ui_airframe_multirotor.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" #include "uavtalk/telemetrymanager.h" + #include #include #include @@ -46,13 +46,13 @@ class ConfigMultiRotorWidget: public VehicleConfig Q_OBJECT public: - ConfigMultiRotorWidget(Ui_AircraftWidget *aircraft = 0, QWidget *parent = 0); + ConfigMultiRotorWidget(Ui_MultiRotorConfigWidget *aircraft = 0, QWidget *parent = 0); ~ConfigMultiRotorWidget(); friend class ConfigVehicleTypeWidget; private: - Ui_AircraftWidget *m_aircraft; + Ui_MultiRotorConfigWidget *m_aircraft; QWidget *uiowner; QGraphicsSvgItem *quad; diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp index 64ab037c8..ad76c1632 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.cpp @@ -29,7 +29,6 @@ #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" - #include "systemsettings.h" #include diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h index 3b729a6dd..e8de31427 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/vehicleconfig.h @@ -33,7 +33,6 @@ #include "uavobject.h" #include "actuatorcommand.h" - typedef struct { uint VTOLMotorN:4; uint VTOLMotorS:4; @@ -103,60 +102,79 @@ typedef union groundGUISettingsStruct ground; } GUIConfigDataUnion; - class VehicleConfig: public ConfigTaskWidget { - Q_OBJECT +Q_OBJECT - public: - VehicleConfig(QWidget *parent = 0); - ~VehicleConfig(); +public: + VehicleConfig(QWidget *parent = 0); + ~VehicleConfig(); - /* Enumeration options for ThrottleCurves */ - typedef enum { MIXER_THROTTLECURVE1=0, MIXER_THROTTLECURVE2=1 } MixerThrottleCurveElem; + /* Enumeration options for ThrottleCurves */ + typedef enum { + MIXER_THROTTLECURVE1 = 0, MIXER_THROTTLECURVE2 = 1 + } MixerThrottleCurveElem; - /* Enumeration options for field MixerType */ - typedef enum { MIXERTYPE_DISABLED=0, MIXERTYPE_MOTOR=1, MIXERTYPE_SERVO=2, MIXERTYPE_CAMERAROLL=3, MIXERTYPE_CAMERAPITCH=4, MIXERTYPE_CAMERAYAW=5, MIXERTYPE_ACCESSORY0=6, MIXERTYPE_ACCESSORY1=7, MIXERTYPE_ACCESSORY2=8, MIXERTYPE_ACCESSORY3=9, MIXERTYPE_ACCESSORY4=10, MIXERTYPE_ACCESSORY5=11 } MixerTypeElem; - /* Array element names for field MixerVector */ - typedef enum { MIXERVECTOR_THROTTLECURVE1=0, MIXERVECTOR_THROTTLECURVE2=1, MIXERVECTOR_ROLL=2, MIXERVECTOR_PITCH=3, MIXERVECTOR_YAW=4 } MixerVectorElem; + /* Enumeration options for field MixerType */ + typedef enum { + MIXERTYPE_DISABLED = 0, + MIXERTYPE_MOTOR = 1, + MIXERTYPE_SERVO = 2, + MIXERTYPE_CAMERAROLL = 3, + MIXERTYPE_CAMERAPITCH = 4, + MIXERTYPE_CAMERAYAW = 5, + MIXERTYPE_ACCESSORY0 = 6, + MIXERTYPE_ACCESSORY1 = 7, + MIXERTYPE_ACCESSORY2 = 8, + MIXERTYPE_ACCESSORY3 = 9, + MIXERTYPE_ACCESSORY4 = 10, + MIXERTYPE_ACCESSORY5 = 11 + } MixerTypeElem; - static GUIConfigDataUnion GetConfigData(); - static void SetConfigData(GUIConfigDataUnion configData); - static void resetField(UAVObjectField * field); - static void setComboCurrentIndex(QComboBox* box, int index); - static void enableComboBoxes(QWidget* owner, QString boxName, int boxCount, bool enable); - double getMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName); - void setMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName, double value); - void resetMixerVector(UAVDataObject* mixer, int channel); - void resetMotorAndServoMixers(UAVDataObject* mixer); - QString getMixerType(UAVDataObject* mixer, int channel); - void setMixerType(UAVDataObject* mixer, int channel, MixerTypeElem mixerType); - double getMixerValue(UAVDataObject* mixer, QString elementName); - void setMixerValue(UAVDataObject* mixer, QString elementName, double value); - void setThrottleCurve(UAVDataObject* mixer, MixerThrottleCurveElem curveType, QList curve); - void getThrottleCurve(UAVDataObject* mixer, MixerThrottleCurveElem curveType, QList* curve); - bool isValidThrottleCurve(QList* curve); - double getCurveMin(QList* curve); - double getCurveMax(QList* curve); - virtual void ResetActuators(GUIConfigDataUnion* configData); + /* Array element names for field MixerVector */ + typedef enum { + MIXERVECTOR_THROTTLECURVE1 = 0, + MIXERVECTOR_THROTTLECURVE2 = 1, + MIXERVECTOR_ROLL = 2, + MIXERVECTOR_PITCH = 3, + MIXERVECTOR_YAW = 4 + } MixerVectorElem; - QStringList channelNames; - QStringList mixerTypes; - QStringList mixerVectors; - QStringList mixerTypeDescriptions; + static GUIConfigDataUnion GetConfigData(); + static void SetConfigData(GUIConfigDataUnion configData); + static void resetField(UAVObjectField * field); + static void setComboCurrentIndex(QComboBox* box, int index); + static void enableComboBoxes(QWidget* owner, QString boxName, int boxCount, bool enable); + double getMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName); + void setMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName, double value); + void resetMixerVector(UAVDataObject* mixer, int channel); + void resetMotorAndServoMixers(UAVDataObject* mixer); + QString getMixerType(UAVDataObject* mixer, int channel); + void setMixerType(UAVDataObject* mixer, int channel, MixerTypeElem mixerType); + double getMixerValue(UAVDataObject* mixer, QString elementName); + void setMixerValue(UAVDataObject* mixer, QString elementName, double value); + void setThrottleCurve(UAVDataObject* mixer, MixerThrottleCurveElem curveType, QList curve); + void getThrottleCurve(UAVDataObject* mixer, MixerThrottleCurveElem curveType, QList* curve); + bool isValidThrottleCurve(QList* curve); + double getCurveMin(QList* curve); + double getCurveMax(QList* curve); + virtual void ResetActuators(GUIConfigDataUnion* configData); - static const quint32 CHANNEL_NUMELEM = ActuatorCommand::CHANNEL_NUMELEM; + QStringList channelNames; + QStringList mixerTypes; + QStringList mixerVectors; + QStringList mixerTypeDescriptions; - private: + static const quint32 CHANNEL_NUMELEM = ActuatorCommand::CHANNEL_NUMELEM;; - static UAVObjectManager* getUAVObjectManager(); +private: + static UAVObjectManager* getUAVObjectManager(); - private slots: +private slots: - public slots: +public slots: - signals: - //void ConfigurationChanged(); +signals: protected: diff --git a/ground/openpilotgcs/src/plugins/config/config.pro b/ground/openpilotgcs/src/plugins/config/config.pro index 1f9d797c4..a2032dbf7 100644 --- a/ground/openpilotgcs/src/plugins/config/config.pro +++ b/ground/openpilotgcs/src/plugins/config/config.pro @@ -18,7 +18,6 @@ HEADERS += configplugin.h \ config_cc_hw_widget.h \ configccattitudewidget.h \ configpipxtremewidget.h \ - cfg_vehicletypes/configccpmwidget.h \ configstabilizationwidget.h \ assertions.h \ calibration.h \ @@ -28,10 +27,11 @@ HEADERS += configplugin.h \ configcamerastabilizationwidget.h \ configtxpidwidget.h \ outputchannelform.h \ - cfg_vehicletypes/configmultirotorwidget.h \ - cfg_vehicletypes/configgroundvehiclewidget.h \ - cfg_vehicletypes/configfixedwingwidget.h \ cfg_vehicletypes/vehicleconfig.h \ + cfg_vehicletypes/configccpmwidget.h \ + cfg_vehicletypes/configmultirotorwidget.h \ + cfg_vehicletypes/configfixedwingwidget.h \ + cfg_vehicletypes/configgroundvehiclewidget.h \ configrevowidget.h \ config_global.h \ mixercurve.h \ @@ -60,17 +60,22 @@ SOURCES += configplugin.cpp \ configcamerastabilizationwidget.cpp \ configrevowidget.cpp \ configtxpidwidget.cpp \ - cfg_vehicletypes/configmultirotorwidget.cpp \ - cfg_vehicletypes/configgroundvehiclewidget.cpp \ - cfg_vehicletypes/configfixedwingwidget.cpp \ - cfg_vehicletypes/configccpmwidget.cpp \ - outputchannelform.cpp \ cfg_vehicletypes/vehicleconfig.cpp \ + cfg_vehicletypes/configccpmwidget.cpp \ + cfg_vehicletypes/configmultirotorwidget.cpp \ + cfg_vehicletypes/configfixedwingwidget.cpp \ + cfg_vehicletypes/configgroundvehiclewidget.cpp \ + outputchannelform.cpp \ mixercurve.cpp \ dblspindelegate.cpp \ configrevohwwidget.cpp FORMS += airframe.ui \ + cfg_vehicletypes/airframe_ccpm.ui \ + cfg_vehicletypes/airframe_fixedwing.ui \ + cfg_vehicletypes/airframe_ground.ui \ + cfg_vehicletypes/airframe_multirotor.ui \ + cfg_vehicletypes/airframe_custom.ui \ cc_hw_settings.ui \ ccpm.ui \ stabilization.ui \ diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp index dd290073a..0e4c26dce 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp @@ -25,6 +25,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "configvehicletypewidget.h" +#include "systemsettings.h" +#include "mixersettings.h" +#include "actuatorsettings.h" #include #include @@ -38,13 +41,9 @@ #include #include -#include "systemsettings.h" -#include "mixersettings.h" -#include "actuatorsettings.h" #include #include - /** Helper delegate for the custom mixer editor table. Taken straight from Qt examples, thanks! @@ -92,10 +91,6 @@ void SpinBoxDelegate::updateEditorGeometry(QWidget *editor, /**********************************************************************************/ - -/** - Constructor - */ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_aircraft = new Ui_AircraftWidget(); @@ -103,8 +98,9 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings * settings=pm->getObject(); - if(!settings->useExpertMode()) + if (!settings->useExpertMode()) { m_aircraft->saveAircraftToRAM->setVisible(false); + } addApplySaveButtons(m_aircraft->saveAircraftToRAM,m_aircraft->saveAircraftToSD); @@ -115,49 +111,44 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi ffTuningInProgress = false; ffTuningPhase = false; - //Generate lists of mixerTypeNames, mixerVectorNames, channelNames - channelNames << "None"; - for (int i = 0; i < (int)ActuatorSettings::CHANNELADDR_NUMELEM; i++) { - - mixerTypes << QString("Mixer%1Type").arg(i+1); - mixerVectors << QString("Mixer%1Vector").arg(i+1); - channelNames << QString("Channel%1").arg(i+1); - } - QStringList airframeTypes; airframeTypes << "Fixed Wing" << "Multirotor" << "Helicopter" << "Ground" << "Custom"; m_aircraft->aircraftType->addItems(airframeTypes); - m_aircraft->aircraftType->setCurrentIndex(1); //Set default vehicle to MultiRotor - m_aircraft->airframesWidget->setCurrentIndex(1); // Force the tab index to match + + // ***************************************************************************************************************** + // FIXED WING + // ***************************************************************************************************************** + + // create and setup a FixedWing config widget + QWidget *fixedwingConfigWidget = new QWidget(); + m_fixedwingUi = new Ui_FixedWingConfigWidget(); + m_fixedwingUi->setupUi(fixedwingConfigWidget); + m_aircraft->airframesWidget->addWidget(fixedwingConfigWidget); + + m_fixedwing = new ConfigFixedWingWidget(m_fixedwingUi); + m_fixedwing->setupUI(m_fixedwingUi->fixedWingType->currentText() ); QStringList fixedWingTypes; fixedWingTypes << "Elevator aileron rudder" << "Elevon" << "Vtail"; - m_aircraft->fixedWingType->addItems(fixedWingTypes); - m_aircraft->fixedWingType->setCurrentIndex(0); //Set default model to "Elevator aileron rudder" + m_fixedwingUi->fixedWingType->addItems(fixedWingTypes); + m_fixedwingUi->fixedWingType->setCurrentIndex(0); //Set default model to "Elevator aileron rudder" - QStringList groundVehicleTypes; - groundVehicleTypes << "Turnable (car)" << "Differential (tank)" << "Motorcycle"; - m_aircraft->groundVehicleType->addItems(groundVehicleTypes); - m_aircraft->groundVehicleType->setCurrentIndex(0); //Set default model to "Turnable (car)" + connect(m_fixedwingUi->fixedWingType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); - QStringList multiRotorTypes; - multiRotorTypes << "Tricopter Y"<< "Quad +" << "Quad X" << - "Hexacopter" << "Hexacopter X" << "Hexacopter Y6" << - "Octocopter" << "Octocopter V" << "Octo Coax +" << "Octo Coax X" ; - m_aircraft->multirotorFrameType->addItems(multiRotorTypes); - m_aircraft->multirotorFrameType->setCurrentIndex(2); //Set default model to "Quad X" + // ***************************************************************************************************************** + // MULTIROTOR + // ***************************************************************************************************************** + // create and setup a MultiRotor config widget + qDebug() << "create multirotor ui"; + QWidget *multirotorConfigWidget = new QWidget(); + m_multirotorUi = new Ui_MultiRotorConfigWidget(); + m_multirotorUi->setupUi(multirotorConfigWidget); + m_aircraft->airframesWidget->addWidget(multirotorConfigWidget); - //NEW STYLE: Loop through the widgets looking for all widgets that have "ChannelBox" in their name - // The upshot of this is that ALL new ComboBox widgets for selecting the output channel must have "ChannelBox" in their name - foreach(QComboBox *combobox, this->findChildren(QRegExp("\\S+ChannelBo\\S+")))//FOR WHATEVER REASON, THIS DOES NOT WORK WITH ChannelBox. ChannelBo is sufficiently accurate - { - combobox->addItems(channelNames); - } - // Setup the Multirotor picture in the Quad settings interface - m_aircraft->quadShape->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - m_aircraft->quadShape->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_multirotorUi->quadShape->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_multirotorUi->quadShape->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); QSvgRenderer *renderer = new QSvgRenderer(); renderer->load(QString(":/configgadget/images/multirotor-shapes.svg")); quad = new QGraphicsSvgItem(); @@ -166,66 +157,129 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi QGraphicsScene *scene = new QGraphicsScene(this); scene->addItem(quad); scene->setSceneRect(quad->boundingRect()); - m_aircraft->quadShape->setScene(scene); + m_multirotorUi->quadShape->setScene(scene); + + m_multirotor = new ConfigMultiRotorWidget(m_multirotorUi); + m_multirotor->quad = quad; + m_multirotor->uiowner = this; + m_multirotor->setupUI(m_multirotorUi->multirotorFrameType->currentText()); + + QStringList multiRotorTypes; + multiRotorTypes << "Tricopter Y"<< "Quad +" << "Quad X" << + "Hexacopter" << "Hexacopter X" << "Hexacopter Y6" << + "Octocopter" << "Octocopter V" << "Octo Coax +" << "Octo Coax X" ; + m_multirotorUi->multirotorFrameType->addItems(multiRotorTypes); + m_multirotorUi->multirotorFrameType->setCurrentIndex(2); //Set default model to "Quad X" + + connect(m_multirotorUi->multirotorFrameType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); + + // Connect the multirotor motor reverse checkbox + connect(m_multirotorUi->MultirotorRevMixercheckBox, SIGNAL(clicked(bool)), this, SLOT(reverseMultirotorMotor())); + + m_multirotorUi->quadShape->fitInView(quad, Qt::KeepAspectRatio); + + // ***************************************************************************************************************** + // HELICOPTER + // ***************************************************************************************************************** + + // create and setup a Helicopter config widget + QWidget *ccpmConfigWidget = new QWidget(); + m_ccpmUi = new Ui_CcpmConfigWidget(); + m_ccpmUi->setupUi(ccpmConfigWidget); + m_aircraft->airframesWidget->addWidget(ccpmConfigWidget); + + m_heli = m_ccpmUi->widget_3; + m_heli->setupUI(QString("HeliCP")); + + + //mdl connect(m_heli->m_ccpm->ccpmType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); + + // ***************************************************************************************************************** + // GROUND + // ***************************************************************************************************************** + + // create and setup a GroundVehicle config widget + qDebug() << "create ground ui"; + QWidget *groundConfigWidget = new QWidget(); + m_groundUi = new Ui_GroundConfigWidget(); + m_groundUi->setupUi(groundConfigWidget); + m_aircraft->airframesWidget->addWidget(groundConfigWidget); + + m_groundvehicle = new ConfigGroundVehicleWidget(m_groundUi); + m_groundvehicle->setupUI(m_groundUi->groundVehicleType->currentText()); + + QStringList groundVehicleTypes; + groundVehicleTypes << "Turnable (car)" << "Differential (tank)" << "Motorcycle"; + m_groundUi->groundVehicleType->addItems(groundVehicleTypes); + m_groundUi->groundVehicleType->setCurrentIndex(0); //Set default model to "Turnable (car)" + + connect(m_groundUi->groundVehicleType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); + + // ***************************************************************************************************************** + // CUSTOM + // ***************************************************************************************************************** + + QWidget *customConfigWidget = new QWidget(); + m_customUi = new Ui_CustomConfigWidget(); + m_customUi->setupUi(customConfigWidget); + m_aircraft->airframesWidget->addWidget(customConfigWidget); // Put combo boxes in line one of the custom mixer table: UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); UAVObjectField* field = obj->getField(QString("Mixer1Type")); QStringList list = field->getOptions(); for (int i=0; i<(int)(VehicleConfig::CHANNEL_NUMELEM); i++) { - QComboBox* qb = new QComboBox(m_aircraft->customMixerTable); + QComboBox* qb = new QComboBox(m_customUi->customMixerTable); qb->addItems(list); - m_aircraft->customMixerTable->setCellWidget(0,i,qb); + m_customUi->customMixerTable->setCellWidget(0,i,qb); } SpinBoxDelegate *sbd = new SpinBoxDelegate(); for (int i=1; i<(int)(VehicleConfig::CHANNEL_NUMELEM); i++) { - m_aircraft->customMixerTable->setItemDelegateForRow(i, sbd); + m_customUi->customMixerTable->setItemDelegateForRow(i, sbd); } - // create and setup a MultiRotor config widget - m_multirotor = new ConfigMultiRotorWidget(m_aircraft); - m_multirotor->quad = quad; - m_multirotor->uiowner = this; - m_multirotor->setupUI(m_aircraft->multirotorFrameType->currentText()); + // ***************************************************************************************************************** - // create and setup a GroundVehicle config widget - m_groundvehicle = new ConfigGroundVehicleWidget(m_aircraft); - m_groundvehicle->setupUI(m_aircraft->groundVehicleType->currentText() ); + // Set default vehicle to MultiRotor + m_aircraft->aircraftType->setCurrentIndex(1); + // Force the tab index to match + m_aircraft->airframesWidget->setCurrentIndex(1); - // create and setup a FixedWing config widget - m_fixedwing = new ConfigFixedWingWidget(m_aircraft); - m_fixedwing->setupUI(m_aircraft->fixedWingType->currentText() ); + // Generate lists of mixerTypeNames, mixerVectorNames, channelNames + channelNames << "None"; + for (int i = 0; i < (int) ActuatorSettings::CHANNELADDR_NUMELEM; i++) { + mixerTypes << QString("Mixer%1Type").arg(i+1); + mixerVectors << QString("Mixer%1Vector").arg(i+1); + channelNames << QString("Channel%1").arg(i+1); + } - // create and setup a Helicopter config widget - m_heli = m_aircraft->widget_3; - m_heli->setupUI(QString("HeliCP")); + // NEW STYLE: Loop through the widgets looking for all widgets that have "ChannelBox" in their name + // The upshot of this is that ALL new ComboBox widgets for selecting the output channel must have "ChannelBox" in their name + // FOR WHATEVER REASON, THIS DOES NOT WORK WITH ChannelBox. ChannelBo is sufficiently accurate + QList l = findChildren(QRegExp("\\S+ChannelBo\\S+")); + foreach(QComboBox *combobox, l) { + combobox->addItems(channelNames); + } - //Connect aircraft type selection dropbox to callback function + // Connect aircraft type selection dropbox to callback function connect(m_aircraft->aircraftType, SIGNAL(currentIndexChanged(int)), this, SLOT(switchAirframeType(int))); - //Connect airframe selection dropbox to callback functions - connect(m_aircraft->fixedWingType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); - connect(m_aircraft->multirotorFrameType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); - connect(m_aircraft->groundVehicleType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); - //mdl connect(m_heli->m_ccpm->ccpmType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); - - //Connect the three feed forward test checkboxes + // Connect the three feed forward test checkboxes connect(m_aircraft->ffTestBox1, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox3, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); - //Connect the multirotor motor reverse checkbox - connect(m_aircraft->MultirotorRevMixercheckBox, SIGNAL(clicked(bool)), this, SLOT(reverseMultirotorMotor())); - // Connect the help pushbutton connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp())); + enableControls(false); + refreshWidgetsValues(); + addToDirtyMonitor(); disableMouseWheelEvents(); - m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); } @@ -323,14 +377,12 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions() void ConfigVehicleTypeWidget::switchAirframeType(int index) { m_aircraft->airframesWidget->setCurrentIndex(index); - m_aircraft->quadShape->setSceneRect(quad->boundingRect()); - m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); - if (m_aircraft->aircraftType->findText("Custom")) { - m_aircraft->customMixerTable->resizeColumnsToContents(); - for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) { - m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()- - m_aircraft->customMixerTable->verticalHeader()->width())/10); - } + m_multirotorUi->quadShape->setSceneRect(quad->boundingRect()); + m_multirotorUi->quadShape->fitInView(quad, Qt::KeepAspectRatio); + m_customUi->customMixerTable->resizeColumnsToContents(); + for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) { + m_customUi->customMixerTable->setColumnWidth(i,(m_customUi->customMixerTable->width()- + m_customUi->customMixerTable->verticalHeader()->width())/ 10); } } @@ -344,11 +396,11 @@ void ConfigVehicleTypeWidget::showEvent(QShowEvent *event) // Thit fitInView method should only be called now, once the // widget is shown, otherwise it cannot compute its values and // the result is usually a ahrsbargraph that is way too small. - m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); - m_aircraft->customMixerTable->resizeColumnsToContents(); + m_multirotorUi->quadShape->fitInView(quad, Qt::KeepAspectRatio); + m_customUi->customMixerTable->resizeColumnsToContents(); for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) { - m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()- - m_aircraft->customMixerTable->verticalHeader()->width())/ 10); + m_customUi->customMixerTable->setColumnWidth(i,(m_customUi->customMixerTable->width()- + m_customUi->customMixerTable->verticalHeader()->width())/ 10); } } @@ -358,12 +410,12 @@ void ConfigVehicleTypeWidget::showEvent(QShowEvent *event) void ConfigVehicleTypeWidget::resizeEvent(QResizeEvent* event) { Q_UNUSED(event); - m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); + m_multirotorUi->quadShape->fitInView(quad, Qt::KeepAspectRatio); // Make the custom table columns autostretch: - m_aircraft->customMixerTable->resizeColumnsToContents(); + m_customUi->customMixerTable->resizeColumnsToContents(); for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) { - m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()- - m_aircraft->customMixerTable->verticalHeader()->width())/ 10); + m_customUi->customMixerTable->setColumnWidth(i,(m_customUi->customMixerTable->width()- + m_customUi->customMixerTable->verticalHeader()->width())/ 10); } } @@ -372,33 +424,33 @@ void ConfigVehicleTypeWidget::resizeEvent(QResizeEvent* event) void ConfigVehicleTypeWidget::toggleAileron2(int index) { if (index) { - m_aircraft->fwAileron2ChannelBox->setEnabled(true); - m_aircraft->fwAileron2Label->setEnabled(true); + m_fixedwingUi->fwAileron2ChannelBox->setEnabled(true); + m_fixedwingUi->fwAileron2Label->setEnabled(true); } else { - m_aircraft->fwAileron2ChannelBox->setEnabled(false); - m_aircraft->fwAileron2Label->setEnabled(false); + m_fixedwingUi->fwAileron2ChannelBox->setEnabled(false); + m_fixedwingUi->fwAileron2Label->setEnabled(false); } } void ConfigVehicleTypeWidget::toggleElevator2(int index) { if (index) { - m_aircraft->fwElevator2ChannelBox->setEnabled(true); - m_aircraft->fwElevator2Label->setEnabled(true); + m_fixedwingUi->fwElevator2ChannelBox->setEnabled(true); + m_fixedwingUi->fwElevator2Label->setEnabled(true); } else { - m_aircraft->fwElevator2ChannelBox->setEnabled(false); - m_aircraft->fwElevator2Label->setEnabled(false); + m_fixedwingUi->fwElevator2ChannelBox->setEnabled(false); + m_fixedwingUi->fwElevator2Label->setEnabled(false); } } void ConfigVehicleTypeWidget::toggleRudder2(int index) { if (index) { - m_aircraft->fwRudder2ChannelBox->setEnabled(true); - m_aircraft->fwRudder2Label->setEnabled(true); + m_fixedwingUi->fwRudder2ChannelBox->setEnabled(true); + m_fixedwingUi->fwRudder2Label->setEnabled(true); } else { - m_aircraft->fwRudder2ChannelBox->setEnabled(false); - m_aircraft->fwRudder2Label->setEnabled(false); + m_fixedwingUi->fwRudder2ChannelBox->setEnabled(false); + m_fixedwingUi->fwRudder2Label->setEnabled(false); } } @@ -474,10 +526,13 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject * o) { Q_UNUSED(o); + qDebug() << "ConfigVehicleTypeWidget::refreshWidgetsValues - begin"; + if(!allObjectsUpdated()) return; - bool dirty=isDirty(); + bool dirty = isDirty(); + qDebug() << "ConfigVehicleTypeWidget::refreshWidgetsValues - isDirty:" << dirty; // Get the Airframe type from the system settings: UAVDataObject* system = dynamic_cast(getObjectManager()->getObject(QString("SystemSettings"))); @@ -488,6 +543,7 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject * o) // At this stage, we will need to have some hardcoded settings in this code, this // is not ideal, but there you go. QString frameType = field->getValue().toString(); + qDebug() << "ConfigVehicleTypeWidget::refreshWidgetsValues - frame type:" << frameType; setupAirframeUI(frameType); UAVDataObject* mixer = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); @@ -501,33 +557,31 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject * o) // is at least one of the curve values != 0? if (vconfig->isValidThrottleCurve(&curveValues)) { // yes, use the curve we just read from mixersettings - m_aircraft->multiThrottleCurve->initCurve(&curveValues); - m_aircraft->fixedWingThrottle->initCurve(&curveValues); - m_aircraft->groundVehicleThrottle1->initCurve(&curveValues); + m_multirotorUi->multiThrottleCurve->initCurve(&curveValues); + m_fixedwingUi->fixedWingThrottle->initCurve(&curveValues); + m_groundUi->groundVehicleThrottle1->initCurve(&curveValues); } else { // no, init a straight curve - m_aircraft->multiThrottleCurve->initLinearCurve(curveValues.count(), 0.9); - m_aircraft->fixedWingThrottle->initLinearCurve(curveValues.count(), 1.0); - m_aircraft->groundVehicleThrottle1->initLinearCurve(curveValues.count(), 1.0); + m_multirotorUi->multiThrottleCurve->initLinearCurve(curveValues.count(), 0.9); + m_fixedwingUi->fixedWingThrottle->initLinearCurve(curveValues.count(), 1.0); + m_groundUi->groundVehicleThrottle1->initLinearCurve(curveValues.count(), 1.0); } // Setup all Throttle2 curves for all types of airframes //AT THIS MOMENT, THAT MEANS ONLY GROUND VEHICLES vconfig->getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, &curveValues); if (vconfig->isValidThrottleCurve(&curveValues)) { - m_aircraft->groundVehicleThrottle2->initCurve(&curveValues); + m_groundUi->groundVehicleThrottle2->initCurve(&curveValues); } else { - m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0); + m_groundUi->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0); } // Load the Settings for fixed wing frames: if (frameType.startsWith("FixedWing")) { - // Retrieve fixed wing settings m_fixedwing->refreshWidgetsValues(frameType); - } else if (frameType == "Tri" || frameType == "QuadX" || frameType == "QuadP" || frameType == "Hexa" || frameType == "HexaCoax" || frameType == "HexaX" || @@ -538,18 +592,17 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject * o) } else if (frameType == "HeliCP") { setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Helicopter")); m_heli->refreshWidgetsValues(frameType); - } else if (frameType.startsWith("GroundVehicle")) { - // Retrieve ground vehicle settings m_groundvehicle->refreshWidgetsValues(frameType); - } else if (frameType == "Custom") { setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Custom")); } updateCustomAirframeUI(); setDirty(dirty); + + qDebug() << "ConfigVehicleTypeWidget::refreshWidgetsValues - end"; } /** @@ -558,12 +611,13 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject * o) */ void ConfigVehicleTypeWidget::setupAirframeUI(QString frameType) { - bool dirty=isDirty(); - if(frameType == "FixedWing" || frameType == "Elevator aileron rudder" || - frameType == "FixedWingElevon" || frameType == "Elevon" || - frameType == "FixedWingVtail" || frameType == "Vtail"){ + qDebug() << "ConfigVehicleTypeWidget::setupAirframeUI - begin"; + qDebug() << "ConfigVehicleTypeWidget::setupAirframeUI - frame type" << frameType; + bool dirty = isDirty(); + if (frameType == "FixedWing" || frameType == "Elevator aileron rudder" || frameType == "FixedWingElevon" + || frameType == "Elevon" || frameType == "FixedWingVtail" || frameType == "Vtail") { m_fixedwing->setupUI(frameType); - } + } else if (frameType == "Tri" || frameType == "Tricopter Y" || frameType == "QuadX" || frameType == "Quad X" || frameType == "QuadP" || frameType == "Quad +" || @@ -588,10 +642,11 @@ void ConfigVehicleTypeWidget::setupAirframeUI(QString frameType) } //SHOULDN'T THIS BE DONE ONLY IN QUAD SETUP, AND NOT ALL THE REST??? - m_aircraft->quadShape->setSceneRect(quad->boundingRect()); - m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); + m_multirotorUi->quadShape->setSceneRect(quad->boundingRect()); + m_multirotorUi->quadShape->fitInView(quad, Qt::KeepAspectRatio); setDirty(dirty); + qDebug() << "ConfigVehicleTypeWidget::setupAirframeUI - end"; } @@ -622,19 +677,19 @@ void ConfigVehicleTypeWidget::updateCustomAirframeUI() // is at least one of the curve values != 0? if (vconfig->isValidThrottleCurve(&curveValues)) { - m_aircraft->customThrottle1Curve->initCurve(&curveValues); + m_customUi->customThrottle1Curve->initCurve(&curveValues); } else { // no, init a straight curve - m_aircraft->customThrottle1Curve->initLinearCurve(curveValues.count(), 1.0); + m_customUi->customThrottle1Curve->initLinearCurve(curveValues.count(), 1.0); } if (MixerSettings* mxr = qobject_cast(mixer)) { MixerSettings::DataFields mixerSettingsData = mxr->getData(); if (mixerSettingsData.Curve2Source == MixerSettings::CURVE2SOURCE_THROTTLE) - m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); + m_customUi->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); else { - m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_PITCH); + m_customUi->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_PITCH); } } @@ -642,10 +697,10 @@ void ConfigVehicleTypeWidget::updateCustomAirframeUI() vconfig->getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, &curveValues); if (vconfig->isValidThrottleCurve(&curveValues)) { - m_aircraft->customThrottle2Curve->initCurve(&curveValues); + m_customUi->customThrottle2Curve->initCurve(&curveValues); } else { - m_aircraft->customThrottle2Curve->initLinearCurve(curveValues.count(), 1.0, m_aircraft->customThrottle2Curve->getMin()); + m_customUi->customThrottle2Curve->initLinearCurve(curveValues.count(), 1.0, m_customUi->customThrottle2Curve->getMin()); } // Update the mixer table: @@ -653,22 +708,22 @@ void ConfigVehicleTypeWidget::updateCustomAirframeUI() UAVObjectField* field = mixer->getField(mixerTypes.at(channel)); if (field) { - QComboBox* q = (QComboBox*)m_aircraft->customMixerTable->cellWidget(0,channel); + QComboBox* q = (QComboBox*)m_customUi->customMixerTable->cellWidget(0,channel); if (q) { QString s = field->getValue().toString(); setComboCurrentIndex(q, q->findText(s)); } - m_aircraft->customMixerTable->item(1,channel)->setText( + m_customUi->customMixerTable->item(1,channel)->setText( QString::number(vconfig->getMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_THROTTLECURVE1))); - m_aircraft->customMixerTable->item(2,channel)->setText( + m_customUi->customMixerTable->item(2,channel)->setText( QString::number(vconfig->getMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_THROTTLECURVE2))); - m_aircraft->customMixerTable->item(3,channel)->setText( + m_customUi->customMixerTable->item(3,channel)->setText( QString::number(vconfig->getMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_ROLL))); - m_aircraft->customMixerTable->item(4,channel)->setText( + m_customUi->customMixerTable->item(4,channel)->setText( QString::number(vconfig->getMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_PITCH))); - m_aircraft->customMixerTable->item(5,channel)->setText( + m_customUi->customMixerTable->item(5,channel)->setText( QString::number(vconfig->getMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_YAW))); } } @@ -715,12 +770,12 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets() airframeType = m_groundvehicle->updateConfigObjectsFromWidgets(); } else { - vconfig->setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->customThrottle1Curve->getCurve()); - vconfig->setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->customThrottle2Curve->getCurve()); + vconfig->setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_customUi->customThrottle1Curve->getCurve()); + vconfig->setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_customUi->customThrottle2Curve->getCurve()); // Update the table: for (int channel=0; channel<(int)(VehicleConfig::CHANNEL_NUMELEM); channel++) { - QComboBox* q = (QComboBox*)m_aircraft->customMixerTable->cellWidget(0,channel); + QComboBox* q = (QComboBox*)m_customUi->customMixerTable->cellWidget(0,channel); if(q->currentText()=="Disabled") vconfig->setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); else if(q->currentText()=="Motor") @@ -747,15 +802,15 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets() vconfig->setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_ACCESSORY5); vconfig->setMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_THROTTLECURVE1, - m_aircraft->customMixerTable->item(1,channel)->text().toDouble()); + m_customUi->customMixerTable->item(1,channel)->text().toDouble()); vconfig->setMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_THROTTLECURVE2, - m_aircraft->customMixerTable->item(2,channel)->text().toDouble()); + m_customUi->customMixerTable->item(2,channel)->text().toDouble()); vconfig->setMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_ROLL, - m_aircraft->customMixerTable->item(3,channel)->text().toDouble()); + m_customUi->customMixerTable->item(3,channel)->text().toDouble()); vconfig->setMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_PITCH, - m_aircraft->customMixerTable->item(4,channel)->text().toDouble()); + m_customUi->customMixerTable->item(4,channel)->text().toDouble()); vconfig->setMixerVectorValue(mixer,channel,VehicleConfig::MIXERVECTOR_YAW, - m_aircraft->customMixerTable->item(5,channel)->text().toDouble()); + m_customUi->customMixerTable->item(5,channel)->text().toDouble()); } } @@ -791,7 +846,7 @@ void ConfigVehicleTypeWidget::setComboCurrentIndex(QComboBox* box, int index) } void ConfigVehicleTypeWidget::reverseMultirotorMotor(){ - QString frameType = m_aircraft->multirotorFrameType->currentText(); + QString frameType = m_multirotorUi->multirotorFrameType->currentText(); m_multirotor->drawAirframe(frameType); } @@ -801,9 +856,10 @@ void ConfigVehicleTypeWidget::reverseMultirotorMotor(){ */ void ConfigVehicleTypeWidget::addToDirtyMonitor() { - addWidget(m_aircraft->customMixerTable); - addWidget(m_aircraft->customThrottle1Curve->getCurveWidget()); - addWidget(m_aircraft->customThrottle2Curve->getCurveWidget()); + /* + addWidget(m_customUi->customMixerTable); + addWidget(m_customUi->customThrottle1Curve->getCurveWidget()); + addWidget(m_customUi->customThrottle2Curve->getCurveWidget()); addWidget(m_aircraft->multiThrottleCurve->getCurveWidget()); addWidget(m_aircraft->fixedWingThrottle->getCurveWidget()); addWidget(m_aircraft->fixedWingType); @@ -869,5 +925,6 @@ void ConfigVehicleTypeWidget::addToDirtyMonitor() addWidget(m_heli->m_ccpm->ThrottleCurve->getCurveWidget()); addWidget(m_heli->m_ccpm->PitchCurve->getCurveWidget()); addWidget(m_heli->m_ccpm->ccpmAdvancedSettingsTable); + */ } diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h index e4cea4cc2..c1ad6b473 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h @@ -34,11 +34,17 @@ #include "uavobject.h" #include "uavtalk/telemetrymanager.h" +#include "cfg_vehicletypes/vehicleconfig.h" #include "cfg_vehicletypes/configccpmwidget.h" #include "cfg_vehicletypes/configfixedwingwidget.h" -#include "cfg_vehicletypes/configmultirotorwidget.h" #include "cfg_vehicletypes/configgroundvehiclewidget.h" -#include "cfg_vehicletypes/vehicleconfig.h" +#include "cfg_vehicletypes/configmultirotorwidget.h" + +#include "ui_airframe_ccpm.h" +#include "ui_airframe_fixedwing.h" +#include "ui_airframe_ground.h" +#include "ui_airframe_multirotor.h" +#include "ui_airframe_custom.h" #include #include @@ -59,6 +65,12 @@ public: private: Ui_AircraftWidget *m_aircraft; + Ui_CcpmConfigWidget *m_ccpmUi; + Ui_FixedWingConfigWidget *m_fixedwingUi; + Ui_MultiRotorConfigWidget *m_multirotorUi; + Ui_GroundConfigWidget *m_groundUi; + Ui_CustomConfigWidget *m_customUi; + ConfigCcpmWidget *m_heli; ConfigFixedWingWidget *m_fixedwing; ConfigMultiRotorWidget *m_multirotor; @@ -66,7 +78,7 @@ private: void updateCustomAirframeUI(); void addToDirtyMonitor(); - void resetField(UAVObjectField * field); + void resetField(UAVObjectField *field); //void setMixerChannel(int channelNumber, bool channelIsMotor, QList vector); @@ -81,10 +93,10 @@ private: private slots: - virtual void refreshWidgetsValues(UAVObject * o=NULL); + virtual void refreshWidgetsValues(UAVObject *o = NULL); virtual void updateObjectsFromWidgets(); - void setComboCurrentIndex(QComboBox* box, int index); + void setComboCurrentIndex(QComboBox *box, int index); void setupAirframeUI(QString type); @@ -102,6 +114,7 @@ protected: void resizeEvent(QResizeEvent *event); + }; class SpinBoxDelegate : public QItemDelegate @@ -111,15 +124,12 @@ class SpinBoxDelegate : public QItemDelegate public: SpinBoxDelegate(QObject *parent = 0); - QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const; + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; - void setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const; + void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; - void updateEditorGeometry(QWidget *editor, - const QStyleOptionViewItem &option, const QModelIndex &index) const; + void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; #endif // CONFIGVEHICLETYPEWIDGET_H