QGCParamSlider.cc 19.5 KB
Newer Older
1 2
#include <QMenu>
#include <QContextMenuEvent>
3
#include <QSettings>
4
#include <QTimer>
Lorenz Meier's avatar
Lorenz Meier committed
5
#include <QToolTip>
6

7 8
#include "QGCParamSlider.h"
#include "ui_QGCParamSlider.h"
9
#include "UASInterface.h"
10
#include "UASManager.h"
11

12

13
QGCParamSlider::QGCParamSlider(QWidget *parent) :
14 15 16 17 18 19 20
    QGCToolWidgetItem("Slider", parent),
    parameterName(""),
    parameterValue(0.0f),
    parameterScalingFactor(0.0),
    parameterMin(0.0f),
    parameterMax(0.0f),
    component(0),
21 22
    ui(new Ui::QGCParamSlider)
{
23
    valueModLock = false;
24
    visibleEnabled = true;
25
    valueModLockParam = false;
26
    ui->setupUi(this);
27
    ui->intValueSpinBox->hide();
28 29
    ui->valueSlider->setEnabled(false);
    ui->doubleValueSpinBox->setEnabled(false);
30
    uas = NULL;
pixhawk's avatar
pixhawk committed
31 32 33

    scaledInt = ui->valueSlider->maximum() - ui->valueSlider->minimum();

34
    ui->editInfoCheckBox->hide();
35 36 37 38 39 40 41 42
    ui->editDoneButton->hide();
    ui->editNameLabel->hide();
    ui->editRefreshParamsButton->hide();
    ui->editSelectParamComboBox->hide();
    ui->editSelectComponentComboBox->hide();
    ui->editStatusLabel->hide();
    ui->editMinSpinBox->hide();
    ui->editMaxSpinBox->hide();
43 44
    ui->editLine1->hide();
    ui->editLine2->hide();
45
    ui->infoLabel->hide();
46

pixhawk's avatar
pixhawk committed
47
    connect(ui->editDoneButton, SIGNAL(clicked()), this, SLOT(endEditMode()));
48 49 50 51 52 53

    // Sending actions
    connect(ui->writeButton, SIGNAL(clicked()), this, SLOT(sendParameter()));
    connect(ui->editSelectComponentComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectComponent(int)));
    connect(ui->editSelectParamComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectParameter(int)));
    connect(ui->valueSlider, SIGNAL(valueChanged(int)), this, SLOT(setSliderValue(int)));
54 55
    connect(ui->doubleValueSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setParamValue(double)));
    connect(ui->intValueSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setParamValue(int)));
56 57
    connect(ui->editNameLabel, SIGNAL(textChanged(QString)), ui->nameLabel, SLOT(setText(QString)));
    connect(ui->readButton, SIGNAL(clicked()), this, SLOT(requestParameter()));
58
    connect(ui->editRefreshParamsButton, SIGNAL(clicked()), this, SLOT(refreshParamList()));
59
    connect(ui->editInfoCheckBox, SIGNAL(clicked(bool)), this, SLOT(showInfo(bool)));
Lorenz Meier's avatar
Lorenz Meier committed
60 61
    // connect to self
    connect(ui->infoLabel, SIGNAL(released()), this, SLOT(showTooltip()));
62
    // Set the current UAS if present
63
    connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
64 65 66 67 68 69 70
}

QGCParamSlider::~QGCParamSlider()
{
    delete ui;
}

Lorenz Meier's avatar
Lorenz Meier committed
71 72 73 74 75 76
void QGCParamSlider::showTooltip()
{
    QWidget* sender = dynamic_cast<QWidget*>(QObject::sender());

    if (sender)
    {
77
        QPoint point = mapToGlobal(ui->infoLabel->pos());
Lorenz Meier's avatar
Lorenz Meier committed
78 79 80 81
        QToolTip::showText(point, sender->toolTip());
    }
}

82 83 84 85
void QGCParamSlider::refreshParamList()
{
    ui->editSelectParamComboBox->setEnabled(true);
    ui->editSelectComponentComboBox->setEnabled(true);
86 87
    if (uas)
    {
88
        uas->getParamManager()->requestParameterList();
Lorenz Meier's avatar
Lorenz Meier committed
89
        ui->editStatusLabel->setText(tr("Parameter list updating.."));
90 91 92
    }
}

93 94
void QGCParamSlider::setActiveUAS(UASInterface* activeUas)
{
95
    if (activeUas) {
96
        // Set param info
97 98 99 100 101 102 103 104
        if (!parameterName.isEmpty()) {
            //disconnect from any existing uas signals
            if (uas != activeUas)  {
                disconnect(uas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant)));
                connect(activeUas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant)), Qt::UniqueConnection);
                uas = activeUas;
            }

105 106
            QString text = uas->getParamDataModel()->getParamDescription(parameterName);
            if (!text.isEmpty()) {
107 108 109 110 111 112 113
                ui->infoLabel->setToolTip(text);
                ui->infoLabel->show();
            }
            // Force-uncheck and hide label if no description is available
            if (ui->editInfoCheckBox->isChecked()) {
                showInfo((text.length() > 0));
            }
114
        }
115 116 117
        else {
            //when parameter widgets are first loaded, they are disconnected from any parameter?
            qWarning() << __FILE__ << ":" << __LINE__ << "slider has no parameterName??";
118
        }
119 120 121 122 123
    }
}

void QGCParamSlider::requestParameter()
{
124 125
    if (!parameterName.isEmpty() && uas)
    {
126
        uas->getParamManager()->requestParameterUpdate(this->component, this->parameterName);
127 128 129
    }
}

130 131 132 133 134 135
void QGCParamSlider::showInfo(bool enable)
{
    ui->editInfoCheckBox->setChecked(enable);
    ui->infoLabel->setVisible(enable);
}

136 137
void QGCParamSlider::setParamValue(double value)
{
138
    parameterValue = (float)value;
139 140 141 142 143 144 145 146 147 148 149
     //disconnect(ui->valueSlider,SIGNAL(valueChanged(int)));
    if (!valueModLock && !valueModLockParam)
    {
        valueModLock = true;
        ui->valueSlider->setValue(floatToScaledInt(value));
    }
    else
    {
        valueModLock = false;
    }
    //connect(ui->valueSlider, SIGNAL(valueChanged(int)), this, SLOT(setSliderValue(int)));
150 151
}

152 153 154
void QGCParamSlider::setParamValue(int value)
{
    parameterValue = value;
155 156 157 158 159 160 161 162 163 164 165
    // disconnect(ui->valueSlider,SIGNAL(valueChanged(int)));
    if (!valueModLock && !valueModLockParam)
    {
        valueModLock = true;
        ui->valueSlider->setValue(floatToScaledInt(value));
    }
    else
    {
        valueModLock = false;
    }
    //connect(ui->valueSlider, SIGNAL(valueChanged(int)), this, SLOT(setSliderValue(int)));
166 167
}

168 169 170 171 172 173 174
void QGCParamSlider::selectComponent(int componentIndex)
{
    this->component = ui->editSelectComponentComboBox->itemData(componentIndex).toInt();
}

void QGCParamSlider::selectParameter(int paramIndex)
{
LM's avatar
LM committed
175
    // Set name
176
    parameterName = ui->editSelectParamComboBox->itemText(paramIndex);
LM's avatar
LM committed
177 178

    // Update min and max values if available
179 180 181
    if (uas) {
        UASParameterDataModel* dataModel =  uas->getParamDataModel();
        if (dataModel) {
LM's avatar
LM committed
182
            // Minimum
183 184
            if (dataModel->isParamMinKnown(parameterName)) {
                parameterMin = dataModel->getParamMin(parameterName);
LM's avatar
LM committed
185 186 187 188
                ui->editMinSpinBox->setValue(parameterMin);
            }

            // Maximum
189 190
            if (dataModel->isParamMaxKnown(parameterName)) {
                parameterMax = dataModel->getParamMax(parameterName);
LM's avatar
LM committed
191 192 193 194
                ui->editMaxSpinBox->setValue(parameterMax);
            }
        }
    }
195 196
}

197 198
void QGCParamSlider::startEditMode()
{
199
    ui->valueSlider->hide();
200 201
    ui->doubleValueSpinBox->hide();
    ui->intValueSpinBox->hide();
202 203 204 205
    ui->nameLabel->hide();
    ui->writeButton->hide();
    ui->readButton->hide();

206
    ui->editInfoCheckBox->show();
pixhawk's avatar
pixhawk committed
207
    ui->editDoneButton->show();
208
    ui->editNameLabel->show();
pixhawk's avatar
pixhawk committed
209 210 211 212 213 214
    ui->editRefreshParamsButton->show();
    ui->editSelectParamComboBox->show();
    ui->editSelectComponentComboBox->show();
    ui->editStatusLabel->show();
    ui->editMinSpinBox->show();
    ui->editMaxSpinBox->show();
215 216
    ui->writeButton->hide();
    ui->readButton->hide();
217 218
    ui->editLine1->show();
    ui->editLine2->show();
219 220 221 222 223
    isInEditMode = true;
}

void QGCParamSlider::endEditMode()
{
224 225 226 227 228 229 230 231 232 233
    // Store component id
    selectComponent(ui->editSelectComponentComboBox->currentIndex());

    // Store parameter name and id
    selectParameter(ui->editSelectParamComboBox->currentIndex());

    // Min/max
    parameterMin = ui->editMinSpinBox->value();
    parameterMax = ui->editMaxSpinBox->value();

234
    ui->editInfoCheckBox->hide();
pixhawk's avatar
pixhawk committed
235
    ui->editDoneButton->hide();
236
    ui->editNameLabel->hide();
pixhawk's avatar
pixhawk committed
237 238 239 240 241 242
    ui->editRefreshParamsButton->hide();
    ui->editSelectParamComboBox->hide();
    ui->editSelectComponentComboBox->hide();
    ui->editStatusLabel->hide();
    ui->editMinSpinBox->hide();
    ui->editMaxSpinBox->hide();
243 244
    ui->editLine1->hide();
    ui->editLine2->hide();
245 246
    ui->writeButton->show();
    ui->readButton->show();
247
    ui->valueSlider->show();
248 249
    switch (parameterValue.type())
    {
250
    case QVariant::Char:
251 252 253 254 255 256 257 258 259 260 261
    case QVariant::Int:
    case QVariant::UInt:
        ui->intValueSpinBox->show();
        break;
    case QMetaType::Float:
        ui->doubleValueSpinBox->show();
        break;
    default:
        qCritical() << "ERROR: NO VALID PARAM TYPE";
        return;
    }
262
    ui->nameLabel->show();
263
    isInEditMode = false;
lm's avatar
lm committed
264
    emit editingFinished();
265 266
}

267 268
void QGCParamSlider::sendParameter()
{
269 270
    if (uas)
    {
271
        // Set value, param manager handles retransmission
272 273 274 275 276 277 278 279 280 281 282
        if (uas->getParamManager())
        {
            uas->getParamManager()->setParameter(component, parameterName, parameterValue);
        }
        else
        {
            qDebug() << "UAS HAS NO PARAM MANAGER, DOING NOTHING";
        }
    }
    else
    {
283 284 285 286
        qDebug() << __FILE__ << __LINE__ << "NO UAS SET, DOING NOTHING";
    }
}

pixhawk's avatar
pixhawk committed
287 288
void QGCParamSlider::setSliderValue(int sliderValue)
{
289
    if (!valueModLock && !valueModLockParam)
290
    {
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
        valueModLock = true;
        switch (parameterValue.type())
        {
        case QVariant::Char:
            parameterValue = QVariant(QChar((unsigned char)scaledIntToFloat(sliderValue)));
            ui->intValueSpinBox->setValue(parameterValue.toInt());
            break;
        case QVariant::Int:
            parameterValue = (int)scaledIntToFloat(sliderValue);
            ui->intValueSpinBox->setValue(parameterValue.toInt());
            break;
        case QVariant::UInt:
            parameterValue = (unsigned int)scaledIntToFloat(sliderValue);
            ui->intValueSpinBox->setValue(parameterValue.toUInt());
            break;
        case QMetaType::Float:
            parameterValue = scaledIntToFloat(sliderValue);
            ui->doubleValueSpinBox->setValue(parameterValue.toFloat());
            break;
        default:
            qCritical() << "ERROR: NO VALID PARAM TYPE";
            valueModLock = false;
            return;
        }
    }
    else
    {
        valueModLock = false;
319
    }
pixhawk's avatar
pixhawk committed
320 321
}

322 323 324 325 326 327
/**
 * @brief uas Unmanned system sending the parameter
 * @brief component UAS component sending the parameter
 * @brief parameterName Key/name of the parameter
 * @brief value Value of the parameter
 */
328
void QGCParamSlider::setParameterValue(int uas, int component, int paramCount, int paramIndex, QString parameterName, QVariant value)
pixhawk's avatar
pixhawk committed
329
{
330
    Q_UNUSED(paramCount);
331 332 333 334
    if (ui->nameLabel->text() == "Name")
    {
        ui->nameLabel->setText(parameterName);
    }
335 336
    // Check if this component and parameter are part of the list
    bool found = false;
337 338 339 340
    for (int i = 0; i< ui->editSelectComponentComboBox->count(); ++i)
    {
        if (component == ui->editSelectComponentComboBox->itemData(i).toInt())
        {
341 342 343 344
            found = true;
        }
    }

345 346
    if (!found)
    {
347 348 349 350 351
        ui->editSelectComponentComboBox->addItem(tr("Component #%1").arg(component), component);
    }

    // Parameter checking
    found = false;
352 353 354 355
    for (int i = 0; i < ui->editSelectParamComboBox->count(); ++i)
    {
        if (parameterName == ui->editSelectParamComboBox->itemText(i))
        {
356 357 358 359
            found = true;
        }
    }

360 361
    if (!found)
    {
362 363 364
        ui->editSelectParamComboBox->addItem(parameterName, paramIndex);
    }

365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
    if (visibleParam != "")
    {
        if (parameterName == visibleParam)
        {
            if (visibleVal == value.toInt())
            {
                this->uas->requestParameter(this->component,this->parameterName);
                visibleEnabled = true;
                this->show();
            }
            else
            {
                //Disable the component here.
                ui->valueSlider->setEnabled(false);
                ui->intValueSpinBox->setEnabled(false);
                ui->doubleValueSpinBox->setEnabled(false);
                visibleEnabled = false;
                this->hide();
            }
        }
    }
386
    Q_UNUSED(uas);
387 388
    if (component == this->component && parameterName == this->parameterName)
    {
389 390 391 392
        if (!visibleEnabled)
        {
            return;
        }
393
        parameterValue = value;
394
        ui->valueSlider->setEnabled(true);
395
        valueModLockParam = true;
396 397
        switch (value.type())
        {
398 399 400 401 402
        case QVariant::Char:
            ui->intValueSpinBox->show();
            ui->intValueSpinBox->setEnabled(true);
            ui->doubleValueSpinBox->hide();
            ui->intValueSpinBox->setValue(value.toUInt());
403
            ui->intValueSpinBox->setRange(0, UINT8_MAX);
404 405
            if (parameterMax == 0 && parameterMin == 0)
            {
406
                ui->editMaxSpinBox->setValue(UINT8_MAX);
407 408
                ui->editMinSpinBox->setValue(0);
            }
409
            ui->valueSlider->setValue(floatToScaledInt(value.toUInt()));
410
            break;
411 412
        case QVariant::Int:
            ui->intValueSpinBox->show();
413
            ui->intValueSpinBox->setEnabled(true);
414
            ui->doubleValueSpinBox->hide();
415
            ui->intValueSpinBox->setValue(value.toInt());
416
            ui->intValueSpinBox->setRange(INT32_MIN, INT32_MAX);
417 418
            if (parameterMax == 0 && parameterMin == 0)
            {
419 420
                ui->editMaxSpinBox->setValue(INT32_MAX);
                ui->editMinSpinBox->setValue(INT32_MIN);
421
            }
422
            ui->valueSlider->setValue(floatToScaledInt(value.toInt()));
423 424 425
            break;
        case QVariant::UInt:
            ui->intValueSpinBox->show();
426
            ui->intValueSpinBox->setEnabled(true);
427
            ui->doubleValueSpinBox->hide();
428
            ui->intValueSpinBox->setValue(value.toUInt());
429
            ui->intValueSpinBox->setRange(0, UINT32_MAX);
430 431
            if (parameterMax == 0 && parameterMin == 0)
            {
432
                ui->editMaxSpinBox->setValue(UINT32_MAX);
433 434
                ui->editMinSpinBox->setValue(0);
            }
435
            ui->valueSlider->setValue(floatToScaledInt(value.toUInt()));
436 437
            break;
        case QMetaType::Float:
438
            ui->doubleValueSpinBox->setValue(value.toFloat());
439
            ui->doubleValueSpinBox->show();
440
            ui->doubleValueSpinBox->setEnabled(true);
441
            ui->intValueSpinBox->hide();
442 443 444 445 446
            if (parameterMax == 0 && parameterMin == 0)
            {
                ui->editMaxSpinBox->setValue(10000);
                ui->editMinSpinBox->setValue(0);
            }
447
            ui->valueSlider->setValue(floatToScaledInt(value.toFloat()));
448 449 450
            break;
        default:
            qCritical() << "ERROR: NO VALID PARAM TYPE";
451
            valueModLockParam = false;
452 453
            return;
        }
454 455 456
        valueModLockParam = false;
        parameterMax = ui->editMaxSpinBox->value();
        parameterMin = ui->editMinSpinBox->value();
457
    }
Lorenz Meier's avatar
Lorenz Meier committed
458 459 460 461 462

    if (paramIndex == paramCount - 1)
    {
        ui->editStatusLabel->setText(tr("Complete parameter list received."));
    }
pixhawk's avatar
pixhawk committed
463 464
}

