QGCParamSlider.cc 20.1 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

47 48
    //ui->editLine1->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }");
    //ui->editLine2->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }");
49

pixhawk's avatar
pixhawk committed
50
    connect(ui->editDoneButton, SIGNAL(clicked()), this, SLOT(endEditMode()));
51 52 53 54 55 56

    // 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)));
57 58
    connect(ui->doubleValueSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setParamValue(double)));
    connect(ui->intValueSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setParamValue(int)));
59 60
    connect(ui->editNameLabel, SIGNAL(textChanged(QString)), ui->nameLabel, SLOT(setText(QString)));
    connect(ui->readButton, SIGNAL(clicked()), this, SLOT(requestParameter()));
61
    connect(ui->editRefreshParamsButton, SIGNAL(clicked()), this, SLOT(refreshParamList()));
62
    connect(ui->editInfoCheckBox, SIGNAL(clicked(bool)), this, SLOT(showInfo(bool)));
Lorenz Meier's avatar
Lorenz Meier committed
63 64
    // connect to self
    connect(ui->infoLabel, SIGNAL(released()), this, SLOT(showTooltip()));
65
    // Set the current UAS if present
66
    connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
67 68 69 70 71 72 73
}

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

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

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

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

96 97
void QGCParamSlider::setActiveUAS(UASInterface* activeUas)
{
98 99 100 101 102
    if (activeUas)
    {
        if (uas)
        {
            disconnect(uas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant)));
103 104 105
        }

        // Connect buttons and signals
106
        connect(activeUas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(setParameterValue(int,int,int,int,QString,QVariant)), Qt::UniqueConnection);
107
        uas = activeUas;
108
        // Update current param value
109
        //requestParameter();
110 111
        // Set param info
        QString text = uas->getParamManager()->getParamInfo(parameterName);
112 113 114 115 116
        if (text != "")
        {
            ui->infoLabel->setToolTip(text);
            ui->infoLabel->show();
        }
117 118
        // Force-uncheck and hide label if no description is available
        if (ui->editInfoCheckBox->isChecked())
119
        {
120
            showInfo((text.length() > 0));
121
        }
122 123 124 125 126
    }
}

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

133 134 135 136 137 138
void QGCParamSlider::showInfo(bool enable)
{
    ui->editInfoCheckBox->setChecked(enable);
    ui->infoLabel->setVisible(enable);
}

139 140
void QGCParamSlider::setParamValue(double value)
{
141
    parameterValue = (float)value;
142 143 144 145 146 147 148 149 150 151 152
     //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)));
153 154
}

155 156 157
void QGCParamSlider::setParamValue(int value)
{
    parameterValue = value;
158 159 160 161 162 163 164 165 166 167 168
    // 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)));
169 170
}

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

void QGCParamSlider::selectParameter(int paramIndex)
{
LM's avatar
LM committed
178
    // Set name
179
    parameterName = ui->editSelectParamComboBox->itemText(paramIndex);
LM's avatar
LM committed
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201

    // Update min and max values if available
    if (uas)
    {
        if (uas->getParamManager())
        {
            // Current value
            uas->getParamManager()->requestParameterUpdate(component, parameterName);

            // Minimum
            if (uas->getParamManager()->isParamMinKnown(parameterName))
            {
                parameterMin = uas->getParamManager()->getParamMin(parameterName);
                ui->editMinSpinBox->setValue(parameterMin);
            }

            // Maximum
            if (uas->getParamManager()->isParamMaxKnown(parameterName))
            {
                parameterMax = uas->getParamManager()->getParamMax(parameterName);
                ui->editMaxSpinBox->setValue(parameterMax);
            }
202 203

            // Description
204 205 206 207
            //QString text = uas->getParamManager()->getParamInfo(parameterName);
            //ui->infoLabel->setText(text);

            //showInfo(!(text.length() > 0));
LM's avatar
LM committed
208 209
        }
    }
210 211
}

