Merge branch 'next' of https://github.com/opentx/opentx into kilrah/Switch_and_pot_warnings
Conflicts: companion/src/firmwares/opentx/opentxeeprom.cpp radio/src/gui/menu_model.cpp radio/src/opentx.cpp radio/src/telemetry/frsky.cpp radio/src/translations.cpp radio/src/translations.h radio/src/translations/cz.h.txt radio/src/translations/de.h.txt radio/src/translations/en.h radio/src/translations/es.h.txt radio/src/translations/fr.h.txt radio/src/translations/it.h.txt radio/src/translations/pl.h.txt radio/src/translations/pt.h.txt radio/src/translations/se.h.txt
This commit is contained in:
@@ -42,6 +42,7 @@ set(modeledit_UIS
|
||||
setup_module.ui
|
||||
flightmode.ui
|
||||
telemetry_analog.ui
|
||||
telemetry_customscreen.ui
|
||||
)
|
||||
|
||||
foreach(name ${modeledit_NAMES})
|
||||
|
||||
@@ -57,24 +57,26 @@ Channels::Channels(QWidget * parent, ModelData & model):
|
||||
gridLayout->addWidget(offset, i+1, col++, 1, 1);
|
||||
|
||||
// Channel min
|
||||
QSpinBox * minSB = new QSpinBox(this);
|
||||
QDoubleSpinBox * minSB = new QDoubleSpinBox(this);
|
||||
minSB->setProperty("index", i);
|
||||
minSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
minSB->setAccelerated(true);
|
||||
minSB->setDecimals(1);
|
||||
minSB->setMinimum(model.extendedLimits ? -125 : -100);
|
||||
minSB->setMaximum(0);
|
||||
minSB->setValue(model.limitData[i].min);
|
||||
minSB->setValue(float(model.limitData[i].min) / 10);
|
||||
connect(minSB, SIGNAL(editingFinished()), this, SLOT(minEdited()));
|
||||
gridLayout->addWidget(minSB, i+1, col++, 1, 1);
|
||||
|
||||
// Channel max
|
||||
QSpinBox * maxSB = new QSpinBox(this);
|
||||
QDoubleSpinBox * maxSB = new QDoubleSpinBox(this);
|
||||
maxSB->setProperty("index", i);
|
||||
maxSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
maxSB->setAccelerated(true);
|
||||
maxSB->setDecimals(1);
|
||||
maxSB->setMinimum(0);
|
||||
maxSB->setMaximum(model.extendedLimits ? 125 : 100);
|
||||
maxSB->setValue(model.limitData[i].max);
|
||||
maxSB->setValue(float(model.limitData[i].max) / 10);
|
||||
connect(maxSB, SIGNAL(editingFinished()), this, SLOT(maxEdited()));
|
||||
gridLayout->addWidget(maxSB, i+1, col++, 1, 1);
|
||||
|
||||
@@ -108,9 +110,6 @@ Channels::Channels(QWidget * parent, ModelData & model):
|
||||
gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
// setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
}
|
||||
|
||||
Channels::~Channels()
|
||||
@@ -141,23 +140,23 @@ void Channels::offsetEdited()
|
||||
{
|
||||
QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int index = dsb->property("index").toInt();
|
||||
model.limitData[index].offset = round(dsb->value()*10);
|
||||
model.limitData[index].offset = round(dsb->value() * 10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void Channels::minEdited()
|
||||
{
|
||||
QSpinBox *sb = qobject_cast<QSpinBox*>(sender());
|
||||
QDoubleSpinBox *sb = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int index = sb->property("index").toInt();
|
||||
model.limitData[index].min = sb->value();
|
||||
model.limitData[index].min = round(sb->value() * 10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void Channels::maxEdited()
|
||||
{
|
||||
QSpinBox *sb = qobject_cast<QSpinBox*>(sender());
|
||||
QDoubleSpinBox *sb = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int index = sb->property("index").toInt();
|
||||
model.limitData[index].max = sb->value();
|
||||
model.limitData[index].max = round(sb->value() * 10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
+115
-105
@@ -2,13 +2,12 @@
|
||||
#include "ui_curves.h"
|
||||
#include "node.h"
|
||||
#include "edge.h"
|
||||
#include "helpers.h"
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
// TODO Capability CustomCurves to be removed
|
||||
|
||||
#define GFX_MARGIN 16
|
||||
|
||||
static const QColor colors[C9X_MAX_CURVES] = {
|
||||
@@ -75,18 +74,17 @@ Curves::Curves(QWidget * parent, ModelData & model):
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
lock = true;
|
||||
|
||||
if (!GetEepromInterface()->getCapability(HasCvNames)) {
|
||||
ui->cname_LE->hide();
|
||||
ui->cname_label->hide();
|
||||
ui->curveName->hide();
|
||||
ui->curveNameLabel->hide();
|
||||
}
|
||||
|
||||
QGraphicsScene *scene = new QGraphicsScene(ui->curvePreview);
|
||||
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||
ui->curvePreview->setScene(scene);
|
||||
|
||||
QIcon clearIcon;
|
||||
clearIcon.addFile(":/images/clear.png", QSize(), QIcon::Normal, QIcon::Off);
|
||||
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(NumCurves); i++) {
|
||||
visibleCurves[i] = false;
|
||||
|
||||
@@ -94,7 +92,7 @@ Curves::Curves(QWidget * parent, ModelData & model):
|
||||
QPushButton * reset = new QPushButton(this);
|
||||
reset->setProperty("index", i);
|
||||
reset->setMinimumSize(QSize(0, 0));
|
||||
reset->setIcon(clearIcon);
|
||||
reset->setIcon(CompanionIcon("clear.png"));
|
||||
reset->setIconSize(QSize(14, 14));
|
||||
connect(reset, SIGNAL(clicked()), this, SLOT(resetCurve()));
|
||||
ui->curvesLayout->addWidget(reset, i, 0, 1, 1);
|
||||
@@ -134,7 +132,20 @@ Curves::Curves(QWidget * parent, ModelData & model):
|
||||
spnx[i]->setAccelerated(true);
|
||||
connect(spnx[i], SIGNAL(valueChanged(int)), this, SLOT(onPointEdited()));
|
||||
ui->pointsLayout->addWidget(spnx[i], i, 1, 1, 1);
|
||||
|
||||
bool insert;
|
||||
if (GetEepromInterface()->getCapability(EnhancedCurves)) {
|
||||
insert = (i >= 1);
|
||||
}
|
||||
else {
|
||||
insert = (i==2 || i==4 || i==8 || i==16);
|
||||
}
|
||||
if (insert) {
|
||||
ui->curvePoints->addItem(tr("%1 points").arg(i+1), i+1);
|
||||
}
|
||||
}
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
Curves::~Curves()
|
||||
@@ -154,7 +165,7 @@ void Curves::resetCurve()
|
||||
{
|
||||
QPushButton *button = (QPushButton *)sender();
|
||||
int index = button->property("index").toInt();
|
||||
int res = QMessageBox::question(this, "companion9x", tr("Are you sure you want to reset curve %1 ?").arg(index+1), QMessageBox::Yes | QMessageBox::No);
|
||||
int res = QMessageBox::question(this, "companion", tr("Are you sure you want to reset curve %1 ?").arg(index+1), QMessageBox::Yes | QMessageBox::No);
|
||||
if (res == QMessageBox::Yes) {
|
||||
model.curves[index].clear(5);
|
||||
update();
|
||||
@@ -175,7 +186,7 @@ void Curves::update()
|
||||
lock = true;
|
||||
|
||||
if (GetEepromInterface()->getCapability(HasCvNames)) {
|
||||
ui->cname_LE->setText(model.curves[currentCurve].name);
|
||||
ui->curveName->setText(model.curves[currentCurve].name);
|
||||
}
|
||||
|
||||
int count = model.curves[currentCurve].count;
|
||||
@@ -217,14 +228,27 @@ void Curves::setCurrentCurve(int index)
|
||||
|
||||
void Curves::updateCurveType()
|
||||
{
|
||||
int index = (model.curves[currentCurve].type == CurveData::CURVE_TYPE_CUSTOM ? 1 : 0);
|
||||
if (model.curves[currentCurve].count==5)
|
||||
index += 2;
|
||||
else if (model.curves[currentCurve].count==9)
|
||||
index += 4;
|
||||
else if (model.curves[currentCurve].count==17)
|
||||
index += 6;
|
||||
ui->curvetype_CB->setCurrentIndex(index);
|
||||
lock = true;
|
||||
|
||||
int index = 0;
|
||||
|
||||
if (GetEepromInterface()->getCapability(EnhancedCurves)) {
|
||||
index = model.curves[currentCurve].count - 2;
|
||||
}
|
||||
else {
|
||||
if (model.curves[currentCurve].count == 5)
|
||||
index += 2;
|
||||
else if (model.curves[currentCurve].count == 9)
|
||||
index += 4;
|
||||
else if (model.curves[currentCurve].count == 17)
|
||||
index += 6;
|
||||
}
|
||||
|
||||
ui->curvePoints->setCurrentIndex(index);
|
||||
ui->curveCustom->setCurrentIndex(model.curves[currentCurve].type);
|
||||
ui->curveSmooth->setCurrentIndex(model.curves[currentCurve].smooth);
|
||||
|
||||
lock = false;
|
||||
}
|
||||
|
||||
void Curves::updateCurve()
|
||||
@@ -335,61 +359,83 @@ void Curves::onNodeUnfocus()
|
||||
updateCurve();
|
||||
}
|
||||
|
||||
void Curves::on_curvetype_CB_currentIndexChanged(int index)
|
||||
bool Curves::allowCurveType(int points, CurveData::CurveType type)
|
||||
{
|
||||
static const int numpoint[] = {3,3,5,5,9,9,17,17};
|
||||
static const CurveData::CurveType types[] = {CurveData::CURVE_TYPE_STANDARD, CurveData::CURVE_TYPE_CUSTOM, CurveData::CURVE_TYPE_STANDARD, CurveData::CURVE_TYPE_CUSTOM, CurveData::CURVE_TYPE_STANDARD, CurveData::CURVE_TYPE_CUSTOM, CurveData::CURVE_TYPE_STANDARD, CurveData::CURVE_TYPE_CUSTOM};
|
||||
int numcurves = GetEepromInterface()->getCapability(NumCurves);
|
||||
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
int totalpoints = 0;
|
||||
for (int i=0; i<numcurves; i++) {
|
||||
int cvPoints = (i==currentCurve ? points : model.curves[i].count);
|
||||
CurveData::CurveType cvType = (i==currentCurve ? type : model.curves[i].type);
|
||||
totalpoints += cvPoints + (cvType==CurveData::CURVE_TYPE_CUSTOM ? cvPoints-2 : 0);
|
||||
}
|
||||
|
||||
int numcurves = GetEepromInterface()->getCapability(NumCurves);
|
||||
// int currpoints = model.curves[currentCurve].count;
|
||||
// bool currcustom = model.curves[currentCurve].custom;
|
||||
|
||||
int totalpoints=0;
|
||||
for (int i=0; i<numcurves; i++) {
|
||||
if (i!=currentCurve) {
|
||||
totalpoints += model.curves[i].count;
|
||||
if (model.curves[i].type == CurveData::CURVE_TYPE_CUSTOM) {
|
||||
totalpoints += model.curves[i].count-2;
|
||||
}
|
||||
}
|
||||
}
|
||||
totalpoints += numpoint[index];
|
||||
if (types[index] == CurveData::CURVE_TYPE_CUSTOM) {
|
||||
totalpoints += numpoint[index]-2;
|
||||
}
|
||||
|
||||
int fwpoints = GetEepromInterface()->getCapability(NumCurvePoints);
|
||||
if (fwpoints!=0) {
|
||||
if (fwpoints < totalpoints) {
|
||||
QMessageBox::warning(this, "companion9x", tr("Not enough free points in EEPROM to store the curve."));
|
||||
updateCurveType();
|
||||
lock = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
model.curves[currentCurve].count = numpoint[index];
|
||||
model.curves[currentCurve].type = types[index];
|
||||
|
||||
// TODO something better!
|
||||
for (int i=0; i<C9X_MAX_POINTS; i++) {
|
||||
model.curves[currentCurve].points[i].x = (i >= model.curves[currentCurve].count-1 ? +100 : -100 + (200*i)/(numpoint[index]-1));
|
||||
model.curves[currentCurve].points[i].y = 0;
|
||||
}
|
||||
|
||||
update();
|
||||
emit modified();
|
||||
lock = false;
|
||||
int fwpoints = GetEepromInterface()->getCapability(NumCurvePoints);
|
||||
if (totalpoints > fwpoints) {
|
||||
QMessageBox::warning(this, "companion", tr("Not enough free points in EEPROM to store the curve."));
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void Curves::on_cname_LE_editingFinished()
|
||||
void Curves::on_curvePoints_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
int numpoints = ((QComboBox *)sender())->itemData(index).toInt();
|
||||
|
||||
if (allowCurveType(numpoints, model.curves[currentCurve].type)) {
|
||||
model.curves[currentCurve].count = numpoints;
|
||||
|
||||
// TODO something better + reuse!
|
||||
for (int i=0; i<C9X_MAX_POINTS; i++) {
|
||||
model.curves[currentCurve].points[i].x = (i >= model.curves[currentCurve].count-1 ? +100 : -100 + (200*i)/(numpoints-1));
|
||||
model.curves[currentCurve].points[i].y = 0;
|
||||
}
|
||||
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
else {
|
||||
updateCurveType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Curves::on_curveCustom_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
CurveData::CurveType type = (CurveData::CurveType)index;
|
||||
int numpoints = ui->curvePoints->itemData(ui->curvePoints->currentIndex()).toInt();
|
||||
if (allowCurveType(model.curves[currentCurve].count, type)) {
|
||||
model.curves[currentCurve].type = type;
|
||||
|
||||
// TODO something better + reuse!
|
||||
for (int i=0; i<C9X_MAX_POINTS; i++) {
|
||||
model.curves[currentCurve].points[i].x = (i >= model.curves[currentCurve].count-1 ? +100 : -100 + (200*i)/(numpoints-1));
|
||||
model.curves[currentCurve].points[i].y = 0;
|
||||
}
|
||||
|
||||
update();
|
||||
emit modified();
|
||||
}
|
||||
else {
|
||||
updateCurveType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Curves::on_curveSmooth_currentIndexChanged(int index)
|
||||
{
|
||||
model.curves[currentCurve].smooth = index;
|
||||
update();
|
||||
}
|
||||
|
||||
void Curves::on_curveName_editingFinished()
|
||||
{
|
||||
memset(model.curves[currentCurve].name, 0, sizeof(model.curves[currentCurve].name));
|
||||
strcpy(model.curves[currentCurve].name, ui->cname_LE->text().toAscii());
|
||||
strcpy(model.curves[currentCurve].name, ui->curveName->text().toAscii());
|
||||
emit modified();
|
||||
}
|
||||
|
||||
@@ -600,9 +646,9 @@ void ModelEdit::on_ca_apply_PB_clicked()
|
||||
|
||||
void ModelEdit::clearCurves(bool ask)
|
||||
{
|
||||
if(ask) {
|
||||
int res = QMessageBox::question(this,tr("Clear Curves?"),tr("Really clear all the curves?"),QMessageBox::Yes | QMessageBox::No);
|
||||
if(res!=QMessageBox::Yes) return;
|
||||
if (ask) {
|
||||
int res = QMessageBox::question(this, tr("Clear Curves?"), tr("Really clear all the curves?"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (res!=QMessageBox::Yes) return;
|
||||
}
|
||||
curvesLock=true;
|
||||
for (int j=0; j<16; j++) {
|
||||
@@ -623,47 +669,11 @@ void ModelEdit::clearCurves(bool ask)
|
||||
currentCurve=0;
|
||||
curvesLock=false;
|
||||
ui->curvetype_CB->setCurrentIndex(2);
|
||||
ui->cname_LE->clear();
|
||||
ui->curveName->clear();
|
||||
updateSettings();
|
||||
drawCurve();
|
||||
}
|
||||
|
||||
void ModelEdit::setCurve(uint8_t c, int8_t ar[])
|
||||
{
|
||||
int len=sizeof(ar)/sizeof(int8_t);
|
||||
if (GetEepromInterface()->getCapability(CustomCurves)) {
|
||||
if (GetEepromInterface()->getCapability(NumCurves)>c) {
|
||||
if (len<9) {
|
||||
model.curves[c].count=5;
|
||||
model.curves[c].custom=false;
|
||||
for (int i=0; i< 5; i++) {
|
||||
model.curves[c].points[i].y=ar[i];
|
||||
}
|
||||
} else {
|
||||
model.curves[c].count=5;
|
||||
model.curves[c].custom=false;
|
||||
for (int i=0; i< 5; i++) {
|
||||
model.curves[c].points[i].y=ar[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (len<9) {
|
||||
model.curves[c].count=5;
|
||||
model.curves[c].custom=false;
|
||||
for (int i=0; i< 5; i++) {
|
||||
model.curves[c].points[i].y=ar[i];
|
||||
}
|
||||
} else {
|
||||
model.curves[c+8].count=5;
|
||||
model.curves[c+8].custom=false;
|
||||
for (int i=0; i< 5; i++) {
|
||||
model.curves[c+8].points[i].y=ar[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModelEdit::ControlCurveSignal(bool flag)
|
||||
{
|
||||
foreach(QSpinBox *sb, findChildren<QSpinBox *>(QRegExp("curvePt[0-9]+"))) {
|
||||
|
||||
@@ -22,8 +22,10 @@ class Curves : public ModelPanel
|
||||
void resetCurve();
|
||||
void editCurve();
|
||||
void plotCurve(bool checked);
|
||||
void on_cname_LE_editingFinished();
|
||||
void on_curvetype_CB_currentIndexChanged(int index);
|
||||
void on_curveName_editingFinished();
|
||||
void on_curvePoints_currentIndexChanged(int index);
|
||||
void on_curveCustom_currentIndexChanged(int index);
|
||||
void on_curveSmooth_currentIndexChanged(int index);
|
||||
void onPointEdited();
|
||||
void onNodeMoved(int x, int y);
|
||||
void onNodeFocus();
|
||||
@@ -41,6 +43,7 @@ class Curves : public ModelPanel
|
||||
void setCurrentCurve(int index);
|
||||
void updateCurve();
|
||||
void updateCurveType();
|
||||
bool allowCurveType(int points, CurveData::CurveType type);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -20,9 +20,47 @@
|
||||
<layout class="QGridLayout" name="curvesLayout"/>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout_8" rowstretch="0,0,0" columnstretch="1,1">
|
||||
<layout class="QGridLayout" name="gridLayout_8" rowstretch="0,0,0" columnstretch="1,0">
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="curvePoints"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="curveCustom">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standard</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="curveSmooth">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Lines</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Smooth</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="curvetype_label">
|
||||
<widget class="QLabel" name="curveTypeLabel">
|
||||
<property name="text">
|
||||
<string>Curve type</string>
|
||||
</property>
|
||||
@@ -31,52 +69,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="curvetype_CB">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3 points</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3 points custom</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5 points</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5 points custom</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9 points</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9 points custom</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>17 points</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>17 points custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="cname_label">
|
||||
<widget class="QLabel" name="curveNameLabel">
|
||||
<property name="text">
|
||||
<string>Curve name</string>
|
||||
</property>
|
||||
@@ -86,7 +80,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="cname_LE">
|
||||
<widget class="QLineEdit" name="curveName">
|
||||
<property name="maxLength">
|
||||
<number>6</number>
|
||||
</property>
|
||||
@@ -129,7 +123,7 @@
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="5">
|
||||
<item row="5" column="0" colspan="5">
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
||||
@@ -7,6 +7,35 @@
|
||||
#include <QDoubleSpinBox>
|
||||
#include "helpers.h"
|
||||
|
||||
RepeatComboBox::RepeatComboBox(QWidget *parent, int & repeatParam):
|
||||
QComboBox(parent),
|
||||
repeatParam(repeatParam)
|
||||
{
|
||||
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
|
||||
int value = repeatParam/step;
|
||||
|
||||
if (step == 1) {
|
||||
addItem(QObject::tr("Played once, not during startup"), -1);
|
||||
value++;
|
||||
}
|
||||
|
||||
addItem(QObject::tr("No repeat"), 0);
|
||||
|
||||
for (unsigned int i=step; i<=60; i+=step) {
|
||||
addItem(QObject::tr("%1s").arg(i), i);
|
||||
}
|
||||
|
||||
setCurrentIndex(value);
|
||||
|
||||
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onIndexChanged(int)));
|
||||
}
|
||||
|
||||
void RepeatComboBox::onIndexChanged(int index)
|
||||
{
|
||||
repeatParam = itemData(index).toInt();
|
||||
emit modified();
|
||||
}
|
||||
|
||||
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
||||
ModelPanel(parent, model),
|
||||
generalSettings(generalSettings),
|
||||
@@ -16,7 +45,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
|
||||
int col = 1;
|
||||
addLabel(gridLayout, tr("Switch"), col++);
|
||||
addLabel(gridLayout, tr("Function"), col++);
|
||||
addLabel(gridLayout, tr("Action"), col++);
|
||||
addLabel(gridLayout, tr("Parameters"), col++);
|
||||
addLabel(gridLayout, tr("Enable"), col++);
|
||||
|
||||
@@ -36,7 +65,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
}
|
||||
}
|
||||
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QSettings settings;
|
||||
QString path = settings.value("sdPath", ".").toString();
|
||||
path.append("/SOUNDS/");
|
||||
QString lang = generalSettings.ttsLanguage;
|
||||
@@ -61,15 +90,6 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
AssignFunc func = model.funcSw[i].func;
|
||||
|
||||
// The label
|
||||
QLabel * label = new QLabel(this);
|
||||
label->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
label->setMouseTracking(true);
|
||||
label->setProperty("index", i);
|
||||
label->setText(tr("CF%1").arg(i+1));
|
||||
gridLayout->addWidget(label, i+1, 0);
|
||||
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
|
||||
|
||||
// The switch
|
||||
fswtchSwtch[i] = new QComboBox(this);
|
||||
fswtchSwtch[i]->setProperty("index", i);
|
||||
@@ -110,7 +130,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
fswtchParamT[i] = new QComboBox(this);
|
||||
fswtchParamT[i]->setProperty("index", i);
|
||||
paramLayout->addWidget(fswtchParamT[i]);
|
||||
populateFuncParamCB(fswtchParamT[i], func, model.funcSw[i].param, model.funcSw[i].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[i], model, func, model.funcSw[i].param, model.funcSw[i].adjustMode);
|
||||
connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
|
||||
fswtchParamArmT[i] = new QComboBox(this);
|
||||
@@ -125,19 +145,16 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
#ifdef PHONON
|
||||
playBT[i] = new QPushButton(this);
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setIcon(QIcon(":/images/play.png"));
|
||||
playBT[i]->setIcon(CompanionIcon("play.png"));
|
||||
paramLayout->addWidget(playBT[i]);
|
||||
connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
|
||||
#endif
|
||||
|
||||
QHBoxLayout *repeatLayout = new QHBoxLayout();
|
||||
gridLayout->addLayout(repeatLayout, i+1, 4);
|
||||
|
||||
fswtchRepeat[i] = new QComboBox(this);
|
||||
fswtchRepeat[i]->setProperty("index", i);
|
||||
connect(fswtchRepeat[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
fswtchRepeat[i] = new RepeatComboBox(this, model.funcSw[i].repeatParam);
|
||||
repeatLayout->addWidget(fswtchRepeat[i], i+1);
|
||||
populateRepeatCB(fswtchRepeat[i], model.funcSw[i].repeatParam);
|
||||
connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
||||
|
||||
fswtchEnable[i] = new QCheckBox(this);
|
||||
fswtchEnable[i]->setProperty("index", i);
|
||||
@@ -160,6 +177,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
||||
{
|
||||
if (phononLock)
|
||||
return;
|
||||
|
||||
phononLock=true;
|
||||
if ((newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) {
|
||||
clickObject->stop();
|
||||
@@ -167,7 +185,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
||||
clickObject->clear();
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setIcon(QIcon(":/images/play.png"));
|
||||
playBT[i]->setIcon(CompanionIcon("play.png"));
|
||||
}
|
||||
}
|
||||
if (newState==Phonon::ErrorState) {
|
||||
@@ -176,7 +194,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
||||
clickObject->clear();
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setIcon(QIcon(":/images/play.png"));
|
||||
playBT[i]->setIcon(CompanionIcon("play.png"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,14 +207,15 @@ void CustomFunctionsPanel::playMusic()
|
||||
QPushButton *playButton = qobject_cast<QPushButton*>(sender());
|
||||
int index=playButton->objectName().mid(5,2).toInt();
|
||||
QString function=playButton->objectName().left(4);
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QString path=settings.value("sdPath", ".").toString();
|
||||
QSettings settings;
|
||||
QString path = settings.value("sdPath", ".").toString();
|
||||
QDir qd(path);
|
||||
QString track;
|
||||
if (qd.exists()) {
|
||||
if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
|
||||
track=path+QString("/%1.wav").arg(int(fswtchParam[index]->value()),4,10,(const QChar)'0');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
path.append("/SOUNDS/");
|
||||
QString lang = generalSettings.ttsLanguage;
|
||||
if (lang.isEmpty())
|
||||
@@ -217,12 +236,12 @@ void CustomFunctionsPanel::playMusic()
|
||||
clickObject->setCurrentSource(Phonon::MediaSource(track));
|
||||
clickObject->play();
|
||||
playBT[index]->setObjectName(QString("stop_%1").arg(index));
|
||||
playBT[index]->setIcon(QIcon(":/images/stop.png"));
|
||||
playBT[index]->setIcon(CompanionIcon("stop.png"));
|
||||
} else {
|
||||
clickObject->stop();
|
||||
clickObject->clear();
|
||||
playBT[index]->setObjectName(QString("play_%1").arg(index));
|
||||
playBT[index]->setIcon(QIcon(":/images/play.png"));
|
||||
playBT[index]->setIcon(CompanionIcon("play.png"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -250,14 +269,18 @@ void CustomFunctionsPanel::customFunctionEdited()
|
||||
}
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::onChildModified()
|
||||
{
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
{
|
||||
unsigned int widgetsMask = 0;
|
||||
if (modified) {
|
||||
model.funcSw[i].swtch = RawSwitch(fswtchSwtch[i]->itemData(fswtchSwtch[i]->currentIndex()).toInt());
|
||||
model.funcSw[i].func = (AssignFunc)fswtchFunc[i]->currentIndex();
|
||||
model.funcSw[i].enabled =fswtchEnable[i]->isChecked();
|
||||
model.funcSw[i].repeatParam = (AssignFunc)fswtchRepeat[i]->currentIndex();
|
||||
model.funcSw[i].enabled = fswtchEnable[i]->isChecked();
|
||||
model.funcSw[i].adjustMode = (AssignFunc)fswtchGVmode[i]->currentIndex();
|
||||
}
|
||||
|
||||
@@ -273,14 +296,15 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
}
|
||||
fswtchParam[i]->setValue(model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
} else if (index==FuncLogs) {
|
||||
}
|
||||
else if (index==FuncLogs) {
|
||||
fswtchParam[i]->setDecimals(1);
|
||||
fswtchParam[i]->setMinimum(0);
|
||||
fswtchParam[i]->setMaximum(25.5);
|
||||
fswtchParam[i]->setSingleStep(0.1);
|
||||
if (modified) model.funcSw[i].param = fswtchParam[i]->value()*10.0;
|
||||
fswtchParam[i]->setValue(model.funcSw[i].param/10.0);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM;
|
||||
}
|
||||
else if (index>=FuncAdjustGV1 && index<=FuncAdjustGVLast) {
|
||||
if (modified) model.funcSw[i].adjustMode = fswtchGVmode[i]->currentIndex();
|
||||
@@ -293,38 +317,41 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
fswtchParam[i]->setMaximum(125);
|
||||
fswtchParam[i]->setValue(model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (modified) model.funcSw[i].param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], index, model.funcSw[i].param, model.funcSw[i].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, model.funcSw[i].param, model.funcSw[i].adjustMode);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
|
||||
}
|
||||
} else if (index==FuncReset) {
|
||||
}
|
||||
else if (index==FuncReset) {
|
||||
if (modified) model.funcSw[i].param = (uint8_t)fswtchParamT[i]->currentIndex();
|
||||
populateFuncParamCB(fswtchParamT[i], index, model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
|
||||
} else if (index==FuncVolume) {
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (index==FuncVolume) {
|
||||
if (modified) model.funcSw[i].param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], index, model.funcSw[i].param);
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
} else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||
if (modified) model.funcSw[i].repeatParam = fswtchRepeat[i]->itemData(fswtchRepeat[i]->currentIndex()).toInt();
|
||||
if (index != FuncBackgroundMusic) {
|
||||
if (GetEepromInterface()->getCapability(HasFuncRepeat)) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_REPEAT;
|
||||
}
|
||||
}
|
||||
else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
|
||||
if (index != FuncBackgroundMusic && GetEepromInterface()->getCapability(HasFuncRepeat)) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_REPEAT;
|
||||
}
|
||||
if (index==FuncPlayValue) {
|
||||
if (modified) model.funcSw[i].param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], index, model.funcSw[i].param);
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_REPEAT;
|
||||
} else if (index==FuncPlayPrompt || index==FuncPlayBoth) {
|
||||
}
|
||||
else if (index==FuncPlayPrompt || index==FuncPlayBoth) {
|
||||
if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setMinimum(0);
|
||||
if (index==FuncPlayPrompt) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_REPEAT + CUSTOM_FUNCTION_GV_TOOGLE;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_REPEAT;
|
||||
fswtchParamGV[i]->setChecked(false);
|
||||
}
|
||||
@@ -333,7 +360,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
if (fswtchParamGV[i]->isChecked()) {
|
||||
fswtchParam[i]->setMinimum(1);
|
||||
model.funcSw[i].param = std::min(fswtchParam[i]->value(),5.0)+(fswtchParamGV[i]->isChecked() ? 250 : 0);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
model.funcSw[i].param = fswtchParam[i]->value();
|
||||
}
|
||||
}
|
||||
@@ -341,13 +369,15 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
fswtchParamGV[i]->setChecked(true);
|
||||
fswtchParam[i]->setValue(model.funcSw[i].param-250);
|
||||
fswtchParam[i]->setMaximum(5);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
fswtchParamGV[i]->setChecked(false);
|
||||
fswtchParam[i]->setValue(model.funcSw[i].param);
|
||||
}
|
||||
if (model.funcSw[i].param < 251)
|
||||
widgetsMask |= CUSTOM_FUNCTION_PLAY;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
|
||||
if (modified) {
|
||||
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
|
||||
@@ -360,7 +390,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (index==FuncBackgroundMusic) {
|
||||
}
|
||||
else if (index==FuncBackgroundMusic) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
|
||||
if (modified) {
|
||||
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
|
||||
@@ -372,21 +403,24 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (index==FuncPlaySound) {
|
||||
}
|
||||
else if (index==FuncPlaySound) {
|
||||
if (modified) model.funcSw[i].param = (uint8_t)fswtchParamT[i]->currentIndex();
|
||||
populateFuncParamCB(fswtchParamT[i], index, model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
|
||||
} else if (index==FuncPlayHaptic) {
|
||||
if (modified) model.funcSw[i].param = (uint8_t)fswtchParamT[i]->currentIndex();
|
||||
populateFuncParamCB(fswtchParamT[i], index, model.funcSw[i].param);
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
|
||||
}
|
||||
} else if (model.funcSw[i].swtch.type!=SWITCH_TYPE_NONE) {
|
||||
else if (index==FuncPlayHaptic) {
|
||||
if (modified) model.funcSw[i].param = (uint8_t)fswtchParamT[i]->currentIndex();
|
||||
populateFuncParamCB(fswtchParamT[i], model, index, model.funcSw[i].param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (modified) model.funcSw[i].param = fswtchParam[i]->value();
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setValue(model.funcSw[i].param);
|
||||
if (index<=FuncInstantTrim) {
|
||||
if (index <= FuncInstantTrim) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
}
|
||||
@@ -406,17 +440,19 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
|
||||
void CustomFunctionsPanel::update()
|
||||
{
|
||||
lock = true;
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
|
||||
refreshCustomFunction(i);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
void CustomFunctionsPanel::fswPaste()
|
||||
{
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
if (mimeData->hasFormat("application/x-companion9x-fsw")) {
|
||||
QByteArray fswData = mimeData->data("application/x-companion9x-fsw");
|
||||
if (mimeData->hasFormat("application/x-companion-fsw")) {
|
||||
QByteArray fswData = mimeData->data("application/x-companion-fsw");
|
||||
|
||||
FuncSwData *fsw = &model.funcSw[selectedFunction];
|
||||
memcpy(fsw, fswData.mid(0, sizeof(FuncSwData)).constData(), sizeof(FuncSwData));
|
||||
@@ -443,7 +479,7 @@ void CustomFunctionsPanel::fswCopy()
|
||||
QByteArray fswData;
|
||||
fswData.append((char*)&model.funcSw[selectedFunction],sizeof(FuncSwData));
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion9x-fsw", fswData);
|
||||
mimeData->setData("application/x-companion-fsw", fswData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
@@ -462,13 +498,13 @@ void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos)
|
||||
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
bool hasData = mimeData->hasFormat("application/x-companion9x-fsw");
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-fsw");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(fswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(fswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(fswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(fswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(fswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(fswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(fswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(fswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,23 @@
|
||||
#include <phonon/mediasource.h>
|
||||
#endif
|
||||
|
||||
class RepeatComboBox: public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RepeatComboBox(QWidget *parent, int & repeatParam);
|
||||
|
||||
signals:
|
||||
void modified();
|
||||
|
||||
private slots:
|
||||
void onIndexChanged(int);
|
||||
|
||||
protected:
|
||||
int & repeatParam;
|
||||
};
|
||||
|
||||
class CustomFunctionsPanel : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -28,6 +45,7 @@ class CustomFunctionsPanel : public ModelPanel
|
||||
void fsw_customContextMenuRequested(QPoint pos);
|
||||
void refreshCustomFunction(int index, bool modified=false);
|
||||
void playMusic();
|
||||
void onChildModified();
|
||||
#ifdef PHONON
|
||||
void mediaPlayer_state(Phonon::State newState, Phonon::State oldState);
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
QGridLayout * gridLayout = new QGridLayout(this);
|
||||
|
||||
int col = 1;
|
||||
addLabel(gridLayout, tr("Function"), col++);
|
||||
addLabel(gridLayout, tr("Condition"), col++);
|
||||
addLabel(gridLayout, tr("V1"), col++);
|
||||
addLabel(gridLayout, tr("V2"), col++);
|
||||
addLabel(gridLayout, tr("AND"), col++);
|
||||
@@ -29,9 +29,9 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
QLabel * label = new QLabel(this);
|
||||
label->setProperty("index", i);
|
||||
if (i < 9)
|
||||
label->setText(tr("CS%1").arg(i+1));
|
||||
label->setText(tr("LS%1").arg(i+1));
|
||||
else
|
||||
label->setText(tr("CS%1").arg(QChar('A'+i-9)));
|
||||
label->setText(tr("LS%1").arg(QChar('A'+i-9)));
|
||||
label->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
label->setMouseTracking(true);
|
||||
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint)));
|
||||
@@ -146,36 +146,43 @@ void CustomSwitchesPanel::edited()
|
||||
{
|
||||
case (CS_FAMILY_VOFS):
|
||||
if (model.customSw[i].val1 != cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt()) {
|
||||
source=RawSource(model.customSw[i].val1);
|
||||
source = RawSource(model.customSw[i].val1, &model);
|
||||
model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
|
||||
RawSource newSource = RawSource(model.customSw[i].val1);
|
||||
RawSource newSource = RawSource(model.customSw[i].val1, &model);
|
||||
if (newSource.type == SOURCE_TYPE_TELEMETRY) {
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = -128;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
RawSourceRange range = source.getRange();
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value()/source.getStep(model));
|
||||
} else {
|
||||
model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(model))/source.getStep(model))-source.getRawOffset(model);
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step/* TODO - source.getRawOffset(model)*/;
|
||||
}
|
||||
}
|
||||
setSwitchWidgetVisibility(i);
|
||||
} else {
|
||||
source=RawSource(model.customSw[i].val1);
|
||||
}
|
||||
else {
|
||||
source = RawSource(model.customSw[i].val1, &model);
|
||||
RawSourceRange range = source.getRange();
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value()/source.getStep(model));
|
||||
cswitchOffset[i]->setValue(model.customSw[i].val2*source.getStep(model));
|
||||
} else {
|
||||
model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(model))/source.getStep(model))-source.getRawOffset(model);
|
||||
cswitchOffset[i]->setValue((model.customSw[i].val2 +source.getRawOffset(model))*source.getStep(model)+source.getOffset(model));
|
||||
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
|
||||
cswitchOffset[i]->setValue(model.customSw[i].val2*range.step);
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val2 = ((cswitchOffset[i]->value()-range.offset)/range.step)/* TODO - source.getRawOffset(model)*/;
|
||||
cswitchOffset[i]->setValue((model.customSw[i].val2 /* + TODO source.getRawOffset(model)*/)*range.step+range.offset);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (CS_FAMILY_TIMERS): {
|
||||
value=cswitchOffset[i]->value();
|
||||
value = cswitchOffset[i]->value();
|
||||
newval=TimToVal(value);
|
||||
if (newval>model.customSw[i].val2) {
|
||||
if (value >=60) {
|
||||
@@ -246,7 +253,9 @@ void CustomSwitchesPanel::edited()
|
||||
|
||||
void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
{
|
||||
RawSource source = RawSource(model.customSw[i].val1);
|
||||
RawSource source = RawSource(model.customSw[i].val1, &model);
|
||||
RawSourceRange range = source.getRange();
|
||||
|
||||
switch (getCSFunctionFamily(model.customSw[i].func))
|
||||
{
|
||||
case CS_FAMILY_VOFS:
|
||||
@@ -254,17 +263,17 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
cswitchSource2[i]->setVisible(false);
|
||||
cswitchValue[i]->setVisible(false);
|
||||
cswitchOffset[i]->setVisible(true);
|
||||
populateSourceCB(cswitchSource1[i], source, POPULATE_SOURCES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
cswitchOffset[i]->setDecimals(source.getDecimals(model));
|
||||
cswitchOffset[i]->setSingleStep(source.getStep(model));
|
||||
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
cswitchOffset[i]->setDecimals(range.decimals);
|
||||
cswitchOffset[i]->setSingleStep(range.step);
|
||||
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
|
||||
cswitchOffset[i]->setMinimum(source.getStep(model)*-127);
|
||||
cswitchOffset[i]->setMaximum(source.getStep(model)*127);
|
||||
cswitchOffset[i]->setValue(source.getStep(model)*model.customSw[i].val2);
|
||||
cswitchOffset[i]->setMinimum(range.step*-127);
|
||||
cswitchOffset[i]->setMaximum(range.step*127);
|
||||
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
|
||||
} else {
|
||||
cswitchOffset[i]->setMinimum(source.getMin(model));
|
||||
cswitchOffset[i]->setMaximum(source.getMax(model));
|
||||
cswitchOffset[i]->setValue(source.getStep(model)*(model.customSw[i].val2+source.getRawOffset(model))+source.getOffset(model));
|
||||
cswitchOffset[i]->setMinimum(range.min);
|
||||
cswitchOffset[i]->setMaximum(range.max);
|
||||
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
|
||||
}
|
||||
break;
|
||||
case CS_FAMILY_VBOOL:
|
||||
@@ -280,8 +289,8 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
cswitchSource2[i]->setVisible(true);
|
||||
cswitchValue[i]->setVisible(false);
|
||||
cswitchOffset[i]->setVisible(false);
|
||||
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), POPULATE_SOURCES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), POPULATE_SOURCES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
|
||||
break;
|
||||
case CS_FAMILY_TIMERS:
|
||||
cswitchSource1[i]->setVisible(false);
|
||||
@@ -337,8 +346,8 @@ void CustomSwitchesPanel::cswPaste()
|
||||
{
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
if (mimeData->hasFormat("application/x-companion9x-csw")) {
|
||||
QByteArray cswData = mimeData->data("application/x-companion9x-csw");
|
||||
if (mimeData->hasFormat("application/x-companion-csw")) {
|
||||
QByteArray cswData = mimeData->data("application/x-companion-csw");
|
||||
|
||||
CustomSwData *csw = &model.customSw[selectedSwitch];
|
||||
memcpy(csw, cswData.mid(0, sizeof(CustomSwData)).constData(), sizeof(CustomSwData));
|
||||
@@ -359,7 +368,7 @@ void CustomSwitchesPanel::cswCopy()
|
||||
QByteArray cswData;
|
||||
cswData.append((char*)&model.customSw[selectedSwitch],sizeof(CustomSwData));
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion9x-csw", cswData);
|
||||
mimeData->setData("application/x-companion-csw", cswData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
@@ -387,13 +396,13 @@ void CustomSwitchesPanel::csw_customContextMenuRequested(QPoint pos)
|
||||
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
bool hasData = mimeData->hasFormat("application/x-companion9x-csw");
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-csw");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(cswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(cswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(cswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(cswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(cswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(cswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(cswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(cswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
@@ -3,188 +3,142 @@
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
|
||||
ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) :
|
||||
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, int stickMode) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ExpoDialog),
|
||||
model(model),
|
||||
ed(expoData)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
ui->setupUi(this);
|
||||
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
|
||||
setWindowTitle(tr("DEST -> %1").arg(getStickStr(ed->chn)));
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
|
||||
int gvars=0;
|
||||
if (GetEepromInterface()->getCapability(HasVariants)) {
|
||||
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
|
||||
gvars=1;
|
||||
}
|
||||
} else {
|
||||
gvars=1;
|
||||
}
|
||||
setWindowTitle(tr("Edit %1").arg(getInputStr(model, ed->chn)));
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
|
||||
if (gvars==0) {
|
||||
ui->weightGV->setDisabled(true);
|
||||
ui->curveGVarCB->hide();
|
||||
if ((ed->curve.type == CurveReference::CURVE_REF_EXPO || ed->curve.type == CurveReference::CURVE_REF_DIFF) && ed->curve.value > 100) {
|
||||
ed->curve.value = 0;
|
||||
}
|
||||
if (ed->weight>100 || ed->weight<-100) {
|
||||
ed->weight = 100;
|
||||
}
|
||||
}
|
||||
gvGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, 100, 0, 100);
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
|
||||
|
||||
populateGVCB(ui->weightCB, ed->weight);
|
||||
populateSwitchCB(ui->switchesCB,ed->swtch);
|
||||
|
||||
ui->weightSB->setMinimum(0);
|
||||
ui->weightSB->setMaximum(100);
|
||||
if (ed->weight>100 || ed->weight<0) {
|
||||
ui->weightGV->setChecked(true);
|
||||
ui->weightSB->hide();
|
||||
ui->weightCB->show();
|
||||
} else {
|
||||
ui->weightGV->setChecked(false);
|
||||
ui->weightSB->setValue(ed->weight);
|
||||
ui->weightSB->show();
|
||||
ui->weightCB->hide();
|
||||
}
|
||||
ui->sideCB->setCurrentIndex(ed->mode-1);
|
||||
|
||||
populateSwitchCB(ui->switchesCB,ed->swtch);
|
||||
|
||||
// TODO keep this group, same in MixerDialog
|
||||
CurveGroup * curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
|
||||
|
||||
ui->sideCB->setCurrentIndex(ed->mode-1);
|
||||
|
||||
if (!GetEepromInterface()->getCapability(FlightPhases)) {
|
||||
ui->label_phases->hide();
|
||||
for (int i=0; i<9; i++) {
|
||||
lb_fp[i]->hide();
|
||||
cb_fp[i]->hide();
|
||||
}
|
||||
} else {
|
||||
int mask=1;
|
||||
for (int i=0; i<9 ; i++) {
|
||||
if ((ed->phases & mask)==0) {
|
||||
cb_fp[i]->setChecked(true);
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
|
||||
lb_fp[i]->hide();
|
||||
cb_fp[i]->hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(VirtualInputs)) {
|
||||
ui->sideLabel->hide();
|
||||
ui->sideCB->hide();
|
||||
}
|
||||
else {
|
||||
ui->sourceLabel->hide();
|
||||
ui->sourceCB->hide();
|
||||
ui->scaleLabel->hide();
|
||||
ui->scaleSB->hide();
|
||||
ui->trimLabel->hide();
|
||||
ui->trimCB->hide();
|
||||
}
|
||||
|
||||
int expolength=GetEepromInterface()->getCapability(HasExpoNames);
|
||||
if (!expolength) {
|
||||
ui->label_name->hide();
|
||||
ui->expoName->hide();
|
||||
} else {
|
||||
ui->expoName->setMaxLength(expolength);
|
||||
}
|
||||
|
||||
ui->expoName->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->expoName->setText(ed->name);
|
||||
valuesChanged();
|
||||
|
||||
connect(ui->expoName,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
|
||||
connect(ui->curveTypeCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->curveGVarCB,SIGNAL(stateChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->curveValueCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->curveValueSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
|
||||
connect(ui->weightCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->weightSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->sideCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->weightGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
|
||||
if (!GetEepromInterface()->getCapability(FlightPhases)) {
|
||||
ui->label_phases->hide();
|
||||
for (int i=0; i<9; i++) {
|
||||
connect(cb_fp[i],SIGNAL(toggled(bool)),this,SLOT(valuesChanged()));
|
||||
lb_fp[i]->hide();
|
||||
cb_fp[i]->hide();
|
||||
}
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
else {
|
||||
int mask=1;
|
||||
for (int i=0; i<9 ; i++) {
|
||||
if ((ed->phases & mask)==0) {
|
||||
cb_fp[i]->setChecked(true);
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
|
||||
lb_fp[i]->hide();
|
||||
cb_fp[i]->hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(VirtualInputs)) {
|
||||
ui->sideLabel->hide();
|
||||
ui->sideCB->hide();
|
||||
ui->inputName->setMaxLength(4);
|
||||
populateSourceCB(ui->sourceCB, ed->srcRaw, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||
ui->sourceCB->removeItem(0);
|
||||
}
|
||||
else {
|
||||
ui->inputNameLabel->hide();
|
||||
ui->inputName->hide();
|
||||
ui->sourceLabel->hide();
|
||||
ui->sourceCB->hide();
|
||||
ui->trimLabel->hide();
|
||||
ui->trimCB->hide();
|
||||
}
|
||||
|
||||
ui->trimCB->addItem(tr("Rud"), 1);
|
||||
ui->trimCB->addItem(tr("Ele"), 2);
|
||||
ui->trimCB->addItem(tr("Thr"), 3);
|
||||
ui->trimCB->addItem(tr("Ail"), 4);
|
||||
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
|
||||
|
||||
int expolength = GetEepromInterface()->getCapability(HasExpoNames);
|
||||
if (!expolength) {
|
||||
ui->lineNameLabel->hide();
|
||||
ui->lineName->hide();
|
||||
}
|
||||
else {
|
||||
ui->lineName->setMaxLength(expolength);
|
||||
}
|
||||
|
||||
ui->inputName->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->inputName->setText(model.inputNames[ed->chn]);
|
||||
|
||||
ui->lineName->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->lineName->setText(ed->name);
|
||||
|
||||
updateScale();
|
||||
valuesChanged();
|
||||
|
||||
connect(ui->lineName, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
||||
connect(ui->sourceCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
connect(ui->scale, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
||||
connect(ui->trimCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
connect(ui->switchesCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
connect(ui->sideCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
for (int i=0; i<9; i++) {
|
||||
connect(cb_fp[i], SIGNAL(toggled(bool)), this, SLOT(valuesChanged()));
|
||||
}
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
ExpoDialog::~ExpoDialog()
|
||||
{
|
||||
delete ui;
|
||||
delete gvGroup;
|
||||
delete curveGroup;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ExpoDialog::changeEvent(QEvent *e)
|
||||
void ExpoDialog::updateScale()
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ExpoDialog::widgetChanged()
|
||||
{
|
||||
// TODO so many times duplicated :(
|
||||
int gvars=0;
|
||||
if (GetEepromInterface()->getCapability(HasVariants)) {
|
||||
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
|
||||
gvars=1;
|
||||
}
|
||||
} else {
|
||||
gvars=1;
|
||||
if (GetEepromInterface()->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
|
||||
RawSourceRange range = ed->srcRaw.getRange();
|
||||
ui->scaleLabel->show();
|
||||
ui->scale->show();
|
||||
ui->scale->setDecimals(range.decimals);
|
||||
ui->scale->setMinimum(range.min);
|
||||
ui->scale->setMaximum(range.max);
|
||||
ui->scale->setValue(round(range.step * ed->scale));
|
||||
}
|
||||
else {
|
||||
ui->scaleLabel->hide();
|
||||
ui->scale->hide();
|
||||
}
|
||||
|
||||
/* TODO if (gvars==1) {
|
||||
if (ui->expoCurveGV->isChecked()) {
|
||||
ui->expoCurveCB->show();
|
||||
ui->expoCurveSB->hide();
|
||||
} else {
|
||||
ui->expoCurveCB->hide();
|
||||
ui->expoCurveSB->show();
|
||||
}
|
||||
if (ui->weightGV->isChecked()) {
|
||||
ui->weightCB->show();
|
||||
ui->weightSB->hide();
|
||||
} else {
|
||||
ui->weightCB->hide();
|
||||
ui->weightSB->show();
|
||||
}
|
||||
} */
|
||||
valuesChanged();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
void ExpoDialog::valuesChanged()
|
||||
{
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
|
||||
if (ui->weightGV->isChecked()) {
|
||||
ed->weight = ui->weightCB->itemData(ui->weightCB->currentIndex()).toInt();
|
||||
} else {
|
||||
ed->weight = ui->weightSB->value();
|
||||
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||
if (ed->srcRaw != srcRaw) {
|
||||
ed->srcRaw = srcRaw;
|
||||
updateScale();
|
||||
}
|
||||
|
||||
RawSourceRange range = srcRaw.getRange();
|
||||
ed->scale = round(float(ui->scale->value()) / range.step);
|
||||
ed->carryTrim = 1 - ui->trimCB->currentIndex();
|
||||
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||
ed->mode = ui->sideCB->currentIndex() + 1;
|
||||
int i=0;
|
||||
for (i=0; i<ui->expoName->text().toAscii().length(); i++) {
|
||||
ed->name[i]=ui->expoName->text().toAscii().at(i);
|
||||
}
|
||||
ed->name[i]=0;
|
||||
|
||||
strcpy(ed->name, ui->lineName->text().toAscii().data());
|
||||
strcpy(model.inputNames[ed->chn], ui->inputName->text().toAscii().data());
|
||||
|
||||
ed->phases=0;
|
||||
for (int i=8; i>=0 ; i--) {
|
||||
if (!cb_fp[i]->checkState()) {
|
||||
@@ -231,5 +185,5 @@ void ExpoDialog::valuesChanged()
|
||||
|
||||
void ExpoDialog::shrink()
|
||||
{
|
||||
resize(0,0);
|
||||
resize(0, 0);
|
||||
}
|
||||
|
||||
@@ -4,27 +4,32 @@
|
||||
#include <QDialog>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
class GVarGroup;
|
||||
class CurveGroup;
|
||||
|
||||
namespace Ui {
|
||||
class ExpoDialog;
|
||||
class ExpoDialog;
|
||||
}
|
||||
|
||||
class ExpoDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ExpoDialog(QWidget *parent, ExpoData *mixdata, int stickMode);
|
||||
public:
|
||||
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode);
|
||||
~ExpoDialog();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
protected:
|
||||
void updateScale();
|
||||
|
||||
private slots:
|
||||
private slots:
|
||||
void valuesChanged();
|
||||
void widgetChanged();
|
||||
void shrink();
|
||||
|
||||
private:
|
||||
Ui::ExpoDialog *ui;
|
||||
ExpoData *ed;
|
||||
private:
|
||||
Ui::ExpoDialog * ui;
|
||||
ModelData & model;
|
||||
ExpoData * ed;
|
||||
GVarGroup * gvGroup;
|
||||
CurveGroup * curveGroup;
|
||||
};
|
||||
|
||||
#endif // EXPODIALOG_H
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>370</width>
|
||||
<height>331</height>
|
||||
<width>381</width>
|
||||
<height>414</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -26,32 +26,39 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<iconset resource="../companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="sourceCB">
|
||||
<property name="whatsThis">
|
||||
<string>The source for the mixer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_name">
|
||||
<widget class="QLabel" name="inputNameLabel">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
<string>Input name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="expoName">
|
||||
<widget class="QLineEdit" name="inputName">
|
||||
<property name="maxLength">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Weight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="6" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1,0">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="weightGV">
|
||||
@@ -66,7 +73,7 @@
|
||||
<item>
|
||||
<widget class="QComboBox" name="weightCB">
|
||||
<property name="whatsThis">
|
||||
<string>Phase used by the expo.</string>
|
||||
<string>Phase used by the input.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -85,14 +92,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_phases">
|
||||
<property name="text">
|
||||
<string>Flight modes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="8" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lb_FP0">
|
||||
@@ -249,29 +256,29 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Switch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="switchesCB">
|
||||
<property name="whatsThis">
|
||||
<string>Switch used by the expo.
|
||||
If blank then the expo is considered to be "ON" all the time.</string>
|
||||
<string>Switch used by the input.
|
||||
If blank then the input is considered to be "ON" all the time.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="sideLabel">
|
||||
<property name="text">
|
||||
<string>Stick Side</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="sideCB">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -290,7 +297,7 @@ If blank then the expo is considered to be "ON" all the time.</string>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<item row="13" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -309,7 +316,7 @@ If blank then the expo is considered to be "ON" all the time.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<item row="12" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -322,15 +329,8 @@ If blank then the expo is considered to be "ON" all the time.</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="sourceCB">
|
||||
<property name="whatsThis">
|
||||
<string>The source for the mixer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="scaleSB">
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="scale">
|
||||
<property name="whatsThis">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
@@ -352,28 +352,21 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="scaleLabel">
|
||||
<property name="text">
|
||||
<string>Scale</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="trimLabel">
|
||||
<property name="text">
|
||||
<string>Include Trim</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="sourceLabel">
|
||||
<property name="text">
|
||||
<string>Source</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="trimCB">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -387,14 +380,14 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_curves">
|
||||
<property name="text">
|
||||
<string>Curve</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1,0">
|
||||
<item>
|
||||
<widget class="QComboBox" name="curveTypeCB">
|
||||
@@ -402,7 +395,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>The curve used by the expo</string>
|
||||
<string>The curve used by the input</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -425,10 +418,57 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="sourceLabel">
|
||||
<property name="text">
|
||||
<string>Source</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lineNameLabel">
|
||||
<property name="text">
|
||||
<string>Line name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineName">
|
||||
<property name="maxLength">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>inputName</tabstop>
|
||||
<tabstop>lineName</tabstop>
|
||||
<tabstop>sourceCB</tabstop>
|
||||
<tabstop>scale</tabstop>
|
||||
<tabstop>trimCB</tabstop>
|
||||
<tabstop>weightGV</tabstop>
|
||||
<tabstop>weightSB</tabstop>
|
||||
<tabstop>weightCB</tabstop>
|
||||
<tabstop>curveTypeCB</tabstop>
|
||||
<tabstop>curveGVarCB</tabstop>
|
||||
<tabstop>curveValueCB</tabstop>
|
||||
<tabstop>curveValueSB</tabstop>
|
||||
<tabstop>cb_FP0</tabstop>
|
||||
<tabstop>cb_FP1</tabstop>
|
||||
<tabstop>cb_FP2</tabstop>
|
||||
<tabstop>cb_FP3</tabstop>
|
||||
<tabstop>cb_FP4</tabstop>
|
||||
<tabstop>cb_FP5</tabstop>
|
||||
<tabstop>cb_FP6</tabstop>
|
||||
<tabstop>cb_FP7</tabstop>
|
||||
<tabstop>cb_FP8</tabstop>
|
||||
<tabstop>switchesCB</tabstop>
|
||||
<tabstop>sideCB</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion9x.qrc"/>
|
||||
<include location="../companion.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -26,7 +26,7 @@ void HeliPanel::update()
|
||||
lock = true;
|
||||
|
||||
ui->swashTypeCB->setCurrentIndex(model.swashRingData.type);
|
||||
populateSourceCB(ui->swashCollectiveCB, model.swashRingData.collectiveSource, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
populateSourceCB(ui->swashCollectiveCB, model.swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
ui->swashRingValSB->setValue(model.swashRingData.value);
|
||||
ui->swashInvertELE->setChecked(model.swashRingData.invertELE);
|
||||
ui->swashInvertAIL->setChecked(model.swashRingData.invertAIL);
|
||||
|
||||
@@ -14,15 +14,15 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g
|
||||
QPushButton * qbUp = new QPushButton(this);
|
||||
QPushButton * qbDown = new QPushButton(this);
|
||||
QPushButton * qbClear = new QPushButton(this);
|
||||
|
||||
|
||||
qbUp->setText(tr("Move Up"));
|
||||
qbUp->setIcon(QIcon(":/images/moveup.png"));
|
||||
qbUp->setIcon(CompanionIcon("moveup.png"));
|
||||
qbUp->setShortcut(QKeySequence(tr("Ctrl+Up")));
|
||||
qbDown->setText(tr("Move Down"));
|
||||
qbDown->setIcon(QIcon(":/images/movedown.png"));
|
||||
qbDown->setIcon(CompanionIcon("movedown.png"));
|
||||
qbDown->setShortcut(QKeySequence(tr("Ctrl+Down")));
|
||||
qbClear->setText(tr("Clear Expo Settings"));
|
||||
qbClear->setIcon(QIcon(":/images/clear.png"));
|
||||
qbClear->setText(tr("Clear All Settings"));
|
||||
qbClear->setIcon(CompanionIcon("clear.png"));
|
||||
|
||||
exposLayout->addWidget(ExposlistWidget,1,1,1,3);
|
||||
exposLayout->addWidget(qbUp,2,1);
|
||||
@@ -48,6 +48,10 @@ void InputsPanel::update()
|
||||
{
|
||||
lock = true;
|
||||
|
||||
int inputsCount = GetEepromInterface()->getCapability(VirtualInputs);
|
||||
if (inputsCount == 0)
|
||||
inputsCount = NUM_STICKS;
|
||||
|
||||
// curDest -> destination channel
|
||||
// i -> mixer number
|
||||
QByteArray qba;
|
||||
@@ -58,10 +62,12 @@ void InputsPanel::update()
|
||||
ExpoData *md = &model.expoData[i];
|
||||
|
||||
if (md->mode==0) break;
|
||||
QString str = "";
|
||||
while(curDest<(int)md->chn-1) {
|
||||
|
||||
QString str;
|
||||
|
||||
while (curDest<(int)md->chn-1) {
|
||||
curDest++;
|
||||
str = getStickStr(curDest);
|
||||
str = getInputStr(model, curDest);
|
||||
qba.clear();
|
||||
qba.append((quint8)-curDest-1);
|
||||
QListWidgetItem *itm = new QListWidgetItem(str);
|
||||
@@ -69,14 +75,27 @@ void InputsPanel::update()
|
||||
ExposlistWidget->addItem(itm);
|
||||
}
|
||||
|
||||
if(curDest!=(int)md->chn) {
|
||||
str = getStickStr(md->chn);
|
||||
if (curDest!=(int)md->chn) {
|
||||
if (GetEepromInterface()->getCapability(VirtualInputs))
|
||||
str = QString("%1").arg(getInputStr(model, md->chn), -8, ' ');
|
||||
else
|
||||
str = getInputStr(model, md->chn);
|
||||
curDest = md->chn;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
str = " ";
|
||||
}
|
||||
|
||||
if (!GetEepromInterface()->getCapability(VirtualInputs)) {
|
||||
if (GetEepromInterface()->getCapability(VirtualInputs)) {
|
||||
str += " " + tr("Source(%1)").arg(md->srcRaw.toString());
|
||||
if (md->carryTrim>0) {
|
||||
str += " " + tr("No Trim");
|
||||
}
|
||||
else if (md->carryTrim<0) {
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (md->mode) {
|
||||
case (1): str += " <-"; break;
|
||||
case (2): str += " ->"; break;
|
||||
@@ -94,12 +113,10 @@ void InputsPanel::update()
|
||||
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
|
||||
|
||||
if (GetEepromInterface()->getCapability(HasExpoNames)) {
|
||||
QString ExpoName;
|
||||
ExpoName.append(md->name);
|
||||
if (!ExpoName.isEmpty()) {
|
||||
str+=QString("(%1)").arg(ExpoName);
|
||||
}
|
||||
QString expoName = md->name;
|
||||
if (!expoName.isEmpty()) str += QString(" [%1]").arg(expoName);
|
||||
}
|
||||
|
||||
qba.clear();
|
||||
qba.append((quint8)i);
|
||||
qba.append((const char*)md, sizeof(ExpoData));
|
||||
@@ -108,9 +125,9 @@ void InputsPanel::update()
|
||||
ExposlistWidget->addItem(itm); //(str);
|
||||
}
|
||||
|
||||
while(curDest<NUM_STICKS-1) {
|
||||
while (curDest<inputsCount-1) {
|
||||
curDest++;
|
||||
QString str = getStickStr(curDest);
|
||||
QString str = getInputStr(model, curDest);
|
||||
qba.clear();
|
||||
qba.append((quint8)-curDest-1);
|
||||
QListWidgetItem *itm = new QListWidgetItem(str);
|
||||
@@ -125,7 +142,7 @@ void InputsPanel::update()
|
||||
bool InputsPanel::gm_insertExpo(int idx)
|
||||
{
|
||||
if (idx<0 || idx>=C9X_MAX_EXPOS || model.expoData[C9X_MAX_EXPOS-1].mode > 0) {
|
||||
QMessageBox::information(this, "companion9x", tr("Not enough available expos!"));
|
||||
QMessageBox::information(this, "companion", tr("Not enough available inputs!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -154,12 +171,13 @@ void InputsPanel::gm_openExpo(int index)
|
||||
emit modified();
|
||||
update();
|
||||
|
||||
ExpoDialog *g = new ExpoDialog(this, &mixd, generalSettings.stickMode);
|
||||
if(g->exec()) {
|
||||
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode);
|
||||
if (g->exec()) {
|
||||
model.expoData[index] = mixd;
|
||||
emit modified();
|
||||
update();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (expoInserted) {
|
||||
gm_deleteExpo(index);
|
||||
}
|
||||
@@ -203,8 +221,8 @@ void InputsPanel::exposDelete(bool ask)
|
||||
QMessageBox::StandardButton ret = QMessageBox::No;
|
||||
|
||||
if(ask)
|
||||
ret = QMessageBox::warning(this, "companion9x",
|
||||
tr("Delete Selected Expos?"),
|
||||
ret = QMessageBox::warning(this, "companion",
|
||||
tr("Delete Selected Inputs?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
|
||||
@@ -231,7 +249,7 @@ void InputsPanel::exposCopy()
|
||||
}
|
||||
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion9x-expo", mxData);
|
||||
mimeData->setData("application/x-companion-expo", mxData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
@@ -245,7 +263,7 @@ void InputsPanel::mimeExpoDropped(int index, const QMimeData *data, Qt::DropActi
|
||||
#include <QtGui/qwidget.h>
|
||||
void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx)
|
||||
{
|
||||
if (mimeData->hasFormat("application/x-companion9x-expo")) {
|
||||
if (mimeData->hasFormat("application/x-companion-expo")) {
|
||||
int idx; // mixer index
|
||||
int dch;
|
||||
|
||||
@@ -257,7 +275,7 @@ void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx)
|
||||
dch = model.expoData[idx].chn;
|
||||
}
|
||||
|
||||
QByteArray mxData = mimeData->data("application/x-companion9x-expo");
|
||||
QByteArray mxData = mimeData->data("application/x-companion-expo");
|
||||
|
||||
int i = 0;
|
||||
while (i < mxData.size()) {
|
||||
@@ -333,20 +351,20 @@ void InputsPanel::expolistWidget_customContextMenuRequested(QPoint pos)
|
||||
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
bool hasData = mimeData->hasFormat("application/x-companion9x-expo");
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-expo");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(QIcon(":/images/add.png"), tr("&Add"),this,SLOT(expoAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(QIcon(":/images/edit.png"), tr("&Edit"),this,SLOT(expoOpen()),tr("Enter"));
|
||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"),this,SLOT(expoAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(expoOpen()),tr("Enter"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(exposDelete()),tr("Delete"));
|
||||
contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(exposCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(exposCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(exposPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(QIcon(":/images/duplicate.png"), tr("Du&plicate"),this,SLOT(exposDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(exposDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(exposCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(exposCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(exposPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"),this,SLOT(exposDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(QIcon(":/images/moveup.png"), tr("Move Up"),this,SLOT(moveExpoUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(QIcon(":/images/movedown.png"), tr("Move Down"),this,SLOT(moveExpoDown()),tr("Ctrl+Down"));
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"),this,SLOT(moveExpoUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"),this,SLOT(moveExpoDown()),tr("Ctrl+Down"));
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
@@ -442,7 +460,7 @@ void InputsPanel::exposDeleteList(QList<int> list)
|
||||
|
||||
void InputsPanel::clearExpos()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Clear Expos?"), tr("Really clear all the expos?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
if (QMessageBox::question(this, tr("Clear Inputs?"), tr("Really clear all the inputs?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
model.clearInputs();
|
||||
emit modified();
|
||||
update();
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
|
||||
MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
|
||||
MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, int stickMode) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::MixerDialog),
|
||||
model(model),
|
||||
md(mixdata),
|
||||
lock(false)
|
||||
{
|
||||
@@ -19,84 +20,44 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
|
||||
else
|
||||
this->setWindowTitle(tr("DEST -> CH%1%2").arg(md->destCh/10).arg(md->destCh%10));
|
||||
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, POPULATE_SOURCES | POPULATE_SWITCHES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | (GetEepromInterface()->getCapability(GvarsAsSources) ? POPULATE_GVARS : 0));
|
||||
|
||||
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
ui->sourceCB->removeItem(0);
|
||||
int limit=GetEepromInterface()->getCapability(OffsetWeight);
|
||||
int gvars=0;
|
||||
if (GetEepromInterface()->getCapability(HasVariants)) {
|
||||
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
|
||||
gvars=1;
|
||||
}
|
||||
} else {
|
||||
gvars=1;
|
||||
}
|
||||
if (gvars==0) {
|
||||
ui->offsetGV->setDisabled(true);
|
||||
ui->weightGV->setDisabled(true);
|
||||
if (md->weight>limit || md->weight<-limit) {
|
||||
md->weight=100;
|
||||
}
|
||||
if (md->sOffset>limit || md->sOffset<-limit) {
|
||||
md->sOffset=0;
|
||||
}
|
||||
}
|
||||
populateGVCB(ui->offsetCB,md->sOffset);
|
||||
populateGVCB(ui->weightCB,md->weight);
|
||||
ui->weightSB->setMinimum(-limit);
|
||||
ui->weightSB->setMaximum(limit);
|
||||
if (md->weight>limit || md->weight<-limit) {
|
||||
ui->weightGV->setChecked(true);
|
||||
ui->weightSB->hide();
|
||||
ui->weightCB->show();
|
||||
}
|
||||
else {
|
||||
ui->weightGV->setChecked(false);
|
||||
ui->weightSB->setValue(md->weight);
|
||||
ui->weightSB->show();
|
||||
ui->weightCB->hide();
|
||||
}
|
||||
|
||||
ui->offsetSB->setMinimum(-limit);
|
||||
ui->offsetSB->setMaximum(limit);
|
||||
if (md->sOffset>limit || md->sOffset<-limit) {
|
||||
ui->offsetGV->setChecked(true);
|
||||
ui->offsetSB->hide();
|
||||
ui->offsetCB->show();
|
||||
}
|
||||
else {
|
||||
ui->offsetGV->setChecked(false);
|
||||
ui->offsetSB->setValue(md->sOffset);
|
||||
ui->offsetSB->show();
|
||||
ui->offsetCB->hide();
|
||||
}
|
||||
int limit = GetEepromInterface()->getCapability(OffsetWeight);
|
||||
|
||||
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
|
||||
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
|
||||
|
||||
if (GetEepromInterface()->getCapability(VirtualInputs)) {
|
||||
ui->trimLabel->hide();
|
||||
ui->trimCB->hide();
|
||||
}
|
||||
|
||||
CurveGroup * curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve);
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve);
|
||||
|
||||
ui->MixDR_CB->setChecked(md->noExpo==0);
|
||||
if (!GetEepromInterface()->getCapability(MixesWithoutExpo)) {
|
||||
ui->MixDR_CB->hide();
|
||||
ui->label_MixDR->hide();
|
||||
}
|
||||
if (GetEepromInterface()->getCapability(ExtraTrims)) {
|
||||
ui->trimCB->addItem(tr("Rud"),1);
|
||||
ui->trimCB->addItem(tr("Ele"),2);
|
||||
ui->trimCB->addItem(tr("Thr"),3);
|
||||
ui->trimCB->addItem(tr("Ail"),4);
|
||||
}
|
||||
ui->trimCB->setCurrentIndex((-md->carryTrim)+1);
|
||||
int namelength=GetEepromInterface()->getCapability(HasMixerNames);
|
||||
|
||||
ui->trimCB->addItem(tr("Rud"), 1);
|
||||
ui->trimCB->addItem(tr("Ele"), 2);
|
||||
ui->trimCB->addItem(tr("Thr"), 3);
|
||||
ui->trimCB->addItem(tr("Ail"), 4);
|
||||
ui->trimCB->setCurrentIndex(1 - md->carryTrim);
|
||||
|
||||
int namelength = GetEepromInterface()->getCapability(HasMixerNames);
|
||||
if (!namelength) {
|
||||
ui->label_name->hide();
|
||||
ui->mixerName->hide();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->mixerName->setMaxLength(namelength);
|
||||
}
|
||||
ui->mixerName->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->mixerName->setText(md->name);
|
||||
|
||||
if (!GetEepromInterface()->getCapability(FlightPhases)) {
|
||||
ui->label_phases->hide();
|
||||
for (int i=0; i<9; i++) {
|
||||
@@ -118,9 +79,6 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
|
||||
}
|
||||
}
|
||||
|
||||
ui->mixerName->setValidator(new QRegExpValidator(rx, this));
|
||||
ui->mixerName->setText(md->name);
|
||||
|
||||
populateSwitchCB(ui->switchesCB,md->swtch);
|
||||
ui->warningCB->setCurrentIndex(md->mixWarn);
|
||||
ui->mltpxCB->setCurrentIndex(md->mltpx);
|
||||
@@ -147,12 +105,6 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
|
||||
valuesChanged();
|
||||
connect(ui->mixerName,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
connect(ui->sourceCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->weightCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->offsetCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->weightSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
connect(ui->offsetSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
|
||||
connect(ui->weightGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged())); // TODO why the same slot?
|
||||
connect(ui->offsetGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
|
||||
connect(ui->trimCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
connect(ui->MixDR_CB,SIGNAL(toggled(bool)),this,SLOT(valuesChanged()));
|
||||
connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
|
||||
@@ -169,54 +121,23 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
|
||||
|
||||
MixerDialog::~MixerDialog()
|
||||
{
|
||||
delete ui;
|
||||
delete gvWeightGroup;
|
||||
delete gvOffsetGroup;
|
||||
delete curveGroup;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MixerDialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
QDialog::changeEvent(e);
|
||||
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MixerDialog::widgetChanged()
|
||||
{
|
||||
int gvars = 0;
|
||||
if (GetEepromInterface()->getCapability(HasVariants)) {
|
||||
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
|
||||
gvars = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
gvars = 1;
|
||||
}
|
||||
|
||||
if (gvars == 1) {
|
||||
if (ui->weightGV->isChecked()) {
|
||||
ui->weightCB->show();
|
||||
ui->weightSB->hide();
|
||||
}
|
||||
else {
|
||||
ui->weightCB->hide();
|
||||
ui->weightSB->show();
|
||||
}
|
||||
if (ui->offsetGV->isChecked()) {
|
||||
ui->offsetCB->show();
|
||||
ui->offsetSB->hide();
|
||||
}
|
||||
else {
|
||||
ui->offsetCB->hide();
|
||||
ui->offsetSB->show();
|
||||
}
|
||||
}
|
||||
|
||||
valuesChanged();
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
void MixerDialog::valuesChanged()
|
||||
@@ -224,29 +145,21 @@ void MixerDialog::valuesChanged()
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
|
||||
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt(), &model);
|
||||
if ((ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt()-65536)<4) {
|
||||
if (!GetEepromInterface()->getCapability(MixesWithoutExpo)) {
|
||||
ui->MixDR_CB->hide();
|
||||
ui->label_MixDR->hide();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->MixDR_CB->setVisible(true);
|
||||
ui->label_MixDR->setVisible(true);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->MixDR_CB->setHidden(true);
|
||||
ui->label_MixDR->setHidden(true);
|
||||
}
|
||||
if (ui->weightGV->isChecked()) {
|
||||
md->weight = ui->weightCB->itemData(ui->weightCB->currentIndex()).toInt();
|
||||
} else {
|
||||
md->weight = ui->weightSB->value();
|
||||
}
|
||||
if (ui->offsetGV->isChecked()) {
|
||||
md->sOffset = ui->offsetCB->itemData(ui->offsetCB->currentIndex()).toInt();
|
||||
} else {
|
||||
md->sOffset = ui->offsetSB->value();
|
||||
}
|
||||
md->carryTrim = -(ui->trimCB->currentIndex()-1);
|
||||
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
|
||||
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||
@@ -276,6 +189,7 @@ void MixerDialog::valuesChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void MixerDialog::shrink() {
|
||||
resize(0,0);
|
||||
void MixerDialog::shrink()
|
||||
{
|
||||
resize(0, 0);
|
||||
}
|
||||
|
||||
@@ -4,29 +4,34 @@
|
||||
#include <QDialog>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
class GVarGroup;
|
||||
class CurveGroup;
|
||||
|
||||
namespace Ui {
|
||||
class MixerDialog;
|
||||
class MixerDialog;
|
||||
}
|
||||
|
||||
class MixerDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MixerDialog(QWidget *parent, MixData *mixdata, int stickMode);
|
||||
public:
|
||||
MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, int stickMode);
|
||||
~MixerDialog();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private slots:
|
||||
void widgetChanged();
|
||||
private slots:
|
||||
void valuesChanged();
|
||||
void shrink();
|
||||
|
||||
|
||||
private:
|
||||
private:
|
||||
Ui::MixerDialog *ui;
|
||||
ModelData & model;
|
||||
MixData *md;
|
||||
bool lock;
|
||||
GVarGroup * gvWeightGroup;
|
||||
GVarGroup * gvOffsetGroup;
|
||||
CurveGroup * curveGroup;
|
||||
};
|
||||
|
||||
#endif // MIXERDIALOG_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>342</width>
|
||||
<width>364</width>
|
||||
<height>434</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -20,7 +20,7 @@
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../companion9x.qrc">
|
||||
<iconset resource="../companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
@@ -612,7 +612,7 @@ If blank then the mix is considered to be "ON" all the time.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../companion9x.qrc"/>
|
||||
<include location="../companion.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -40,9 +40,9 @@ bool MixersList::dropMimeData( int index, const QMimeData * data, Qt::DropAction
|
||||
{
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
if (expo)
|
||||
mimeData->setData("application/x-companion9x-expo", qba);
|
||||
mimeData->setData("application/x-companion-expo", qba);
|
||||
else
|
||||
mimeData->setData("application/x-companion9x-mix", qba);
|
||||
mimeData->setData("application/x-companion-mix", qba);
|
||||
|
||||
emit mimeDropped(index, mimeData, action);
|
||||
}
|
||||
|
||||
@@ -14,15 +14,14 @@ MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||
QPushButton * qbUp = new QPushButton(this);
|
||||
QPushButton * qbDown = new QPushButton(this);
|
||||
QPushButton * qbClear = new QPushButton(this);
|
||||
|
||||
qbUp->setText(tr("Move Up"));
|
||||
qbUp->setIcon(QIcon(":/images/moveup.png"));
|
||||
qbUp->setIcon(CompanionIcon("moveup.png"));
|
||||
qbUp->setShortcut(QKeySequence(tr("Ctrl+Up")));
|
||||
qbDown->setText(tr("Move Down"));
|
||||
qbDown->setIcon(QIcon(":/images/movedown.png"));
|
||||
qbDown->setIcon(CompanionIcon("movedown.png"));
|
||||
qbDown->setShortcut(QKeySequence(tr("Ctrl+Down")));
|
||||
qbClear->setText(tr("Clear Mixes"));
|
||||
qbClear->setIcon(QIcon(":/images/clear.png"));
|
||||
qbClear->setIcon(CompanionIcon("clear.png"));
|
||||
|
||||
mixesLayout->addWidget(MixerlistWidget,1,1,1,3);
|
||||
mixesLayout->addWidget(qbUp,2,1);
|
||||
@@ -113,11 +112,13 @@ void MixesPanel::update()
|
||||
|
||||
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
|
||||
|
||||
if (md->carryTrim>0) {
|
||||
str += " " + tr("No Trim");
|
||||
}
|
||||
else if (md->carryTrim<0) {
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
|
||||
if (!GetEepromInterface()->getCapability(VirtualInputs)) {
|
||||
if (md->carryTrim>0) {
|
||||
str += " " + tr("No Trim");
|
||||
}
|
||||
else if (md->carryTrim<0) {
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (md->noExpo) str += " " + tr("No DR/Expo");
|
||||
@@ -176,7 +177,7 @@ void MixesPanel::update()
|
||||
bool MixesPanel::gm_insertMix(int idx)
|
||||
{
|
||||
if (idx<0 || idx>=GetEepromInterface()->getCapability(Mixes) || model.mixData[GetEepromInterface()->getCapability(Mixes)-1].destCh > 0) {
|
||||
QMessageBox::information(this, "companion9x", tr("Not enough available mixers!"));
|
||||
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -205,7 +206,7 @@ void MixesPanel::gm_openMix(int index)
|
||||
emit modified();
|
||||
update();
|
||||
|
||||
MixerDialog *g = new MixerDialog(this, &mixd, generalSettings.stickMode);
|
||||
MixerDialog *g = new MixerDialog(this, model, &mixd, generalSettings.stickMode);
|
||||
if(g->exec()) {
|
||||
model.mixData[index] = mixd;
|
||||
emit modified();
|
||||
@@ -281,7 +282,7 @@ void MixesPanel::mixersDelete(bool ask)
|
||||
QMessageBox::StandardButton ret = QMessageBox::No;
|
||||
|
||||
if(ask)
|
||||
ret = QMessageBox::warning(this, "companion9x",
|
||||
ret = QMessageBox::warning(this, "companion",
|
||||
tr("Delete Selected Mixes?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
@@ -310,13 +311,13 @@ void MixesPanel::mixersCopy()
|
||||
}
|
||||
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("application/x-companion9x-mix", mxData);
|
||||
mimeData->setData("application/x-companion-mix", mxData);
|
||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
{
|
||||
if(mimeData->hasFormat("application/x-companion9x-mix")) {
|
||||
if(mimeData->hasFormat("application/x-companion-mix")) {
|
||||
int idx; // mixer index
|
||||
int dch;
|
||||
|
||||
@@ -328,7 +329,7 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||
dch = model.mixData[idx].destCh;
|
||||
}
|
||||
|
||||
QByteArray mxData = mimeData->data("application/x-companion9x-mix");
|
||||
QByteArray mxData = mimeData->data("application/x-companion-mix");
|
||||
|
||||
int i = 0;
|
||||
while(i<mxData.size()) {
|
||||
@@ -410,20 +411,20 @@ void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
||||
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
bool hasData = mimeData->hasFormat("application/x-companion9x-mix");
|
||||
bool hasData = mimeData->hasFormat("application/x-companion-mix");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(QIcon(":/images/add.png"), tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(QIcon(":/images/edit.png"), tr("&Edit"),this,SLOT(mixerOpen()),tr("Enter"));
|
||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(mixerOpen()),tr("Enter"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete"));
|
||||
contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(mixersCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(mixersCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(QIcon(":/images/duplicate.png"), tr("Du&plicate"),this,SLOT(mixersDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(mixersCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(mixersCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"),this,SLOT(mixersDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(QIcon(":/images/moveup.png"), tr("Move Up"),this,SLOT(moveMixUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(QIcon(":/images/movedown.png"), tr("Move Down"),this,SLOT(moveMixDown()),tr("Ctrl+Down"));
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"),this,SLOT(moveMixUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"),this,SLOT(moveMixDown()),tr("Ctrl+Down"));
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "mixes.h"
|
||||
#include "channels.h"
|
||||
#include "curves.h"
|
||||
#include "../helpers.h"
|
||||
#include "customswitches.h"
|
||||
#include "customfunctions.h"
|
||||
#include "telemetry.h"
|
||||
@@ -17,20 +18,22 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
|
||||
ui(new Ui::ModelEdit),
|
||||
modelId(modelId),
|
||||
model(radioData.models[modelId]),
|
||||
generalSettings(generalSettings)
|
||||
generalSettings(radioData.generalSettings)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QSettings settings;
|
||||
restoreGeometry(settings.value("modelEditGeometry").toByteArray());
|
||||
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
|
||||
addTab(new Setup(this, model), tr("Setup"));
|
||||
addTab(new HeliPanel(this, model), tr("Heli"));
|
||||
addTab(new FlightModes(this, model, radioData.generalSettings), tr("Flight Modes"));
|
||||
addTab(new InputsPanel(this, model, radioData.generalSettings), tr("Inputs"));
|
||||
addTab(new MixesPanel(this, model, radioData.generalSettings), tr("Mixes"));
|
||||
addTab(new Channels(this, model), tr("Channels"));
|
||||
addTab(new CustomSwitchesPanel(this, model), tr("Custom Switches"));
|
||||
addTab(new CustomSwitchesPanel(this, model), tr("Logical Switches"));
|
||||
if (GetEepromInterface()->getCapability(CustomFunctions))
|
||||
addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Assignable Functions"));
|
||||
addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Switch Assignment"));
|
||||
addTab(new Curves(this, model), tr("Curves"));
|
||||
// TODO remove this capability if (!GetEepromInterface()->getCapability(FSSwitch))
|
||||
if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY)
|
||||
addTab(new TelemetryPanel(this, model), tr("Telemetry"));
|
||||
}
|
||||
@@ -40,6 +43,12 @@ ModelEdit::~ModelEdit()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ModelEdit::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("modelEditGeometry", saveGeometry());
|
||||
}
|
||||
|
||||
class VerticalScrollArea : public QScrollArea
|
||||
{
|
||||
public:
|
||||
@@ -109,14 +118,16 @@ void ModelEdit::launchSimulation()
|
||||
simuData->generalSettings = generalSettings;
|
||||
simuData->models[modelId] = model;
|
||||
if (GetEepromInterface()->getCapability(SimulatorType)) {
|
||||
xsimulatorDialog sd(this);
|
||||
sd.loadParams(*simuData, modelId);
|
||||
sd.exec();
|
||||
xsimulatorDialog *sd = new xsimulatorDialog(this);
|
||||
sd->loadParams(*simuData, modelId);
|
||||
sd->exec();
|
||||
delete sd;
|
||||
}
|
||||
else {
|
||||
simulatorDialog sd(this);
|
||||
sd.loadParams(*simuData, modelId);
|
||||
sd.exec();
|
||||
simulatorDialog *sd = new simulatorDialog(this);
|
||||
sd->loadParams(*simuData, modelId);
|
||||
sd->exec();
|
||||
delete sd;
|
||||
}
|
||||
delete simuData;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ class ModelEdit : public QDialog
|
||||
public:
|
||||
explicit ModelEdit(RadioData & radioData, int modelId , bool openWizard =false, bool inNew =false, QWidget *parent = 0);
|
||||
~ModelEdit();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
signals:
|
||||
void modified();
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../companion9x.qrc">
|
||||
<iconset resource="../companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
@@ -50,10 +50,6 @@
|
||||
<property name="text">
|
||||
<string>Simulate</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../companion9x.qrc">
|
||||
<normaloff>:/images/simulate.png</normaloff>:/images/simulate.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -61,7 +57,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../companion9x.qrc"/>
|
||||
<include location="../companion.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -19,13 +19,10 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer):
|
||||
ui->persistentValue->hide();
|
||||
}
|
||||
|
||||
if (!GetEepromInterface()->getCapability(minuteBeep)) {
|
||||
ui->minuteBeep->hide();
|
||||
}
|
||||
|
||||
if (!GetEepromInterface()->getCapability(countdownBeep)) {
|
||||
ui->countdownBeep->hide();
|
||||
}
|
||||
ui->countdownBeep->addItem(tr("None"));
|
||||
ui->countdownBeep->addItem(tr("Beeps"));
|
||||
if (IS_ARM(GetEepromInterface()->getBoard()) || IS_2560(GetEepromInterface()->getBoard()))
|
||||
ui->countdownBeep->addItem(tr("Countdown"));
|
||||
}
|
||||
|
||||
TimerPanel::~TimerPanel()
|
||||
@@ -54,13 +51,8 @@ void TimerPanel::update()
|
||||
ui->persistentValue->setText(QString(" %1(%2:%3:%4)").arg(sign<0 ? "-" :" ").arg(hours, 2, 10, QLatin1Char('0')).arg(minutes, 2, 10, QLatin1Char('0')).arg(seconds, 2, 10, QLatin1Char('0')));
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(minuteBeep)) {
|
||||
ui->minuteBeep->setChecked(timer.minuteBeep);
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(countdownBeep)) {
|
||||
ui->countdownBeep->setChecked(timer.countdownBeep);
|
||||
}
|
||||
ui->countdownBeep->setCurrentIndex(timer.countdownBeep);
|
||||
ui->minuteBeep->setChecked(timer.minuteBeep);
|
||||
}
|
||||
|
||||
void TimerPanel::on_value_editingFinished()
|
||||
@@ -81,15 +73,15 @@ void TimerPanel::on_persistent_toggled(bool checked)
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TimerPanel::on_minuteBeep_toggled(bool checked)
|
||||
void TimerPanel::on_countdownBeep_currentIndexChanged(int index)
|
||||
{
|
||||
timer.minuteBeep = checked;
|
||||
timer.countdownBeep = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TimerPanel::on_countdownBeep_toggled(bool checked)
|
||||
void TimerPanel::on_minuteBeep_toggled(bool checked)
|
||||
{
|
||||
timer.countdownBeep = checked;
|
||||
timer.minuteBeep = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
@@ -107,16 +99,16 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
|
||||
|
||||
QString label;
|
||||
if (moduleIdx < 0) {
|
||||
label = tr("Trainer Module");
|
||||
label = tr("Trainer Output");
|
||||
ui->trainerMode->setCurrentIndex(model.trainerMode);
|
||||
}
|
||||
else {
|
||||
ui->label_trainerMode->hide();
|
||||
ui->trainerMode->hide();
|
||||
if (moduleIdx == 0)
|
||||
label = tr("Internal Module");
|
||||
label = tr("Internal Radio System");
|
||||
else
|
||||
label = tr("External Module");
|
||||
label = tr("External Radio Module");
|
||||
|
||||
}
|
||||
ui->label_module->setText(label);
|
||||
@@ -224,14 +216,18 @@ void ModulePanel::update()
|
||||
ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafeMode->setCurrentIndex(module.failsafeMode);
|
||||
ui->label_failsafeFrame->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafesFrame->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafesFrame->setEnabled(module.failsafeMode == 1);
|
||||
for (int i=0; i<failsafeSliders.size(); i++) {
|
||||
failsafeSliders[i]->setValue(module.failsafeChannels[i]);
|
||||
failsafeSpins[i]->setValue(module.failsafeChannels[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mask = 0;
|
||||
}
|
||||
|
||||
ui->failsafesLayoutLabel->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->failsafesFrame->setVisible(mask & MASK_FAILSAFES);
|
||||
}
|
||||
|
||||
void ModulePanel::on_trainerMode_currentIndexChanged(int index)
|
||||
@@ -353,7 +349,7 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
||||
if (GetEepromInterface()->getCapability(ModelImage)) {
|
||||
QStringList items;
|
||||
items.append("");
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QSettings settings;
|
||||
QString path = settings.value("sdPath", ".").toString();
|
||||
path.append("/BMP/");
|
||||
QDir qd(path);
|
||||
@@ -486,7 +482,7 @@ void Setup::on_extendedTrims_toggled(bool checked)
|
||||
|
||||
void Setup::on_trimIncrement_currentIndexChanged(int index)
|
||||
{
|
||||
model.trimInc = index;
|
||||
model.trimInc = index-2;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
@@ -507,7 +503,7 @@ void Setup::on_image_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
strncpy(model.bitmap, ui->image->currentText().toAscii(), GetEepromInterface()->getCapability(VoicesMaxLength));
|
||||
QSettings settings("companion9x", "companion9x");
|
||||
QSettings settings;
|
||||
QString path=settings.value("sdPath", ".").toString();
|
||||
path.append("/BMP/");
|
||||
QDir qd(path);
|
||||
@@ -545,7 +541,7 @@ void Setup::update()
|
||||
ui->throttleWarning->setChecked(model.disableThrottleWarning);
|
||||
|
||||
//trim inc, thro trim, thro expo, instatrim
|
||||
ui->trimIncrement->setCurrentIndex(model.trimInc);
|
||||
ui->trimIncrement->setCurrentIndex(model.trimInc+2);
|
||||
ui->throttleTrim->setChecked(model.thrTrim);
|
||||
ui->extendedLimits->setChecked(model.extendedLimits);
|
||||
ui->extendedTrims->setChecked(model.extendedTrims);
|
||||
|
||||
@@ -28,7 +28,7 @@ class TimerPanel : public ModelPanel
|
||||
void on_value_editingFinished();
|
||||
void on_persistent_toggled(bool checked);
|
||||
void on_minuteBeep_toggled(bool checked);
|
||||
void on_countdownBeep_toggled(bool checked);
|
||||
void on_countdownBeep_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
TimerData & timer;
|
||||
|
||||
@@ -443,7 +443,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_failsafeFrame">
|
||||
<widget class="QLabel" name="failsafesLayoutLabel">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>726</width>
|
||||
<height>54</height>
|
||||
<width>586</width>
|
||||
<height>38</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -33,6 +33,23 @@
|
||||
<item>
|
||||
<widget class="QComboBox" name="mode"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="countdownBeepLabel">
|
||||
<property name="text">
|
||||
<string>Countdown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="countdownBeep"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minuteBeep">
|
||||
<property name="text">
|
||||
<string>MinuteBeep</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="persistent">
|
||||
<property name="text">
|
||||
@@ -47,20 +64,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minuteBeep">
|
||||
<property name="text">
|
||||
<string>MinuteBeep</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="countdownBeep">
|
||||
<property name="text">
|
||||
<string>CountDownBeep</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@
|
||||
|
||||
namespace Ui {
|
||||
class TelemetryAnalog;
|
||||
class TelemetryCustomScreen;
|
||||
class Telemetry;
|
||||
}
|
||||
|
||||
@@ -44,6 +45,32 @@ class TelemetryAnalog : public QWidget
|
||||
void update();
|
||||
};
|
||||
|
||||
class TelemetryCustomScreen : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen);
|
||||
~TelemetryCustomScreen();
|
||||
void update();
|
||||
|
||||
private slots:
|
||||
void on_screenType_currentIndexChanged(int index);
|
||||
void customFieldChanged(int index);
|
||||
void barSourceChanged(int index);
|
||||
void barMinChanged(double value);
|
||||
void barMaxChanged(double value);
|
||||
|
||||
private:
|
||||
void updateBar(int line);
|
||||
Ui::TelemetryCustomScreen * ui;
|
||||
FrSkyScreenData & screen;
|
||||
QComboBox * fieldsCB[4][3];
|
||||
QComboBox * barsCB[4];
|
||||
QDoubleSpinBox * minSB[4];
|
||||
QDoubleSpinBox * maxSB[4];
|
||||
};
|
||||
|
||||
class TelemetryPanel : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -74,24 +101,15 @@ class TelemetryPanel : public ModelPanel
|
||||
void on_varioLimitCenterMin_DSB_editingFinished();
|
||||
void on_varioLimitMinOff_ChkB_toggled(bool checked);
|
||||
void on_varioLimitCenterMax_DSB_editingFinished();
|
||||
void telBarCBcurrentIndexChanged(int index);
|
||||
void ScreenTypeCBcurrentIndexChanged(int index);
|
||||
void telMaxSBeditingFinished();
|
||||
void telMinSBeditingFinished();
|
||||
void customFieldEdited();
|
||||
void on_fasOffset_DSB_editingFinished();
|
||||
void on_mahCount_SB_editingFinished();
|
||||
void on_mahCount_ChkB_toggled(bool checked);
|
||||
|
||||
private:
|
||||
Ui::Telemetry *ui;
|
||||
TelemetryAnalog * analogs[2];
|
||||
QGroupBox* barsGB[3];
|
||||
QGroupBox* numsGB[3];
|
||||
QComboBox* barsCB[12];
|
||||
QDoubleSpinBox* minSB[12];
|
||||
QDoubleSpinBox* maxSB[12];
|
||||
QComboBox* csf[36];
|
||||
|
||||
void setup();
|
||||
float getBarStep(int barId);
|
||||
void telBarUpdate();
|
||||
};
|
||||
|
||||
|
||||
+104
-1227
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TelemetryCustomScreen</class>
|
||||
<widget class="QWidget" name="TelemetryCustomScreen">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>650</width>
|
||||
<height>393</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="screenTypeLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Custom Screen Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="screenType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Nums</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bars</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="screenNums">
|
||||
<layout class="QGridLayout" name="screenNumsLayout"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="screenBars">
|
||||
<layout class="QGridLayout" name="screenBarsLayout" columnstretch="1,0,1,0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_266">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_265">
|
||||
<property name="text">
|
||||
<string>Source</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_267">
|
||||
<property name="text">
|
||||
<string>Gauge</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_268">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -2,6 +2,28 @@
|
||||
#include <QListWidget>
|
||||
#include <QMessageBox>
|
||||
|
||||
void ModelEdit::setCurve(uint8_t c, int8_t ar[])
|
||||
{
|
||||
int len=sizeof(ar)/sizeof(int8_t);
|
||||
|
||||
if (GetEepromInterface()->getCapability(NumCurves)>c) {
|
||||
if (len<9) {
|
||||
model.curves[c].count=5;
|
||||
model.curves[c].custom=false;
|
||||
for (int i=0; i< 5; i++) {
|
||||
model.curves[c].points[i].y=ar[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
model.curves[c].count=5;
|
||||
model.curves[c].custom=false;
|
||||
for (int i=0; i< 5; i++) {
|
||||
model.curves[c].points[i].y=ar[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Templates::Templates(QWidget * parent, ModelData & model):
|
||||
QWidget(parent),
|
||||
model(model)
|
||||
|
||||
Reference in New Issue
Block a user