From 88177572fc4a165573125e562448708f0361a1b6 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 24 Sep 2016 13:05:07 +0200 Subject: [PATCH] Port fixes by electpower to next Fixed #3662 --- companion/src/modeledit/heli.cpp | 6 +++--- companion/src/modeledit/inputs.cpp | 23 +++++++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/companion/src/modeledit/heli.cpp b/companion/src/modeledit/heli.cpp index 7de479a11..9d04eb680 100644 --- a/companion/src/modeledit/heli.cpp +++ b/companion/src/modeledit/heli.cpp @@ -48,11 +48,11 @@ void HeliPanel::update() lock = true; ui->swashType->setCurrentIndex(model->swashRingData.type); - populateSourceCB(ui->swashCollectiveSource, model->swashRingData.collectiveSource, generalSettings, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); + populateSourceCB(ui->swashCollectiveSource, model->swashRingData.collectiveSource, generalSettings, model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); ui->swashRingVal->setValue(model->swashRingData.value); if (firmware->getCapability(VirtualInputs)) { - populateSourceCB(ui->swashElevatorSource, model->swashRingData.elevatorSource, generalSettings, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); - populateSourceCB(ui->swashAileronSource, model->swashRingData.aileronSource, generalSettings, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); + populateSourceCB(ui->swashElevatorSource, model->swashRingData.elevatorSource, generalSettings, model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); + populateSourceCB(ui->swashAileronSource, model->swashRingData.aileronSource, generalSettings, model, POPULATE_NONE | POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS); ui->swashElevatorWeight->setValue(model->swashRingData.elevatorWeight); ui->swashAileronWeight->setValue(model->swashRingData.aileronWeight); ui->swashCollectiveWeight->setValue(model->swashRingData.collectiveWeight); diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp index 004472c52..3ddaaf2d6 100644 --- a/companion/src/modeledit/inputs.cpp +++ b/companion/src/modeledit/inputs.cpp @@ -17,7 +17,7 @@ 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(CompanionIcon("moveup.png")); qbUp->setShortcut(QKeySequence(tr("Ctrl+Up"))); @@ -89,14 +89,14 @@ void InputsPanel::update() @note Input lines are now HTML formated because they use same widget as mixers. - @param[in] dest defines which input line to create. + @param[in] dest defines which input line to create. If dest < 0 then create empty input slot for input -dest ( dest=-6 -> Input05) if dest >=0 then create used input based on model input data from slot dest (dest=4 -> model expoData[4]) @retval true created input number is different from the previous list item false created input number is the same as previous list item */ -bool InputsPanel::AddInputLine(int dest) +bool InputsPanel::AddInputLine(int dest) { bool new_ch; QString str = getInputText(dest, &new_ch); @@ -107,11 +107,11 @@ bool InputsPanel::AddInputLine(int dest) ExpoData *md = &model->expoData[dest]; qba.append((const char*)md, sizeof(ExpoData)); } - itm->setData(Qt::UserRole, qba); + itm->setData(Qt::UserRole, qba); #if MIX_ROW_HEIGHT_INCREASE > 0 if (new_ch && !firstLine) { //increase size of this row - itm->setData(GroupHeaderRole, 1); + itm->setData(GroupHeaderRole, 1); } #endif ExposlistWidget->addItem(itm); @@ -124,11 +124,11 @@ bool InputsPanel::AddInputLine(int dest) /** @brief Returns HTML formated input representation - @param[in] dest defines which input line to create. + @param[in] dest defines which input line to create. If dest < 0 then create empty input slot for input -dest ( dest=-6 -> Input05) if dest >=0 then create used input based on model input data from slot dest (dest=4 -> model expoData[4]) - @retval string input line in HTML + @retval string input line in HTML */ QString InputsPanel::getInputText(int dest, bool * new_ch) { @@ -281,10 +281,17 @@ void InputsPanel::exposCopy() QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard); } -void InputsPanel::mimeExpoDropped(int index, const QMimeData *data, Qt::DropAction /*action*/) +void InputsPanel::mimeExpoDropped(int index, const QMimeData *data, Qt::DropAction action) { int idx = ExposlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0); + if (action==Qt::CopyAction) { pasteExpoMimeData(data, idx); + } + else if (action==Qt::MoveAction) { + QList list = createExpoListFromSelected(); + exposDeleteList(list); + pasteExpoMimeData(data, idx); + } } void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx)