示例#1
0
HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
  ModelPanel(parent, model, generalSettings, firmware),
  ui(new Ui::Heli)
{
  ui->setupUi(this);

  connect(ui->swashTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
  connect(ui->swashCollectiveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
  connect(ui->swashRingValSB, SIGNAL(editingFinished()), this, SLOT(edited()));
  connect(ui->swashInvertELE, SIGNAL(stateChanged(int)), this, SLOT(edited()));
  connect(ui->swashInvertAIL, SIGNAL(stateChanged(int)), this, SLOT(edited()));
  connect(ui->swashInvertCOL, SIGNAL(stateChanged(int)), this, SLOT(edited()));

  disableMouseScrolling();
}
示例#2
0
TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
    ModelPanel(parent, model, generalSettings, firmware),
    ui(new Ui::TelemetryAnalog),
    analog(analog),
    lock(false)
{
    ui->setupUi(this);

    float ratio = analog.getRatio();

    if (analog.type==0 || analog.type==1 || analog.type==2) {
        ui->RatioSB->setDecimals(1);
        ui->RatioSB->setMaximum(25.5*firmware->getCapability(TelemetryMaxMultiplier));
    }
    else {
        ui->RatioSB->setDecimals(0);
        ui->RatioSB->setMaximum(255*firmware->getCapability(TelemetryMaxMultiplier));
    }
    ui->RatioSB->setValue(ratio);

    update();

    ui->UnitCB->setCurrentIndex(analog.type);
    if (!IS_TARANIS(firmware->getBoard())) {
        ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
        ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
        ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
        ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater);
    }
    else {
        ui->alarm1LevelCB->hide();
        ui->alarm2LevelCB->hide();
        ui->alarm1GreaterCB->hide();
        ui->alarm2GreaterCB->hide();
        ui->alarm1Label->setText(tr("Low Alarm"));
        ui->alarm2Label->setText(tr("Critical Alarm"));
    }

    if (!(firmware->getCapability(Telemetry) & TM_HASOFFSET)) {
        ui->CalibSB->hide();
        ui->CalibLabel->hide();
    }
    else {
        ui->label_Max->setText(tr("Range"));
    }

    disableMouseScrolling();
}
示例#3
0
TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
    ModelPanel(parent, model, generalSettings, firmware),
    ui(new Ui::Telemetry)
{
    ui->setupUi(this);

    if (firmware->getCapability(NoTelemetryProtocol)) {
        model.frsky.usrProto = 1;
    }

    analogs[0] = new TelemetryAnalog(this, model.frsky.channels[0], model, generalSettings, firmware);
    ui->A1Layout->addWidget(analogs[0]);
    connect(analogs[0], SIGNAL(modified()), this, SLOT(onAnalogModified()));

    analogs[1] = new TelemetryAnalog(this, model.frsky.channels[1], model, generalSettings, firmware);
    ui->A2Layout->addWidget(analogs[1]);
    connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified()));

    if (IS_ARM(firmware->getBoard())) {
        analogs[2] = new TelemetryAnalog(this, model.frsky.channels[2], model, generalSettings, firmware);
        ui->A3Layout->addWidget(analogs[2]);
        connect(analogs[2], SIGNAL(modified()), this, SLOT(onAnalogModified()));

        analogs[3] = new TelemetryAnalog(this, model.frsky.channels[3], model, generalSettings, firmware);
        ui->A4Layout->addWidget(analogs[3]);
        connect(analogs[3], SIGNAL(modified()), this, SLOT(onAnalogModified()));
    }
    else {
        ui->A3GB->hide();
        ui->A4GB->hide();
    }

    for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++) {
        TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings, firmware);
        ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
        telemetryCustomScreens[i] = tab;
    }

    if (IS_ARM(firmware->getBoard())) {
        ui->bladesCount->setMinimum(1);
        ui->bladesCount->setMaximum(128);
    }

    disableMouseScrolling();

    setup();
}
示例#4
0
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, FirmwareInterface * firmware):
    ModelPanel(parent, model, generalSettings, firmware),
    ui(new Ui::TelemetryCustomScreen),
    screen(screen)
{
    ui->setupUi(this);

    for (int l=0; l<4; l++) {
        for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
            fieldsCB[l][c] = new QComboBox(this);
            fieldsCB[l][c]->setProperty("index", c + (l<<8));
            ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
            connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
        }
    }

    for (int l=0; l<4; l++) {
        barsCB[l] = new QComboBox(this);
        barsCB[l]->setProperty("index", l);
        connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
        ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);

        minSB[l] = new QDoubleSpinBox(this);
        minSB[l]->setProperty("index", l);
        connect(minSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMinChanged(double)));
        ui->screenBarsLayout->addWidget(minSB[l], l, 1, 1, 1);

        QLabel * label = new QLabel(this);
        label->setAutoFillBackground(false);
        label->setStyleSheet(QString::fromUtf8("Background:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 128, 255), stop:0.339795 rgba(0, 0, 128, 255), stop:0.339799 rgba(255, 255, 255, 255), stop:0.662444 rgba(255, 255, 255, 255),)\n"""));
        label->setFrameShape(QFrame::Panel);
        label->setFrameShadow(QFrame::Raised);
        label->setAlignment(Qt::AlignCenter);
        ui->screenBarsLayout->addWidget(label, l, 2, 1, 1);

        maxSB[l] = new QDoubleSpinBox(this);
        maxSB[l]->setProperty("index", l);
        connect(maxSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMaxChanged(double)));
        ui->screenBarsLayout->addWidget(maxSB[l], l, 3, 1, 1);
    }

    disableMouseScrolling();

    update();
}
示例#5
0
CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
  GeneralPanel(parent, generalSettings, firmware)
{

  tableWidget = new QTableWidget();
  QVBoxLayout * layout = new QVBoxLayout();
  layout->addWidget(tableWidget);
  layout->setContentsMargins(0, 0, 0, 0);
  this->setLayout(layout);

  tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
  tableWidget->setColumnCount(3);
  tableWidget->setShowGrid(false);
  tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
  tableWidget->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
  tableWidget->setStyleSheet("QTableWidget {background-color: transparent;}");
  QStringList headerLabels;
  headerLabels << QObject::tr("Negative span") << QObject::tr("Mid value") << QObject::tr("Positive span"); 
  tableWidget->setHorizontalHeaderLabels(headerLabels);

  int rows = NUM_STICKS + GetCurrentFirmware()->getCapability(Pots) + GetCurrentFirmware()->getCapability(Sliders);
  tableWidget->setRowCount(rows);

  for(int i = 0; i < rows; ++i) {

    QTableWidgetItem *newItem = new QTableWidgetItem(AnalogString(i));
    newItem->setTextAlignment(Qt::AlignLeft);
    tableWidget->setVerticalHeaderItem(i, newItem);

    for(int j = 0; j < 3; ++j) {
      QSpinBox * newItem = new QSpinBox();
      newItem->setMinimum(-9999);
      newItem->setMaximum(9999);
      newItem->setSingleStep(1);
      newItem->setValue(getCalibrationValue(i, j));
      newItem->setProperty("row", i);
      newItem->setProperty("column", j);
      tableWidget->setCellWidget(i, j, newItem);
      connect(newItem, SIGNAL(valueChanged(int)), this, SLOT(onCellChanged(int)));
    }
  }
  disableMouseScrolling();
}
示例#6
0
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
  ModelPanel(parent, model, generalSettings, firmware),
  initialized(false)