465 466 467 468 469 470 471 472 473 474 475
void QGCParamSlider::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}
lm's avatar
lm committed
476

pixhawk's avatar
pixhawk committed
477
float QGCParamSlider::scaledIntToFloat(int sliderValue)
lm's avatar
lm committed
478
{
479
    float result = (((double)sliderValue)/(double)scaledInt)*(ui->editMaxSpinBox->value() - ui->editMinSpinBox->value());
480
    //qDebug() << "INT TO FLOAT: CONVERTED" << sliderValue << "TO" << result;
481
    return result;
pixhawk's avatar
pixhawk committed
482
}
lm's avatar
lm committed
483

pixhawk's avatar
pixhawk committed
484 485
int QGCParamSlider::floatToScaledInt(float value)
{
486
    int result = ((value - ui->editMinSpinBox->value())/(ui->editMaxSpinBox->value() - ui->editMinSpinBox->value()))*scaledInt;
487
    //qDebug() << "FLOAT TO INT: CONVERTED" << value << "TO" << result << "SCALEDINT" << scaledInt;
488
    return result;
lm's avatar
lm committed
489 490
}

pixhawk's avatar
pixhawk committed
491
void QGCParamSlider::writeSettings(QSettings& settings)
lm's avatar
lm committed
492
{
pixhawk's avatar
pixhawk committed
493 494 495
    settings.setValue("TYPE", "SLIDER");
    settings.setValue("QGC_PARAM_SLIDER_DESCRIPTION", ui->nameLabel->text());
    //settings.setValue("QGC_PARAM_SLIDER_BUTTONTEXT", ui->actionButton->text());
496 497
    settings.setValue("QGC_PARAM_SLIDER_PARAMID", parameterName);
    settings.setValue("QGC_PARAM_SLIDER_COMPONENTID", component);
pixhawk's avatar
pixhawk committed
498 499
    settings.setValue("QGC_PARAM_SLIDER_MIN", ui->editMinSpinBox->value());
    settings.setValue("QGC_PARAM_SLIDER_MAX", ui->editMaxSpinBox->value());
500
    settings.setValue("QGC_PARAM_SLIDER_DISPLAY_INFO", ui->editInfoCheckBox->isChecked());
pixhawk's avatar
pixhawk committed
501
    settings.sync();
lm's avatar
lm committed
502
}
503 504 505 506 507 508 509 510 511 512 513 514
void QGCParamSlider::readSettings(const QString& pre,const QVariantMap& settings)
{
    parameterName = settings.value(pre + "QGC_PARAM_SLIDER_PARAMID").toString();
    component = settings.value(pre + "QGC_PARAM_SLIDER_COMPONENTID").toInt();
    ui->nameLabel->setText(settings.value(pre + "QGC_PARAM_SLIDER_DESCRIPTION").toString());
    ui->editNameLabel->setText(settings.value(pre + "QGC_PARAM_SLIDER_DESCRIPTION").toString());
    //settings.setValue("QGC_PARAM_SLIDER_BUTTONTEXT", ui->actionButton->text());
    ui->editSelectParamComboBox->addItem(settings.value(pre + "QGC_PARAM_SLIDER_PARAMID").toString());
    ui->editSelectParamComboBox->setCurrentIndex(ui->editSelectParamComboBox->count()-1);
    ui->editSelectComponentComboBox->addItem(tr("Component #%1").arg(settings.value(pre + "QGC_PARAM_SLIDER_COMPONENTID").toInt()), settings.value(pre + "QGC_PARAM_SLIDER_COMPONENTID").toInt());
    ui->editMinSpinBox->setValue(settings.value(pre + "QGC_PARAM_SLIDER_MIN").toFloat());
    ui->editMaxSpinBox->setValue(settings.value(pre + "QGC_PARAM_SLIDER_MAX").toFloat());
515 516
    visibleParam = settings.value(pre+"QGC_PARAM_SLIDER_VISIBLE_PARAM","").toString();
    visibleVal = settings.value(pre+"QGC_PARAM_SLIDER_VISIBLE_VAL",0).toInt();
517 518 519 520
    parameterMax = ui->editMaxSpinBox->value();
    parameterMin = ui->editMinSpinBox->value();
    //ui->valueSlider->setMaximum(parameterMax);
    //ui->valueSlider->setMinimum(parameterMin);
521 522 523 524 525 526 527 528 529
    showInfo(settings.value(pre + "QGC_PARAM_SLIDER_DISPLAY_INFO", true).toBool());
    ui->editSelectParamComboBox->setEnabled(true);
    ui->editSelectComponentComboBox->setEnabled(true);

    setActiveUAS(UASManager::instance()->getActiveUAS());

    // Get param value after settings have been loaded
    //requestParameter();
}
lm's avatar
lm committed
530 531 532

