1
0
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:
m_thread 2014-09-02 11:03:52 +02:00
parent c56980e54e
commit 819e4d6b3b
10 changed files with 132 additions and 641 deletions

View File

@ -26,106 +26,46 @@
*/ */
#include "fixedwingpage.h" #include "fixedwingpage.h"
#include "ui_fixedwingpage.h"
#include "setupwizard.h" #include "setupwizard.h"
FixedWingPage::FixedWingPage(SetupWizard *wizard, QWidget *parent) : FixedWingPage::FixedWingPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent), SelectionPage(wizard, QString(":/setupwizard/resources/fixedwing-shapes-wizard-no-numbers.svg"), parent)
ui(new Ui::FixedWingPage)
{ {
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() FixedWingPage::~FixedWingPage()
{ {
delete ui;
} }
void FixedWingPage::initializePage() bool FixedWingPage::validatePage(SelectionItem *seletedItem)
{ {
updateAvailableTypes(); getWizard()->setVehicleSubType((SetupWizard::VEHICLE_SUB_TYPE)seletedItem->id());
updateImageAndDescription();
}
bool FixedWingPage::validatePage()
{
SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt();
getWizard()->setVehicleSubType(type);
return true; return true;
} }
void FixedWingPage::fitInView() void FixedWingPage::setupSelection(Selection *selection)
{ {
if (m_fixedwingPic) { selection->setTitle(tr("OpenPilot Fixed-wing Configuration"));
ui->typeGraphicsView->setSceneRect(m_fixedwingPic->boundingRect()); selection->setText(tr("This part of the wizard will set up the OpenPilot controller for use with a fixed-wing "
ui->typeGraphicsView->fitInView(m_fixedwingPic, Qt::KeepAspectRatio); "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:"));
void FixedWingPage::resizeEvent(QResizeEvent *event) selection->addItem(tr("Aileron Dual Servos"),
{ tr("This setup expects a traditional airframe using two independent aileron servos "
Q_UNUSED(event); "on their own channel (not connected by Y adapter) plus an elevator and a rudder."),
fitInView(); "aileron",
} SetupWizard::FIXED_WING_DUAL_AILERON);
void FixedWingPage::showEvent(QShowEvent *event) selection->addItem(tr("Aileron Single Servo"),
{ tr("This setup expects a traditional airframe using a single alieron servo or two servos "
Q_UNUSED(event); "connected by a Y adapter plus an elevator and a rudder."),
fitInView(); "aileron-single",
} SetupWizard::FIXED_WING_AILERON);
void FixedWingPage::setupFixedWingTypesCombo() selection->addItem(tr("Elevon"),
{ tr("This setup currently expects a flying-wing setup, an elevon plus rudder setup is not yet "
ui->typeCombo->addItem(tr("Aileron Dual Servos"), SetupWizard::FIXED_WING_DUAL_AILERON); "supported. Setup should include only two elevons, and should explicitly not include a rudder."),
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. "); "elevon",
SetupWizard::FIXED_WING_ELEVON);
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);
} }

View File

@ -28,40 +28,18 @@
#ifndef FIXEDWINGPAGE_H #ifndef FIXEDWINGPAGE_H
#define FIXEDWINGPAGE_H #define FIXEDWINGPAGE_H
#include <QtSvg/QGraphicsSvgItem> #include "selectionpage.h"
#include <QtSvg/QSvgRenderer>
#include <QList>
#include "abstractwizardpage.h" class FixedWingPage : public SelectionPage {
namespace Ui {
class FixedWingPage;
}
class FixedWingPage : public AbstractWizardPage {
Q_OBJECT Q_OBJECT
public: public:
explicit FixedWingPage(SetupWizard *wizard, QWidget *parent = 0); explicit FixedWingPage(SetupWizard *wizard, QWidget *parent = 0);
~FixedWingPage(); ~FixedWingPage();
void initializePage(); public:
bool validatePage(); bool validatePage(SelectionItem* seletedItem);
void setupSelection(Selection *selection);
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();
}; };
#endif // FIXEDWINGPAGE_H #endif // FIXEDWINGPAGE_H

View File

@ -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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot Fixed-wing Configuration&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Please select the type of fixed-wing you want to create a configuration for below:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>

View File

@ -26,165 +26,69 @@
*/ */
#include "multipage.h" #include "multipage.h"
#include "ui_multipage.h"
#include "setupwizard.h" #include "setupwizard.h"
MultiPage::MultiPage(SetupWizard *wizard, QWidget *parent) : MultiPage::MultiPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent), SelectionPage(wizard, QString(":/configgadget/images/multirotor-shapes.svg"), parent)
ui(new Ui::MultiPage)
{ {
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() MultiPage::~MultiPage()
{ {
delete ui;
} }
void MultiPage::initializePage() bool MultiPage::validatePage(SelectionItem *selectedItem)
{ {
updateAvailableTypes(); getWizard()->setVehicleSubType((SetupWizard::VEHICLE_SUB_TYPE)selectedItem->id());
updateImageAndDescription();
}
bool MultiPage::validatePage()
{
SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt();
getWizard()->setVehicleSubType(type);
return true; return true;
} }
void MultiPage::resizeEvent(QResizeEvent *event) void MultiPage::setupSelection(Selection *selection)
{ {
Q_UNUSED(event); selection->setTitle(tr("OpenPilot Multirotor Configuration"));
if (m_multiPic) { selection->setText(tr("This part of the wizard will set up the OpenPilot controller for use with a flying platform utilizing multiple rotors. "
ui->typeGraphicsView->setSceneRect(m_multiPic->boundingRect()); "The wizard supports the most common types of multirotors. Other variants of multirotors can be configured by using custom "
ui->typeGraphicsView->fitInView(m_multiPic, Qt::KeepAspectRatio); "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. "
void MultiPage::setupMultiTypesCombo() "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("Tricopter"), SetupWizard::MULTI_ROTOR_TRI_Y); "tri",
m_descriptions << tr("The Tricopter uses three motors and one servo. The servo is used to give yaw authority to the rear motor. " SetupWizard::MULTI_ROTOR_TRI_Y);
"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."); 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 "
ui->typeCombo->addItem(tr("Quadcopter X"), SetupWizard::MULTI_ROTOR_QUAD_X); "and two counter clockwise. The motors positioned diagonal to each other rotate in the same direction. "
m_descriptions << tr("The X Quadcopter uses four motors and is the most common multi rotor configuration. Two of the motors rotate clockwise " "This setup is perfect for sport flying and is also commonly used for FPV platforms."),
"and two counter clockwise. The motors positioned diagonal to each other rotate in the same direction. " "quad-x",
"This setup is perfect for sport flying and is also commonly used for FPV platforms."); SetupWizard::MULTI_ROTOR_QUAD_X);
ui->typeCombo->addItem(tr("Quadcopter +"), SetupWizard::MULTI_ROTOR_QUAD_PLUS); selection->addItem(tr("Quadcopter +"),
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. " 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. " "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 " "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."); "for FPV since the fore rotor tend to be in the way of the camera."),
"quad-plus",
ui->typeCombo->addItem(tr("Hexacopter"), SetupWizard::MULTI_ROTOR_HEXA); SetupWizard::MULTI_ROTOR_QUAD_PLUS);
m_descriptions << tr("Hexacopter");
selection->addItem(tr("Hexacopter"),
ui->typeCombo->addItem(tr("Hexacopter X"), SetupWizard::MULTI_ROTOR_HEXA_X); tr("A multirotor with six motors, one motor in front."),
m_descriptions << tr("Hexacopter X"); "quad-hexa",
SetupWizard::MULTI_ROTOR_HEXA);
ui->typeCombo->addItem(tr("Hexacopter H"), SetupWizard::MULTI_ROTOR_HEXA_H);
m_descriptions << tr("Hexacopter H"); selection->addItem(tr("Hexacopter X"),
tr("A multirotor with six motors, two motors in front."),
ui->typeCombo->addItem(tr("Hexacopter Coax (Y6)"), SetupWizard::MULTI_ROTOR_HEXA_COAX_Y); "quad-hexa-X",
m_descriptions << tr("Hexacopter Coax (Y6)"); SetupWizard::MULTI_ROTOR_HEXA_X);
selection->addItem(tr("Hexacopter H"),
// Fredrik Arvidsson(m_thread) 2012-08-26 Disable Octos until further notice tr("A multirotor with six motors in two rows."),
/* "quad-hexa-H",
ui->typeCombo->addItem(tr("Octocopter"), SetupWizard::MULTI_ROTOR_OCTO); SetupWizard::MULTI_ROTOR_HEXA_H);
m_descriptions << tr("Octocopter");
selection->addItem(tr("Hexacopter Coax (Y6)"),
ui->typeCombo->addItem(tr("Octocopter Coax X"), SetupWizard::MULTI_ROTOR_OCTO_COAX_X); tr("A multirotor with six motors mounted in a coaxial fashion."),
m_descriptions << tr("Octocopter Coax X"); "hexa-coax",
SetupWizard::MULTI_ROTOR_HEXA_COAX_Y);
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);
} }

View File

@ -28,38 +28,18 @@
#ifndef MULTIPAGE_H #ifndef MULTIPAGE_H
#define MULTIPAGE_H #define MULTIPAGE_H
#include <QtSvg/QGraphicsSvgItem> #include "selectionpage.h"
#include <QtSvg/QSvgRenderer>
#include <QList>
#include "abstractwizardpage.h" class MultiPage : public SelectionPage {
namespace Ui {
class MultiPage;
}
class MultiPage : public AbstractWizardPage {
Q_OBJECT Q_OBJECT
public: public:
explicit MultiPage(SetupWizard *wizard, QWidget *parent = 0); explicit MultiPage(SetupWizard *wizard, QWidget *parent = 0);
~MultiPage(); virtual ~MultiPage();
void initializePage(); public:
bool validatePage(); bool validatePage(SelectionItem *selectedItem);
void setupSelection(Selection *selection);
protected:
void resizeEvent(QResizeEvent *event);
private:
Ui::MultiPage *ui;
void setupMultiTypesCombo();
QGraphicsSvgItem *m_multiPic;
void updateAvailableTypes();
QList<QString> m_descriptions;
private slots:
void updateImageAndDescription();
}; };
#endif // MULTIPAGE_H #endif // MULTIPAGE_H

View File

@ -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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot Multirotor Configuration&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Please select the type of multirotor you want to create a configuration for below:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>

View File

@ -30,7 +30,7 @@
#include "setupwizard.h" #include "setupwizard.h"
SelectionPage::SelectionPage(SetupWizard *wizard, QString shapeFile, QWidget *parent) : SelectionPage::SelectionPage(SetupWizard *wizard, QString shapeFile, QWidget *parent) :
AbstractWizardPage(wizard, parent), AbstractWizardPage(wizard, parent), Selection(),
ui(new Ui::SelectionPage) ui(new Ui::SelectionPage)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -108,12 +108,21 @@ void SelectionPage::addItem(QString name, QString description, QString shapeId,
m_selectionItems << new SelectionItem(name, description, shapeId, id); 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) : SelectionItem::SelectionItem(QString name, QString description, QString shapeId, int id) :
m_name(name), m_description(description), m_shapeId(shapeId), m_id(id) m_name(name), m_description(description), m_shapeId(shapeId), m_id(id)
{ {
} }
SelectionItem::~SelectionItem()
{
}

View File

@ -38,8 +38,7 @@ namespace Ui {
class SelectionPage; class SelectionPage;
} }
class SelectionItem : public QObject { class SelectionItem {
Q_OBJECT
public: public:
SelectionItem(QString name, QString description, QString shapeId, int id); SelectionItem(QString name, QString description, QString shapeId, int id);
~SelectionItem(); ~SelectionItem();
@ -58,11 +57,13 @@ private:
class Selection { class Selection {
public: public:
Selection() {}
virtual void addItem(QString name, QString description, QString shapeId, int id) = 0; 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 Q_OBJECT
public: public:
@ -72,7 +73,8 @@ public:
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
void addItem(QString name, QString description, QString shapeId, int id); 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 void setupSelection(Selection *selection) = 0;
virtual bool validatePage(SelectionItem *selectedItem) = 0; virtual bool validatePage(SelectionItem *selectedItem) = 0;
@ -89,8 +91,6 @@ private:
private slots: private slots:
void selectionChanged(int index); void selectionChanged(int index);
void fitImage(); void fitImage();
}; };
#endif // SUBVEHICLEPAGEPAGE_H #endif // SUBVEHICLEPAGEPAGE_H

View File

@ -16,11 +16,31 @@
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>placeholder_text</string> <string>placeholder_text</string>
</property> </property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment"> <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>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@ -56,13 +76,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text"> <property name="text">
<string>Select:</string> <string>Select:</string>
</property> </property>
@ -119,7 +132,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
@ -157,6 +170,9 @@
<property name="interactive"> <property name="interactive">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="renderHints">
<set>QPainter::Antialiasing|QPainter::HighQualityAntialiasing</set>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -78,8 +78,6 @@ FORMS += \
pages/controllerpage.ui \ pages/controllerpage.ui \
pages/vehiclepage.ui \ pages/vehiclepage.ui \
pages/notyetimplementedpage.ui \ pages/notyetimplementedpage.ui \
pages/multipage.ui \
pages/fixedwingpage.ui \
pages/helipage.ui \ pages/helipage.ui \
pages/surfacepage.ui \ pages/surfacepage.ui \
pages/inputpage.ui \ pages/inputpage.ui \