Wizard fully functional on GUI level. Right click on model slot to test.
No functionality whatsoever on the logical level! Completely harmless to run.
@@ -151,8 +151,8 @@ set(companion_SRCS
|
||||
splashlibrary.cpp
|
||||
mainwindow.cpp
|
||||
companion.cpp
|
||||
modelconfigdialog.cpp
|
||||
qcustomplot.cpp
|
||||
wizarddialog.cpp
|
||||
)
|
||||
|
||||
set(companion_MOC_HDRS
|
||||
@@ -174,9 +174,9 @@ set(companion_MOC_HDRS
|
||||
modelslist.h
|
||||
mdichild.h
|
||||
mainwindow.h
|
||||
modelconfigdialog.h
|
||||
qcustomplot.h
|
||||
helpers.h
|
||||
wizarddialog.h
|
||||
)
|
||||
|
||||
set(companion_UIS
|
||||
@@ -195,7 +195,6 @@ set(companion_UIS
|
||||
customizesplashdialog.ui
|
||||
splashlibrary.ui
|
||||
burndialog.ui
|
||||
modelconfigdialog.ui
|
||||
)
|
||||
|
||||
set(companion_RCS
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<file>images/wizard/ailerons.png</file>
|
||||
<file>images/wizard/airbrakes.png</file>
|
||||
<file>images/wizard/bank.png</file>
|
||||
<file>images/wizard/conclusion.png</file>
|
||||
<file>images/wizard/cyclic.png</file>
|
||||
<file>images/wizard/fblheli.png</file>
|
||||
<file>images/wizard/flaps.png</file>
|
||||
@@ -68,10 +69,12 @@
|
||||
<file>images/wizard/helictrl.png</file>
|
||||
<file>images/wizard/models.png</file>
|
||||
<file>images/wizard/multirotor.png</file>
|
||||
<file>images/wizard/rudder.png</file>
|
||||
<file>images/wizard/simpletail.png</file>
|
||||
<file>images/wizard/tail.png</file>
|
||||
<file>images/wizard/tails.png</file>
|
||||
<file>images/wizard/throttle.png</file>
|
||||
<file>images/wizard/wingtype.png</file>
|
||||
<file>images/library/00001.png</file>
|
||||
<file>images/library/00002.png</file>
|
||||
<file>images/library/00003.png</file>
|
||||
|
||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 15 KiB |
@@ -52,6 +52,7 @@
|
||||
#include "burndialog.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include "wizarddialog.h"
|
||||
#include <QFileInfo>
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
@@ -109,6 +110,12 @@ void MdiChild::copy()
|
||||
ui->modelsList->copy();
|
||||
}
|
||||
|
||||
void MdiChild::openWizard()
|
||||
{
|
||||
WizardDialog *wizard = new WizardDialog(this);
|
||||
wizard->show();
|
||||
}
|
||||
|
||||
void MdiChild::paste()
|
||||
{
|
||||
ui->modelsList->paste();
|
||||
@@ -145,9 +152,10 @@ void MdiChild::on_SimulateTxButton_clicked()
|
||||
startSimulation(this, radioData, -1);
|
||||
}
|
||||
|
||||
void MdiChild::OpenEditWindow(bool wizard=false)
|
||||
void MdiChild::OpenEditWindow()
|
||||
{
|
||||
int row = ui->modelsList->currentRow();
|
||||
bool wizard=false;
|
||||
|
||||
if (row) {
|
||||
//TODO error checking
|
||||
@@ -159,10 +167,9 @@ void MdiChild::OpenEditWindow(bool wizard=false)
|
||||
isNew = true; //modeledit - clear mixes, apply first template
|
||||
setModified();
|
||||
}
|
||||
if (isNew && !wizard) {
|
||||
if (isNew) {
|
||||
int ret;
|
||||
bool wizardEnable=g.enableWizard();
|
||||
if (wizardEnable) {
|
||||
if (g.enableWizard()) {
|
||||
ret = QMessageBox::question(this, tr("Companion"), tr("Do you want to use model wizard? "), QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::Yes) {
|
||||
wizard=true;
|
||||
|
||||
@@ -89,10 +89,11 @@ private slots:
|
||||
void qSleep(int ms);
|
||||
|
||||
public slots:
|
||||
void OpenEditWindow(bool wizard);
|
||||
|
||||
void OpenEditWindow();
|
||||
|
||||
void cut();
|
||||
void copy();
|
||||
void openWizard();
|
||||
void paste();
|
||||
void writeEeprom();
|
||||
void simulate();
|
||||
|
||||
@@ -1,937 +0,0 @@
|
||||
#include "modelconfigdialog.h"
|
||||
#include "ui_modelconfigdialog.h"
|
||||
#include "helpers.h"
|
||||
#include "eeprominterface.h"
|
||||
#include <QtGui>
|
||||
#include "helpers.h"
|
||||
|
||||
#define NUM_CH 10
|
||||
|
||||
modelConfigDialog::modelConfigDialog(RadioData &radioData, uint64_t * result, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::modelConfigDialog),
|
||||
radioData(radioData),
|
||||
result(result),
|
||||
generalSettings(radioData.generalSettings)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowIcon(CompanionIcon("wizard.png"));
|
||||
rxLock=false;
|
||||
ruddercolor << "#ffd100" << "#ffff00";
|
||||
throttlecolor << "#e40000";
|
||||
aileroncolor << "#0000ff" << "#00ffff";
|
||||
elevatorcolor << "#827f00" << "#ffff00";
|
||||
flapscolor << "#007f00" << "#00ff00";
|
||||
airbrakecolor << "#9b0099" << "#ff00fc";
|
||||
helicolor << "#00ff00" << "#0000ff" << "#00ffff" << "#ffff00" << "#e40000" << "#ffa400";
|
||||
connect(ui->ailType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
|
||||
connect(ui->flapsType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
|
||||
connect(ui->spoilersType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
|
||||
connect(ui->swashType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
|
||||
connect(ui->engine_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
|
||||
connect(ui->rudder_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
|
||||
connect(ui->tailType_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(tailConfigChanged()));
|
||||
connect(ui->gyro_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(tailConfigChanged()));
|
||||
connect(ui->chStyle_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(ConfigChanged()));
|
||||
connect(ui->asail2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
|
||||
connect(ui->asele2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
|
||||
connect(ui->asrud2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
|
||||
connect(ui->asfla1_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
|
||||
connect(ui->asfla2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
|
||||
connect(ui->asspo1_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
|
||||
connect(ui->asspo2_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(rxUpdate()));
|
||||
connect(ui->as_CB,SIGNAL(clicked()),this,SLOT(rxUpdate()));
|
||||
formSetup();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
connect(ui->buttonBox,SIGNAL(clicked(QAbstractButton*)), this, SLOT(doAction(QAbstractButton*)));
|
||||
}
|
||||
|
||||
modelConfigDialog::~modelConfigDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void modelConfigDialog::rxUpdate()
|
||||
{
|
||||
QLabel * channel[] = {ui->CH_1,ui->CH_2,ui->CH_3,ui->CH_4,ui->CH_5,ui->CH_6,ui->CH_7,ui->CH_8,ui->CH_9,ui->CH_10,NULL};
|
||||
for (int i=0; channel[i]; i++) {
|
||||
channel[i]->setStyleSheet("");
|
||||
}
|
||||
for (int i=0; i<NUM_CH ; i++) {
|
||||
rx[i]=false;
|
||||
}
|
||||
int index;
|
||||
if (ui->as_CB->isChecked()) {
|
||||
if ((ModelType==0) || (ModelType==2)) {
|
||||
index=ui->asail2_CB->currentIndex();
|
||||
if (ailerons>1 && index>0) {
|
||||
rx[index-1]=true;
|
||||
}
|
||||
index=ui->asele2_CB->currentIndex();
|
||||
if (elevators>1 && index>0) {
|
||||
rx[index-1]=true;
|
||||
}
|
||||
}
|
||||
if (ModelType==3) {
|
||||
index=ui->asrud2_CB->currentIndex();
|
||||
if (rudders>1 && index>0) {
|
||||
rx[index-1]=true;
|
||||
}
|
||||
}
|
||||
index=ui->asfla1_CB->currentIndex();
|
||||
if (flaps>0 && index>0) {
|
||||
rx[index-1]=true;
|
||||
}
|
||||
index=ui->asfla2_CB->currentIndex();
|
||||
if (flaps>1 && index>0) {
|
||||
rx[index-1]=true;
|
||||
}
|
||||
if ((ModelType==0) || (ModelType==2)) {
|
||||
index=ui->asspo1_CB->currentIndex();
|
||||
if (spoilers>0 && index>0) {
|
||||
rx[index-1]=true;
|
||||
}
|
||||
index=ui->asspo2_CB->currentIndex();
|
||||
if (spoilers>1 && index>0) {
|
||||
rx[index-1]=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define ICC(x) icc[(x)-1]
|
||||
uint8_t icc[4] = {0};
|
||||
for(uint8_t i=1; i<=4; i++) //generate inverse array
|
||||
for(uint8_t j=1; j<=4; j++) if(CC(i)==j) icc[j-1]=i;
|
||||
uint8_t stick;
|
||||
switch (ModelType) {
|
||||
case 0: //AIRPLANE
|
||||
stick=ICC(STK_THR);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(throttlecolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
stick=ICC(STK_RUD);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
if (ailerons>0) {
|
||||
stick=ICC(STK_AIL);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
}
|
||||
stick=ICC(STK_ELE);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
if (ailerons>1) {
|
||||
index=ui->asail2_CB->currentIndex();
|
||||
if (!ui->as_CB->isChecked())
|
||||
index=0;
|
||||
if (index==0) {
|
||||
for (int j=0; j<NUM_CH ; j++) {
|
||||
if (!rx[j]) {
|
||||
channel[j]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(1)));
|
||||
rx[j]=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(1)));
|
||||
}
|
||||
}
|
||||
if (elevators>1) {
|
||||
index=ui->asele2_CB->currentIndex();
|
||||
if (!ui->as_CB->isChecked())
|
||||
index=0;
|
||||
if (index==0) {
|
||||
for (int j=0; j<NUM_CH ; j++) {
|
||||
if (!rx[j]) {
|
||||
channel[j]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(1)));
|
||||
rx[j]=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(1)));
|
||||
}
|
||||
}
|
||||
for (uint8_t i=0; i< flaps; i++) {
|
||||
if (i==0) {
|
||||
index=ui->asfla1_CB->currentIndex();
|
||||
} else {
|
||||
index=ui->asfla2_CB->currentIndex();
|
||||
}
|
||||
if (!ui->as_CB->isChecked())
|
||||
index=0;
|
||||
if (index==0) {
|
||||
for (int j=0; j<NUM_CH ; j++) {
|
||||
if (!rx[j]) {
|
||||
channel[j]->setStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
|
||||
rx[j]=true;
|
||||
break;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1: //HELI
|
||||
switch (ui->chStyle_CB->currentIndex()) {
|
||||
case 0:
|
||||
channel[0]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(0))); //ELE CYC1
|
||||
channel[1]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(1))); //AIL CYC2
|
||||
channel[2]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(2))); //PITCH CYC3
|
||||
channel[3]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(3))); //RUD
|
||||
channel[4]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(4))); //THR
|
||||
if (ui->gyro_CB->currentIndex()>0) {
|
||||
channel[5]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(5))); //GYRO
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
channel[0]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(1))); //AIL CYC2
|
||||
channel[1]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(0))); //ELE CYC1
|
||||
channel[2]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(4))); //THR
|
||||
channel[3]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(3))); //RUD
|
||||
if (ui->gyro_CB->currentIndex()>0) {
|
||||
channel[4]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(5))); //GYRO
|
||||
}
|
||||
channel[5]->setStyleSheet(QString("background-color: %1;").arg(helicolor.at(2))); //PIT CYC3
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2: //GLIDER
|
||||
if (throttle>0) {
|
||||
stick=ICC(STK_THR);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(throttlecolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
}
|
||||
if (ailerons>0) {
|
||||
stick=ICC(STK_AIL);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
}
|
||||
stick=ICC(STK_ELE);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
stick=ICC(STK_RUD);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
if (ailerons>1) {
|
||||
index=ui->asail2_CB->currentIndex();
|
||||
if (!ui->as_CB->isChecked())
|
||||
index=0;
|
||||
if (index==0) {
|
||||
for (int j=0; j<NUM_CH ; j++) {
|
||||
if (!rx[j]) {
|
||||
channel[j]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(1)));
|
||||
rx[j]=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(1)));
|
||||
}
|
||||
}
|
||||
if (elevators>1) {
|
||||
index=ui->asele2_CB->currentIndex();
|
||||
if (!ui->as_CB->isChecked())
|
||||
index=0;
|
||||
if (index==0) {
|
||||
for (int j=0; j<NUM_CH ; j++) {
|
||||
if (!rx[j]) {
|
||||
channel[j]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(1)));
|
||||
rx[j]=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(1)));
|
||||
}
|
||||
}
|
||||
for (uint8_t i=0; i< flaps; i++) {
|
||||
if (i==0) {
|
||||
index=ui->asfla1_CB->currentIndex();
|
||||
} else {
|
||||
index=ui->asfla2_CB->currentIndex();
|
||||
}
|
||||
if (!ui->as_CB->isChecked())
|
||||
index=0;
|
||||
if (index==0) {
|
||||
for (int j=0; j<NUM_CH ; j++) {
|
||||
if (!rx[j]) {
|
||||
channel[j]->setStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
|
||||
rx[j]=true;
|
||||
break;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
|
||||
}
|
||||
}
|
||||
for (uint8_t i=0; i< spoilers; i++) {
|
||||
if (i==0) {
|
||||
index=ui->asspo1_CB->currentIndex();
|
||||
} else {
|
||||
index=ui->asspo2_CB->currentIndex();
|
||||
}
|
||||
if (!ui->as_CB->isChecked())
|
||||
index=0;
|
||||
if (index==0) {
|
||||
for (int j=0; j<NUM_CH ; j++) {
|
||||
if (!rx[j]) {
|
||||
channel[j]->setStyleSheet(QString("background-color: %1;").arg(airbrakecolor.at(i)));
|
||||
rx[j]=true;
|
||||
break;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(airbrakecolor.at(i)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3: //DELTA WING
|
||||
if (throttle>0) {
|
||||
stick=ICC(STK_THR);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(throttlecolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
}
|
||||
stick=ICC(STK_AIL);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(aileroncolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
stick=ICC(STK_ELE);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(elevatorcolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
if (rudders>0) {
|
||||
stick=ICC(STK_RUD);
|
||||
channel[stick-1]->setStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(0)));
|
||||
rx[stick-1]=true;
|
||||
}
|
||||
if (rudders>1) {
|
||||
index=ui->asrud2_CB->currentIndex();
|
||||
if (!ui->as_CB->isChecked())
|
||||
index=0;
|
||||
if (index==0) {
|
||||
for (int j=0; j<NUM_CH ; j++) {
|
||||
if (!rx[j]) {
|
||||
channel[j]->setStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(1)));
|
||||
rx[j]=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(ruddercolor.at(1)));
|
||||
}
|
||||
}
|
||||
for (uint8_t i=0; i< flaps; i++) {
|
||||
if (i==0) {
|
||||
index=ui->asfla1_CB->currentIndex();
|
||||
} else {
|
||||
index=ui->asfla2_CB->currentIndex();
|
||||
}
|
||||
if (!ui->as_CB->isChecked())
|
||||
index=0;
|
||||
if (index==0) {
|
||||
for (int j=0; j<NUM_CH ; j++) {
|
||||
if (!rx[j]) {
|
||||
channel[j]->setStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
|
||||
rx[j]=true;
|
||||
break;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
channel[index-1]->setStyleSheet(QString("background-color: %1;").arg(flapscolor.at(i)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
asUpdate();
|
||||
}
|
||||
|
||||
void modelConfigDialog::tailConfigChanged()
|
||||
{
|
||||
if (tailLock)
|
||||
return;
|
||||
tailLock=true;
|
||||
QImage image;
|
||||
int index;
|
||||
int head;
|
||||
switch (ModelType) {
|
||||
case 0:
|
||||
index=ui->tailType_CB->currentIndex();
|
||||
switch (index) {
|
||||
case 0:
|
||||
rudders=1;
|
||||
elevators=1;
|
||||
image.load(":/images/mcw/at1e1r.png");
|
||||
break;
|
||||
case 1:
|
||||
rudders=1;
|
||||
elevators=1;
|
||||
image.load(":/images/mcw/atailv.png");
|
||||
break;
|
||||
case 2:
|
||||
rudders=1;
|
||||
elevators=2;
|
||||
image.load(":/images/mcw/at2e1r.png");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
elevators=1;
|
||||
rudders=1;
|
||||
head=ui->swashType_CB->currentIndex();
|
||||
if (head==4) {
|
||||
index=ui->gyro_CB->currentIndex();
|
||||
switch (index) {
|
||||
case 0:
|
||||
image.load(":/images/mcw/htailfblng.png");
|
||||
break;
|
||||
case 1:
|
||||
image.load(":/images/mcw/htailfblg.png");
|
||||
break;
|
||||
case 2:
|
||||
image.load(":/images/mcw/htailfblg.png");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
index=ui->gyro_CB->currentIndex();
|
||||
switch (index) {
|
||||
case 0:
|
||||
image.load(":/images/mcw/htailng.png");
|
||||
break;
|
||||
case 1:
|
||||
image.load(":/images/mcw/htailg.png");
|
||||
break;
|
||||
case 2:
|
||||
image.load(":/images/mcw/htailg.png");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
index=ui->tailType_CB->currentIndex();
|
||||
switch (index) {
|
||||
case 0:
|
||||
elevators=1;
|
||||
rudders=1;
|
||||
image.load(":/images/mcw/gt1e1r.png");
|
||||
break;
|
||||
case 1:
|
||||
elevators=1;
|
||||
rudders=1;
|
||||
image.load(":/images/mcw/gtailv.png");
|
||||
break;
|
||||
case 2:
|
||||
elevators=2;
|
||||
rudders=1;
|
||||
image.load(":/images/mcw/gt2e1r.png");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
ui->tailImg->setPixmap(QPixmap::fromImage(image));
|
||||
tailLock=false;
|
||||
rxUpdate();
|
||||
}
|
||||
|
||||
void modelConfigDialog::ConfigChanged()
|
||||
{
|
||||
if (wingsLock)
|
||||
return;
|
||||
wingsLock=true;
|
||||
QImage image;
|
||||
QString imgname=":/images/mcw/";
|
||||
QStringList wimages;
|
||||
int index;
|
||||
switch (ModelType) {
|
||||
case 0:
|
||||
if (ui->ailType_CB->currentIndex()==0) {
|
||||
ui->flapsType_CB->setCurrentIndex(0);
|
||||
ui->flapsType_CB->setDisabled(true);
|
||||
} else {
|
||||
ui->flapsType_CB->setEnabled(true);
|
||||
}
|
||||
ailerons=ui->ailType_CB->currentIndex();
|
||||
flaps=ui->flapsType_CB->currentIndex();
|
||||
throttle=1;
|
||||
imgname.append(QString("aw%1a%2f.png").arg(ui->ailType_CB->currentIndex()).arg(ui->flapsType_CB->currentIndex()));
|
||||
image.load(imgname);
|
||||
ui->wingImg->setPixmap(QPixmap::fromImage(image));
|
||||
break;
|
||||
case 1:
|
||||
wimages.clear();
|
||||
wimages << "h90.png" << "h120.png" << "h120x.png" << "h140.png" << "hfbl.png";
|
||||
index=ui->swashType_CB->currentIndex();
|
||||
ui->gyroType_Label->show();
|
||||
ui->gyro_CB->show();
|
||||
ailerons=1;
|
||||
throttle=1;
|
||||
imgname.append(wimages.at(index));
|
||||
image.load(imgname);
|
||||
ui->wingImg->setPixmap(QPixmap::fromImage(image));
|
||||
tailConfigChanged();
|
||||
break;
|
||||
case 2:
|
||||
if (ui->ailType_CB->currentIndex()==0) {
|
||||
ui->flapsType_CB->setCurrentIndex(0);
|
||||
ui->flapsType_CB->setDisabled(true);
|
||||
} else {
|
||||
ui->flapsType_CB->setEnabled(true);
|
||||
}
|
||||
if (ui->ailType_CB->currentIndex()==0) {
|
||||
ui->spoilersType_CB->setCurrentIndex(0);
|
||||
ui->spoilersType_CB->setDisabled(true);
|
||||
} else {
|
||||
ui->spoilersType_CB->setEnabled(true);
|
||||
}
|
||||
ailerons=ui->ailType_CB->currentIndex();
|
||||
flaps=ui->flapsType_CB->currentIndex();
|
||||
spoilers=ui->spoilersType_CB->currentIndex();
|
||||
throttle=ui->engine_CB->currentIndex();
|
||||
imgname.append(QString("gw%1t%2a%3f%4s.png").arg(ui->engine_CB->currentIndex()).arg(ui->ailType_CB->currentIndex()).arg(ui->flapsType_CB->currentIndex()).arg(ui->spoilersType_CB->currentIndex()));
|
||||
image.load(imgname);
|
||||
ui->wingImg->setPixmap(QPixmap::fromImage(image));
|
||||
break;
|
||||
case 3:
|
||||
ailerons=ui->ailType_CB->currentIndex();
|
||||
flaps=ui->flapsType_CB->currentIndex();
|
||||
rudders=ui->rudder_CB->currentIndex();
|
||||
throttle=ui->engine_CB->currentIndex();
|
||||
imgname.append(QString("dt%1t2e%2f%3r.png").arg(ui->engine_CB->currentIndex()).arg(ui->flapsType_CB->currentIndex()).arg(ui->rudder_CB->currentIndex()));
|
||||
image.load(imgname);
|
||||
ui->wingImg->setPixmap(QPixmap::fromImage(image));
|
||||
imgname.clear();
|
||||
imgname.append(QString(":/images/mcw/db%1t2e%2f%3r.png").arg(ui->engine_CB->currentIndex()).arg(ui->flapsType_CB->currentIndex()).arg(ui->rudder_CB->currentIndex()));
|
||||
image.load(imgname);
|
||||
ui->tailImg->setPixmap(QPixmap::fromImage(image));
|
||||
break;
|
||||
default:
|
||||
ui->wingImg->clear();
|
||||
break;
|
||||
}
|
||||
wingsLock=false;
|
||||
rxUpdate();
|
||||
}
|
||||
|
||||
void modelConfigDialog::on_planeButton_clicked()
|
||||
{
|
||||
ui->planeButton->setStyleSheet("background-color: #007f00; color: white;");
|
||||
ui->heliButton->setStyleSheet("");
|
||||
ui->gliderButton->setStyleSheet("");
|
||||
ui->deltaButton->setStyleSheet("");
|
||||
ModelType=0;
|
||||
wingsLock=true;
|
||||
tailLock=true;
|
||||
ui->engine_Label->hide();
|
||||
ui->engine_CB->setCurrentIndex(0);
|
||||
ui->engine_CB->hide();
|
||||
ui->rudder_Label->hide();
|
||||
ui->rudder_CB->setCurrentIndex(0);
|
||||
ui->rudder_CB->hide();
|
||||
ui->spoilersLabel->hide();
|
||||
ui->spoilersType_CB->setCurrentIndex(0);
|
||||
ui->spoilersType_CB->hide();
|
||||
ui->spLabel->hide();
|
||||
ui->sp_Label->hide();
|
||||
ui->swashType_CB->setCurrentIndex(0);
|
||||
ui->swashType_CB->hide();
|
||||
ui->gyroType_Label->hide();
|
||||
ui->gyro_CB->setCurrentIndex(0);
|
||||
ui->gyro_CB->hide();
|
||||
ui->chStyle_CB->hide();
|
||||
ui->chStyle_CB->setCurrentIndex(0);
|
||||
ui->chassign_Label->hide();
|
||||
ui->wingLabel->show();
|
||||
ui->ailType_Label->show();
|
||||
ui->ailType_CB->show();
|
||||
ui->ailType_CB->setCurrentIndex(0);
|
||||
ui->tailLabel->show();
|
||||
ui->tailType_Label->show();
|
||||
ui->tailType_CB->show();
|
||||
ui->tailType_CB->setCurrentIndex(0);
|
||||
ui->flapsType_Label->show();
|
||||
ui->flapsType_CB->show();
|
||||
ui->flapsType_CB->setCurrentIndex(0);
|
||||
ui->flapsType_CB->setDisabled(true);
|
||||
ui->planeButton->setDisabled(true);
|
||||
ui->heliButton->setEnabled(true);
|
||||
ui->gliderButton->setEnabled(true);
|
||||
ui->deltaButton->setEnabled(true);
|
||||
wingsLock=false;
|
||||
tailLock=false;
|
||||
resetControls();
|
||||
ConfigChanged();
|
||||
tailConfigChanged();
|
||||
}
|
||||
|
||||
void modelConfigDialog::on_heliButton_clicked()
|
||||
{
|
||||
ui->planeButton->setStyleSheet("");
|
||||
ui->heliButton->setStyleSheet("background-color: #007f00; color: white;");
|
||||
ui->gliderButton->setStyleSheet("");
|
||||
ui->deltaButton->setStyleSheet("");
|
||||
ModelType=1;
|
||||
wingsLock=true;
|
||||
tailLock=true;
|
||||
ui->engine_Label->hide();
|
||||
ui->engine_CB->setCurrentIndex(0);
|
||||
ui->engine_CB->hide();
|
||||
ui->rudder_Label->hide();
|
||||
ui->rudder_CB->setCurrentIndex(0);
|
||||
ui->rudder_CB->hide();
|
||||
ui->wingLabel->hide();
|
||||
ui->ailType_Label->hide();
|
||||
ui->ailType_CB->hide();
|
||||
ui->ailType_CB->setCurrentIndex(0);
|
||||
ui->tailType_Label->hide();
|
||||
ui->tailType_CB->hide();
|
||||
ui->tailType_CB->setCurrentIndex(0);
|
||||
ui->flapsType_Label->hide();
|
||||
ui->flapsType_CB->hide();
|
||||
ui->flapsType_CB->setCurrentIndex(0);
|
||||
ui->flapsType_CB->setDisabled(true);
|
||||
ui->spoilersLabel->hide();
|
||||
ui->spoilersType_CB->setCurrentIndex(0);
|
||||
ui->spoilersType_CB->hide();
|
||||
ui->tailLabel->show();
|
||||
ui->spLabel->show();
|
||||
ui->sp_Label->show();
|
||||
ui->swashType_CB->setCurrentIndex(0);
|
||||
ui->swashType_CB->show();
|
||||
ui->gyroType_Label->show();
|
||||
ui->gyro_CB->setCurrentIndex(0);
|
||||
ui->gyro_CB->show();
|
||||
ui->chStyle_CB->show();
|
||||
ui->chStyle_CB->setCurrentIndex(0);
|
||||
ui->chassign_Label->show();
|
||||
ui->planeButton->setEnabled(true);
|
||||
ui->heliButton->setDisabled(true);
|
||||
ui->gliderButton->setEnabled(true);
|
||||
ui->deltaButton->setEnabled(true);
|
||||
wingsLock=false;
|
||||
tailLock=false;
|
||||
resetControls();
|
||||
ConfigChanged();
|
||||
tailConfigChanged();
|
||||
}
|
||||
|
||||
void modelConfigDialog::on_gliderButton_clicked()
|
||||
{
|
||||
ui->planeButton->setStyleSheet("");
|
||||
ui->heliButton->setStyleSheet("");
|
||||
ui->gliderButton->setStyleSheet("background-color: #007f00; color: white;");
|
||||
ui->deltaButton->setStyleSheet("");
|
||||
ModelType=2;
|
||||
wingsLock=true;
|
||||
tailLock=true;
|
||||
ui->rudder_Label->hide();
|
||||
ui->rudder_CB->setCurrentIndex(0);
|
||||
ui->rudder_CB->hide();
|
||||
ui->spLabel->hide();
|
||||
ui->sp_Label->hide();
|
||||
ui->swashType_CB->setCurrentIndex(0);
|
||||
ui->swashType_CB->hide();
|
||||
ui->gyroType_Label->hide();
|
||||
ui->gyro_CB->setCurrentIndex(0);
|
||||
ui->gyro_CB->hide();
|
||||
ui->chStyle_CB->hide();
|
||||
ui->chStyle_CB->setCurrentIndex(0);
|
||||
ui->chassign_Label->hide();
|
||||
ui->wingLabel->show();
|
||||
ui->engine_Label->show();
|
||||
ui->engine_CB->setCurrentIndex(0);
|
||||
ui->engine_CB->show();
|
||||
ui->ailType_Label->show();
|
||||
ui->ailType_CB->show();
|
||||
ui->ailType_CB->setCurrentIndex(0);
|
||||
ui->tailLabel->show();
|
||||
ui->tailType_Label->show();
|
||||
ui->tailType_CB->show();
|
||||
ui->tailType_CB->setCurrentIndex(0);
|
||||
ui->flapsType_Label->show();
|
||||
ui->flapsType_CB->show();
|
||||
ui->flapsType_CB->setCurrentIndex(0);
|
||||
ui->flapsType_CB->setDisabled(true);
|
||||
ui->spoilersLabel->show();
|
||||
ui->spoilersType_CB->setCurrentIndex(0);
|
||||
ui->spoilersType_CB->setDisabled(true);
|
||||
ui->spoilersType_CB->show();
|
||||
ui->planeButton->setEnabled(true);
|
||||
ui->heliButton->setEnabled(true);
|
||||
ui->gliderButton->setDisabled(true);
|
||||
ui->deltaButton->setEnabled(true);
|
||||
wingsLock=false;
|
||||
tailLock=false;
|
||||
resetControls();
|
||||
ConfigChanged();
|
||||
tailConfigChanged();
|
||||
}
|
||||
|
||||
void modelConfigDialog::on_deltaButton_clicked()
|
||||
{
|
||||
ui->planeButton->setStyleSheet("");
|
||||
ui->heliButton->setStyleSheet("");
|
||||
ui->gliderButton->setStyleSheet("");
|
||||
ui->deltaButton->setStyleSheet("background-color: #007f00; color: white;");
|
||||
ModelType=3;
|
||||
wingsLock=true;
|
||||
tailLock=true;
|
||||
ui->spLabel->hide();
|
||||
ui->sp_Label->hide();
|
||||
ui->swashType_CB->setCurrentIndex(0);
|
||||
ui->swashType_CB->hide();
|
||||
ui->gyroType_Label->hide();
|
||||
ui->gyro_CB->setCurrentIndex(0);
|
||||
ui->gyro_CB->hide();
|
||||
ui->chStyle_CB->hide();
|
||||
ui->chStyle_CB->setCurrentIndex(0);
|
||||
ui->chassign_Label->hide();
|
||||
ui->ailType_Label->hide();
|
||||
ui->ailType_CB->hide();
|
||||
ui->ailType_CB->setCurrentIndex(0);
|
||||
ui->tailLabel->hide();
|
||||
ui->tailType_Label->hide();
|
||||
ui->tailType_CB->hide();
|
||||
ui->tailType_CB->setCurrentIndex(0);
|
||||
ui->spoilersLabel->hide();
|
||||
ui->spoilersType_CB->setCurrentIndex(0);
|
||||
ui->spoilersType_CB->hide();
|
||||
ui->engine_Label->show();
|
||||
ui->engine_CB->setCurrentIndex(0);
|
||||
ui->engine_CB->show();
|
||||
ui->rudder_Label->show();
|
||||
ui->rudder_CB->setCurrentIndex(0);
|
||||
ui->rudder_CB->show();
|
||||
ui->wingLabel->show();
|
||||
ui->flapsType_Label->show();
|
||||
ui->flapsType_CB->show();
|
||||
ui->flapsType_CB->setCurrentIndex(0);
|
||||
ui->flapsType_CB->setEnabled(true);
|
||||
ui->planeButton->setEnabled(true);
|
||||
ui->heliButton->setEnabled(true);
|
||||
ui->gliderButton->setEnabled(true);
|
||||
ui->deltaButton->setDisabled(true);
|
||||
wingsLock=false;
|
||||
tailLock=false;
|
||||
resetControls();
|
||||
ConfigChanged();
|
||||
}
|
||||
|
||||
|
||||
void modelConfigDialog::formSetup()
|
||||
{
|
||||
on_planeButton_clicked();
|
||||
}
|
||||
|
||||
void modelConfigDialog::resetControls() {
|
||||
ailerons=0;
|
||||
rudders=0;
|
||||
throttle=0;
|
||||
elevators=0;
|
||||
spoilers=0;
|
||||
flaps=0;
|
||||
}
|
||||
|
||||
|
||||
void modelConfigDialog::shrink()
|
||||
{
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
void modelConfigDialog::doAction(QAbstractButton *button)
|
||||
{
|
||||
if ( ui->buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) {
|
||||
int res = QMessageBox::question(this,tr("Apply configuration ?"),tr("Apply configuration deleting existing model ?"),QMessageBox::Yes | QMessageBox::No);
|
||||
if(res==QMessageBox::Yes) {
|
||||
uint64_t tmp=0;
|
||||
tmp=ModelType;
|
||||
tmp <<=2;
|
||||
tmp |= ui->engine_CB->currentIndex();
|
||||
tmp <<=2;
|
||||
tmp |= ui->ailType_CB->currentIndex();
|
||||
tmp <<=2;
|
||||
tmp |= ui->flapsType_CB->currentIndex();
|
||||
tmp <<=2;
|
||||
tmp |= ui->spoilersType_CB->currentIndex();
|
||||
tmp <<=2;
|
||||
tmp |= ui->rudder_CB->currentIndex();
|
||||
tmp <<=3;
|
||||
tmp |= ui->swashType_CB->currentIndex();
|
||||
tmp <<=2;
|
||||
tmp |= ui->tailType_CB->currentIndex();
|
||||
tmp <<=2;
|
||||
tmp |= ui->gyro_CB->currentIndex();
|
||||
tmp <<=2;
|
||||
tmp |= ui->chStyle_CB->currentIndex();
|
||||
if (ui->as_CB->isChecked()) {
|
||||
tmp <<=4;
|
||||
tmp |= ui->asail2_CB->currentIndex();
|
||||
tmp <<=4;
|
||||
tmp |= ui->asele2_CB->currentIndex();
|
||||
tmp <<=4;
|
||||
tmp |= ui->asrud2_CB->currentIndex();
|
||||
tmp <<=4;
|
||||
tmp |= ui->asfla1_CB->currentIndex();
|
||||
tmp <<=4;
|
||||
tmp |= ui->asfla2_CB->currentIndex();
|
||||
tmp <<=4;
|
||||
tmp |= ui->asspo1_CB->currentIndex();
|
||||
tmp <<=4;
|
||||
tmp |= ui->asspo2_CB->currentIndex();
|
||||
} else {
|
||||
tmp <<=28;
|
||||
}
|
||||
*result=tmp;
|
||||
}
|
||||
}
|
||||
this->close();
|
||||
}
|
||||
|
||||
void modelConfigDialog::asUpdate()
|
||||
{
|
||||
if (rxLock==true)
|
||||
return;
|
||||
rxLock=true;
|
||||
QVariant v(1 | 32);
|
||||
int i;
|
||||
//disable default channels used
|
||||
for (i=0; i<4; i++ ) {
|
||||
if (rx[i]) {
|
||||
ui->asail2_CB->setItemData(i+1,false, Qt::UserRole - 1);
|
||||
ui->asele2_CB->setItemData(i+1,false, Qt::UserRole - 1);
|
||||
ui->asrud2_CB->setItemData(i+1,false, Qt::UserRole - 1);
|
||||
ui->asfla1_CB->setItemData(i+1,false, Qt::UserRole - 1);
|
||||
ui->asfla2_CB->setItemData(i+1,false, Qt::UserRole - 1);
|
||||
ui->asspo1_CB->setItemData(i+1,false, Qt::UserRole - 1);
|
||||
ui->asspo2_CB->setItemData(i+1,false, Qt::UserRole - 1);
|
||||
} else {
|
||||
ui->asail2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asele2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asrud2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asfla1_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asfla2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asspo1_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asspo2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
}
|
||||
}
|
||||
for (i=4; i<NUM_CH; i++ ) {
|
||||
ui->asail2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asele2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asrud2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asfla1_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asfla2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asspo1_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
ui->asspo2_CB->setItemData(i+1,v, Qt::UserRole-1);
|
||||
}
|
||||
|
||||
i=ui->asail2_CB->currentIndex();
|
||||
if (i>0) {
|
||||
ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
}
|
||||
i=ui->asrud2_CB->currentIndex();
|
||||
if (i>0) {
|
||||
ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
}
|
||||
i=ui->asele2_CB->currentIndex();
|
||||
if (i>0) {
|
||||
ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
}
|
||||
i=ui->asfla1_CB->currentIndex();
|
||||
if (i>0) {
|
||||
ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
}
|
||||
i=ui->asfla2_CB->currentIndex();
|
||||
if (i>0) {
|
||||
ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
}
|
||||
i=ui->asspo1_CB->currentIndex();
|
||||
if (i>0) {
|
||||
ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
}
|
||||
i=ui->asspo2_CB->currentIndex();
|
||||
if (i>0) {
|
||||
ui->asail2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asele2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asrud2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asfla2_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
ui->asspo1_CB->setItemData(i,false, Qt::UserRole - 1);
|
||||
}
|
||||
|
||||
if (ailerons>1 && ui->as_CB->isChecked()) {
|
||||
ui->asail2_label->show();
|
||||
ui->asail2_CB->show();
|
||||
} else {
|
||||
ui->asail2_label->hide();
|
||||
ui->asail2_CB->hide();
|
||||
}
|
||||
if (elevators>1 && ui->as_CB->isChecked()) {
|
||||
ui->asele2_label->show();
|
||||
ui->asele2_CB->show();
|
||||
} else {
|
||||
ui->asele2_label->hide();
|
||||
ui->asele2_CB->hide();
|
||||
}
|
||||
if (rudders>1 && ui->as_CB->isChecked()) {
|
||||
ui->asrud2_label->show();
|
||||
ui->asrud2_CB->show();
|
||||
} else {
|
||||
ui->asrud2_label->hide();
|
||||
ui->asrud2_CB->hide();
|
||||
}
|
||||
if (flaps>0 && ui->as_CB->isChecked()) {
|
||||
ui->asfla1_label->show();
|
||||
ui->asfla1_CB->show();
|
||||
} else {
|
||||
ui->asfla1_label->hide();
|
||||
ui->asfla1_CB->hide();
|
||||
}
|
||||
if (flaps>1 && ui->as_CB->isChecked()) {
|
||||
ui->asfla2_label->show();
|
||||
ui->asfla2_CB->show();
|
||||
} else {
|
||||
ui->asfla2_label->hide();
|
||||
ui->asfla2_CB->hide();
|
||||
}
|
||||
if (spoilers>0 && ui->as_CB->isChecked()) {
|
||||
ui->asspo1_label->show();
|
||||
ui->asspo1_CB->show();
|
||||
} else {
|
||||
ui->asspo1_label->hide();
|
||||
ui->asspo1_CB->hide();
|
||||
}
|
||||
if (spoilers>1 && ui->as_CB->isChecked()) {
|
||||
ui->asspo2_label->show();
|
||||
ui->asspo2_CB->show();
|
||||
} else {
|
||||
ui->asspo2_label->hide();
|
||||
ui->asspo2_CB->hide();
|
||||
}
|
||||
rxLock=false;
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
#ifndef MODELCONFIGDIALOG_H
|
||||
#define MODELCONFIGDIALOG_H
|
||||
#include "eeprominterface.h"
|
||||
#include <QDialog>
|
||||
#include <QtGui>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class modelConfigDialog;
|
||||
}
|
||||
|
||||
class modelConfigDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
modelConfigDialog(RadioData &radioData, uint64_t * result, QWidget *parent = 0);
|
||||
~modelConfigDialog();
|
||||
|
||||
private:
|
||||
Ui::modelConfigDialog *ui;
|
||||
bool wingsLock;
|
||||
bool tailLock;
|
||||
bool rxLock;
|
||||
int ModelType;
|
||||
RadioData &radioData;
|
||||
uint64_t * result;
|
||||
GeneralSettings generalSettings;
|
||||
QStringList ruddercolor;
|
||||
QStringList aileroncolor;
|
||||
QStringList elevatorcolor;
|
||||
QStringList throttlecolor;
|
||||
QStringList flapscolor;
|
||||
QStringList airbrakecolor;
|
||||
QStringList helicolor;
|
||||
bool rx[10];
|
||||
unsigned int ailerons;
|
||||
unsigned int rudders;
|
||||
unsigned int throttle;
|
||||
unsigned int elevators;
|
||||
unsigned int spoilers;
|
||||
unsigned int flaps;
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
void ConfigChanged();
|
||||
void tailConfigChanged();
|
||||
void rxUpdate();
|
||||
void resetControls();
|
||||
void on_planeButton_clicked();
|
||||
void on_heliButton_clicked();
|
||||
void on_gliderButton_clicked();
|
||||
void on_deltaButton_clicked();
|
||||
void formSetup();
|
||||
void asUpdate();
|
||||
void shrink();
|
||||
void doAction(QAbstractButton *button);
|
||||
};
|
||||
|
||||
#endif // MODELCONFIGDIALOG_H
|
||||
@@ -105,12 +105,12 @@ void ModelsListWidget::ShowContextMenu(const QPoint& pos)
|
||||
|
||||
void ModelsListWidget::OpenEditWindow()
|
||||
{
|
||||
((MdiChild *)parent())->OpenEditWindow(false);
|
||||
((MdiChild *)parent())->OpenEditWindow();
|
||||
}
|
||||
|
||||
void ModelsListWidget::OpenWizard()
|
||||
{
|
||||
((MdiChild *)parent())->OpenEditWindow(true);
|
||||
((MdiChild *)parent())->openWizard();
|
||||
}
|
||||
|
||||
void ModelsListWidget::LoadBackup()
|
||||
@@ -229,6 +229,7 @@ void ModelsListWidget::dropEvent(QDropEvent *event)
|
||||
|
||||
// QMessageBox::warning(this, tr("Companion"),tr("Index :%1").arg(row));
|
||||
const QMimeData *mimeData = event->mimeData();
|
||||
|
||||
if(mimeData->hasFormat("application/x-companion"))
|
||||
{
|
||||
QByteArray gmData = mimeData->data("application/x-companion");
|
||||
|
||||
@@ -0,0 +1,416 @@
|
||||
#include <QtGui>
|
||||
#include "wizarddialog.h"
|
||||
|
||||
WizardDialog::WizardDialog(QWidget *parent)
|
||||
: QWizard(parent)
|
||||
{
|
||||
setWindowTitle(tr("Model Wizard"));
|
||||
|
||||
setPage(Page_Models, new ModelSelectionPage(this, "models",tr("Model Type"),tr("Enter model name and model type.")));
|
||||
setPage(Page_Throttle, new ThrottlePage(this, "throttle",tr("Throttle"),tr("Has your model got a motor or an engine?"), Page_Wingtypes));
|
||||
setPage(Page_Wingtypes, new WingtypeSelectionPage(this, "wingtype",tr("Wing Type"),tr("Is your model a flying wing/deltawing or has it a standard wing configuration?")));
|
||||
setPage(Page_Ailerons, new AileronsPage(this, "ailerons",tr("Ailerons"),tr("Has your model got ailerons?"), Page_Flaps));
|
||||
setPage(Page_Flaps, new FlapsPage(this, "flaps",tr("Flaps"),tr("Has your model got flaps?"), Page_Airbrakes));
|
||||
setPage(Page_Airbrakes, new AirbreaksPage(this, "airbrakes",tr("Airbrakes"),tr("Has your model got airbrakes?"), Page_Tails));
|
||||
setPage(Page_Bank, new BankPage(this, "bank",tr("Flying-wing / Delta-wing"),tr("Are the elevons controlled by servos connected to separate channels or by a single servo channel?"), Page_Rudder));
|
||||
setPage(Page_Rudder, new RudderPage(this, "rudder",tr("Rudder"),tr("Does your model have a rudder?"), Page_Conclusion));
|
||||
setPage(Page_Tails, new TailSelectionPage(this, "tails",tr("Tail Type"),tr("Select which type of tail your model is equiped with.")));
|
||||
setPage(Page_Tail, new TailPage(this, "tail",tr("Tail"),tr("Select channels for tail control."), Page_Conclusion));
|
||||
setPage(Page_Simpletail, new SimpleTailPage(this, "simpletail",tr("Tail"),tr("Select elevator channel."), Page_Conclusion));
|
||||
setPage(Page_Cyclic, new CyclicPage(this, "cyclic",tr("Cyclic"),tr("Which type of swash control is installed in your helicopter?"), Page_Gyro));
|
||||
setPage(Page_Gyro, new GyroPage(this, "gyro",tr("Tail Gyro"),tr("Has your helicopter got an adjustable gyro for the tail?"), Page_Flybar));
|
||||
setPage(Page_Flybar, new FlybarSelectionPage(this, "flybar",tr("Rotor Type"),tr("Has your helicopter got a flybar?")));
|
||||
setPage(Page_Fblheli, new FblPage(this, "fblheli",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Conclusion));
|
||||
setPage(Page_Helictrl, new HeliPage(this, "helictrl",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Conclusion));
|
||||
setPage(Page_Multirotor, new MultirotorPage(this, "multirotor",tr("Multirotor"),tr("Select the control channels for your multirotor"), Page_Conclusion));
|
||||
setPage(Page_Conclusion, new ConclusionPage(this, "conclusion",tr("Save Changes"),tr(
|
||||
"Your model should now be set up. You now have to manually check the direction of each control surface and reverse the channels that "
|
||||
"make controls move in the wrong direction.<br><br>Remove the propeller/propellers before you try to control your model for the first time.<br><br>"
|
||||
"Please note that continuing removes all old model settings!"), -1));
|
||||
|
||||
setStartId(Page_Models);
|
||||
|
||||
#ifndef Q_WS_MAC
|
||||
setWizardStyle(ModernStyle);
|
||||
#endif
|
||||
setOption(HaveHelpButton, true);
|
||||
connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
|
||||
}
|
||||
|
||||
void WizardDialog::showHelp()
|
||||
{
|
||||
QString message;
|
||||
|
||||
switch (currentId()) {
|
||||
case Page_Models: message = tr("Select the type of model you want to create settings for."); break;
|
||||
case Page_Throttle: message = tr("Select the receiver channel that is connected to your ESC or throttle servo."); break;
|
||||
case Page_Wingtypes: message = tr("The wing control surfaces of flying wings and delta winged aircraft are called elevons and are used for controlling both elevation and roll. "
|
||||
"These aircrafts do not have a tail with control surfaces"); break;
|
||||
case Page_Ailerons: message = tr("One or two channels are used to control the Ailerons. "
|
||||
"If your servos are connected by a common Y-cable you should select the single-servo option."); break;
|
||||
case Page_Flaps: message = tr("This wizard assumes that your flaps are controlled by a switch. "
|
||||
"If your flaps are controlled by a potentiometer you can change that manually later."
|
||||
"Just select the correct receiver channel and an arbitrary switch."); break;
|
||||
case Page_Airbrakes: message = tr("Air brakes are used to reduce the speed of advanced sail planes. "
|
||||
"It is very uncommon on other types of planes."); break;
|
||||
case Page_Bank: message = tr("Please note that, even if the elevons are controlled by separate servos, "
|
||||
"these may be controlled by a common channel."); break;
|
||||
case Page_Rudder: message = tr("TBD."); break;
|
||||
case Page_Tails: message = tr("Select the tail type of your plane."); break;
|
||||
case Page_Tail: message = tr("TBD."); break;
|
||||
case Page_Simpletail: message = tr("TBD."); break;
|
||||
case Page_Flybar: message = tr("TBD."); break;
|
||||
case Page_Cyclic: message = tr("TBD."); break;
|
||||
case Page_Gyro: message = tr("TBD."); break;
|
||||
case Page_Fblheli: message = tr("TBD."); break;
|
||||
case Page_Helictrl: message = tr("TBD."); break;
|
||||
case Page_Multirotor: message = tr("TBD."); break;
|
||||
case Page_Conclusion: message = tr("TBD."); break;
|
||||
default: message = tr("Move on. Nothin to see here.");
|
||||
}
|
||||
QMessageBox::information(this, tr("Model Wizard Help"), message);
|
||||
}
|
||||
|
||||
StandardPage::StandardPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: QWizardPage()
|
||||
{
|
||||
pageFollower = nextPage;
|
||||
wizardDialog = dlg;
|
||||
|
||||
setTitle(title);
|
||||
setPixmap(QWizard::WatermarkPixmap, QPixmap(QString(":/images/wizard/") + image + QString(".png")));
|
||||
topLabel = new QLabel(text+"<br>");
|
||||
topLabel->setWordWrap(true);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addWidget(topLabel);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
int StandardPage::nextId() const
|
||||
{
|
||||
return pageFollower;
|
||||
}
|
||||
|
||||
ModelSelectionPage::ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text)
|
||||
: StandardPage(dlg, image, title, text)
|
||||
{
|
||||
nameLineEdit = new QLineEdit;
|
||||
planeRB = new QRadioButton(tr("Plane"));
|
||||
planeRB->setChecked(true);
|
||||
multirotorRB = new QRadioButton(tr("Multirotor"));
|
||||
helicopterRB = new QRadioButton(tr("Helicopter"));
|
||||
|
||||
registerField("evaluate.name*", nameLineEdit);
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(new QLabel(tr("Model Name:")));
|
||||
l->addWidget(nameLineEdit);
|
||||
l->addWidget(new QLabel(""));
|
||||
l->addWidget(new QLabel(tr("Model Type:")));
|
||||
l->addWidget(planeRB);
|
||||
l->addWidget(multirotorRB);
|
||||
l->addWidget(helicopterRB);
|
||||
}
|
||||
|
||||
int ModelSelectionPage::nextId() const
|
||||
{
|
||||
if (helicopterRB->isChecked())
|
||||
return WizardDialog::Page_Cyclic;
|
||||
else if (multirotorRB->isChecked())
|
||||
return WizardDialog::Page_Multirotor;
|
||||
else
|
||||
return WizardDialog::Page_Throttle;
|
||||
}
|
||||
|
||||
WingtypeSelectionPage::WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text)
|
||||
: StandardPage(dlg, image, title, text)
|
||||
{
|
||||
standardWingRB = new QRadioButton(tr("Standard Wing"));
|
||||
standardWingRB->setChecked(true);
|
||||
deltaWingRB = new QRadioButton(tr("Flying Wing / Deltawing"));
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(standardWingRB);
|
||||
l->addWidget(deltaWingRB);
|
||||
}
|
||||
|
||||
int WingtypeSelectionPage::nextId() const
|
||||
{
|
||||
if (deltaWingRB->isChecked())
|
||||
return WizardDialog::Page_Bank;
|
||||
else
|
||||
return WizardDialog::Page_Ailerons;
|
||||
}
|
||||
|
||||
TailSelectionPage::TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text)
|
||||
: StandardPage(dlg, image, title, text)
|
||||
{
|
||||
standardTailRB = new QRadioButton(tr("Elevator and Rudder"));
|
||||
standardTailRB->setChecked(true);
|
||||
simpleTailRB = new QRadioButton(tr("Only Elevator"));
|
||||
vTailRB = new QRadioButton(tr("V-tail"));
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(new QLabel(tr("Tail Type:")));
|
||||
l->addWidget(standardTailRB);
|
||||
l->addWidget(simpleTailRB);
|
||||
l->addWidget(vTailRB);
|
||||
}
|
||||
|
||||
int TailSelectionPage::nextId() const
|
||||
{
|
||||
if (simpleTailRB->isChecked())
|
||||
return WizardDialog::Page_Simpletail;
|
||||
else
|
||||
return WizardDialog::Page_Tail;
|
||||
}
|
||||
|
||||
FlybarSelectionPage::FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text)
|
||||
: StandardPage(dlg, image, title, text)
|
||||
{
|
||||
flybarRB = new QRadioButton(tr("Has Flybar"));
|
||||
flybarRB->setChecked(true);
|
||||
noFlybarRB = new QRadioButton(tr("Flybarless"));
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(new QLabel(tr("Flybar:")));
|
||||
l->addWidget(flybarRB);
|
||||
l->addWidget(noFlybarRB);
|
||||
}
|
||||
|
||||
int FlybarSelectionPage::nextId() const
|
||||
{
|
||||
if (flybarRB->isChecked())
|
||||
return WizardDialog::Page_Helictrl;
|
||||
else
|
||||
return WizardDialog::Page_Fblheli;
|
||||
}
|
||||
|
||||
ThrottlePage::ThrottlePage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
motorRB = new QRadioButton(tr("Yes"));
|
||||
noMotorRB = new QRadioButton(tr("No"));
|
||||
motorRB->setChecked(true);
|
||||
throttleCB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(motorRB);
|
||||
l->addWidget(noMotorRB);
|
||||
l->addWidget(new QLabel(tr("<br>Throttle Channel:")));
|
||||
l->addWidget(throttleCB);
|
||||
}
|
||||
|
||||
AileronsPage::AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
noAileronsRB = new QRadioButton(tr("No"));
|
||||
oneAileronRB = new QRadioButton(tr("Yes, controlled by a single channel"));
|
||||
twoAileronsRB = new QRadioButton(tr("Yes, controlled by two channels"));
|
||||
noAileronsRB->setChecked(true);
|
||||
aileron1CB = new QComboBox();
|
||||
aileron2CB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(noAileronsRB);
|
||||
l->addWidget(oneAileronRB);
|
||||
l->addWidget(twoAileronsRB);
|
||||
l->addWidget(new QLabel(tr("<br>First Aileron Channel:")));
|
||||
l->addWidget(aileron1CB);
|
||||
l->addWidget(new QLabel(tr("Second Aileron Channel:")));
|
||||
l->addWidget(aileron2CB);
|
||||
}
|
||||
|
||||
FlapsPage::FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
noFlapsRB = new QRadioButton(tr("No"));
|
||||
oneFlapRB = new QRadioButton(tr("Yes, controlled by a single channel"));
|
||||
twoFlapsRB = new QRadioButton(tr("Yes, controlled by two channels"));
|
||||
noFlapsRB->setChecked(true);
|
||||
flap1CB = new QComboBox();
|
||||
flap2CB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(noFlapsRB);
|
||||
l->addWidget(oneFlapRB);
|
||||
l->addWidget(twoFlapsRB);
|
||||
l->addWidget(new QLabel(tr("<br>First Flap Channel:")));
|
||||
l->addWidget(flap1CB);
|
||||
l->addWidget(new QLabel(tr("Second Flap Channel:")));
|
||||
l->addWidget(flap2CB);
|
||||
}
|
||||
|
||||
AirbreaksPage::AirbreaksPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
noAirbreaksRB = new QRadioButton(tr("No"));
|
||||
oneAirbreakRB = new QRadioButton(tr("Yes, controlled by a single channel"));
|
||||
twoAirbreaksRB = new QRadioButton(tr("Yes, controlled by two channels"));
|
||||
noAirbreaksRB->setChecked(true);
|
||||
airbreak1CB = new QComboBox();
|
||||
airbreak2CB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(noAirbreaksRB);
|
||||
l->addWidget(oneAirbreakRB);
|
||||
l->addWidget(twoAirbreaksRB);
|
||||
l->addWidget(new QLabel(tr("<br>First Airbreak Channel:")));
|
||||
l->addWidget(airbreak1CB);
|
||||
l->addWidget(new QLabel(tr("Second Airbreak Channel:")));
|
||||
l->addWidget(airbreak2CB);
|
||||
}
|
||||
|
||||
BankPage::BankPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
oneElevonChRB = new QRadioButton(tr("One"));
|
||||
oneElevonChRB->setChecked(true);
|
||||
twoElevonsChRB = new QRadioButton(tr("Two"));
|
||||
elevon1CB = new QComboBox();
|
||||
elevon2CB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(oneElevonChRB);
|
||||
l->addWidget(twoElevonsChRB);
|
||||
l->addWidget(new QLabel(tr("<br>First Elevon Channel:")));
|
||||
l->addWidget(elevon1CB);
|
||||
l->addWidget(new QLabel(tr("Second Elevon Channel:")));
|
||||
l->addWidget(elevon2CB);
|
||||
}
|
||||
RudderPage::RudderPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
noRudderRB = new QRadioButton(tr("No"));
|
||||
noRudderRB->setChecked(true);
|
||||
hasRudderRB = new QRadioButton(tr("Yes"));
|
||||
rudderCB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(noRudderRB);
|
||||
l->addWidget(hasRudderRB);
|
||||
l->addWidget(new QLabel(tr("<br>Rudder Channel:")));
|
||||
l->addWidget(rudderCB);
|
||||
}
|
||||
|
||||
TailPage::TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
elevatorCB = new QComboBox();
|
||||
rudderCB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(new QLabel(tr("Rudder Channel:")));
|
||||
l->addWidget(rudderCB);
|
||||
l->addWidget(new QLabel(tr("Elevator Channel:")));
|
||||
l->addWidget(elevatorCB);
|
||||
}
|
||||
|
||||
SimpleTailPage::SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
elevatorCB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(new QLabel(tr("Elevator Channel:")));
|
||||
l->addWidget(elevatorCB);
|
||||
}
|
||||
|
||||
CyclicPage::CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
cyclic90RB = new QRadioButton(tr("90"));
|
||||
cyclic90RB->setChecked(true);
|
||||
cyclic120RB = new QRadioButton(tr("120"));
|
||||
cyclic120XRB = new QRadioButton(tr("120x"));
|
||||
cyclic140RB = new QRadioButton(tr("140"));
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(cyclic90RB);
|
||||
l->addWidget(cyclic120RB);
|
||||
l->addWidget(cyclic120XRB);
|
||||
l->addWidget(cyclic140RB);
|
||||
}
|
||||
|
||||
GyroPage::GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
noGyroRB = new QRadioButton(tr("No"));
|
||||
noGyroRB->setChecked(true);
|
||||
switchGyroRB = new QRadioButton(tr("Yes, controled by a switch"));
|
||||
potGyroRB = new QRadioButton(tr("Yes, controlled by a pot"));
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(noGyroRB);
|
||||
l->addWidget(switchGyroRB);
|
||||
l->addWidget(potGyroRB);
|
||||
}
|
||||
|
||||
FblPage::FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
throttleCB = new QComboBox();
|
||||
yawCB = new QComboBox();
|
||||
pitchCB = new QComboBox();
|
||||
rollCB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(new QLabel(tr("Trottle Channel:")));
|
||||
l->addWidget(throttleCB);
|
||||
l->addWidget(new QLabel(tr("Yaw Channel:")));
|
||||
l->addWidget(yawCB);
|
||||
l->addWidget(new QLabel(tr("Pitch Channel:")));
|
||||
l->addWidget(pitchCB);
|
||||
l->addWidget(new QLabel(tr("Roll Channel:")));
|
||||
l->addWidget(rollCB);
|
||||
}
|
||||
|
||||
HeliPage::HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
throttleCB = new QComboBox();
|
||||
yawCB = new QComboBox();
|
||||
pitchCB = new QComboBox();
|
||||
rollCB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(new QLabel(tr("Trottle Channel:")));
|
||||
l->addWidget(throttleCB);
|
||||
l->addWidget(new QLabel(tr("Yaw Channel:")));
|
||||
l->addWidget(yawCB);
|
||||
l->addWidget(new QLabel(tr("Pitch Channel:")));
|
||||
l->addWidget(pitchCB);
|
||||
l->addWidget(new QLabel(tr("Roll Channel:")));
|
||||
l->addWidget(rollCB);
|
||||
}
|
||||
|
||||
MultirotorPage::MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
throttleCB = new QComboBox();
|
||||
yawCB = new QComboBox();
|
||||
pitchCB = new QComboBox();
|
||||
rollCB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(new QLabel(tr("Trottle Channel:")));
|
||||
l->addWidget(throttleCB);
|
||||
l->addWidget(new QLabel(tr("Yaw Channel:")));
|
||||
l->addWidget(yawCB);
|
||||
l->addWidget(new QLabel(tr("Pitch Channel:")));
|
||||
l->addWidget(pitchCB);
|
||||
l->addWidget(new QLabel(tr("Roll Channel:")));
|
||||
l->addWidget(rollCB);
|
||||
}
|
||||
|
||||
ConclusionPage::ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(dlg, image, title, text, nextPage)
|
||||
{
|
||||
proceedCB = new QCheckBox(tr("OK, I understand."));
|
||||
registerField("evaluate.proceed*", proceedCB);
|
||||
|
||||
QLayout *l = layout();
|
||||
l->addWidget(proceedCB);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
#ifndef WIZARDDIALOG_H
|
||||
#define WIZARDDIALOG_H
|
||||
|
||||
#include <QWizard>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QRadioButton;
|
||||
class QComboBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
class WizardDialog : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum { Page_Models, Page_Throttle, Page_Wingtypes, Page_Ailerons, Page_Flaps,
|
||||
Page_Airbrakes, Page_Bank, Page_Rudder, Page_Tails, Page_Tail,
|
||||
Page_Simpletail, Page_Cyclic, Page_Gyro, Page_Flybar,
|
||||
Page_Fblheli, Page_Helictrl, Page_Multirotor,
|
||||
Page_Conclusion };
|
||||
|
||||
WizardDialog(QWidget *parent = 0);
|
||||
|
||||
private slots:
|
||||
void showHelp();
|
||||
};
|
||||
|
||||
class StandardPage: public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
StandardPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
WizardDialog *wizardDialog;
|
||||
private:
|
||||
QLabel *topLabel;
|
||||
int pageFollower;
|
||||
int nextId() const;
|
||||
};
|
||||
|
||||
class ModelSelectionPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ModelSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
|
||||
private:
|
||||
QLineEdit *nameLineEdit;
|
||||
QRadioButton *planeRB;
|
||||
QRadioButton *multirotorRB;
|
||||
QRadioButton *helicopterRB;
|
||||
int nextId() const;
|
||||
};
|
||||
|
||||
class WingtypeSelectionPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
WingtypeSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
|
||||
private:
|
||||
QRadioButton *deltaWingRB;
|
||||
QRadioButton *standardWingRB;
|
||||
int nextId() const;
|
||||
};
|
||||
|
||||
class TailSelectionPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TailSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
|
||||
private:
|
||||
QRadioButton *vTailRB;
|
||||
QRadioButton *standardTailRB;
|
||||
QRadioButton *simpleTailRB;
|
||||
int nextId() const;
|
||||
};
|
||||
|
||||
class FlybarSelectionPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FlybarSelectionPage(WizardDialog *dlg, QString image, QString title, QString text);
|
||||
private:
|
||||
QRadioButton *flybarRB;
|
||||
QRadioButton *noFlybarRB;
|
||||
int nextId() const;
|
||||
};
|
||||
|
||||
class ThrottlePage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ThrottlePage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QRadioButton *motorRB;
|
||||
QRadioButton *noMotorRB;
|
||||
QComboBox *throttleCB;
|
||||
};
|
||||
|
||||
class AileronsPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AileronsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QRadioButton *oneAileronRB;
|
||||
QRadioButton *twoAileronsRB;
|
||||
QRadioButton *noAileronsRB;
|
||||
QComboBox *aileron1CB;
|
||||
QComboBox *aileron2CB;
|
||||
};
|
||||
|
||||
class FlapsPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FlapsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QRadioButton *oneFlapRB;
|
||||
QRadioButton *twoFlapsRB;
|
||||
QRadioButton *noFlapsRB;
|
||||
QComboBox *flap1CB;
|
||||
QComboBox *flap2CB;
|
||||
};
|
||||
|
||||
class AirbreaksPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AirbreaksPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QRadioButton *oneAirbreakRB;
|
||||
QRadioButton *twoAirbreaksRB;
|
||||
QRadioButton *noAirbreaksRB;
|
||||
QComboBox *airbreak1CB;
|
||||
QComboBox *airbreak2CB;
|
||||
};
|
||||
|
||||
class BankPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BankPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QRadioButton *oneElevonChRB;
|
||||
QRadioButton *twoElevonsChRB;
|
||||
QComboBox *elevon1CB;
|
||||
QComboBox *elevon2CB;
|
||||
};
|
||||
|
||||
class RudderPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RudderPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QRadioButton *noRudderRB;
|
||||
QRadioButton *hasRudderRB;
|
||||
QComboBox *rudderCB;
|
||||
};
|
||||
|
||||
class TailPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
QComboBox *elevatorCB;
|
||||
QComboBox *rudderCB;
|
||||
};
|
||||
|
||||
class SimpleTailPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
QComboBox *elevatorCB;
|
||||
};
|
||||
|
||||
class CyclicPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CyclicPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QRadioButton *cyclic90RB;
|
||||
QRadioButton *cyclic120RB;
|
||||
QRadioButton *cyclic120XRB;
|
||||
QRadioButton *cyclic140RB;
|
||||
};
|
||||
|
||||
class GyroPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GyroPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QRadioButton *noGyroRB;
|
||||
QRadioButton *switchGyroRB;
|
||||
QRadioButton *potGyroRB;
|
||||
};
|
||||
|
||||
class FblPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FblPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QComboBox *throttleCB;
|
||||
QComboBox *yawCB;
|
||||
QComboBox *pitchCB;
|
||||
QComboBox *rollCB;
|
||||
};
|
||||
|
||||
class HeliPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HeliPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QComboBox *throttleCB;
|
||||
QComboBox *yawCB;
|
||||
QComboBox *pitchCB;
|
||||
QComboBox *rollCB;
|
||||
};
|
||||
|
||||
class MultirotorPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MultirotorPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QComboBox *throttleCB;
|
||||
QComboBox *yawCB;
|
||||
QComboBox *pitchCB;
|
||||
QComboBox *rollCB;
|
||||
};
|
||||
|
||||
class ConclusionPage: public StandardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
private:
|
||||
QCheckBox *proceedCB;
|
||||
};
|
||||
|
||||
#endif // WIZARDDIALOG_H
|
||||