#if defined(PHONON)
  ,
  phononCurrent(-1),
  clickObject(NULL),
  clickOutput(NULL)
#endif
{
  QGridLayout * gridLayout = new QGridLayout(this);

  addLabel(gridLayout, tr("Switch"), 1);
  addLabel(gridLayout, tr("Action"), 2);
  addLabel(gridLayout, tr("Parameters"), 3);
  addLabel(gridLayout, tr("Enable"), 4, true );
  addEmptyLabel(gridLayout, 5 );

  lock = true;
  int num_fsw = firmware->getCapability(CustomFunctions);

  if (!firmware->getCapability(VoicesAsNumbers)) {
    tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength));
    for (int i=0; i<num_fsw; i++) {
      if (model.funcSw[i].func==FuncPlayPrompt || model.funcSw[i].func==FuncBackgroundMusic) {
        QString temp = model.funcSw[i].paramarm;
        if (!temp.isEmpty()) {
          tracksSet.insert(temp);
        }
      }
    }
    qDebug() << tracksSet;
  }

  if (IS_TARANIS(firmware->getBoard())) {
    scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
    for (int i=0; i<num_fsw; i++) {
      if (model.funcSw[i].func==FuncPlayScript) {
        QString temp = model.funcSw[i].paramarm;
        if (!temp.isEmpty()) {
          scriptsSet.insert(temp);
        }
      }
    }
    qDebug() << scriptsSet;
  }

  CompanionIcon playIcon("play.png");

  for (int i=0; i<num_fsw; i++) {
    // The label
    QLabel * label = new QLabel(this);
    label->setContextMenuPolicy(Qt::CustomContextMenu);
    label->setMouseTracking(true);
    label->setProperty("index", i);
    label->setText(tr("SF%1").arg(i+1));
    label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
    connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
    gridLayout->addWidget(label, i+1, 0);

    // The switch
    fswtchSwtch[i] = new QComboBox(this);
    fswtchSwtch[i]->setProperty("index", i);
    fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
    connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
    gridLayout->addWidget(fswtchSwtch[i], i+1, 1);

    // The function
    fswtchFunc[i] = new QComboBox(this);
    fswtchFunc[i]->setProperty("index", i);
    connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited()));
    gridLayout->addWidget(fswtchFunc[i], i+1, 2);

    QHBoxLayout *paramLayout = new QHBoxLayout();
    gridLayout->addLayout(paramLayout, i+1, 3);

    fswtchGVmode[i] = new QComboBox(this);
    fswtchGVmode[i]->setProperty("index", i);
    connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchGVmode[i]);

    fswtchParamGV[i] = new QCheckBox(this);
    fswtchParamGV[i]->setProperty("index", i);
    fswtchParamGV[i]->setText("GV");
    fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchParamGV[i]);

    fswtchParam[i] = new QDoubleSpinBox(this);
    fswtchParam[i]->setProperty("index", i);
    fswtchParam[i]->setAccelerated(true);
    fswtchParam[i]->setDecimals(0);
    connect(fswtchParam[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchParam[i]);

    fswtchParamTime[i] = new QTimeEdit(this);
    fswtchParamTime[i]->setProperty("index", i);
    fswtchParamTime[i]->setAccelerated(true);
    fswtchParamTime[i]->setDisplayFormat("hh:mm:ss");
    connect(fswtchParamTime[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchParamTime[i]);

    fswtchParamT[i] = new QComboBox(this);
    fswtchParamT[i]->setProperty("index", i);
    paramLayout->addWidget(fswtchParamT[i]);
    connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));

    fswtchParamArmT[i] = new QComboBox(this);
    fswtchParamArmT[i]->setProperty("index", i);
    fswtchParamArmT[i]->setEditable(true);
    paramLayout->addWidget(fswtchParamArmT[i]);

    connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
    connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited()));

    fswtchBLcolor[i] = new QSlider(this);
    fswtchBLcolor[i]->setProperty("index", i);
    fswtchBLcolor[i]->setMinimum(0);
    fswtchBLcolor[i]->setMaximum(100);
    fswtchBLcolor[i]->setSingleStep(1);
    fswtchBLcolor[i]->setOrientation(Qt::Horizontal);
    paramLayout->addWidget(fswtchBLcolor[i]);
    connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited()));

