mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
OP-1622 Changes discussed in review
This commit is contained in:
parent
71f6872dee
commit
e517e2dc6f
@ -103,19 +103,19 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
|||||||
Q_ASSERT(m_aircraft);
|
Q_ASSERT(m_aircraft);
|
||||||
QSvgRenderer *renderer = new QSvgRenderer();
|
QSvgRenderer *renderer = new QSvgRenderer();
|
||||||
renderer->load(QString(":/configgadget/images/ground-shapes.svg"));
|
renderer->load(QString(":/configgadget/images/ground-shapes.svg"));
|
||||||
groundimg = new QGraphicsSvgItem();
|
m_vehicleImg = new QGraphicsSvgItem();
|
||||||
groundimg->setSharedRenderer(renderer);
|
m_vehicleImg->setSharedRenderer(renderer);
|
||||||
|
|
||||||
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
|
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
|
||||||
Q_ASSERT(system);
|
Q_ASSERT(system);
|
||||||
QPointer<UAVObjectField> field = system->getField(QString("AirframeType"));
|
QPointer<UAVObjectField> frameTypeSaved = system->getField(QString("AirframeType"));
|
||||||
|
|
||||||
m_aircraft->differentialSteeringSlider1->setEnabled(false);
|
m_aircraft->differentialSteeringSlider1->setEnabled(false);
|
||||||
m_aircraft->differentialSteeringSlider2->setEnabled(false);
|
m_aircraft->differentialSteeringSlider2->setEnabled(false);
|
||||||
|
|
||||||
if (frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)") {
|
if (frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)") {
|
||||||
// Tank
|
// Tank
|
||||||
groundimg->setElementId("tank");
|
m_vehicleImg->setElementId("tank");
|
||||||
setComboCurrentIndex(m_aircraft->groundVehicleType,
|
setComboCurrentIndex(m_aircraft->groundVehicleType,
|
||||||
m_aircraft->groundVehicleType->findText("Differential (tank)"));
|
m_aircraft->groundVehicleType->findText("Differential (tank)"));
|
||||||
m_aircraft->gvMotor1ChannelBox->setEnabled(true);
|
m_aircraft->gvMotor1ChannelBox->setEnabled(true);
|
||||||
@ -137,13 +137,13 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
|||||||
m_aircraft->gvThrottleCurve2GroupBox->setTitle("Right throttle curve");
|
m_aircraft->gvThrottleCurve2GroupBox->setTitle("Right throttle curve");
|
||||||
|
|
||||||
// If new setup, set sliders to defaults
|
// If new setup, set sliders to defaults
|
||||||
if (field->getValue().toString() != "GroundVehicleDifferential") {
|
if (frameTypeSaved->getValue().toString() != "GroundVehicleDifferential") {
|
||||||
m_aircraft->differentialSteeringSlider1->setValue(100);
|
m_aircraft->differentialSteeringSlider1->setValue(100);
|
||||||
m_aircraft->differentialSteeringSlider2->setValue(100);
|
m_aircraft->differentialSteeringSlider2->setValue(100);
|
||||||
}
|
}
|
||||||
} else if (frameType == "GroundVehicleMotorcycle" || frameType == "Motorcycle") {
|
} else if (frameType == "GroundVehicleMotorcycle" || frameType == "Motorcycle") {
|
||||||
// Motorcycle
|
// Motorcycle
|
||||||
groundimg->setElementId("motorbike");
|
m_vehicleImg->setElementId("motorbike");
|
||||||
setComboCurrentIndex(m_aircraft->groundVehicleType, m_aircraft->groundVehicleType->findText("Motorcycle"));
|
setComboCurrentIndex(m_aircraft->groundVehicleType, m_aircraft->groundVehicleType->findText("Motorcycle"));
|
||||||
m_aircraft->gvMotor1ChannelBox->setEnabled(false);
|
m_aircraft->gvMotor1ChannelBox->setEnabled(false);
|
||||||
m_aircraft->gvMotor2ChannelBox->setEnabled(true);
|
m_aircraft->gvMotor2ChannelBox->setEnabled(true);
|
||||||
@ -161,7 +161,7 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
|||||||
m_aircraft->gvThrottleCurve2GroupBox->setTitle("Rear throttle curve");
|
m_aircraft->gvThrottleCurve2GroupBox->setTitle("Rear throttle curve");
|
||||||
} else {
|
} else {
|
||||||
// Car
|
// Car
|
||||||
groundimg->setElementId("car");
|
m_vehicleImg->setElementId("car");
|
||||||
setComboCurrentIndex(m_aircraft->groundVehicleType, m_aircraft->groundVehicleType->findText("Turnable (car)"));
|
setComboCurrentIndex(m_aircraft->groundVehicleType, m_aircraft->groundVehicleType->findText("Turnable (car)"));
|
||||||
|
|
||||||
m_aircraft->gvMotor1ChannelBox->setEnabled(true);
|
m_aircraft->gvMotor1ChannelBox->setEnabled(true);
|
||||||
@ -181,9 +181,9 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsScene *scene = new QGraphicsScene();
|
QGraphicsScene *scene = new QGraphicsScene();
|
||||||
scene->addItem(groundimg);
|
scene->addItem(m_vehicleImg);
|
||||||
scene->setSceneRect(groundimg->boundingRect());
|
scene->setSceneRect(m_vehicleImg->boundingRect());
|
||||||
m_aircraft->groundShape->fitInView(groundimg, Qt::KeepAspectRatio);
|
m_aircraft->groundShape->fitInView(m_vehicleImg, Qt::KeepAspectRatio);
|
||||||
m_aircraft->groundShape->setScene(scene);
|
m_aircraft->groundShape->setScene(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,14 +535,14 @@ bool ConfigGroundVehicleWidget::throwConfigError(QString airframeType)
|
|||||||
|
|
||||||
void ConfigGroundVehicleWidget::resizeEvent(QResizeEvent *)
|
void ConfigGroundVehicleWidget::resizeEvent(QResizeEvent *)
|
||||||
{
|
{
|
||||||
if (groundimg) {
|
if (m_vehicleImg) {
|
||||||
m_aircraft->groundShape->fitInView(groundimg, Qt::KeepAspectRatio);
|
m_aircraft->groundShape->fitInView(m_vehicleImg, Qt::KeepAspectRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigGroundVehicleWidget::showEvent(QShowEvent *)
|
void ConfigGroundVehicleWidget::showEvent(QShowEvent *)
|
||||||
{
|
{
|
||||||
if (groundimg) {
|
if (m_vehicleImg) {
|
||||||
m_aircraft->groundShape->fitInView(groundimg, Qt::KeepAspectRatio);
|
m_aircraft->groundShape->fitInView(m_vehicleImg, Qt::KeepAspectRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_GroundConfigWidget *m_aircraft;
|
Ui_GroundConfigWidget *m_aircraft;
|
||||||
QGraphicsSvgItem *groundimg;
|
QGraphicsSvgItem *m_vehicleImg;
|
||||||
|
|
||||||
virtual void registerWidgets(ConfigTaskWidget &parent);
|
virtual void registerWidgets(ConfigTaskWidget &parent);
|
||||||
virtual void resetActuators(GUIConfigDataUnion *configData);
|
virtual void resetActuators(GUIConfigDataUnion *configData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user