212 213
void QGCParamSlider::startEditMode()
{
214
    ui->valueSlider->hide();
215 216
    ui->doubleValueSpinBox->hide();
    ui->intValueSpinBox->hide();
217 218 219 220
    ui->nameLabel->hide();
    ui->writeButton->hide();
    ui->readButton->hide();

221
    ui->editInfoCheckBox->show();
pixhawk's avatar
pixhawk committed
222
    ui->editDoneButton->show();
223
    ui->editNameLabel->show();
pixhawk's avatar
pixhawk committed
224 225 226 227 228 229
    ui->editRefreshParamsButton->show();
    ui->editSelectParamComboBox->show();
    ui->editSelectComponentComboBox->show();
    ui->editStatusLabel->show();
    ui->editMinSpinBox->show();
    ui->editMaxSpinBox->show();
230 231
    ui->writeButton->hide();
    ui->readButton->hide();
232 233
    ui->editLine1->show();
    ui->editLine2->show();
234 235 236 237 238
    isInEditMode = true;
}

void QGCParamSlider::endEditMode()
{
239 240 241 242 243 244 245 246 247 248
    // 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();

249
    ui->editInfoCheckBox->hide();
pixhawk's avatar
pixhawk committed
250
    ui->editDoneButton->hide();
251
    ui->editNameLabel->hide();
pixhawk's avatar
pixhawk committed
252 253 254 255 256 257
    ui->editRefreshParamsButton->hide();
    ui->editSelectParamComboBox->hide();
    ui->editSelectComponentComboBox->hide();
    ui->editStatusLabel->hide();
    ui->editMinSpinBox->hide();
    ui->editMaxSpinBox->hide();
258 259
    ui->editLine1->hide();
    ui->editLine2->hide();
260 261
    ui->writeButton->show();
    ui->readButton->show();
262
    ui->valueSlider->show();
263 264
    switch (parameterValue.type())
    {
265 266 267
    case QVariant::Char:
        ui->intValueSpinBox->show();
        break;
268 269 270 271 272 273 274 275 276 277 278 279 280
    case QVariant::Int:
        ui->intValueSpinBox->show();
        break;
    case QVariant::UInt:
        ui->intValueSpinBox->show();
        break;
    case QMetaType::Float:
        ui->doubleValueSpinBox->show();
        break;
    default:
        qCritical() << "ERROR: NO VALID PARAM TYPE";
        return;
    }
281
    ui->nameLabel->show();
282
    isInEditMode = false;
lm's avatar
lm committed
283
    emit editingFinished();
284 285
}

286 287
void QGCParamSlider::sendParameter()
{
288 289
    if (uas)
    {
290
        // Set value, param manager handles retransmission
291 292 293 294 295 296 297 298 299 300 301
        if (uas->getParamManager())
        {
            uas->getParamManager()->setParameter(component, parameterName, parameterValue);
        }
        else
        {
            qDebug() << "UAS HAS NO PARAM MANAGER, DOING NOTHING";
        }
    }
    else
    {
302 303 304 305
        qDebug() << __FILE__ << __LINE__ << "NO UAS SET, DOING NOTHING";
    }
}

pixhawk's avatar
pixhawk committed
306 307
void QGCParamSlider::setSliderValue(int sliderValue)
{
308
    if (!valueModLock && !valueModLockParam)
309
    {
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
        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;
338
    }
pixhawk's avatar
pixhawk committed
339 340
}

341 342 343 344 345 346
/**
 * @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
 */
347
void QGCParamSlider::setParameterValue(int uas, int component, int paramCount, int paramIndex, QString parameterName, QVariant value)
pixhawk's avatar
pixhawk committed
348
{
349
    Q_UNUSED(paramCount);
350 351 352 353
    if (ui->nameLabel->text() == "Name")
    {
        ui->nameLabel->setText(parameterName);
    }
354 355
    // Check if this component and parameter are part of the list
    bool found = false;
356 357 358 359
    for (int i = 0; i< ui->editSelectComponentComboBox->count(); ++i)
    {
        if (component == ui->editSelectComponentComboBox->itemData(i).toInt())
        {
360 361 362 363
            found = true;
        }
    }

364 365
    if (!found)
    {
366 367 368 369 370
        ui->editSelectComponentComboBox->addItem(tr("Component #%1").arg(component), component);
    }

    // Parameter checking
    found = false;
371 372 373 374
    for (int i = 0; i < ui->editSelectParamComboBox->count(); ++i)
    {
        if (parameterName == ui->editSelectParamComboBox->itemText(i))
        {
375 376 377 378
            found = true;
        }
    }

379 380
    if (!found)
    {
381 382 383
        ui->editSelectParamComboBox->addItem(parameterName, paramIndex);
    }

384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
    if (this->parameterName == "RC5_MIN")
    {
        int stopper = 1;
    }
    if (parameterName == "RC5_MIN")
    {
        int stpoper = 1;
    }
    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();
            }
        }
    }
413
    Q_UNUSED(uas);
414 415
    if (component == this->component && parameterName == this->parameterName)
    {
416 417 418 419
        if (!visibleEnabled)
        {
            return;
        }
420
        parameterValue = value;
421
        ui->valueSlider->setEnabled(true);
422
        valueModLockParam = true;
423 424
        switch (value.type())
        {
425 426 427 428 429 430
        case QVariant::Char:
            ui->intValueSpinBox->show();
            ui->intValueSpinBox->setEnabled(true);
            ui->doubleValueSpinBox->hide();
            ui->intValueSpinBox->setValue(value.toUInt());
            ui->intValueSpinBox->setMinimum(-ui->intValueSpinBox->maximum());
431
            ui->valueSlider->setValue(floatToScaledInt(value.toUInt()));
432 433 434 435 436
            if (parameterMax == 0 && parameterMin == 0)
            {
                ui->editMaxSpinBox->setValue(255);
                ui->editMinSpinBox->setValue(0);
            }
437
            break;
438 439
        case QVariant::Int:
            ui->intValueSpinBox->show();
440
            ui->intValueSpinBox->setEnabled(true);
441
            ui->doubleValueSpinBox->hide();
442
            ui->intValueSpinBox->setValue(value.toInt());
443
            ui->valueSlider->setValue(floatToScaledInt(value.toInt()));
444
            ui->intValueSpinBox->setMinimum(-ui->intValueSpinBox->maximum());
445 446 447 448 449
            if (parameterMax == 0 && parameterMin == 0)
            {
                ui->editMaxSpinBox->setValue(65535);
                ui->editMinSpinBox->setValue(0);
            }
450 451 452
            break;
        case QVariant::UInt:
            ui->intValueSpinBox->show();
453
            ui->intValueSpinBox->setEnabled(true);
454
            ui->doubleValueSpinBox->hide();
455
            ui->intValueSpinBox->setValue(value.toUInt());
456
            ui->valueSlider->setValue(floatToScaledInt(value.toUInt()));
457
            ui->intValueSpinBox->setMinimum(0);
458 459 460 461 462
            if (parameterMax == 0 && parameterMin == 0)
            {
                ui->editMaxSpinBox->setValue(65535);
                ui->editMinSpinBox->setValue(0);
            }
463 464
            break;
        case QMetaType::Float:
465
            ui->doubleValueSpinBox->setValue(value.toFloat());
466
            ui->doubleValueSpinBox->show();
467
            ui->doubleValueSpinBox->setEnabled(true);
468
            ui->intValueSpinBox->hide();
469
            ui->valueSlider->setValue(floatToScaledInt(value.toFloat()));
470 471 472 473 474
            if (parameterMax == 0 && parameterMin == 0)
            {
                ui->editMaxSpinBox->setValue(10000);
                ui->editMinSpinBox->setValue(0);
            }
475 476 477
            break;
        default:
            qCritical() << "ERROR: NO VALID PARAM TYPE";
478
            valueModLockParam = false;
479 480
            return;
        }
481 482 483
        valueModLockParam = false;
        parameterMax = ui->editMaxSpinBox->value();
        parameterMin = ui->editMinSpinBox->value();
484
    }
Lorenz Meier's avatar
Lorenz Meier committed
485 486 487 488 489

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

492 493 494 495 496 497 498 499 500 501 502
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
503

pixhawk's avatar
pixhawk committed
504
float QGCParamSlider::scaledIntToFloat(int sliderValue)
lm's avatar
lm committed
505
{
506
    float result = (((double)sliderValue)/(double)scaledInt)*(ui->editMaxSpinBox->value() - ui->editMinSpinBox->value());
507
    //qDebug() << "INT TO FLOAT: CONVERTED" << sliderValue << "TO" << result;
508
    return result;
pixhawk's avatar
pixhawk committed
509
}
lm's avatar
lm committed
510

