Esempio n. 1
0
void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
{
  b->clear();
  for (unsigned int i=0; i<FuncCount; i++) {
    if (((i>=FuncOverrideCH1 && i<=FuncOverrideCH32) && (!model || !firmware->getCapability(SafetyChannelCustomFunction))) ||
        ((i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) ||
        ((i==FuncPlayScript && !IS_TARANIS(firmware->getBoard()))) ||
        ((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
        ((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
        ((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
        ((i==FuncSetTimer3) && firmware->getCapability(Timers) < 3) ||
        ((i>=FuncRangeCheckInternalModule && i<=FuncBindExternalModule) && (!model || !firmware->getCapability(DangerousFunctions))) ||
        ((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && !firmware->getCapability(Gvars))
        ) {
      // skipped
      // b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(), i);
      // QModelIndex index = b->model()->index(i, 0);
      // QVariant v(0);
      // b->model()->setData(index, v, Qt::UserRole - 1);
    }
    else {
      b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(), i);
      if (i == value) {
        b->setCurrentIndex(b->count()-1);
      }
    }
  }
}
Esempio n. 2
0
void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
{
  b->clear();
  for (unsigned int i=0; i<FuncCount; i++) {
    b->addItem(FuncSwData(AssignFunc(i)).funcToString());
    if (((i>=FuncOverrideCH1 && i<=FuncOverrideCH32) && !firmware->getCapability(SafetyChannelCustomFunction)) ||
        ((i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) ||
        ((i==FuncPlayScript && !IS_TARANIS(firmware->getBoard()))) ||
        ((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
        ((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
        ((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
        ((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && !firmware->getCapability(Gvars))
        ) {
      QModelIndex index = b->model()->index(i, 0);
      QVariant v(0);
      b->model()->setData(index, v, Qt::UserRole - 1);
    }
  }
  b->setCurrentIndex(value);
  b->setMaxVisibleItems(10);
}