mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
Issue #731 - Conversion issues (Inputs) fixed
This commit is contained in:
parent
aed219cbd1
commit
bf7919bd8d
9 changed files with 159 additions and 99 deletions
|
@ -242,10 +242,13 @@ QString RawSource::toString()
|
|||
}
|
||||
switch (type) {
|
||||
case SOURCE_TYPE_VIRTUAL_INPUT:
|
||||
if (model && strlen(model->inputNames[index]) > 0)
|
||||
return QString(model->inputNames[index]);
|
||||
else
|
||||
return QObject::tr("Input %1").arg(index+1);
|
||||
{
|
||||
QString result = QObject::tr("[I%1]").arg(index+1);
|
||||
if (model && strlen(model->inputNames[index]) > 0) {
|
||||
result += QString(model->inputNames[index]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
case SOURCE_TYPE_STICK:
|
||||
return AnalogString(index);
|
||||
case SOURCE_TYPE_TRIM:
|
||||
|
@ -893,6 +896,19 @@ ModelData::ModelData()
|
|||
clear();
|
||||
}
|
||||
|
||||
ExpoData * ModelData::insertInput(const int idx)
|
||||
{
|
||||
memmove(&expoData[idx+1], &expoData[idx], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||
expoData[idx].clear();
|
||||
return &expoData[idx];
|
||||
}
|
||||
|
||||
void ModelData::removeInput(const int idx)
|
||||
{
|
||||
memmove(&expoData[idx], &expoData[idx+1], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||
expoData[C9X_MAX_EXPOS-1].clear();
|
||||
}
|
||||
|
||||
void ModelData::clearInputs()
|
||||
{
|
||||
for (int i=0; i<C9X_MAX_EXPOS; i++)
|
||||
|
|
|
@ -502,12 +502,19 @@ class CurveReference {
|
|||
QString toString();
|
||||
};
|
||||
|
||||
enum InputMode {
|
||||
INPUT_MODE_NONE,
|
||||
INPUT_MODE_POS,
|
||||
INPUT_MODE_NEG,
|
||||
INPUT_MODE_BOTH
|
||||
};
|
||||
|
||||
class ExpoData {
|
||||
public:
|
||||
ExpoData() { clear(); }
|
||||
RawSource srcRaw;
|
||||
unsigned int scale;
|
||||
unsigned int mode; // 0=end, 1=pos, 2=neg, 3=both
|
||||
unsigned int mode;
|
||||
unsigned int chn;
|
||||
RawSwitch swtch;
|
||||
unsigned int phases; // -5=!FP4, 0=normal, 5=FP4
|
||||
|
@ -880,6 +887,10 @@ class ScriptData {
|
|||
class ModelData {
|
||||
public:
|
||||
ModelData();
|
||||
|
||||
ExpoData * insertInput(const int idx);
|
||||
void removeInput(const int idx);
|
||||
|
||||
bool used;
|
||||
char name[12+1];
|
||||
uint8_t modelVoice;
|
||||
|
|
|
@ -733,12 +733,13 @@ void importGvarParam(int & gvar, const int _gvar)
|
|||
|
||||
class MixField: public TransformedField {
|
||||
public:
|
||||
MixField(MixData & mix, BoardEnum board, unsigned int version):
|
||||
MixField(MixData & mix, BoardEnum board, unsigned int version, ModelData * model):
|
||||
TransformedField(internalField),
|
||||
internalField("Mix"),
|
||||
mix(mix),
|
||||
board(board),
|
||||
version(version)
|
||||
version(version),
|
||||
model(model)
|
||||
{
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
internalField.Append(new UnsignedField<8>(_destCh));
|
||||
|
@ -878,6 +879,14 @@ class MixField: public TransformedField {
|
|||
|
||||
virtual void afterImport()
|
||||
{
|
||||
if (IS_TARANIS(board) || version < 216) {
|
||||
if (mix.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < NUM_STICKS) {
|
||||
if (!mix.noExpo) {
|
||||
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index, model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mix.srcRaw.type != SOURCE_TYPE_NONE) {
|
||||
mix.destCh = _destCh + 1;
|
||||
if (!IS_ARM(board) || version < 216) {
|
||||
|
@ -908,6 +917,7 @@ class MixField: public TransformedField {
|
|||
MixData & mix;
|
||||
BoardEnum board;
|
||||
unsigned int version;
|
||||
ModelData * model;
|
||||
unsigned int _destCh;
|
||||
bool _curveMode;
|
||||
int _curveParam;
|
||||
|
@ -917,11 +927,11 @@ class MixField: public TransformedField {
|
|||
unsigned int _offsetMode;
|
||||
};
|
||||
|
||||
class ExpoField: public TransformedField {
|
||||
class InputField: public TransformedField {
|
||||
public:
|
||||
ExpoField(ExpoData & expo, BoardEnum board, unsigned int version):
|
||||
InputField(ExpoData & expo, BoardEnum board, unsigned int version):
|
||||
TransformedField(internalField),
|
||||
internalField("Expo"),
|
||||
internalField("Input"),
|
||||
expo(expo),
|
||||
board(board),
|
||||
version(version)
|
||||
|
@ -940,11 +950,11 @@ class ExpoField: public TransformedField {
|
|||
internalField.Append(new SpareBitsField<8>());
|
||||
}
|
||||
else if (IS_ARM(board)) {
|
||||
internalField.Append(new UnsignedField<8>(expo.mode));
|
||||
internalField.Append(new UnsignedField<8>(expo.chn));
|
||||
internalField.Append(new UnsignedField<8>(expo.mode, "Mode"));
|
||||
internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
|
||||
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
|
||||
internalField.Append(new UnsignedField<16>(expo.phases));
|
||||
internalField.Append(new SignedField<8>(_weight));
|
||||
internalField.Append(new UnsignedField<16>(expo.phases, "Phases"));
|
||||
internalField.Append(new SignedField<8>(_weight, "Weight"));
|
||||
internalField.Append(new BoolField<8>(_curveMode));
|
||||
if (HAS_LARGE_LCD(board)) {
|
||||
internalField.Append(new ZCharField<8>(expo.name));
|
||||
|
@ -979,6 +989,7 @@ class ExpoField: public TransformedField {
|
|||
virtual void beforeExport()
|
||||
{
|
||||
_weight = smallGvarToEEPROM(expo.weight);
|
||||
|
||||
if (!IS_TARANIS(board) || version < 216) {
|
||||
if (expo.curve.type==CurveReference::CURVE_REF_FUNC && expo.curve.value) {
|
||||
_curveMode = true;
|
||||
|
@ -998,7 +1009,9 @@ class ExpoField: public TransformedField {
|
|||
virtual void afterImport()
|
||||
{
|
||||
if (IS_TARANIS(board) && version < 216) {
|
||||
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
|
||||
if (expo.mode) {
|
||||
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
|
||||
}
|
||||
}
|
||||
|
||||
expo.weight = smallGvarToC9x(_weight);
|
||||
|
@ -1278,13 +1291,14 @@ class AndSwitchesConversionTable: public ConversionTable {
|
|||
|
||||
class LogicalSwitchField: public TransformedField {
|
||||
public:
|
||||
LogicalSwitchField(LogicalSwitchData & csw, BoardEnum board, unsigned int version, unsigned int variant):
|
||||
LogicalSwitchField(LogicalSwitchData & csw, BoardEnum board, unsigned int version, unsigned int variant, ModelData * model=NULL):
|
||||
TransformedField(internalField),
|
||||
internalField("LogicalSwitch"),
|
||||
csw(csw),
|
||||
board(board),
|
||||
version(version),
|
||||
variant(variant),
|
||||
model(model),
|
||||
functionsConversionTable(board, version),
|
||||
sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, (version >= 214 || (!IS_ARM(board) && version >= 213)) ? 0 : FLAG_NOSWITCHES)),
|
||||
switchesConversionTable(SwitchesConversionTable::getInstance(board, version)),
|
||||
|
@ -1374,7 +1388,7 @@ class LogicalSwitchField: public TransformedField {
|
|||
else if (csw.func != LS_FN_OFF) {
|
||||
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
|
||||
csw.val2 = v2;
|
||||
RawSource val1(csw.val1);
|
||||
RawSource val1(csw.val1, model);
|
||||
if (IS_ARM(board) && version < 216 && val1.type == SOURCE_TYPE_TELEMETRY) {
|
||||
switch (val1.index) {
|
||||
case TELEMETRY_SOURCE_TIMER1:
|
||||
|
@ -1426,6 +1440,7 @@ class LogicalSwitchField: public TransformedField {
|
|||
BoardEnum board;
|
||||
unsigned int version;
|
||||
unsigned int variant;
|
||||
ModelData * model;
|
||||
LogicalSwitchesFunctionsTable functionsConversionTable;
|
||||
SourcesConversionTable * sourcesConversionTable;
|
||||
SwitchesConversionTable * switchesConversionTable;
|
||||
|
@ -2143,11 +2158,12 @@ class MavlinkField: public StructField {
|
|||
int exportPpmDelay(int delay) { return (delay - 300) / 50; }
|
||||
int importPpmDelay(int delay) { return 300 + 50 * delay; }
|
||||
|
||||
Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, unsigned int version, unsigned int variant):
|
||||
OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigned int version, unsigned int variant):
|
||||
TransformedField(internalField),
|
||||
internalField("ModelData"),
|
||||
modelData(modelData),
|
||||
board(board),
|
||||
version(version),
|
||||
variant(variant),
|
||||
protocolsConversionTable(board)
|
||||
{
|
||||
|
@ -2237,14 +2253,14 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
|||
internalField.Append(new UnsignedField<8>(modelData.beepANACenter));
|
||||
|
||||
for (int i=0; i<MAX_MIXERS(board, version); i++)
|
||||
internalField.Append(new MixField(modelData.mixData[i], board, version));
|
||||
internalField.Append(new MixField(modelData.mixData[i], board, version, &modelData));
|
||||
for (int i=0; i<MAX_CHANNELS(board, version); i++)
|
||||
internalField.Append(new LimitField(modelData.limitData[i], board, version));
|
||||
for (int i=0; i<MAX_EXPOS(board, version); i++)
|
||||
internalField.Append(new ExpoField(modelData.expoData[i], board, version));
|
||||
internalField.Append(new InputField(modelData.expoData[i], board, version));
|
||||
internalField.Append(new CurvesField(modelData.curves, board, version));
|
||||
for (int i=0; i<MAX_CUSTOM_SWITCHES(board, version); i++)
|
||||
internalField.Append(new LogicalSwitchField(modelData.customSw[i], board, version, variant));
|
||||
internalField.Append(new LogicalSwitchField(modelData.customSw[i], board, version, variant, &modelData));
|
||||
for (int i=0; i<MAX_CUSTOM_FUNCTIONS(board, version); i++) {
|
||||
if (IS_ARM(board))
|
||||
internalField.Append(new ArmCustomFunctionField(modelData.funcSw[i], board, version, variant));
|
||||
|
@ -2356,7 +2372,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
|||
}
|
||||
}
|
||||
|
||||
void Open9xModelDataNew::beforeExport()
|
||||
void OpenTxModelData::beforeExport()
|
||||
{
|
||||
// qDebug() << QString("before export model") << modelData.name;
|
||||
|
||||
|
@ -2370,10 +2386,29 @@ void Open9xModelDataNew::beforeExport()
|
|||
}
|
||||
}
|
||||
|
||||
void Open9xModelDataNew::afterImport()
|
||||
void OpenTxModelData::afterImport()
|
||||
{
|
||||
// qDebug() << QString("after import model") << modelData.name ;
|
||||
|
||||
if (IS_TARANIS(board) && version < 216) {
|
||||
for (unsigned int i=0; i<NUM_STICKS; i++) {
|
||||
for (int j=0; j<64; j++) {
|
||||
ExpoData * expo = &modelData.expoData[j];
|
||||
if (expo->mode == INPUT_MODE_BOTH && expo->chn == i && expo->phases == 0 && expo->swtch.type == SWITCH_TYPE_NONE)
|
||||
break;
|
||||
if (expo->mode == 0 || expo->chn > i) {
|
||||
ExpoData * newExpo = modelData.insertInput(j);
|
||||
newExpo->mode = INPUT_MODE_BOTH;
|
||||
newExpo->srcRaw = RawSource(SOURCE_TYPE_STICK, i);
|
||||
newExpo->chn = i;
|
||||
newExpo->weight = 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
strncpy(modelData.inputNames[i], AnalogString(i).toLatin1().constData(), sizeof(modelData.inputNames[i])-1);
|
||||
}
|
||||
}
|
||||
|
||||
for (int module=0; module<3; module++) {
|
||||
if (modelData.moduleData[module].protocol == PXX_XJT_X16 || modelData.moduleData[module].protocol == LP45) {
|
||||
if (subprotocols[module] >= 0)
|
||||
|
@ -2384,7 +2419,7 @@ void Open9xModelDataNew::afterImport()
|
|||
}
|
||||
}
|
||||
|
||||
Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant):
|
||||
OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant):
|
||||
TransformedField(internalField),
|
||||
internalField("General Settings"),
|
||||
generalData(generalData),
|
||||
|
@ -2521,7 +2556,7 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
|
|||
}
|
||||
}
|
||||
|
||||
void Open9xGeneralDataNew::beforeExport()
|
||||
void OpenTxGeneralData::beforeExport()
|
||||
{
|
||||
uint16_t sum = 0;
|
||||
if (version >= 216) {
|
||||
|
@ -2544,6 +2579,6 @@ void Open9xGeneralDataNew::beforeExport()
|
|||
chkSum = sum;
|
||||
}
|
||||
|
||||
void Open9xGeneralDataNew::afterImport()
|
||||
void OpenTxGeneralData::afterImport()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -51,9 +51,9 @@
|
|||
#define O9X_ARM_MAX_CSFUNCOLD 13
|
||||
#define O9X_ARM_MAX_CSFUNC 15
|
||||
|
||||
class Open9xGeneralDataNew: public TransformedField {
|
||||
class OpenTxGeneralData: public TransformedField {
|
||||
public:
|
||||
Open9xGeneralDataNew(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant=0);
|
||||
OpenTxGeneralData(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant=0);
|
||||
|
||||
protected:
|
||||
virtual void beforeExport();
|
||||
|
@ -113,9 +113,9 @@ class ChannelsConversionTable: public ConversionTable
|
|||
};
|
||||
|
||||
|
||||
class Open9xModelDataNew: public TransformedField {
|
||||
class OpenTxModelData: public TransformedField {
|
||||
public:
|
||||
Open9xModelDataNew(ModelData & modelData, BoardEnum board, unsigned int version, unsigned int variant);
|
||||
OpenTxModelData(ModelData & modelData, BoardEnum board, unsigned int version, unsigned int variant);
|
||||
|
||||
const char * getName() { return name; }
|
||||
|
||||
|
@ -126,6 +126,7 @@ class Open9xModelDataNew: public TransformedField {
|
|||
StructField internalField;
|
||||
ModelData & modelData;
|
||||
BoardEnum board;
|
||||
unsigned int version;
|
||||
unsigned int variant;
|
||||
|
||||
private:
|
||||
|
|
|
@ -236,11 +236,11 @@ bool OpenTxInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data
|
|||
return loadModel<Open9xArmModelData_v212>(model, data, index);
|
||||
}
|
||||
else {
|
||||
return loadModelVariant<Open9xModelDataNew>(index, model, data, version, variant);
|
||||
return loadModelVariant<OpenTxModelData>(index, model, data, version, variant);
|
||||
}
|
||||
}
|
||||
else if (version >= 213) {
|
||||
return loadModelVariant<Open9xModelDataNew>(index, model, data, version, variant);
|
||||
return loadModelVariant<OpenTxModelData>(index, model, data, version, variant);
|
||||
}
|
||||
|
||||
std::cout << " ko\n";
|
||||
|
@ -336,7 +336,7 @@ bool OpenTxInterface::load(RadioData &radioData, const uint8_t *eeprom, int size
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!loadGeneral<Open9xGeneralDataNew>(radioData.generalSettings, version)) {
|
||||
if (!loadGeneral<OpenTxGeneralData>(radioData.generalSettings, version)) {
|
||||
std::cout << " ko\n";
|
||||
return false;
|
||||
}
|
||||
|
@ -383,14 +383,14 @@ int OpenTxInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian
|
|||
variant |= M128_VARIANT;
|
||||
}
|
||||
|
||||
int result = saveGeneral<Open9xGeneralDataNew>(radioData.generalSettings, board, version, variant);
|
||||
int result = saveGeneral<OpenTxGeneralData>(radioData.generalSettings, board, version, variant);
|
||||
if (!result) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int i=0; i<getMaxModels(); i++) {
|
||||
if (!radioData.models[i].isempty()) {
|
||||
result = saveModel<Open9xModelDataNew>(i, radioData.models[i], version, variant);
|
||||
result = saveModel<OpenTxModelData>(i, radioData.models[i], version, variant);
|
||||
if (!result) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ int OpenTxInterface::getSize(ModelData &model)
|
|||
uint8_t tmp[EESIZE_RLC_MAX];
|
||||
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
|
||||
|
||||
Open9xModelDataNew open9xModel(model, board, 255, GetCurrentFirmwareVariant());
|
||||
OpenTxModelData open9xModel(model, board, 255, GetCurrentFirmwareVariant());
|
||||
|
||||
QByteArray eeprom;
|
||||
open9xModel.Export(eeprom);
|
||||
|
@ -436,7 +436,7 @@ int OpenTxInterface::getSize(GeneralSettings &settings)
|
|||
uint8_t tmp[EESIZE_RLC_MAX];
|
||||
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
|
||||
|
||||
Open9xGeneralDataNew open9xGeneral(settings, board, 255, GetCurrentFirmwareVariant());
|
||||
OpenTxGeneralData open9xGeneral(settings, board, 255, GetCurrentFirmwareVariant());
|
||||
// open9xGeneral.Dump();
|
||||
|
||||
QByteArray eeprom;
|
||||
|
|
|
@ -29,9 +29,9 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g
|
|||
exposLayout->addWidget(qbClear,2,2);
|
||||
exposLayout->addWidget(qbDown,2,3);
|
||||
|
||||
connect(ExposlistWidget, SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(expolistWidget_customContextMenuRequested(QPoint)));
|
||||
connect(ExposlistWidget, SIGNAL(doubleClicked(QModelIndex)),this,SLOT(expolistWidget_doubleClicked(QModelIndex)));
|
||||
connect(ExposlistWidget, SIGNAL(mimeDropped(int,const QMimeData*,Qt::DropAction)),this,SLOT(mimeExpoDropped(int,const QMimeData*,Qt::DropAction)));
|
||||
connect(ExposlistWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(expolistWidget_customContextMenuRequested(QPoint)));
|
||||
connect(ExposlistWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(expolistWidget_doubleClicked(QModelIndex)));
|
||||
connect(ExposlistWidget, SIGNAL(mimeDropped(int,const QMimeData*,Qt::DropAction)), this, SLOT(mimeExpoDropped(int, const QMimeData*, Qt::DropAction)));
|
||||
|
||||
connect(qbUp, SIGNAL(pressed()),SLOT(moveExpoUp()));
|
||||
connect(qbDown, SIGNAL(pressed()),SLOT(moveExpoDown()));
|
||||
|
@ -58,7 +58,7 @@ void InputsPanel::update()
|
|||
ExposlistWidget->clear();
|
||||
int curDest = -1;
|
||||
|
||||
for(int i=0; i<C9X_MAX_EXPOS; i++) {
|
||||
for (int i=0; i<C9X_MAX_EXPOS; i++) {
|
||||
ExpoData *md = &model.expoData[i];
|
||||
|
||||
if (md->mode==0) break;
|
||||
|
@ -144,26 +144,24 @@ 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, "companion", tr("Not enough available inputs!"));
|
||||
return false;
|
||||
}
|
||||
if (idx<0 || idx>=C9X_MAX_EXPOS || model.expoData[C9X_MAX_EXPOS-1].mode > 0) {
|
||||
QMessageBox::information(this, "Companion", tr("Not enough available inputs!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
int chn = model.expoData[idx].chn;
|
||||
memmove(&model.expoData[idx+1],&model.expoData[idx],
|
||||
(C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData) );
|
||||
memset(&model.expoData[idx],0,sizeof(ExpoData));
|
||||
model.expoData[idx].chn = chn;
|
||||
model.expoData[idx].weight = 100;
|
||||
model.expoData[idx].mode = 3 /* TODO enum */;
|
||||
return true;
|
||||
int chn = model.expoData[idx].chn;
|
||||
|
||||
ExpoData * newExpo = model.insertInput(idx);
|
||||
newExpo->chn = chn;
|
||||
newExpo->weight = 100;
|
||||
newExpo->mode = INPUT_MODE_BOTH;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InputsPanel::gm_deleteExpo(int index)
|
||||
{
|
||||
memmove(&model.expoData[index],&model.expoData[index+1],
|
||||
(C9X_MAX_EXPOS-(index+1))*sizeof(ExpoData));
|
||||
memset(&model.expoData[C9X_MAX_EXPOS-1],0,sizeof(ExpoData));
|
||||
model.removeInput(index);
|
||||
}
|
||||
|
||||
void InputsPanel::gm_openExpo(int index)
|
||||
|
|
|
@ -6,24 +6,19 @@
|
|||
class MixersList : public QListWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MixersList(QWidget *parent, bool expo);
|
||||
// QMimeData * mimeData ( const QList<QListWidgetItem *> items );
|
||||
|
||||
public:
|
||||
explicit MixersList(QWidget *parent, bool expo);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
|
||||
signals:
|
||||
signals:
|
||||
void mimeDropped(int index, const QMimeData *data, Qt::DropAction action);
|
||||
void keyWasPressed(QKeyEvent *event);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action);
|
||||
|
||||
private:
|
||||
private:
|
||||
QPoint dragStartPosition;
|
||||
bool expo;
|
||||
|
||||
|
|
|
@ -53,15 +53,16 @@ void MixesPanel::update()
|
|||
int i;
|
||||
unsigned int outputs = GetEepromInterface()->getCapability(Outputs);
|
||||
int showNames = false; // TODO in a menu ui->showNames_Ckb->isChecked();
|
||||
for(i=0; i<GetEepromInterface()->getCapability(Mixes); i++) {
|
||||
for (i=0; i<GetEepromInterface()->getCapability(Mixes); i++) {
|
||||
MixData *md = &model.mixData[i];
|
||||
if ((md->destCh==0) || (md->destCh>outputs+(unsigned int)GetEepromInterface()->getCapability(ExtraChannels))) continue;
|
||||
QString str = "";
|
||||
while(curDest<(md->destCh-1)) {
|
||||
while (curDest<(md->destCh-1)) {
|
||||
curDest++;
|
||||
if (curDest > outputs) {
|
||||
str = tr("X%1 ").arg(curDest-outputs);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
str = tr("CH%1%2").arg(curDest/10).arg(curDest%10);
|
||||
if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
|
||||
QString name=model.limitData[curDest-1].name;
|
||||
|
@ -80,7 +81,8 @@ void MixesPanel::update()
|
|||
|
||||
if (md->destCh > outputs) {
|
||||
str = tr("X%1 ").arg(md->destCh-outputs);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
str = tr("CH%1%2").arg(md->destCh/10).arg(md->destCh%10);
|
||||
str.append(" ");
|
||||
if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
|
||||
|
@ -97,7 +99,7 @@ void MixesPanel::update()
|
|||
str.fill(' ');
|
||||
}
|
||||
|
||||
switch(md->mltpx) {
|
||||
switch (md->mltpx) {
|
||||
case (1): str += " *"; break;
|
||||
case (2): str += " R"; break;
|
||||
default: str += " "; break;
|
||||
|
@ -110,7 +112,9 @@ void MixesPanel::update()
|
|||
QString phasesStr = getPhasesStr(md->phases, model);
|
||||
if (!phasesStr.isEmpty()) str += " " + phasesStr;
|
||||
|
||||
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
|
||||
if (md->swtch.type != SWITCH_TYPE_NONE) {
|
||||
str += " " + tr("Switch(%1)").arg(md->swtch.toString());
|
||||
}
|
||||
|
||||
if (!GetEepromInterface()->getCapability(VirtualInputs)) {
|
||||
if (md->carryTrim>0) {
|
||||
|
@ -125,9 +129,9 @@ void MixesPanel::update()
|
|||
if (md->sOffset) str += " " + tr("Offset(%1)").arg(getGVarString(md->sOffset));
|
||||
if (md->curve.value) str += " " + md->curve.toString();
|
||||
|
||||
int scale=GetEepromInterface()->getCapability(SlowScale);
|
||||
if (scale==0)
|
||||
scale=1;
|
||||
int scale = GetEepromInterface()->getCapability(SlowScale);
|
||||
if (scale == 0)
|
||||
scale = 1;
|
||||
if (md->delayDown || md->delayUp)
|
||||
str += tr(" Delay(u%1:d%2)").arg((double)md->delayUp/scale).arg((double)md->delayDown/scale);
|
||||
if (md->speedDown || md->speedUp)
|
||||
|
@ -144,8 +148,8 @@ void MixesPanel::update()
|
|||
qba.append((quint8)i);
|
||||
qba.append((const char*)md, sizeof(MixData));
|
||||
QListWidgetItem *itm = new QListWidgetItem(str);
|
||||
itm->setData(Qt::UserRole,qba); // mix number
|
||||
MixerlistWidget->addItem(itm);//(str);
|
||||
itm->setData(Qt::UserRole, qba); // mix number
|
||||
MixerlistWidget->addItem(itm); //(str);
|
||||
}
|
||||
|
||||
while(curDest<outputs+GetEepromInterface()->getCapability(ExtraChannels)) {
|
||||
|
|
|
@ -44,36 +44,36 @@
|
|||
#include "helpers.h"
|
||||
|
||||
class DragDropHeader {
|
||||
public:
|
||||
DragDropHeader():
|
||||
general_settings(false),
|
||||
models_count(0)
|
||||
{
|
||||
}
|
||||
bool general_settings;
|
||||
uint8_t models_count;
|
||||
uint8_t models[C9X_MAX_MODELS];
|
||||
public:
|
||||
DragDropHeader():
|
||||
general_settings(false),
|
||||
models_count(0)
|
||||
{
|
||||
}
|
||||
bool general_settings;
|
||||
uint8_t models_count;
|
||||
uint8_t models[C9X_MAX_MODELS];
|
||||
};
|
||||
|
||||
ModelsListWidget::ModelsListWidget(QWidget *parent):
|
||||
QListWidget(parent)
|
||||
{
|
||||
this->setFont(QFont("Courier New",12));
|
||||
radioData = &((MdiChild *)parent)->radioData;
|
||||
refreshList();
|
||||
setFont(QFont("Courier New",12));
|
||||
radioData = &((MdiChild *)parent)->radioData;
|
||||
refreshList();
|
||||
|
||||
connect(this, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(OpenEditWindow()));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu(const QPoint&)));
|
||||
connect(this, SIGNAL(currentRowChanged(int)), this, SLOT(viableModelSelected(int)));
|
||||
connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(OpenEditWindow()));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu(const QPoint&)));
|
||||
connect(this, SIGNAL(currentRowChanged(int)), this, SLOT(viableModelSelected(int)));
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setDragEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
setDragDropOverwriteMode(true);
|
||||
setDropIndicatorShown(true);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setDragEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
setDragDropOverwriteMode(true);
|
||||
setDropIndicatorShown(true);
|
||||
|
||||
active_highlight_color = this->palette().color(QPalette::Active, QPalette::Highlight);
|
||||
active_highlight_color = palette().color(QPalette::Active, QPalette::Highlight);
|
||||
}
|
||||
|
||||
void ModelsListWidget::ShowContextMenu(const QPoint& pos)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue