Merge pull request #3850 from opentx/3djc/companion-fixes-port2-next

Port fixes by elecpower to next
This commit is contained in:
3djc
2016-09-24 14:12:29 +02:00
committed by GitHub
2 changed files with 18 additions and 11 deletions
+3 -3
View File
@@ -48,11 +48,11 @@ void HeliPanel::update()
lock = true; lock = true;
ui->swashType->setCurrentIndex(model->swashRingData.type); 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); ui->swashRingVal->setValue(model->swashRingData.value);
if (firmware->getCapability(VirtualInputs)) { if (firmware->getCapability(VirtualInputs)) {
populateSourceCB(ui->swashElevatorSource, model->swashRingData.elevatorSource, 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_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->swashElevatorWeight->setValue(model->swashRingData.elevatorWeight);
ui->swashAileronWeight->setValue(model->swashRingData.aileronWeight); ui->swashAileronWeight->setValue(model->swashRingData.aileronWeight);
ui->swashCollectiveWeight->setValue(model->swashRingData.collectiveWeight); ui->swashCollectiveWeight->setValue(model->swashRingData.collectiveWeight);
+15 -8
View File
@@ -17,7 +17,7 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g
QPushButton * qbUp = new QPushButton(this); QPushButton * qbUp = new QPushButton(this);
QPushButton * qbDown = new QPushButton(this); QPushButton * qbDown = new QPushButton(this);
QPushButton * qbClear = new QPushButton(this); QPushButton * qbClear = new QPushButton(this);
qbUp->setText(tr("Move Up")); qbUp->setText(tr("Move Up"));
qbUp->setIcon(CompanionIcon("moveup.png")); qbUp->setIcon(CompanionIcon("moveup.png"));
qbUp->setShortcut(QKeySequence(tr("Ctrl+Up"))); 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. @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 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]) 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 @retval true created input number is different from the previous list item
false created input number is the same as 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; bool new_ch;
QString str = getInputText(dest, &new_ch); QString str = getInputText(dest, &new_ch);
@@ -107,11 +107,11 @@ bool InputsPanel::AddInputLine(int dest)
ExpoData *md = &model->expoData[dest]; ExpoData *md = &model->expoData[dest];
qba.append((const char*)md, sizeof(ExpoData)); qba.append((const char*)md, sizeof(ExpoData));
} }
itm->setData(Qt::UserRole, qba); itm->setData(Qt::UserRole, qba);
#if MIX_ROW_HEIGHT_INCREASE > 0 #if MIX_ROW_HEIGHT_INCREASE > 0
if (new_ch && !firstLine) { if (new_ch && !firstLine) {
//increase size of this row //increase size of this row
itm->setData(GroupHeaderRole, 1); itm->setData(GroupHeaderRole, 1);
} }
#endif #endif
ExposlistWidget->addItem(itm); ExposlistWidget->addItem(itm);
@@ -124,11 +124,11 @@ bool InputsPanel::AddInputLine(int dest)
/** /**
@brief Returns HTML formated input representation @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 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]) 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) QString InputsPanel::getInputText(int dest, bool * new_ch)
{ {
@@ -281,10 +281,17 @@ void InputsPanel::exposCopy()
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard); 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); int idx = ExposlistWidget->item(index > 0 ? index-1 : 0)->data(Qt::UserRole).toByteArray().at(0);
if (action==Qt::CopyAction) {
pasteExpoMimeData(data, idx); pasteExpoMimeData(data, idx);
}
else if (action==Qt::MoveAction) {
QList<int> list = createExpoListFromSelected();
exposDeleteList(list);
pasteExpoMimeData(data, idx);
}
} }
void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx) void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx)