|
|
@ -92,16 +92,20 @@ void QGCParamSlider::refreshParamList() |
|
|
|
|
|
|
|
|
|
|
|
void QGCParamSlider::setActiveUAS(UASInterface* activeUas) |
|
|
|
void QGCParamSlider::setActiveUAS(UASInterface* activeUas) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (activeUas) { |
|
|
|
|
|
|
|
// Set param info
|
|
|
|
|
|
|
|
if (!parameterName.isEmpty()) { |
|
|
|
|
|
|
|
//disconnect from any existing uas signals
|
|
|
|
|
|
|
|
if (uas != activeUas) { |
|
|
|
if (uas != activeUas) { |
|
|
|
disconnect(uas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant))); |
|
|
|
if (uas) { |
|
|
|
connect(activeUas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant)), Qt::UniqueConnection); |
|
|
|
disconnect(uas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), |
|
|
|
|
|
|
|
this, SLOT(setParameterValue(int,int,int,int,QString,QVariant))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (activeUas) { |
|
|
|
|
|
|
|
connect(activeUas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), |
|
|
|
|
|
|
|
this, SLOT(setParameterValue(int,int,int,int,QString,QVariant)), Qt::UniqueConnection); |
|
|
|
|
|
|
|
} |
|
|
|
uas = activeUas; |
|
|
|
uas = activeUas; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uas && !parameterName.isEmpty()) { |
|
|
|
QString text = uas->getParamDataModel()->getParamDescription(parameterName); |
|
|
|
QString text = uas->getParamDataModel()->getParamDescription(parameterName); |
|
|
|
if (!text.isEmpty()) { |
|
|
|
if (!text.isEmpty()) { |
|
|
|
ui->infoLabel->setToolTip(text); |
|
|
|
ui->infoLabel->setToolTip(text); |
|
|
@ -112,11 +116,8 @@ void QGCParamSlider::setActiveUAS(UASInterface* activeUas) |
|
|
|
showInfo((text.length() > 0)); |
|
|
|
showInfo((text.length() > 0)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
|
|
|
|
//when parameter widgets are first loaded, they are disconnected from any parameter?
|
|
|
|
|
|
|
|
qWarning() << __FILE__ << ":" << __LINE__ << "slider has no parameterName??"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QGCParamSlider::requestParameter() |
|
|
|
void QGCParamSlider::requestParameter() |
|
|
@ -245,7 +246,7 @@ void QGCParamSlider::endEditMode() |
|
|
|
ui->writeButton->show(); |
|
|
|
ui->writeButton->show(); |
|
|
|
ui->readButton->show(); |
|
|
|
ui->readButton->show(); |
|
|
|
ui->valueSlider->show(); |
|
|
|
ui->valueSlider->show(); |
|
|
|
switch (parameterValue.type()) |
|
|
|
switch ((int)parameterValue.type()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case QVariant::Char: |
|
|
|
case QVariant::Char: |
|
|
|
case QVariant::Int: |
|
|
|
case QVariant::Int: |
|
|
@ -289,7 +290,7 @@ void QGCParamSlider::setSliderValue(int sliderValue) |
|
|
|
if (!valueModLock && !valueModLockParam) |
|
|
|
if (!valueModLock && !valueModLockParam) |
|
|
|
{ |
|
|
|
{ |
|
|
|
valueModLock = true; |
|
|
|
valueModLock = true; |
|
|
|
switch (parameterValue.type()) |
|
|
|
switch ((int)parameterValue.type()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case QVariant::Char: |
|
|
|
case QVariant::Char: |
|
|
|
parameterValue = QVariant(QChar((unsigned char)scaledIntToFloat(sliderValue))); |
|
|
|
parameterValue = QVariant(QChar((unsigned char)scaledIntToFloat(sliderValue))); |
|
|
@ -393,7 +394,7 @@ void QGCParamSlider::setParameterValue(int uas, int component, int paramCount, i |
|
|
|
parameterValue = value; |
|
|
|
parameterValue = value; |
|
|
|
ui->valueSlider->setEnabled(true); |
|
|
|
ui->valueSlider->setEnabled(true); |
|
|
|
valueModLockParam = true; |
|
|
|
valueModLockParam = true; |
|
|
|
switch (value.type()) |
|
|
|
switch ((int)value.type()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case QVariant::Char: |
|
|
|
case QVariant::Char: |
|
|
|
ui->intValueSpinBox->show(); |
|
|
|
ui->intValueSpinBox->show(); |
|
|
|