#ifdef PHONON
    playBT[i] = new QPushButton(this);
    playBT[i]->setProperty("index", i);
    playBT[i]->setIcon(playIcon);
    paramLayout->addWidget(playBT[i]);
    connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
#endif

    QHBoxLayout *repeatLayout = new QHBoxLayout();
    gridLayout->addLayout(repeatLayout, i+1, 4);
    fswtchRepeat[i] = new RepeatComboBox(this, model.funcSw[i].repeatParam);
    repeatLayout->addWidget(fswtchRepeat[i], i+1);
    connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified()));

    fswtchEnable[i] = new QCheckBox(this);
    fswtchEnable[i]->setProperty("index", i);
    fswtchEnable[i]->setText(tr("ON"));
    fswtchEnable[i]->setFixedWidth( 80 );
    repeatLayout->addWidget(fswtchEnable[i], i+1);
    connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
  }

  // Push rows upward
  addDoubleSpring(gridLayout, 5, num_fsw+1);

  disableMouseScrolling();

  lock = false;
}
示例#7
0
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware):
  GenericPanel(parent, model, generalSettings, firmware),
  functions(model ? model->customFn : generalSettings.customFn)
#if defined(PHONON)
  ,
  phononCurrent(-1),
  clickObject(NULL),
  clickOutput(NULL)
