1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-16 08:29:15 +01:00

Merge branch 'thread/OP-1222_FW_Wizard' of ssh://git.openpilot.org/OpenPilot into fw_wiz

This commit is contained in:
Fredrik Larson 2014-08-24 01:53:39 +10:00
commit 5561221b9f
5 changed files with 4057 additions and 4081 deletions

View File

@ -45,11 +45,8 @@ FixedWingPage::FixedWingPage(SetupWizard *wizard, QWidget *parent) :
setupFixedWingTypesCombo(); setupFixedWingTypesCombo();
// Default to Aileron setup // Default to Aileron setup
ui->typeCombo->setCurrentIndex(0);
connect(ui->typeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateImageAndDescription())); connect(ui->typeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateImageAndDescription()));
ui->typeGraphicsView->setSceneRect(m_fixedwingPic->boundingRect()); ui->typeCombo->setCurrentIndex(0);
ui->typeGraphicsView->fitInView(m_fixedwingPic, Qt::KeepAspectRatio);
} }
FixedWingPage::~FixedWingPage() FixedWingPage::~FixedWingPage()
@ -71,15 +68,26 @@ bool FixedWingPage::validatePage()
return true; return true;
} }
void FixedWingPage::resizeEvent(QResizeEvent *event) void FixedWingPage::fitInView()
{ {
Q_UNUSED(event);
if (m_fixedwingPic) { if (m_fixedwingPic) {
ui->typeGraphicsView->setSceneRect(m_fixedwingPic->boundingRect()); ui->typeGraphicsView->setSceneRect(m_fixedwingPic->boundingRect());
ui->typeGraphicsView->fitInView(m_fixedwingPic, Qt::KeepAspectRatio); ui->typeGraphicsView->fitInView(m_fixedwingPic, Qt::KeepAspectRatio);
} }
} }
void FixedWingPage::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event);
fitInView();
}
void FixedWingPage::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
fitInView();
}
void FixedWingPage::setupFixedWingTypesCombo() void FixedWingPage::setupFixedWingTypesCombo()
{ {
ui->typeCombo->addItem(tr("Aileron Dual Servos"), SetupWizard::FIXED_WING_DUAL_AILERON); ui->typeCombo->addItem(tr("Aileron Dual Servos"), SetupWizard::FIXED_WING_DUAL_AILERON);
@ -98,8 +106,6 @@ void FixedWingPage::updateAvailableTypes()
void FixedWingPage::updateImageAndDescription() void FixedWingPage::updateImageAndDescription()
{ {
SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt(); SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt();
QString elementId = ""; QString elementId = "";
QString description = m_descriptions.at(ui->typeCombo->currentIndex()); QString description = m_descriptions.at(ui->typeCombo->currentIndex());
@ -125,4 +131,3 @@ void FixedWingPage::updateImageAndDescription()
ui->typeDescription->setText(description); ui->typeDescription->setText(description);
} }

View File

@ -48,8 +48,10 @@ public:
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
void fitInView();
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void showEvent(QShowEvent *event);
private: private:
Ui::FixedWingPage *ui; Ui::FixedWingPage *ui;
@ -60,6 +62,7 @@ private:
private slots: private slots:
void updateImageAndDescription(); void updateImageAndDescription();
}; };
#endif // FIXEDWINGPAGE_H #endif // FIXEDWINGPAGE_H

View File

@ -185,12 +185,12 @@ void OutputCalibrationPage::setupVehicle()
break; break;
case SetupWizard::FIXED_WING_AILERON: case SetupWizard::FIXED_WING_AILERON:
loadSVGFile(FIXEDWING_SVG_FILE); loadSVGFile(FIXEDWING_SVG_FILE);
m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4; m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4;
m_vehicleElementIds << "aileron-single" << "ail2-frame" << "ail2-motor" << "ail2-ail-left" << "ail2-ail-right" << "ail2-rudder" << "ail2-elevator"; m_vehicleElementIds << "aileron-single" << "ail2-frame" << "ail2-motor" << "ail2-aileron" << "ail2-rudder" << "ail2-elevator";
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3 << 4 << 4 << 4 << 5 << 5 << 5; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3 << 4 << 4 << 4;
m_channelIndex << 0 << 2 << 0 << 0 << 0 << 1 << 1 << 1 << 3 << 3 << 3 << 4 << 4 << 4; m_channelIndex << 0 << 2 << 0 << 0 << 0 << 4 << 4 << 4 << 1 << 1 << 1;
setupActuatorMinMaxAndNeutral(3, 3, 5); setupActuatorMinMaxAndNeutral(3, 3, 4);
getWizard()->setActuatorSettings(m_actuatorSettings); getWizard()->setActuatorSettings(m_actuatorSettings);
break; break;

View File

@ -59,6 +59,6 @@ bool VehiclePage::validatePage()
void VehiclePage::initializePage() void VehiclePage::initializePage()
{ {
ui->fixedwingButton->setEnabled(getWizard()->getControllerType() == SetupWizard::CONTROLLER_REVO || //ui->fixedwingButton->setEnabled(getWizard()->getControllerType() == SetupWizard::CONTROLLER_REVO ||
getWizard()->getControllerType() == SetupWizard::CONTROLLER_NANO); // getWizard()->getControllerType() == SetupWizard::CONTROLLER_NANO);
} }

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 260 KiB

After

Width:  |  Height:  |  Size: 270 KiB