mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
OP-1222 Finished re-factoring vehicle selection pages,
This commit is contained in:
parent
c56980e54e
commit
819e4d6b3b
@ -26,106 +26,46 @@
|
||||
*/
|
||||
|
||||
#include "fixedwingpage.h"
|
||||
#include "ui_fixedwingpage.h"
|
||||
#include "setupwizard.h"
|
||||
|
||||
FixedWingPage::FixedWingPage(SetupWizard *wizard, QWidget *parent) :
|
||||
AbstractWizardPage(wizard, parent),
|
||||
ui(new Ui::FixedWingPage)
|
||||
SelectionPage(wizard, QString(":/setupwizard/resources/fixedwing-shapes-wizard-no-numbers.svg"), parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QSvgRenderer *renderer = new QSvgRenderer();
|
||||
renderer->load(QString(":/setupwizard/resources/fixedwing-shapes-wizard-no-numbers.svg"));
|
||||
m_fixedwingPic = new QGraphicsSvgItem();
|
||||
m_fixedwingPic->setSharedRenderer(renderer);
|
||||
QGraphicsScene *scene = new QGraphicsScene(this);
|
||||
scene->addItem(m_fixedwingPic);
|
||||
ui->typeGraphicsView->setScene(scene);
|
||||
|
||||
setupFixedWingTypesCombo();
|
||||
|
||||
// Default to Aileron setup
|
||||
connect(ui->typeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateImageAndDescription()));
|
||||
ui->typeCombo->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
FixedWingPage::~FixedWingPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FixedWingPage::initializePage()
|
||||
bool FixedWingPage::validatePage(SelectionItem *seletedItem)
|
||||
{
|
||||
updateAvailableTypes();
|
||||
updateImageAndDescription();
|
||||
}
|
||||
|
||||
bool FixedWingPage::validatePage()
|
||||
{
|
||||
SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt();
|
||||
|
||||
getWizard()->setVehicleSubType(type);
|
||||
getWizard()->setVehicleSubType((SetupWizard::VEHICLE_SUB_TYPE)seletedItem->id());
|
||||
return true;
|
||||
}
|
||||
|
||||
void FixedWingPage::fitInView()
|
||||
void FixedWingPage::setupSelection(Selection *selection)
|
||||
{
|
||||
if (m_fixedwingPic) {
|
||||
ui->typeGraphicsView->setSceneRect(m_fixedwingPic->boundingRect());
|
||||
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()
|
||||
{
|
||||
ui->typeCombo->addItem(tr("Aileron Dual Servos"), SetupWizard::FIXED_WING_DUAL_AILERON);
|
||||
m_descriptions << tr("This setup expects a traditional airframe using two independent aileron servos on their own channel (not connected by Y adapter) plus an elevator and a rudder. ");
|
||||
|
||||
ui->typeCombo->addItem(tr("Aileron Single Servo"), SetupWizard::FIXED_WING_AILERON);
|
||||
m_descriptions << tr("This setup expects a traditional airframe using a single alieron servo or two servos connected by a Y adapter plus an elevator and a rudder. ");
|
||||
|
||||
ui->typeCombo->addItem(tr("Elevon"), SetupWizard::FIXED_WING_ELEVON);
|
||||
m_descriptions << tr("This setup currently expects a flying-wing setup, an elevon plus rudder setup is not yet supported. Setup should include only two elevons, and should explicitly not include a rudder.");
|
||||
}
|
||||
|
||||
void FixedWingPage::updateAvailableTypes()
|
||||
{}
|
||||
|
||||
void FixedWingPage::updateImageAndDescription()
|
||||
{
|
||||
SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt();
|
||||
QString elementId = "";
|
||||
QString description = m_descriptions.at(ui->typeCombo->currentIndex());
|
||||
|
||||
switch (type) {
|
||||
case SetupWizard::FIXED_WING_DUAL_AILERON:
|
||||
elementId = "aileron";
|
||||
break;
|
||||
case SetupWizard::FIXED_WING_AILERON:
|
||||
elementId = "aileron-single";
|
||||
break;
|
||||
case SetupWizard::FIXED_WING_ELEVON:
|
||||
elementId = "elevon";
|
||||
break;
|
||||
default:
|
||||
elementId = "";
|
||||
break;
|
||||
}
|
||||
m_fixedwingPic->setElementId(elementId);
|
||||
ui->typeGraphicsView->setSceneRect(m_fixedwingPic->boundingRect());
|
||||
ui->typeGraphicsView->fitInView(m_fixedwingPic, Qt::KeepAspectRatio);
|
||||
|
||||
ui->typeDescription->setText(description);
|
||||
selection->setTitle(tr("OpenPilot Fixed-wing Configuration"));
|
||||
selection->setText(tr("This part of the wizard will set up the OpenPilot controller for use with a fixed-wing "
|
||||
"flying aircraft utilizing servos. The wizard supports the most common types of fixed-wing "
|
||||
"aircraft, other variants of fixed-wing aircraft can be configured by using custom "
|
||||
"configuration options in the Configuration plugin in the GCS.\n\n"
|
||||
"Please select the type of fixed-wing you want to create a configuration for below:"));
|
||||
selection->addItem(tr("Aileron Dual Servos"),
|
||||
tr("This setup expects a traditional airframe using two independent aileron servos "
|
||||
"on their own channel (not connected by Y adapter) plus an elevator and a rudder."),
|
||||
"aileron",
|
||||
SetupWizard::FIXED_WING_DUAL_AILERON);
|
||||
|
||||
selection->addItem(tr("Aileron Single Servo"),
|
||||
tr("This setup expects a traditional airframe using a single alieron servo or two servos "
|
||||
"connected by a Y adapter plus an elevator and a rudder."),
|
||||
"aileron-single",
|
||||
SetupWizard::FIXED_WING_AILERON);
|
||||
|
||||
selection->addItem(tr("Elevon"),
|
||||
tr("This setup currently expects a flying-wing setup, an elevon plus rudder setup is not yet "
|
||||
"supported. Setup should include only two elevons, and should explicitly not include a rudder."),
|
||||
"elevon",
|
||||
SetupWizard::FIXED_WING_ELEVON);
|
||||
}
|
||||
|
@ -28,40 +28,18 @@
|
||||
#ifndef FIXEDWINGPAGE_H
|
||||
#define FIXEDWINGPAGE_H
|
||||
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QList>
|
||||
#include "selectionpage.h"
|
||||
|
||||
#include "abstractwizardpage.h"
|
||||
|
||||
namespace Ui {
|
||||
class FixedWingPage;
|
||||
}
|
||||
|
||||
class FixedWingPage : public AbstractWizardPage {
|
||||
class FixedWingPage : public SelectionPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FixedWingPage(SetupWizard *wizard, QWidget *parent = 0);
|
||||
~FixedWingPage();
|
||||
|
||||
void initializePage();
|
||||
bool validatePage();
|
||||
|
||||
void fitInView();
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void showEvent(QShowEvent *event);
|
||||
|
||||
private:
|
||||
Ui::FixedWingPage *ui;
|
||||
void setupFixedWingTypesCombo();
|
||||
QGraphicsSvgItem *m_fixedwingPic;
|
||||
void updateAvailableTypes();
|
||||
QList<QString> m_descriptions;
|
||||
|
||||
private slots:
|
||||
void updateImageAndDescription();
|
||||
public:
|
||||
bool validatePage(SelectionItem* seletedItem);
|
||||
void setupSelection(Selection *selection);
|
||||
};
|
||||
|
||||
#endif // FIXEDWINGPAGE_H
|
||||
|
@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FixedWingPage</class>
|
||||
<widget class="QWizardPage" name="FixedWingPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WizardPage</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">OpenPilot Fixed-wing Configuration</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">This part of the wizard will set up the OpenPilot controller for use with a fixed-wing flying aircraft utilizing servos. The wizard supports the most common types of fixed-wing aircraft, other variants of fixed-wing aircraft can be configured by using custom configuration options in the Configuration plugin in the GCS.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Please select the type of fixed-wing you want to create a configuration for below:</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fixed-wing type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="typeCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="typeDescription">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="typeGraphicsView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="backgroundBrush">
|
||||
<brush brushstyle="NoBrush">
|
||||
<color alpha="0">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</property>
|
||||
<property name="foregroundBrush">
|
||||
<brush brushstyle="NoBrush">
|
||||
<color alpha="0">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</property>
|
||||
<property name="interactive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -26,165 +26,69 @@
|
||||
*/
|
||||
|
||||
#include "multipage.h"
|
||||
#include "ui_multipage.h"
|
||||
#include "setupwizard.h"
|
||||
|
||||
MultiPage::MultiPage(SetupWizard *wizard, QWidget *parent) :
|
||||
AbstractWizardPage(wizard, parent),
|
||||
ui(new Ui::MultiPage)
|
||||
SelectionPage(wizard, QString(":/configgadget/images/multirotor-shapes.svg"), parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QSvgRenderer *renderer = new QSvgRenderer();
|
||||
renderer->load(QString(":/configgadget/images/multirotor-shapes.svg"));
|
||||
m_multiPic = new QGraphicsSvgItem();
|
||||
m_multiPic->setSharedRenderer(renderer);
|
||||
QGraphicsScene *scene = new QGraphicsScene(this);
|
||||
scene->addItem(m_multiPic);
|
||||
ui->typeGraphicsView->setScene(scene);
|
||||
|
||||
setupMultiTypesCombo();
|
||||
|
||||
// Default to Quad X since it is the most common setup
|
||||
ui->typeCombo->setCurrentIndex(1);
|
||||
connect(ui->typeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateImageAndDescription()));
|
||||
ui->typeGraphicsView->setSceneRect(m_multiPic->boundingRect());
|
||||
ui->typeGraphicsView->fitInView(m_multiPic, Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
MultiPage::~MultiPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MultiPage::initializePage()
|
||||
bool MultiPage::validatePage(SelectionItem *selectedItem)
|
||||
{
|
||||
updateAvailableTypes();
|
||||
updateImageAndDescription();
|
||||
}
|
||||
|
||||
bool MultiPage::validatePage()
|
||||
{
|
||||
SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt();
|
||||
|
||||
getWizard()->setVehicleSubType(type);
|
||||
getWizard()->setVehicleSubType((SetupWizard::VEHICLE_SUB_TYPE)selectedItem->id());
|
||||
return true;
|
||||
}
|
||||
|
||||
void MultiPage::resizeEvent(QResizeEvent *event)
|
||||
void MultiPage::setupSelection(Selection *selection)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (m_multiPic) {
|
||||
ui->typeGraphicsView->setSceneRect(m_multiPic->boundingRect());
|
||||
ui->typeGraphicsView->fitInView(m_multiPic, Qt::KeepAspectRatio);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiPage::setupMultiTypesCombo()
|
||||
{
|
||||
ui->typeCombo->addItem(tr("Tricopter"), SetupWizard::MULTI_ROTOR_TRI_Y);
|
||||
m_descriptions << tr("The Tricopter uses three motors and one servo. The servo is used to give yaw authority to the rear motor. "
|
||||
"The front motors are rotating in opposite directions. The Tricopter is known for its sweeping yaw movement and "
|
||||
"it is very well suited for FPV since the front rotors are spread wide apart.");
|
||||
|
||||
ui->typeCombo->addItem(tr("Quadcopter X"), SetupWizard::MULTI_ROTOR_QUAD_X);
|
||||
m_descriptions << tr("The X Quadcopter uses four motors and is the most common multi rotor configuration. Two of the motors rotate clockwise "
|
||||
"and two counter clockwise. The motors positioned diagonal to each other rotate in the same direction. "
|
||||
"This setup is perfect for sport flying and is also commonly used for FPV platforms.");
|
||||
|
||||
ui->typeCombo->addItem(tr("Quadcopter +"), SetupWizard::MULTI_ROTOR_QUAD_PLUS);
|
||||
m_descriptions << tr("The Plus(+) Quadcopter uses four motors and is similar to the X Quadcopter but the forward direction is offset by 45 degrees. "
|
||||
"The motors front and rear rotate in clockwise and the motors right and left rotate counter-clockwise. "
|
||||
"This setup was one of the first to be used and is still used for sport flying. This configuration is not that well suited "
|
||||
"for FPV since the fore rotor tend to be in the way of the camera.");
|
||||
|
||||
ui->typeCombo->addItem(tr("Hexacopter"), SetupWizard::MULTI_ROTOR_HEXA);
|
||||
m_descriptions << tr("Hexacopter");
|
||||
|
||||
ui->typeCombo->addItem(tr("Hexacopter X"), SetupWizard::MULTI_ROTOR_HEXA_X);
|
||||
m_descriptions << tr("Hexacopter X");
|
||||
|
||||
ui->typeCombo->addItem(tr("Hexacopter H"), SetupWizard::MULTI_ROTOR_HEXA_H);
|
||||
m_descriptions << tr("Hexacopter H");
|
||||
|
||||
ui->typeCombo->addItem(tr("Hexacopter Coax (Y6)"), SetupWizard::MULTI_ROTOR_HEXA_COAX_Y);
|
||||
m_descriptions << tr("Hexacopter Coax (Y6)");
|
||||
|
||||
|
||||
// Fredrik Arvidsson(m_thread) 2012-08-26 Disable Octos until further notice
|
||||
/*
|
||||
ui->typeCombo->addItem(tr("Octocopter"), SetupWizard::MULTI_ROTOR_OCTO);
|
||||
m_descriptions << tr("Octocopter");
|
||||
|
||||
ui->typeCombo->addItem(tr("Octocopter Coax X"), SetupWizard::MULTI_ROTOR_OCTO_COAX_X);
|
||||
m_descriptions << tr("Octocopter Coax X");
|
||||
|
||||
ui->typeCombo->addItem(tr("Octocopter Coax +"), SetupWizard::MULTI_ROTOR_OCTO_COAX_PLUS);
|
||||
m_descriptions << tr("Octocopter Coax +");
|
||||
|
||||
ui->typeCombo->addItem(tr("Octocopter V"), SetupWizard::MULTI_ROTOR_OCTO_V);
|
||||
m_descriptions << tr("Octocopter V");
|
||||
*/
|
||||
}
|
||||
|
||||
void MultiPage::updateAvailableTypes()
|
||||
{
|
||||
/*
|
||||
QVariant enable = (getWizard()->getInputType() == SetupWizard::INPUT_PWM) ? QVariant(0) : QVariant(1 | 32);
|
||||
ui->typeCombo->model()->setData(ui->typeCombo->model()->index(6, 0), enable, Qt::UserRole - 1);
|
||||
ui->typeCombo->model()->setData(ui->typeCombo->model()->index(7, 0), enable, Qt::UserRole - 1);
|
||||
ui->typeCombo->model()->setData(ui->typeCombo->model()->index(8, 0), enable, Qt::UserRole - 1);
|
||||
ui->typeCombo->model()->setData(ui->typeCombo->model()->index(9, 0), enable, Qt::UserRole - 1);
|
||||
*/
|
||||
}
|
||||
|
||||
void MultiPage::updateImageAndDescription()
|
||||
{
|
||||
SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt();
|
||||
QString elementId = "";
|
||||
QString description = m_descriptions.at(ui->typeCombo->currentIndex());
|
||||
|
||||
switch (type) {
|
||||
case SetupWizard::MULTI_ROTOR_TRI_Y:
|
||||
elementId = "tri";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_QUAD_X:
|
||||
elementId = "quad-x";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
|
||||
elementId = "quad-plus";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA:
|
||||
elementId = "quad-hexa";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y:
|
||||
elementId = "hexa-coax";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA_H:
|
||||
elementId = "quad-hexa-H";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_HEXA_X:
|
||||
elementId = "quad-hexa-X";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_OCTO:
|
||||
elementId = "quad-octo";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_OCTO_COAX_X:
|
||||
elementId = "octo-coax-X";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_OCTO_COAX_PLUS:
|
||||
elementId = "octo-coax-P";
|
||||
break;
|
||||
case SetupWizard::MULTI_ROTOR_OCTO_V:
|
||||
elementId = "quad-octo-v";
|
||||
break;
|
||||
default:
|
||||
elementId = "";
|
||||
break;
|
||||
}
|
||||
m_multiPic->setElementId(elementId);
|
||||
ui->typeGraphicsView->setSceneRect(m_multiPic->boundingRect());
|
||||
ui->typeGraphicsView->fitInView(m_multiPic, Qt::KeepAspectRatio);
|
||||
|
||||
ui->typeDescription->setText(description);
|
||||
selection->setTitle(tr("OpenPilot Multirotor Configuration"));
|
||||
selection->setText(tr("This part of the wizard will set up the OpenPilot controller for use with a flying platform utilizing multiple rotors. "
|
||||
"The wizard supports the most common types of multirotors. Other variants of multirotors can be configured by using custom "
|
||||
"configuration options in the Configuration plugin in the GCS.\n\n"
|
||||
"Please select the type of multirotor you want to create a configuration for below:"));
|
||||
selection->addItem(tr("Tricopter"),
|
||||
tr("The Tricopter uses three motors and one servo. The servo is used to give yaw authority to the rear motor. "
|
||||
"The front motors are rotating in opposite directions. The Tricopter is known for its sweeping yaw movement and "
|
||||
"it is very well suited for FPV since the front rotors are spread wide apart."),
|
||||
"tri",
|
||||
SetupWizard::MULTI_ROTOR_TRI_Y);
|
||||
|
||||
selection->addItem(tr("Quadcopter X"),
|
||||
tr("The X Quadcopter uses four motors and is the most common multi rotor configuration. Two of the motors rotate clockwise "
|
||||
"and two counter clockwise. The motors positioned diagonal to each other rotate in the same direction. "
|
||||
"This setup is perfect for sport flying and is also commonly used for FPV platforms."),
|
||||
"quad-x",
|
||||
SetupWizard::MULTI_ROTOR_QUAD_X);
|
||||
|
||||
selection->addItem(tr("Quadcopter +"),
|
||||
tr("The Plus(+) Quadcopter uses four motors and is similar to the X Quadcopter but the forward direction is offset by 45 degrees. "
|
||||
"The motors front and rear rotate in clockwise and the motors right and left rotate counter-clockwise. "
|
||||
"This setup was one of the first to be used and is still used for sport flying. This configuration is not that well suited "
|
||||
"for FPV since the fore rotor tend to be in the way of the camera."),
|
||||
"quad-plus",
|
||||
SetupWizard::MULTI_ROTOR_QUAD_PLUS);
|
||||
|
||||
selection->addItem(tr("Hexacopter"),
|
||||
tr("A multirotor with six motors, one motor in front."),
|
||||
"quad-hexa",
|
||||
SetupWizard::MULTI_ROTOR_HEXA);
|
||||
|
||||
selection->addItem(tr("Hexacopter X"),
|
||||
tr("A multirotor with six motors, two motors in front."),
|
||||
"quad-hexa-X",
|
||||
SetupWizard::MULTI_ROTOR_HEXA_X);
|
||||
|
||||
selection->addItem(tr("Hexacopter H"),
|
||||
tr("A multirotor with six motors in two rows."),
|
||||
"quad-hexa-H",
|
||||
SetupWizard::MULTI_ROTOR_HEXA_H);
|
||||
|
||||
selection->addItem(tr("Hexacopter Coax (Y6)"),
|
||||
tr("A multirotor with six motors mounted in a coaxial fashion."),
|
||||
"hexa-coax",
|
||||
SetupWizard::MULTI_ROTOR_HEXA_COAX_Y);
|
||||
}
|
||||
|
@ -28,38 +28,18 @@
|
||||
#ifndef MULTIPAGE_H
|
||||
#define MULTIPAGE_H
|
||||
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QList>
|
||||
#include "selectionpage.h"
|
||||
|
||||
#include "abstractwizardpage.h"
|
||||
|
||||
namespace Ui {
|
||||
class MultiPage;
|
||||
}
|
||||
|
||||
class MultiPage : public AbstractWizardPage {
|
||||
class MultiPage : public SelectionPage {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MultiPage(SetupWizard *wizard, QWidget *parent = 0);
|
||||
~MultiPage();
|
||||
virtual ~MultiPage();
|
||||
|
||||
void initializePage();
|
||||
bool validatePage();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
Ui::MultiPage *ui;
|
||||
void setupMultiTypesCombo();
|
||||
QGraphicsSvgItem *m_multiPic;
|
||||
void updateAvailableTypes();
|
||||
QList<QString> m_descriptions;
|
||||
|
||||
private slots:
|
||||
void updateImageAndDescription();
|
||||
public:
|
||||
bool validatePage(SelectionItem *selectedItem);
|
||||
void setupSelection(Selection *selection);
|
||||
};
|
||||
|
||||
#endif // MULTIPAGE_H
|
||||
|
@ -1,164 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MultiPage</class>
|
||||
<widget class="QWizardPage" name="MultiPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WizardPage</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">OpenPilot Multirotor Configuration</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">This part of the wizard will set up the OpenPilot controller for use with a flying platform utilizing multiple rotors. The wizard supports the most common types of multirotors. Other variants of multirotors can be configured by using custom configuration options in the Configuration plugin in the GCS.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Please select the type of multirotor you want to create a configuration for below:</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Multirotor type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="typeCombo">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="typeDescription">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="typeGraphicsView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="backgroundBrush">
|
||||
<brush brushstyle="NoBrush">
|
||||
<color alpha="0">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</property>
|
||||
<property name="foregroundBrush">
|
||||
<brush brushstyle="NoBrush">
|
||||
<color alpha="0">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</property>
|
||||
<property name="interactive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -30,7 +30,7 @@
|
||||
#include "setupwizard.h"
|
||||
|
||||
SelectionPage::SelectionPage(SetupWizard *wizard, QString shapeFile, QWidget *parent) :
|
||||
AbstractWizardPage(wizard, parent),
|
||||
AbstractWizardPage(wizard, parent), Selection(),
|
||||
ui(new Ui::SelectionPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -108,12 +108,21 @@ void SelectionPage::addItem(QString name, QString description, QString shapeId,
|
||||
m_selectionItems << new SelectionItem(name, description, shapeId, id);
|
||||
}
|
||||
|
||||
void SelectionPage::setTitleLabel(QString text)
|
||||
void SelectionPage::setTitle(QString title)
|
||||
{
|
||||
ui->label->setText(text);
|
||||
ui->label->setText(title);
|
||||
}
|
||||
|
||||
void SelectionPage::setText(QString text)
|
||||
{
|
||||
ui->text->setText(text);
|
||||
}
|
||||
|
||||
SelectionItem::SelectionItem(QString name, QString description, QString shapeId, int id) :
|
||||
m_name(name), m_description(description), m_shapeId(shapeId), m_id(id)
|
||||
{
|
||||
}
|
||||
|
||||
SelectionItem::~SelectionItem()
|
||||
{
|
||||
}
|
||||
|
@ -38,8 +38,7 @@ namespace Ui {
|
||||
class SelectionPage;
|
||||
}
|
||||
|
||||
class SelectionItem : public QObject {
|
||||
Q_OBJECT
|
||||
class SelectionItem {
|
||||
public:
|
||||
SelectionItem(QString name, QString description, QString shapeId, int id);
|
||||
~SelectionItem();
|
||||
@ -58,11 +57,13 @@ private:
|
||||
|
||||
class Selection {
|
||||
public:
|
||||
Selection() {}
|
||||
virtual void addItem(QString name, QString description, QString shapeId, int id) = 0;
|
||||
virtual void setTitleLabel(QString text) = 0;
|
||||
virtual void setTitle(QString title) = 0;
|
||||
virtual void setText(QString text) = 0;
|
||||
};
|
||||
|
||||
class SelectionPage : public AbstractWizardPage, Selection {
|
||||
class SelectionPage : public AbstractWizardPage, public Selection {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -72,7 +73,8 @@ public:
|
||||
void initializePage();
|
||||
bool validatePage();
|
||||
void addItem(QString name, QString description, QString shapeId, int id);
|
||||
void setTitleLabel(QString text);
|
||||
void setTitle(QString title);
|
||||
void setText(QString text);
|
||||
|
||||
virtual void setupSelection(Selection *selection) = 0;
|
||||
virtual bool validatePage(SelectionItem *selectedItem) = 0;
|
||||
@ -89,8 +91,6 @@ private:
|
||||
private slots:
|
||||
void selectionChanged(int index);
|
||||
void fitImage();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // SUBVEHICLEPAGEPAGE_H
|
||||
|
@ -16,11 +16,31 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>13</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>placeholder_text</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="text">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@ -56,13 +76,6 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select:</string>
|
||||
</property>
|
||||
@ -119,7 +132,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
@ -157,6 +170,9 @@
|
||||
<property name="interactive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="renderHints">
|
||||
<set>QPainter::Antialiasing|QPainter::HighQualityAntialiasing</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -78,8 +78,6 @@ FORMS += \
|
||||
pages/controllerpage.ui \
|
||||
pages/vehiclepage.ui \
|
||||
pages/notyetimplementedpage.ui \
|
||||
pages/multipage.ui \
|
||||
pages/fixedwingpage.ui \
|
||||
pages/helipage.ui \
|
||||
pages/surfacepage.ui \
|
||||
pages/inputpage.ui \
|
||||
|
Loading…
Reference in New Issue
Block a user