1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-11 19:24:10 +01:00

Move some code around to accomidate multiple svg images in the output calibration screen.

Need to fix the SVG to allow for zooming in on specific channel components as we do with the multi rotor screen.

This has some sloppy comments in if for my own debugging purposes.
This commit is contained in:
Kevin Finisterre 2013-12-16 14:29:04 -05:00
parent 632ffed707
commit 82e2c5cf92
2 changed files with 49 additions and 7 deletions

View File

@ -92,6 +92,7 @@ ConfigFixedWingWidget::ConfigFixedWingWidget(QWidget *parent) :
QString type = "aileron"; // This needs fixed. Need to be able to obtain the aircraft type.
qDebug() << "Current Aircraft type: " << m_aircraft->fixedWingType->currentText();
// not sure why m_aircraft->fixedWingType->currentText() is not working here! fix it
if (type == "vtail")
{

View File

@ -39,14 +39,10 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren
qDebug() << "calling output calibration page";
m_vehicleRenderer = new QSvgRenderer();
// need to determine multi rotor or fixed wing. and pick the right svg
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->isValid()) {
// move the code that was here to setupVehicle() so we can determine which image to use.
m_vehicleScene = new QGraphicsScene(this);
ui->vehicleView->setScene(m_vehicleScene);
}
}
OutputCalibrationPage::~OutputCalibrationPage()
@ -67,8 +63,18 @@ void OutputCalibrationPage::setupVehicle()
m_channelIndex.clear();
m_currentWizardIndex = 0;
m_vehicleScene->clear();
// KF moved code from OutputCalibrationPage() here so it can be used to detect the current vehicle
// needs to be slimmed down and not repeated.
switch (getWizard()->getVehicleSubType()) {
case SetupWizard::MULTI_ROTOR_TRI_Y:
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->isValid()) {
ui->vehicleView->setScene(m_vehicleScene);
}
m_wizardIndexes << 0 << 1 << 1 << 1 << 2 << 3 << 4;
m_vehicleElementIds << "tri" << "tri-frame" << "tri-m1" << "tri-m2" << "tri-m3" << "tri-s1";
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 4 << 4;
@ -79,30 +85,55 @@ void OutputCalibrationPage::setupVehicle()
getWizard()->setActuatorSettings(m_actuatorSettings);
break;
case SetupWizard::MULTI_ROTOR_QUAD_X:
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->isValid()) {
ui->vehicleView->setScene(m_vehicleScene);
}
m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "quad-x" << "quad-x-frame" << "quad-x-m1" << "quad-x-m2" << "quad-x-m3" << "quad-x-m4";
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
m_channelIndex << 0 << 0 << 1 << 2 << 3;
break;
case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->isValid()) {
ui->vehicleView->setScene(m_vehicleScene);
}
m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "quad-p" << "quad-p-frame" << "quad-p-m1" << "quad-p-m2" << "quad-p-m3" << "quad-p-m4";
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
m_channelIndex << 0 << 0 << 1 << 2 << 3;
break;
case SetupWizard::MULTI_ROTOR_HEXA:
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->isValid()) {
ui->vehicleView->setScene(m_vehicleScene);
}
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "hexa" << "hexa-frame" << "hexa-m1" << "hexa-m2" << "hexa-m3" << "hexa-m4" << "hexa-m5" << "hexa-m6";
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
break;
case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y:
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->isValid()) {
ui->vehicleView->setScene(m_vehicleScene);
}
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "hexa-y6" << "hexa-y6-frame" << "hexa-y6-m2" << "hexa-y6-m1" << "hexa-y6-m4" << "hexa-y6-m3" << "hexa-y6-m6" << "hexa-y6-m5";
m_vehicleHighlightElementIndexes << 0 << 2 << 1 << 4 << 3 << 6 << 5;
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
break;
case SetupWizard::MULTI_ROTOR_HEXA_H:
if (QFile::exists(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->load(QString(":/setupwizard/resources/multirotor-shapes.svg")) &&
m_vehicleRenderer->isValid()) {
ui->vehicleView->setScene(m_vehicleScene);
}
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "hexa-h" << "hexa-h-frame" << "hexa-h-m1" << "hexa-h-m2" << "hexa-h-m3" << "hexa-h-m4" << "hexa-h-m5" << "hexa-h-m6";
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
@ -110,6 +141,11 @@ void OutputCalibrationPage::setupVehicle()
break;
// KF hack
case SetupWizard::FIXED_WING_AILERON:
if (QFile::exists(QString(":/setupwizard/resources/fixedwing-shapes.svg")) &&
m_vehicleRenderer->load(QString(":/setupwizard/resources/fixedwing-shapes.svg")) &&
m_vehicleRenderer->isValid()) {
ui->vehicleView->setScene(m_vehicleScene);
}
qDebug() << "no clue what a wizard index is!";
// m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
m_wizardIndexes << 0 << 1 << 1 << 1 << 2 << 3 << 4;
@ -119,6 +155,11 @@ void OutputCalibrationPage::setupVehicle()
getWizard()->setActuatorSettings(m_actuatorSettings);
break;
case SetupWizard::FIXED_WING_VTAIL:
if (QFile::exists(QString(":/setupwizard/resources/fixedwing-shapes.svg")) &&
m_vehicleRenderer->load(QString(":/setupwizard/resources/fixedwing-shapes.svg")) &&
m_vehicleRenderer->isValid()) {
ui->vehicleView->setScene(m_vehicleScene);
}
qDebug() << "no clue what a wizard index is!";
// m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
m_wizardIndexes << 0 << 1 << 1 << 1 << 2 << 3 << 4;