#endif
{
  Stopwatch s1("CustomFunctionsPanel - populate"); 
  lock = true;
  int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);

  if (!firmware->getCapability(VoicesAsNumbers)) {
    tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength));
    for (int i=0; i<num_fsw; i++) {
      if (functions[i].func==FuncPlayPrompt || functions[i].func==FuncBackgroundMusic) {
        QString temp = functions[i].paramarm;
        if (!temp.isEmpty()) {
          tracksSet.insert(temp);
        }
      }
    }
  }

  s1.report("get tracks");

  if (IS_TARANIS(firmware->getBoard())) {
    scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
    for (int i=0; i<num_fsw; i++) {
      if (functions[i].func==FuncPlayScript) {
        QString temp = functions[i].paramarm;
        if (!temp.isEmpty()) {
          scriptsSet.insert(temp);
        }
      }
    }
  }
  s1.report("get scripts");

  CompanionIcon playIcon("play.png");

  QStringList headerLabels;
  headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << tr("Enable");
  TableLayout * tableLayout = new TableLayout(this, num_fsw, headerLabels);

  for (int i=0; i<num_fsw; i++) {
    // The label
    QLabel * label = new QLabel(this);
    label->setContextMenuPolicy(Qt::CustomContextMenu);
    label->setMouseTracking(true);
    label->setProperty("index", i);
    if (model)
      label->setText(tr("SF%1").arg(i+1));
    else
      label->setText(tr("GF%1").arg(i+1));
    label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
    connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
    tableLayout->addWidget(i, 0, label);
    // s1.report("label");

    // The switch
    fswtchSwtch[i] = new QComboBox(this);
    fswtchSwtch[i]->setProperty("index", i);
    populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext);
    fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
    fswtchSwtch[i]->setMaxVisibleItems(10);
    connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
    tableLayout->addWidget(i, 1, fswtchSwtch[i]);
    // s1.report("switch");

    // The function
    fswtchFunc[i] = new QComboBox(this);
    fswtchFunc[i]->setProperty("index", i);
    populateFuncCB(fswtchFunc[i], functions[i].func);
    connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited()));
    tableLayout->addWidget(i, 2, fswtchFunc[i]);
    // s1.report("func");

    // The parameters
    QHBoxLayout * paramLayout = new QHBoxLayout();
    tableLayout->addLayout(i, 3, paramLayout);

    fswtchGVmode[i] = new QComboBox(this);
    fswtchGVmode[i]->setProperty("index", i);
    populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode);
    fswtchGVmode[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchGVmode[i]);

    fswtchParamGV[i] = new QCheckBox(this);
    fswtchParamGV[i]->setProperty("index", i);
    fswtchParamGV[i]->setText("GV");
    fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchParamGV[i]);

    fswtchParam[i] = new QDoubleSpinBox(this);
    fswtchParam[i]->setProperty("index", i);
    fswtchParam[i]->setAccelerated(true);
    fswtchParam[i]->setDecimals(0);
    connect(fswtchParam[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchParam[i]);

    fswtchParamTime[i] = new QTimeEdit(this);
    fswtchParamTime[i]->setProperty("index", i);
    fswtchParamTime[i]->setAccelerated(true);
    fswtchParamTime[i]->setDisplayFormat("hh:mm:ss");
    connect(fswtchParamTime[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited()));
    paramLayout->addWidget(fswtchParamTime[i]);

    fswtchParamT[i] = new QComboBox(this);
    fswtchParamT[i]->setProperty("index", i);
    populateFuncParamCB(fswtchParamT[i], functions[i].func, functions[i].param, functions[i].adjustMode);
    paramLayout->addWidget(fswtchParamT[i]);
    fswtchParamT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));

    fswtchParamArmT[i] = new QComboBox(this);
    fswtchParamArmT[i]->setProperty("index", i);
    fswtchParamArmT[i]->setEditable(true);
    fswtchParamArmT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    paramLayout->addWidget(fswtchParamArmT[i]);

    connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
    connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited()));

    fswtchBLcolor[i] = new QSlider(this);
    fswtchBLcolor[i]->setProperty("index", i);
    fswtchBLcolor[i]->setMinimum(0);
    fswtchBLcolor[i]->setMaximum(100);
    fswtchBLcolor[i]->setSingleStep(1);
    fswtchBLcolor[i]->setOrientation(Qt::Horizontal);
    paramLayout->addWidget(fswtchBLcolor[i]);
    connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited()));

