Cosmetics
This commit is contained in:
@@ -88,7 +88,7 @@ t_Open9xExpoData_v201::operator ExpoData ()
|
|||||||
ExpoData c9x;
|
ExpoData c9x;
|
||||||
c9x.mode = mode;
|
c9x.mode = mode;
|
||||||
c9x.chn = chn;
|
c9x.chn = chn;
|
||||||
if (expo!=0 && curve!=0) {
|
if (expo != 0 && curve != 0) {
|
||||||
EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX"));
|
EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -101,13 +101,13 @@ t_Open9xExpoData_v201::operator ExpoData ()
|
|||||||
}
|
}
|
||||||
c9x.swtch = open9xStockToSwitch(swtch);
|
c9x.swtch = open9xStockToSwitch(swtch);
|
||||||
if (negPhase) {
|
if (negPhase) {
|
||||||
c9x.flightModes= 1 << (phase -1);
|
c9x.flightModes = 1 << (phase -1);
|
||||||
}
|
}
|
||||||
else if (phase==0) {
|
else if (phase == 0) {
|
||||||
c9x.flightModes=0;
|
c9x.flightModes = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c9x.flightModes=63;
|
c9x.flightModes = 63;
|
||||||
c9x.flightModes &= ~(1 << (phase -1));
|
c9x.flightModes &= ~(1 << (phase -1));
|
||||||
}
|
}
|
||||||
c9x.weight = weight;
|
c9x.weight = weight;
|
||||||
@@ -129,8 +129,8 @@ t_Open9xExpoData_v211::operator ExpoData ()
|
|||||||
t_Open9xLimitData_v201::operator LimitData ()
|
t_Open9xLimitData_v201::operator LimitData ()
|
||||||
{
|
{
|
||||||
LimitData c9x;
|
LimitData c9x;
|
||||||
c9x.min = 10*(min-100);
|
c9x.min = 10 * (min - 100);
|
||||||
c9x.max = 10*(max+100);
|
c9x.max = 10 * (max + 100);
|
||||||
c9x.revert = revert;
|
c9x.revert = revert;
|
||||||
c9x.offset = offset;
|
c9x.offset = offset;
|
||||||
return c9x;
|
return c9x;
|
||||||
@@ -139,12 +139,12 @@ t_Open9xLimitData_v201::operator LimitData ()
|
|||||||
t_Open9xLimitData_v211::operator LimitData ()
|
t_Open9xLimitData_v211::operator LimitData ()
|
||||||
{
|
{
|
||||||
LimitData c9x;
|
LimitData c9x;
|
||||||
c9x.min = 10*(min-100);
|
c9x.min = 10 * (min - 100);
|
||||||
c9x.max = 10*(max+100);
|
c9x.max = 10 * (max + 100);
|
||||||
c9x.revert = revert;
|
c9x.revert = revert;
|
||||||
c9x.offset = offset;
|
c9x.offset = offset;
|
||||||
c9x.symetrical=symetrical;
|
c9x.symetrical = symetrical;
|
||||||
c9x.ppmCenter=ppmCenter;
|
c9x.ppmCenter = ppmCenter;
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,12 +197,12 @@ t_Open9xMixData_v201::operator MixData ()
|
|||||||
c9x.mltpx = (MltpxValue)mltpx;
|
c9x.mltpx = (MltpxValue)mltpx;
|
||||||
c9x.mixWarn = mixWarn;
|
c9x.mixWarn = mixWarn;
|
||||||
|
|
||||||
if (phase<0) {
|
if (phase < 0) {
|
||||||
c9x.flightModes= 1 << (-phase -1);
|
c9x.flightModes = 1 << (-phase -1);
|
||||||
} else if (phase==0) {
|
} else if (phase == 0) {
|
||||||
c9x.flightModes=0;
|
c9x.flightModes = 0;
|
||||||
} else {
|
} else {
|
||||||
c9x.flightModes=63;
|
c9x.flightModes = 63;
|
||||||
c9x.flightModes &= ~(1 << (phase -1));
|
c9x.flightModes &= ~(1 << (phase -1));
|
||||||
}
|
}
|
||||||
c9x.sOffset = sOffset;
|
c9x.sOffset = sOffset;
|
||||||
@@ -258,12 +258,12 @@ t_Open9xMixData_v203::operator MixData ()
|
|||||||
c9x.mltpx = (MltpxValue)mltpx;
|
c9x.mltpx = (MltpxValue)mltpx;
|
||||||
c9x.mixWarn = mixWarn;
|
c9x.mixWarn = mixWarn;
|
||||||
|
|
||||||
if (phase<0) {
|
if (phase < 0) {
|
||||||
c9x.flightModes= 1 << (-phase -1);
|
c9x.flightModes = 1 << (-phase -1);
|
||||||
} else if (phase==0) {
|
} else if (phase == 0) {
|
||||||
c9x.flightModes=0;
|
c9x.flightModes = 0;
|
||||||
} else {
|
} else {
|
||||||
c9x.flightModes=63;
|
c9x.flightModes = 63;
|
||||||
c9x.flightModes &= ~(1 << (phase -1));
|
c9x.flightModes &= ~(1 << (phase -1));
|
||||||
}
|
}
|
||||||
c9x.sOffset = sOffset;
|
c9x.sOffset = sOffset;
|
||||||
@@ -319,14 +319,14 @@ t_Open9xMixData_v205::operator MixData ()
|
|||||||
c9x.mltpx = (MltpxValue)mltpx;
|
c9x.mltpx = (MltpxValue)mltpx;
|
||||||
c9x.mixWarn = mixWarn;
|
c9x.mixWarn = mixWarn;
|
||||||
|
|
||||||
if (phase<0) {
|
if (phase < 0) {
|
||||||
c9x.flightModes= 1 << (-phase -1);
|
c9x.flightModes = 1 << (-phase -1);
|
||||||
}
|
}
|
||||||
else if (phase==0) {
|
else if (phase == 0) {
|
||||||
c9x.flightModes=0;
|
c9x.flightModes = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c9x.flightModes=63;
|
c9x.flightModes = 63;
|
||||||
c9x.flightModes &= ~(1 << (phase -1));
|
c9x.flightModes &= ~(1 << (phase -1));
|
||||||
}
|
}
|
||||||
c9x.sOffset = sOffset;
|
c9x.sOffset = sOffset;
|
||||||
@@ -339,7 +339,7 @@ t_Open9xMixData_v209::operator MixData ()
|
|||||||
MixData c9x;
|
MixData c9x;
|
||||||
|
|
||||||
if (srcRaw) {
|
if (srcRaw) {
|
||||||
c9x.destCh = destCh+1;
|
c9x.destCh = destCh + 1;
|
||||||
c9x.swtch = open9xStockToSwitch(swtch);
|
c9x.swtch = open9xStockToSwitch(swtch);
|
||||||
|
|
||||||
if (srcRaw == 0) {
|
if (srcRaw == 0) {
|
||||||
@@ -386,14 +386,14 @@ t_Open9xMixData_v209::operator MixData ()
|
|||||||
c9x.mltpx = (MltpxValue)mltpx;
|
c9x.mltpx = (MltpxValue)mltpx;
|
||||||
c9x.mixWarn = mixWarn;
|
c9x.mixWarn = mixWarn;
|
||||||
|
|
||||||
if (phase<0) {
|
if (phase < 0) {
|
||||||
c9x.flightModes= 1 << (-phase -1);
|
c9x.flightModes = 1 << (-phase -1);
|
||||||
}
|
}
|
||||||
else if (phase==0) {
|
else if (phase ==0 ) {
|
||||||
c9x.flightModes=0;
|
c9x.flightModes = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c9x.flightModes=63;
|
c9x.flightModes = 63;
|
||||||
c9x.flightModes &= ~(1 << (phase -1));
|
c9x.flightModes &= ~(1 << (phase -1));
|
||||||
}
|
}
|
||||||
c9x.sOffset = sOffset;
|
c9x.sOffset = sOffset;
|
||||||
@@ -406,7 +406,7 @@ t_Open9xMixData_v211::operator MixData ()
|
|||||||
MixData c9x;
|
MixData c9x;
|
||||||
|
|
||||||
if (srcRaw) {
|
if (srcRaw) {
|
||||||
c9x.destCh = destCh+1;
|
c9x.destCh = destCh + 1;
|
||||||
c9x.swtch = open9xStockToSwitch(swtch);
|
c9x.swtch = open9xStockToSwitch(swtch);
|
||||||
|
|
||||||
if (srcRaw == 0) {
|
if (srcRaw == 0) {
|
||||||
@@ -603,8 +603,8 @@ t_Open9xCustomFunctionData_v203::operator CustomFunctionData ()
|
|||||||
CustomFunctionData c9x;
|
CustomFunctionData c9x;
|
||||||
c9x.swtch = open9xStockToSwitch(swtch);
|
c9x.swtch = open9xStockToSwitch(swtch);
|
||||||
if (func < 16) {
|
if (func < 16) {
|
||||||
c9x.enabled=param & 0x01;
|
c9x.enabled = param & 0x01;
|
||||||
c9x.param = (param>>1)<<1;
|
c9x.param = (param>>1) << 1;
|
||||||
c9x.func = (AssignFunc)(func);
|
c9x.func = (AssignFunc)(func);
|
||||||
} else {
|
} else {
|
||||||
c9x.param = param;
|
c9x.param = param;
|
||||||
@@ -730,7 +730,7 @@ t_Open9xTimerData_v202::operator TimerData ()
|
|||||||
FrSkyRSSIAlarm t_Open9xFrSkyRSSIAlarm::get(int index)
|
FrSkyRSSIAlarm t_Open9xFrSkyRSSIAlarm::get(int index)
|
||||||
{
|
{
|
||||||
FrSkyRSSIAlarm c9x;
|
FrSkyRSSIAlarm c9x;
|
||||||
c9x.level = (2+index+level) % 4;
|
c9x.level = (2 + index + level) % 4;
|
||||||
c9x.value = value + 50;
|
c9x.value = value + 50;
|
||||||
return c9x;
|
return c9x;
|
||||||
}
|
}
|
||||||
@@ -840,7 +840,7 @@ t_Open9xFrSkyData_v204::operator FrSkyData ()
|
|||||||
c9x.channels[0] = channels[0];
|
c9x.channels[0] = channels[0];
|
||||||
c9x.channels[1] = channels[1];
|
c9x.channels[1] = channels[1];
|
||||||
c9x.usrProto = usrProto;
|
c9x.usrProto = usrProto;
|
||||||
c9x.blades = blades+2;
|
c9x.blades = blades + 2;
|
||||||
c9x.screens[0].type = 1;
|
c9x.screens[0].type = 1;
|
||||||
for (int i=0; i<4; i++)
|
for (int i=0; i<4; i++)
|
||||||
c9x.screens[0].body.bars[i] = bars[i];
|
c9x.screens[0].body.bars[i] = bars[i];
|
||||||
@@ -853,7 +853,7 @@ t_Open9xFrSkyData_v205::operator FrSkyData ()
|
|||||||
c9x.channels[0] = channels[0];
|
c9x.channels[0] = channels[0];
|
||||||
c9x.channels[1] = channels[1];
|
c9x.channels[1] = channels[1];
|
||||||
c9x.usrProto = usrProto;
|
c9x.usrProto = usrProto;
|
||||||
c9x.blades = blades+2;
|
c9x.blades = blades + 2;
|
||||||
c9x.screens[0].type = 1;
|
c9x.screens[0].type = 1;
|
||||||
for (int i=0; i<4; i++)
|
for (int i=0; i<4; i++)
|
||||||
c9x.screens[0].body.bars[i] = bars[i];
|
c9x.screens[0].body.bars[i] = bars[i];
|
||||||
@@ -869,7 +869,7 @@ t_Open9xFrSkyData_v208::operator FrSkyData ()
|
|||||||
c9x.channels[1] = channels[1];
|
c9x.channels[1] = channels[1];
|
||||||
c9x.usrProto = usrProto;
|
c9x.usrProto = usrProto;
|
||||||
c9x.voltsSource = voltsSource;
|
c9x.voltsSource = voltsSource;
|
||||||
c9x.blades = blades+2;
|
c9x.blades = blades + 2;
|
||||||
c9x.currentSource=currentSource;
|
c9x.currentSource=currentSource;
|
||||||
c9x.screens[0].type = 1;
|
c9x.screens[0].type = 1;
|
||||||
for (int i=0; i<4; i++)
|
for (int i=0; i<4; i++)
|
||||||
@@ -886,7 +886,7 @@ t_Open9xFrSkyData_v210::operator FrSkyData ()
|
|||||||
c9x.channels[1] = channels[1];
|
c9x.channels[1] = channels[1];
|
||||||
c9x.usrProto = usrProto;
|
c9x.usrProto = usrProto;
|
||||||
c9x.voltsSource = voltsSource;
|
c9x.voltsSource = voltsSource;
|
||||||
c9x.blades = blades+2;
|
c9x.blades = blades + 2;
|
||||||
c9x.currentSource=currentSource;
|
c9x.currentSource=currentSource;
|
||||||
|
|
||||||
int lines_screen_index = 0;
|
int lines_screen_index = 0;
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
|||||||
ui->offsetCB->hide();
|
ui->offsetCB->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
|
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve,
|
||||||
|
firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
|
||||||
|
|
||||||
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings, MixesContext);
|
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings, MixesContext);
|
||||||
|
|
||||||
@@ -47,14 +48,14 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int mask=1;
|
int mask = 1;
|
||||||
for (int i=0; i<9 ; i++) {
|
for (int i=0; i<9; i++) {
|
||||||
if ((ed->flightModes & mask)==0) {
|
if ((ed->flightModes & mask) == 0) {
|
||||||
cb_fp[i]->setChecked(true);
|
cb_fp[i]->setChecked(true);
|
||||||
}
|
}
|
||||||
mask <<= 1;
|
mask <<= 1;
|
||||||
}
|
}
|
||||||
for (int i=firmware->getCapability(FlightModes); i<9;i++) {
|
for (int i=firmware->getCapability(FlightModes); i<9; i++) {
|
||||||
lb_fp[i]->hide();
|
lb_fp[i]->hide();
|
||||||
cb_fp[i]->hide();
|
cb_fp[i]->hide();
|
||||||
}
|
}
|
||||||
@@ -62,7 +63,8 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
|||||||
|
|
||||||
if (firmware->getCapability(VirtualInputs)) {
|
if (firmware->getCapability(VirtualInputs)) {
|
||||||
ui->inputName->setMaxLength(4);
|
ui->inputName->setMaxLength(4);
|
||||||
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
populateSourceCB(ui->sourceCB, ed->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES |
|
||||||
|
POPULATE_SWITCHES | POPULATE_TRIMS | POPULATE_TELEMETRY);
|
||||||
ui->sourceCB->removeItem(0);
|
ui->sourceCB->removeItem(0);
|
||||||
ui->inputName->setValidator(new QRegExpValidator(rx, this));
|
ui->inputName->setValidator(new QRegExpValidator(rx, this));
|
||||||
ui->inputName->setText(inputName);
|
ui->inputName->setText(inputName);
|
||||||
@@ -139,67 +141,68 @@ void ExpoDialog::updateScale()
|
|||||||
|
|
||||||
void ExpoDialog::valuesChanged()
|
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 };
|
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 };
|
||||||
|
|
||||||
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
RawSource srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
|
||||||
if (ed->srcRaw != srcRaw) {
|
if (ed->srcRaw != srcRaw) {
|
||||||
ed->srcRaw = srcRaw;
|
ed->srcRaw = srcRaw;
|
||||||
updateScale();
|
updateScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
RawSourceRange range = srcRaw.getRange(&model, generalSettings);
|
||||||
|
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;
|
||||||
|
|
||||||
|
strcpy(ed->name, ui->lineName->text().toAscii().data());
|
||||||
|
if (firmware->getCapability(VirtualInputs)) {
|
||||||
|
inputName = ui->inputName->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
ed->flightModes = 0;
|
||||||
|
for (int i=8; i>=0 ; i--) {
|
||||||
|
if (!cb_fp[i]->checkState()) {
|
||||||
|
ed->flightModes++;
|
||||||
}
|
}
|
||||||
|
ed->flightModes <<= 1;
|
||||||
RawSourceRange range = srcRaw.getRange(&model, generalSettings);
|
}
|
||||||
ed->scale = round(float(ui->scale->value()) / range.step);
|
ed->flightModes >>= 1;
|
||||||
ed->carryTrim = 1 - ui->trimCB->currentIndex();
|
if (firmware->getCapability(FlightModes)) {
|
||||||
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
int zeros = 0;
|
||||||
ed->mode = ui->sideCB->currentIndex() + 1;
|
int ones = 0;
|
||||||
|
int phtemp = ed->flightModes;
|
||||||
strcpy(ed->name, ui->lineName->text().toAscii().data());
|
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||||
if (firmware->getCapability(VirtualInputs))
|
if (phtemp & 1) {
|
||||||
inputName = ui->inputName->text();
|
ones++;
|
||||||
|
|
||||||
ed->flightModes=0;
|
|
||||||
for (int i=8; i>=0 ; i--) {
|
|
||||||
if (!cb_fp[i]->checkState()) {
|
|
||||||
ed->flightModes+=1;
|
|
||||||
}
|
}
|
||||||
ed->flightModes<<=1;
|
else {
|
||||||
|
zeros++;
|
||||||
|
}
|
||||||
|
phtemp >>= 1;
|
||||||
}
|
}
|
||||||
ed->flightModes>>=1;
|
if (zeros == 1) {
|
||||||
if (firmware->getCapability(FlightModes)) {
|
phtemp=ed->flightModes;
|
||||||
int zeros=0;
|
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||||
int ones=0;
|
if ((phtemp & 1) == 0) {
|
||||||
int phtemp=ed->flightModes;
|
break;
|
||||||
|
}
|
||||||
|
phtemp >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ones == 1) {
|
||||||
|
phtemp = ed->flightModes;
|
||||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
||||||
if (phtemp & 1) {
|
if (phtemp & 1) {
|
||||||
ones++;
|
break;
|
||||||
}
|
|
||||||
else {
|
|
||||||
zeros++;
|
|
||||||
}
|
|
||||||
phtemp >>=1;
|
|
||||||
}
|
|
||||||
if (zeros==1) {
|
|
||||||
phtemp=ed->flightModes;
|
|
||||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
|
||||||
if ((phtemp & 1)==0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
phtemp >>=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ones==1) {
|
|
||||||
phtemp=ed->flightModes;
|
|
||||||
for (int i=0; i<firmware->getCapability(FlightModes); i++) {
|
|
||||||
if (phtemp & 1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
phtemp >>=1;
|
|
||||||
}
|
}
|
||||||
|
phtemp >>= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
ed->flightModes=0;
|
else {
|
||||||
}
|
ed->flightModes = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExpoDialog::shrink()
|
void ExpoDialog::shrink()
|
||||||
|
|||||||
@@ -19,16 +19,18 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
|||||||
|
|
||||||
this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
|
this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
|
||||||
|
|
||||||
populateSourceCB(ui->sourceCB, md->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
populateSourceCB(ui->sourceCB, md->srcRaw, generalSettings, &model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS |
|
||||||
|
POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||||
ui->sourceCB->removeItem(0);
|
ui->sourceCB->removeItem(0);
|
||||||
|
|
||||||
int limit = firmware->getCapability(OffsetWeight);
|
int limit = firmware->getCapability(OffsetWeight);
|
||||||
|
|
||||||
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
|
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);
|
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
|
||||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
|
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB,
|
||||||
|
md->curve, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
|
||||||
|
|
||||||
ui->MixDR_CB->setChecked(md->noExpo==0);
|
ui->MixDR_CB->setChecked(md->noExpo == 0);
|
||||||
|
|
||||||
if (!firmware->getCapability(HasNoExpo)) {
|
if (!firmware->getCapability(HasNoExpo)) {
|
||||||
ui->MixDR_CB->hide();
|
ui->MixDR_CB->hide();
|
||||||
@@ -63,14 +65,14 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int mask=1;
|
int mask = 1;
|
||||||
for (int i=0; i<9 ; i++) {
|
for (int i=0; i<9 ; i++) {
|
||||||
if ((md->flightModes & mask)==0) {
|
if ((md->flightModes & mask) == 0) {
|
||||||
cb_fp[i]->setChecked(true);
|
cb_fp[i]->setChecked(true);
|
||||||
}
|
}
|
||||||
mask <<= 1;
|
mask <<= 1;
|
||||||
}
|
}
|
||||||
for (int i=firmware->getCapability(FlightModes); i<9;i++) {
|
for (int i=firmware->getCapability(FlightModes); i<9; i++) {
|
||||||
lb_fp[i]->hide();
|
lb_fp[i]->hide();
|
||||||
cb_fp[i]->hide();
|
cb_fp[i]->hide();
|
||||||
}
|
}
|
||||||
@@ -149,29 +151,26 @@ void MixerDialog::valuesChanged()
|
|||||||
ui->label_MixDR->setEnabled(drVisible);
|
ui->label_MixDR->setEnabled(drVisible);
|
||||||
}
|
}
|
||||||
md->carryTrim = -(ui->trimCB->currentIndex()-1);
|
md->carryTrim = -(ui->trimCB->currentIndex()-1);
|
||||||
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
|
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
|
||||||
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
|
||||||
md->mixWarn = ui->warningCB->currentIndex();
|
md->mixWarn = ui->warningCB->currentIndex();
|
||||||
md->mltpx = (MltpxValue)ui->mltpxCB->currentIndex();
|
md->mltpx = (MltpxValue)ui->mltpxCB->currentIndex();
|
||||||
int scale=firmware->getCapability(SlowScale);
|
int scale = firmware->getCapability(SlowScale);
|
||||||
md->delayDown = round(ui->delayDownSB->value()*scale);
|
md->delayDown = round(ui->delayDownSB->value()*scale);
|
||||||
md->delayUp = round(ui->delayUpSB->value()*scale);
|
md->delayUp = round(ui->delayUpSB->value()*scale);
|
||||||
md->speedDown = round(ui->slowDownSB->value()*scale);
|
md->speedDown = round(ui->slowDownSB->value()*scale);
|
||||||
md->speedUp = round(ui->slowUpSB->value()*scale);
|
md->speedUp = round(ui->slowUpSB->value()*scale);
|
||||||
|
|
||||||
int i=0;
|
strcpy(md->name, ui->mixerName->text().toAscii());
|
||||||
for (i=0; i<ui->mixerName->text().toAscii().length(); i++) {
|
|
||||||
md->name[i]=ui->mixerName->text().toAscii().at(i);
|
md->flightModes = 0;
|
||||||
}
|
|
||||||
md->name[i]=0;
|
|
||||||
md->flightModes=0;
|
|
||||||
for (int i=8; i>=0 ; i--) {
|
for (int i=8; i>=0 ; i--) {
|
||||||
if (!cb_fp[i]->checkState()) {
|
if (!cb_fp[i]->checkState()) {
|
||||||
md->flightModes+=1;
|
md->flightModes++;
|
||||||
}
|
}
|
||||||
md->flightModes<<=1;
|
md->flightModes <<= 1;
|
||||||
}
|
}
|
||||||
md->flightModes>>=1;
|
md->flightModes >>= 1;
|
||||||
|
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|||||||
+202
-201
@@ -48,17 +48,15 @@ void MixesPanel::update()
|
|||||||
{
|
{
|
||||||
// curDest -> destination channel
|
// curDest -> destination channel
|
||||||
// i -> mixer number
|
// i -> mixer number
|
||||||
QByteArray qba;
|
|
||||||
MixerlistWidget->clear();
|
MixerlistWidget->clear();
|
||||||
firstLine = true;
|
firstLine = true;
|
||||||
unsigned int curDest = 0;
|
unsigned int curDest = 0;
|
||||||
int i;
|
|
||||||
unsigned int outputs = firmware->getCapability(Outputs);
|
unsigned int outputs = firmware->getCapability(Outputs);
|
||||||
|
|
||||||
for (i=0; i<firmware->getCapability(Mixes); i++) {
|
for (int i=0; i<firmware->getCapability(Mixes); i++) {
|
||||||
MixData & mix = model->mixData[i];
|
MixData & mix = model->mixData[i];
|
||||||
// qDebug() << "mix.destCh: " << mix.destCh;
|
// qDebug() << "mix.destCh: " << mix.destCh;
|
||||||
if (mix.destCh==0 || mix.destCh>outputs) continue;
|
if (mix.destCh == 0 || mix.destCh>outputs) continue;
|
||||||
QString str = "";
|
QString str = "";
|
||||||
while (curDest < mix.destCh-1) {
|
while (curDest < mix.destCh-1) {
|
||||||
curDest++;
|
curDest++;
|
||||||
@@ -155,146 +153,147 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
|||||||
|
|
||||||
bool MixesPanel::gm_insertMix(int idx)
|
bool MixesPanel::gm_insertMix(int idx)
|
||||||
{
|
{
|
||||||
if (idx<0 || idx>=firmware->getCapability(Mixes) || model->mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
|
if (idx < 0 || idx >= firmware->getCapability(Mixes) || model->mixData[firmware->getCapability(Mixes)-1].destCh > 0) {
|
||||||
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
|
QMessageBox::information(this, "companion", tr("Not enough available mixers!"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = model->mixData[idx].destCh;
|
int i = model->mixData[idx].destCh;
|
||||||
memmove(&model->mixData[idx+1],&model->mixData[idx],
|
memmove(&model->mixData[idx+1], &model->mixData[idx],
|
||||||
(firmware->getCapability(Mixes)-(idx+1))*sizeof(MixData) );
|
(firmware->getCapability(Mixes)-(idx+1)) * sizeof(MixData) );
|
||||||
memset(&model->mixData[idx],0,sizeof(MixData));
|
memset(&model->mixData[idx], 0, sizeof(MixData));
|
||||||
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
|
model->mixData[idx].srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||||
model->mixData[idx].destCh = i;
|
model->mixData[idx].destCh = i;
|
||||||
model->mixData[idx].weight = 100;
|
model->mixData[idx].weight = 100;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::gm_deleteMix(int index)
|
void MixesPanel::gm_deleteMix(int index)
|
||||||
{
|
{
|
||||||
memmove(&model->mixData[index],&model->mixData[index+1],
|
memmove(&model->mixData[index], &model->mixData[index+1],
|
||||||
(firmware->getCapability(Mixes)-(index+1))*sizeof(MixData));
|
(firmware->getCapability(Mixes)-(index+1)) * sizeof(MixData));
|
||||||
memset(&model->mixData[firmware->getCapability(Mixes)-1],0,sizeof(MixData));
|
memset(&model->mixData[firmware->getCapability(Mixes)-1], 0, sizeof(MixData));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::gm_openMix(int index)
|
void MixesPanel::gm_openMix(int index)
|
||||||
{
|
{
|
||||||
if(index<0 || index>=firmware->getCapability(Mixes)) return;
|
if(index < 0 || index>=firmware->getCapability(Mixes)) return;
|
||||||
|
|
||||||
MixData mixd(model->mixData[index]);
|
MixData mixd(model->mixData[index]);
|
||||||
|
emit modified();
|
||||||
|
update();
|
||||||
|
|
||||||
|
MixerDialog *g = new MixerDialog(this, *model, &mixd, generalSettings, firmware);
|
||||||
|
if(g->exec()) {
|
||||||
|
model->mixData[index] = mixd;
|
||||||
emit modified();
|
emit modified();
|
||||||
update();
|
update();
|
||||||
|
}
|
||||||
MixerDialog *g = new MixerDialog(this, *model, &mixd, generalSettings, firmware);
|
else {
|
||||||
if(g->exec()) {
|
if (mixInserted) {
|
||||||
model->mixData[index] = mixd;
|
gm_deleteMix(index);
|
||||||
emit modified();
|
|
||||||
update();
|
|
||||||
} else {
|
|
||||||
if (mixInserted) {
|
|
||||||
gm_deleteMix(index);
|
|
||||||
}
|
|
||||||
mixInserted=false;
|
|
||||||
emit modified();
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
mixInserted = false;
|
||||||
|
emit modified();
|
||||||
|
update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MixesPanel::getMixerIndex(unsigned int dch)
|
int MixesPanel::getMixerIndex(unsigned int dch)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while ((model->mixData[i].destCh<=dch) && (model->mixData[i].destCh) && (i<firmware->getCapability(Mixes))) i++;
|
while ((model->mixData[i].destCh <= dch) && (model->mixData[i].destCh) && (i < firmware->getCapability(Mixes))) i++;
|
||||||
if(i==firmware->getCapability(Mixes)) return -1;
|
if (i == firmware->getCapability(Mixes)) return -1;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixerlistWidget_doubleClicked(QModelIndex index)
|
void MixesPanel::mixerlistWidget_doubleClicked(QModelIndex index)
|
||||||
{
|
{
|
||||||
int idx= MixerlistWidget->item(index.row())->data(Qt::UserRole).toByteArray().at(0);
|
int idx = MixerlistWidget->item(index.row())->data(Qt::UserRole).toByteArray().at(0);
|
||||||
if (idx<0) {
|
if (idx<0) {
|
||||||
int i = -idx;
|
int i = -idx;
|
||||||
idx = getMixerIndex(i); //get mixer index to insert
|
idx = getMixerIndex(i); //get mixer index to insert
|
||||||
if (!gm_insertMix(idx))
|
if (!gm_insertMix(idx)) return;
|
||||||
return;
|
model->mixData[idx].destCh = i;
|
||||||
model->mixData[idx].destCh = i;
|
mixInserted = true;
|
||||||
mixInserted=true;
|
}
|
||||||
} else {
|
else {
|
||||||
mixInserted=false;
|
mixInserted = false;
|
||||||
}
|
}
|
||||||
gm_openMix(idx);
|
gm_openMix(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixersDeleteList(QList<int> list)
|
void MixesPanel::mixersDeleteList(QList<int> list)
|
||||||
{
|
{
|
||||||
qSort(list.begin(), list.end());
|
qSort(list.begin(), list.end());
|
||||||
|
|
||||||
int iDec = 0;
|
int iDec = 0;
|
||||||
foreach(int idx, list) {
|
foreach(int idx, list) {
|
||||||
gm_deleteMix(idx-iDec);
|
gm_deleteMix(idx - iDec);
|
||||||
iDec++;
|
iDec++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> MixesPanel::createMixListFromSelected()
|
QList<int> MixesPanel::createMixListFromSelected()
|
||||||
{
|
{
|
||||||
QList<int> list;
|
QList<int> list;
|
||||||
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
|
foreach(QListWidgetItem *item, MixerlistWidget->selectedItems()) {
|
||||||
int idx= item->data(Qt::UserRole).toByteArray().at(0);
|
int idx= item->data(Qt::UserRole).toByteArray().at(0);
|
||||||
if(idx>=0 && idx<firmware->getCapability(Mixes)) list << idx;
|
if(idx >= 0 && idx<firmware->getCapability(Mixes)) list << idx;
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO duplicated code
|
// TODO duplicated code
|
||||||
void MixesPanel::setSelectedByMixList(QList<int> list)
|
void MixesPanel::setSelectedByMixList(QList<int> list)
|
||||||
{
|
{
|
||||||
for(int i=0; i<MixerlistWidget->count(); i++) {
|
for(int i=0; i<MixerlistWidget->count(); i++) {
|
||||||
int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0);
|
int t = MixerlistWidget->item(i)->data(Qt::UserRole).toByteArray().at(0);
|
||||||
if(list.contains(t))
|
if(list.contains(t)) {
|
||||||
MixerlistWidget->item(i)->setSelected(true);
|
MixerlistWidget->item(i)->setSelected(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MixesPanel::mixersDelete(bool ask)
|
void MixesPanel::mixersDelete(bool ask)
|
||||||
{
|
{
|
||||||
QList<int> list = createMixListFromSelected();
|
QList<int> list = createMixListFromSelected();
|
||||||
if(list.isEmpty()) return;
|
if(list.isEmpty()) return;
|
||||||
|
|
||||||
QMessageBox::StandardButton ret = QMessageBox::No;
|
QMessageBox::StandardButton ret = QMessageBox::No;
|
||||||
|
|
||||||
if(ask)
|
if(ask) {
|
||||||
ret = QMessageBox::warning(this, "companion",
|
ret = QMessageBox::warning(this, "companion",
|
||||||
tr("Delete Selected Mixes?"),
|
tr("Delete Selected Mixes?"),
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ret == QMessageBox::Yes) || (!ask)) {
|
||||||
if ((ret == QMessageBox::Yes) || (!ask)) {
|
mixersDeleteList(list);
|
||||||
mixersDeleteList(list);
|
emit modified();
|
||||||
emit modified();
|
update();
|
||||||
update();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixersCut()
|
void MixesPanel::mixersCut()
|
||||||
{
|
{
|
||||||
mixersCopy();
|
mixersCopy();
|
||||||
mixersDelete(false);
|
mixersDelete(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixersCopy()
|
void MixesPanel::mixersCopy()
|
||||||
{
|
{
|
||||||
|
QList<int> list = createMixListFromSelected();
|
||||||
|
|
||||||
QList<int> list = createMixListFromSelected();
|
QByteArray mxData;
|
||||||
|
foreach(int idx, list) {
|
||||||
|
mxData.append((char*)&model->mixData[idx], sizeof(MixData));
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray mxData;
|
QMimeData *mimeData = new QMimeData;
|
||||||
foreach(int idx, list) {
|
mimeData->setData("application/x-companion-mix", mxData);
|
||||||
mxData.append((char*)&model->mixData[idx],sizeof(MixData));
|
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
||||||
}
|
|
||||||
|
|
||||||
QMimeData *mimeData = new QMimeData;
|
|
||||||
mimeData->setData("application/x-companion-mix", mxData);
|
|
||||||
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
||||||
@@ -318,9 +317,8 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
|||||||
while (i < mxData.size()) {
|
while (i < mxData.size()) {
|
||||||
idx++;
|
idx++;
|
||||||
if (idx == firmware->getCapability(Mixes)) break;
|
if (idx == firmware->getCapability(Mixes)) break;
|
||||||
|
if (!gm_insertMix(idx)) break;
|
||||||
|
|
||||||
if (!gm_insertMix(idx))
|
|
||||||
break;
|
|
||||||
MixData * md = &model->mixData[idx];
|
MixData * md = &model->mixData[idx];
|
||||||
memcpy(md, mxData.mid(i, sizeof(MixData)).constData(), sizeof(MixData));
|
memcpy(md, mxData.mid(i, sizeof(MixData)).constData(), sizeof(MixData));
|
||||||
md->destCh = dch;
|
md->destCh = dch;
|
||||||
@@ -335,34 +333,35 @@ void MixesPanel::pasteMixerMimeData(const QMimeData * mimeData, int destIdx)
|
|||||||
|
|
||||||
void MixesPanel::mixersPaste()
|
void MixesPanel::mixersPaste()
|
||||||
{
|
{
|
||||||
const QClipboard *clipboard = QApplication::clipboard();
|
const QClipboard *clipboard = QApplication::clipboard();
|
||||||
const QMimeData *mimeData = clipboard->mimeData();
|
const QMimeData *mimeData = clipboard->mimeData();
|
||||||
QListWidgetItem *item = MixerlistWidget->currentItem();
|
QListWidgetItem *item = MixerlistWidget->currentItem();
|
||||||
if (item)
|
if (item) {
|
||||||
pasteMixerMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
|
pasteMixerMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixersDuplicate()
|
void MixesPanel::mixersDuplicate()
|
||||||
{
|
{
|
||||||
mixersCopy();
|
mixersCopy();
|
||||||
mixersPaste();
|
mixersPaste();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixerOpen()
|
void MixesPanel::mixerOpen()
|
||||||
{
|
{
|
||||||
int idx = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
int idx = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||||
if(idx<0) {
|
if(idx < 0) {
|
||||||
int i = -idx;
|
int i = -idx;
|
||||||
idx = getMixerIndex(i); //get mixer index to insert
|
idx = getMixerIndex(i); //get mixer index to insert
|
||||||
if (!gm_insertMix(idx))
|
if (!gm_insertMix(idx)) return;
|
||||||
return;
|
model->mixData[idx].destCh = i;
|
||||||
model->mixData[idx].destCh = i;
|
mixInserted = true;
|
||||||
mixInserted=true;
|
}
|
||||||
} else {
|
else {
|
||||||
mixInserted=false;
|
mixInserted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gm_openMix(idx);
|
gm_openMix(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixerHighlight()
|
void MixesPanel::mixerHighlight()
|
||||||
@@ -385,135 +384,137 @@ void MixesPanel::mixerHighlight()
|
|||||||
|
|
||||||
void MixesPanel::mixerAdd()
|
void MixesPanel::mixerAdd()
|
||||||
{
|
{
|
||||||
if (!MixerlistWidget->currentItem())
|
if (!MixerlistWidget->currentItem()) return;
|
||||||
return;
|
|
||||||
int index = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
|
||||||
|
|
||||||
if(index<0) { // if empty then return relavent index
|
int index = MixerlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
|
||||||
int i = -index;
|
|
||||||
index = getMixerIndex(i); //get mixer index to insert
|
if(index < 0) { // if empty then return relavent index
|
||||||
if (!gm_insertMix(index))
|
int i = -index;
|
||||||
return;
|
index = getMixerIndex(i); //get mixer index to insert
|
||||||
model->mixData[index].destCh = i;
|
if (!gm_insertMix(index)) return;
|
||||||
mixInserted=true;
|
model->mixData[index].destCh = i;
|
||||||
} else {
|
mixInserted = true;
|
||||||
index++;
|
}
|
||||||
if (!gm_insertMix(index))
|
else {
|
||||||
return;
|
index++;
|
||||||
model->mixData[index].destCh = model->mixData[index-1].destCh;
|
if (!gm_insertMix(index)) return;
|
||||||
mixInserted=true;
|
model->mixData[index].destCh = model->mixData[index-1].destCh;
|
||||||
}
|
mixInserted = true;
|
||||||
gm_openMix(index);
|
}
|
||||||
|
gm_openMix(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
||||||
{
|
{
|
||||||
QPoint globalPos = MixerlistWidget->mapToGlobal(pos);
|
QPoint globalPos = MixerlistWidget->mapToGlobal(pos);
|
||||||
|
|
||||||
const QClipboard *clipboard = QApplication::clipboard();
|
const QClipboard *clipboard = QApplication::clipboard();
|
||||||
const QMimeData *mimeData = clipboard->mimeData();
|
const QMimeData *mimeData = clipboard->mimeData();
|
||||||
bool hasData = mimeData->hasFormat("application/x-companion-mix");
|
bool hasData = mimeData->hasFormat("application/x-companion-mix");
|
||||||
|
|
||||||
QMenu contextMenu;
|
QMenu contextMenu;
|
||||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A"));
|
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.addAction(CompanionIcon("edit.png"), tr("&Edit"), this, SLOT(mixerOpen()), tr("Enter"));
|
||||||
contextMenu.addAction(CompanionIcon("fuses.png"), tr("&Toggle highlight"),this,SLOT(mixerHighlight()),tr("Ctrl+T"));
|
contextMenu.addAction(CompanionIcon("fuses.png"), tr("&Toggle highlight"), this, SLOT(mixerHighlight()), tr("Ctrl+T"));
|
||||||
contextMenu.addSeparator();
|
contextMenu.addSeparator();
|
||||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete"));
|
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("copy.png"), tr("&Copy"), this, SLOT(mixersCopy()), tr("Ctrl+C"));
|
||||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("C&ut"),this,SLOT(mixersCut()),tr("Ctrl+X"));
|
contextMenu.addAction(CompanionIcon("cut.png"), tr("C&ut"), this, SLOT(mixersCut()), tr("Ctrl+X"));
|
||||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
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.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"), this, SLOT(mixersDuplicate()), tr("Ctrl+U"));
|
||||||
contextMenu.addSeparator();
|
contextMenu.addSeparator();
|
||||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"),this,SLOT(moveMixUp()),tr("Ctrl+Up"));
|
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.addAction(CompanionIcon("movedown.png"), tr("Move Down"), this, SLOT(moveMixDown()), tr("Ctrl+Down"));
|
||||||
|
|
||||||
contextMenu.exec(globalPos);
|
contextMenu.exec(globalPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction /*action*/)
|
void MixesPanel::mimeMixerDropped(int index, const QMimeData *data, Qt::DropAction /*action*/)
|
||||||
{
|
{
|
||||||
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
int idx= MixerlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
|
||||||
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
|
//qDebug() << "MixesPanel::mimeMixerDropped()" << index << data;
|
||||||
pasteMixerMimeData(data, idx);
|
pasteMixerMimeData(data, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixesEdited()
|
void MixesPanel::mixesEdited()
|
||||||
{
|
{
|
||||||
emit modified();
|
emit modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::mixerlistWidget_KeyPress(QKeyEvent *event)
|
void MixesPanel::mixerlistWidget_KeyPress(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
if(event->matches(QKeySequence::SelectAll)) mixerAdd(); //Ctrl A
|
if(event->matches(QKeySequence::SelectAll)) mixerAdd(); //Ctrl A
|
||||||
if(event->matches(QKeySequence::Delete)) mixersDelete();
|
if(event->matches(QKeySequence::Delete)) mixersDelete();
|
||||||
if(event->matches(QKeySequence::Copy)) mixersCopy();
|
if(event->matches(QKeySequence::Copy)) mixersCopy();
|
||||||
if(event->matches(QKeySequence::Cut)) mixersCut();
|
if(event->matches(QKeySequence::Cut)) mixersCut();
|
||||||
if(event->matches(QKeySequence::Paste)) mixersPaste();
|
if(event->matches(QKeySequence::Paste)) mixersPaste();
|
||||||
if(event->matches(QKeySequence::Underline)) mixersDuplicate();
|
if(event->matches(QKeySequence::Underline)) mixersDuplicate();
|
||||||
if(event->matches(QKeySequence::AddTab)) mixerHighlight();
|
if(event->matches(QKeySequence::AddTab)) mixerHighlight();
|
||||||
|
|
||||||
if(event->key()==Qt::Key_Return || event->key()==Qt::Key_Enter) mixerOpen();
|
if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) mixerOpen();
|
||||||
if(event->matches(QKeySequence::MoveToNextLine))
|
|
||||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()+1);
|
if(event->matches(QKeySequence::MoveToNextLine)) {
|
||||||
if(event->matches(QKeySequence::MoveToPreviousLine))
|
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()+1);
|
||||||
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()-1);
|
}
|
||||||
|
if(event->matches(QKeySequence::MoveToPreviousLine)) {
|
||||||
|
MixerlistWidget->setCurrentRow(MixerlistWidget->currentRow()-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
|
int MixesPanel::gm_moveMix(int idx, bool dir) //true=inc=down false=dec=up
|
||||||
{
|
{
|
||||||
if(idx>firmware->getCapability(Mixes) || (idx==firmware->getCapability(Mixes) && dir)) return idx;
|
if(idx > firmware->getCapability(Mixes) || (idx == firmware->getCapability(Mixes) && dir)) return idx;
|
||||||
|
|
||||||
MixData &src=model->mixData[idx];
|
MixData &src=model->mixData[idx];
|
||||||
|
|
||||||
if (idx==0 && !dir) {
|
if (idx == 0 && !dir) {
|
||||||
//special case: topmost mixer moving up
|
//special case: topmost mixer moving up
|
||||||
if (src.destCh > 1) src.destCh--;
|
if (src.destCh > 1) src.destCh--;
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tdx = dir ? idx+1 : idx-1;
|
int tdx = dir ? idx+1 : idx-1;
|
||||||
MixData &tgt=model->mixData[tdx];
|
MixData & tgt = model->mixData[tdx];
|
||||||
|
|
||||||
unsigned int outputs = firmware->getCapability(Outputs);
|
unsigned int outputs = firmware->getCapability(Outputs);
|
||||||
if((src.destCh==0) || (src.destCh>outputs) || (tgt.destCh>outputs)) return idx;
|
if(src.destCh == 0 || src.destCh > outputs || tgt.destCh > outputs) return idx;
|
||||||
|
|
||||||
if (tgt.destCh!=src.destCh) {
|
if (tgt.destCh != src.destCh) {
|
||||||
if ((dir) && (src.destCh<outputs)) src.destCh++;
|
if (dir && src.destCh < outputs) src.destCh++;
|
||||||
if ((!dir) && (src.destCh>0)) src.destCh--;
|
if (!dir && src.destCh > 0) src.destCh--;
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
//flip between idx and tgt
|
//flip between idx and tgt
|
||||||
MixData temp;
|
MixData temp;
|
||||||
memcpy(&temp,&src,sizeof(MixData));
|
memcpy(&temp, &src, sizeof(MixData));
|
||||||
memcpy(&src,&tgt,sizeof(MixData));
|
memcpy(&src, &tgt, sizeof(MixData));
|
||||||
memcpy(&tgt,&temp,sizeof(MixData));
|
memcpy(&tgt, &temp, sizeof(MixData));
|
||||||
return tdx;
|
return tdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::moveMixUp()
|
void MixesPanel::moveMixUp()
|
||||||
{
|
{
|
||||||
QList<int> list = createMixListFromSelected();
|
QList<int> list = createMixListFromSelected();
|
||||||
QList<int> highlightList;
|
QList<int> highlightList;
|
||||||
foreach(int idx, list) {
|
foreach(int idx, list) {
|
||||||
highlightList << gm_moveMix(idx, false);
|
highlightList << gm_moveMix(idx, false);
|
||||||
}
|
}
|
||||||
emit modified();
|
emit modified();
|
||||||
update();
|
update();
|
||||||
setSelectedByMixList(highlightList);
|
setSelectedByMixList(highlightList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::moveMixDown()
|
void MixesPanel::moveMixDown()
|
||||||
{
|
{
|
||||||
QList<int> list = createMixListFromSelected();
|
QList<int> list = createMixListFromSelected();
|
||||||
QList<int> highlightList;
|
QList<int> highlightList;
|
||||||
foreach(int idx, list) {
|
foreach(int idx, list) {
|
||||||
highlightList << gm_moveMix(idx, true);
|
highlightList << gm_moveMix(idx, true);
|
||||||
}
|
}
|
||||||
emit modified();
|
emit modified();
|
||||||
update();
|
update();
|
||||||
setSelectedByMixList(highlightList);
|
setSelectedByMixList(highlightList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MixesPanel::clearMixes()
|
void MixesPanel::clearMixes()
|
||||||
|
|||||||
Reference in New Issue
Block a user