void QGCParamSlider::readSettings(const QSettings& settings)
{
533 534 535 536 537 538 539 540
    QVariantMap map;
    foreach (QString key,settings.allKeys())
    {
        map[key] = settings.value(key);
    }

    readSettings("",map);
    return;
541 542
    parameterName = settings.value("QGC_PARAM_SLIDER_PARAMID").toString();
    component = settings.value("QGC_PARAM_SLIDER_COMPONENTID").toInt();
pixhawk's avatar
pixhawk committed
543
    ui->nameLabel->setText(settings.value("QGC_PARAM_SLIDER_DESCRIPTION").toString());
544
    ui->editNameLabel->setText(settings.value("QGC_PARAM_SLIDER_DESCRIPTION").toString());
pixhawk's avatar
pixhawk committed
545
    //settings.setValue("QGC_PARAM_SLIDER_BUTTONTEXT", ui->actionButton->text());
546 547
    ui->editSelectParamComboBox->addItem(settings.value("QGC_PARAM_SLIDER_PARAMID").toString());
    ui->editSelectParamComboBox->setCurrentIndex(ui->editSelectParamComboBox->count()-1);
548
    ui->editSelectComponentComboBox->addItem(tr("Component #%1").arg(settings.value("QGC_PARAM_SLIDER_COMPONENTID").toInt()), settings.value("QGC_PARAM_SLIDER_COMPONENTID").toInt());
549 550
    ui->editMinSpinBox->setValue(settings.value("QGC_PARAM_SLIDER_MIN").toFloat());
    ui->editMaxSpinBox->setValue(settings.value("QGC_PARAM_SLIDER_MAX").toFloat());
551 552 553
    visibleParam = settings.value("QGC_PARAM_SLIDER_VISIBLE_PARAM","").toString();
             //QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_VISIBLE_PARAM=RC5_FUNCTION
    visibleVal = settings.value("QGC_PARAM_SLIDER_VISIBLE_VAL",0).toInt();
554 555
    parameterMax = ui->editMaxSpinBox->value();
    parameterMin = ui->editMinSpinBox->value();
556
    showInfo(settings.value("QGC_PARAM_SLIDER_DISPLAY_INFO", true).toBool());
557 558
    ui->editSelectParamComboBox->setEnabled(true);
    ui->editSelectComponentComboBox->setEnabled(true);
559 560 561 562

    setActiveUAS(UASManager::instance()->getActiveUAS());

    // Get param value after settings have been loaded
563
    //requestParameter();
lm's avatar
lm committed
564
}