#ifdef PHONON
    playBT[i] = new QPushButton(this);
    playBT[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    playBT[i]->setProperty("index", i);
    playBT[i]->setIcon(playIcon);
    paramLayout->addWidget(playBT[i]);
    connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
#endif

    QHBoxLayout * repeatLayout = new QHBoxLayout();
    tableLayout->addLayout(i, 4, repeatLayout);
    fswtchRepeat[i] = new RepeatComboBox(this, functions[i].repeatParam);
    repeatLayout->addWidget(fswtchRepeat[i], i+1);
    connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified()));

    fswtchEnable[i] = new QCheckBox(this);
    fswtchEnable[i]->setProperty("index", i);
    fswtchEnable[i]->setText(tr("ON"));
    fswtchEnable[i]->setFixedWidth(200);
    repeatLayout->addWidget(fswtchEnable[i], i+1);
    connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
  }
  s1.report("add items");

  disableMouseScrolling();
  s1.report("disableMouseScrolling");

  lock = false;

  update();
  s1.report("update");
  tableLayout->resizeColumnsToContents();
  s1.report("resizeColumnsToContents");
  tableLayout->setColumnWidth(3, 300);
  tableLayout->pushRowsUp(num_fsw+1);
  s1.report("end");
}
示例#8
0
CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
    GeneralPanel(parent, generalSettings, firmware),
    ui(new Ui::Calibration)
{
    ui->setupUi(this);

    if (!firmware->getCapability(MultiposPots)) {
        ui->potsTypeSeparator->hide();
    }

    if (IS_TARANIS(firmware->getBoard())) {
        ui->rudName->setField(generalSettings.stickName[0], 3, this);
        ui->eleName->setField(generalSettings.stickName[1], 3, this);
        ui->thrName->setField(generalSettings.stickName[2], 3, this);
        ui->ailName->setField(generalSettings.stickName[3], 3, this);
    }
    else {
        ui->rudLabel->hide();
        ui->rudName->hide();
        ui->eleLabel->hide();
        ui->eleName->hide();
        ui->thrLabel->hide();
        ui->thrName->hide();
        ui->ailLabel->hide();
        ui->ailName->hide();
    }

    setupPotConfig(0, ui->pot1Label, ui->pot1Name, ui->pot1Type);
    setupPotConfig(1, ui->pot2Label, ui->pot2Name, ui->pot2Type);
    setupPotConfig(2, ui->pot3Label, ui->pot3Name, ui->pot3Type);
    setupPotConfig(3, ui->pot4Label, ui->pot4Name, ui->pot4Type);

    setupSliderConfig(0, ui->lsLabel, ui->lsName, ui->lsType);
    setupSliderConfig(1, ui->rsLabel, ui->rsName, ui->rsType);
    setupSliderConfig(2, ui->ls2Label, ui->ls2Name, ui->ls2Type);
    setupSliderConfig(3, ui->rs2Label, ui->rs2Name, ui->rs2Type);

    setupSwitchConfig(0, ui->saLabel, ui->saName, ui->saType);
    setupSwitchConfig(1, ui->sbLabel, ui->sbName, ui->sbType);
    setupSwitchConfig(2, ui->scLabel, ui->scName, ui->scType);
    setupSwitchConfig(3, ui->sdLabel, ui->sdName, ui->sdType);
    setupSwitchConfig(4, ui->seLabel, ui->seName, ui->seType);
    setupSwitchConfig(5, ui->sfLabel, ui->sfName, ui->sfType);
    setupSwitchConfig(6, ui->sgLabel, ui->sgName, ui->sgType);
    setupSwitchConfig(7, ui->shLabel, ui->shName, ui->shType);
    setupSwitchConfig(8, ui->siLabel, ui->siName, ui->siType);
    setupSwitchConfig(9, ui->sjLabel, ui->sjName, ui->sjType);
    setupSwitchConfig(10, ui->skLabel, ui->skName, ui->skType);
    setupSwitchConfig(11, ui->slLabel, ui->slName, ui->slType);
    setupSwitchConfig(12, ui->smLabel, ui->smName, ui->smType);
    setupSwitchConfig(13, ui->snLabel, ui->snName, ui->snType);
    setupSwitchConfig(14, ui->soLabel, ui->soName, ui->soType);
    setupSwitchConfig(15, ui->spLabel, ui->spName, ui->spType);
    setupSwitchConfig(16, ui->sqLabel, ui->sqName, ui->sqType);
    setupSwitchConfig(17, ui->srLabel, ui->srName, ui->srType);

    int potsCount = GetCurrentFirmware()->getCapability(Pots);
    if (potsCount == 3) {
        ui->ana8Neg->hide();
        ui->ana8Mid->hide();
        ui->ana8Pos->hide();
    }

    if (IS_TARANIS(firmware->getBoard())) {
        ui->serialPortMode->setCurrentIndex(generalSettings.hw_uartMode);
    }
    else {
        ui->serialPortMode->hide();
        ui->serialPortLabel->hide();
    }

    if (IS_TARANIS_X9E(firmware->getBoard())) {
        ui->bluetoothEnable->setChecked(generalSettings.bluetoothEnable);
        ui->bluetoothName->setField(generalSettings.bluetoothName, 10, this);
    }
    else {
        ui->bluetoothLabel->hide();
        ui->bluetoothEnable->hide();
        ui->bluetoothName->hide();
    }

    disableMouseScrolling();
}