pixhawk's avatar
pixhawk committed
511 512
int QGCParamSlider::floatToScaledInt(float value)
{
513
    int result = ((value - ui->editMinSpinBox->value())/(ui->editMaxSpinBox->value() - ui->editMinSpinBox->value()))*scaledInt;
514
    //qDebug() << "FLOAT TO INT: CONVERTED" << value << "TO" << result << "SCALEDINT" << scaledInt;
515
    return result;
lm's avatar
lm committed
516 517
}

pixhawk's avatar
pixhawk committed
518
void QGCParamSlider::writeSettings(QSettings& settings)
lm's avatar
lm committed
519
{
pixhawk's avatar
pixhawk committed
520 521 522
    settings.setValue("TYPE", "SLIDER");
    settings.setValue("QGC_PARAM_SLIDER_DESCRIPTION", ui->nameLabel->text());
    //settings.setValue("QGC_PARAM_SLIDER_BUTTONTEXT", ui->actionButton->text());
523 524
    settings.setValue("QGC_PARAM_SLIDER_PARAMID", parameterName);
    settings.setValue("QGC_PARAM_SLIDER_COMPONENTID", component);
pixhawk's avatar
pixhawk committed
525 526
    settings.setValue("QGC_PARAM_SLIDER_MIN", ui->editMinSpinBox->value());
    settings.setValue("QGC_PARAM_SLIDER_MAX", ui->editMaxSpinBox->value());
527
    settings.setValue("QGC_PARAM_SLIDER_DISPLAY_INFO", ui->editInfoCheckBox->isChecked());
pixhawk's avatar
pixhawk committed
528
    settings.sync();
lm's avatar
lm committed
529
}
530 531 532 533 534 535 536 537 538 539 540 541
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());
542 543
    visibleParam = settings.value(pre+"QGC_PARAM_SLIDER_VISIBLE_PARAM","").toString();
    visibleVal = settings.value(pre+"QGC_PARAM_SLIDER_VISIBLE_VAL",0).toInt();
544 545 546 547
    parameterMax = ui->editMaxSpinBox->value();
    parameterMin = ui->editMinSpinBox->value();
    //ui->valueSlider->setMaximum(parameterMax);
    //ui->valueSlider->setMinimum(parameterMin);
548 549 550 551 552 553 554 555 556
    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
557 558 559

void QGCParamSlider::readSettings(const QSettings& settings)
{
560 561 562 563 564 565 566 567
    QVariantMap map;
    foreach (QString key,settings.allKeys())
    {
        map[key] = settings.value(key);
    }

    readSettings("",map);
    return;
568 569
    parameterName = settings.value("QGC_PARAM_SLIDER_PARAMID").toString();
    component = settings.value("QGC_PARAM_SLIDER_COMPONENTID").toInt();
pixhawk's avatar
pixhawk committed
570
    ui->nameLabel->setText(settings.value("QGC_PARAM_SLIDER_DESCRIPTION").toString());
571
    ui->editNameLabel->setText(settings.value("QGC_PARAM_SLIDER_DESCRIPTION").toString());
pixhawk's avatar
pixhawk committed
572
    //settings.setValue("QGC_PARAM_SLIDER_BUTTONTEXT", ui->actionButton->text());
573 574
    ui->editSelectParamComboBox->addItem(settings.value("QGC_PARAM_SLIDER_PARAMID").toString());
    ui->editSelectParamComboBox->setCurrentIndex(ui->editSelectParamComboBox->count()-1);
575
    ui->editSelectComponentComboBox->addItem(tr("Component #%1").arg(settings.value("QGC_PARAM_SLIDER_COMPONENTID").toInt()), settings.value("QGC_PARAM_SLIDER_COMPONENTID").toInt());
576 577
    ui->editMinSpinBox->setValue(settings.value("QGC_PARAM_SLIDER_MIN").toFloat());
    ui->editMaxSpinBox->setValue(settings.value("QGC_PARAM_SLIDER_MAX").toFloat());
578 579 580
    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();
581 582
    parameterMax = ui->editMaxSpinBox->value();
    parameterMin = ui->editMinSpinBox->value();
583
    showInfo(settings.value("QGC_PARAM_SLIDER_DISPLAY_INFO", true).toBool());
584 585
    ui->editSelectParamComboBox->setEnabled(true);
    ui->editSelectComponentComboBox->setEnabled(true);
586 587 588 589

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

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