[Companion] Show custom channel, G-Var, and Curve names throughout UI. (#4874)
* [Companion] Move RadioData constructor. * [Companion] Move getCapability(SwitchPositions) to Boards class. * [Companion] Show custom channel, g-var, & curve names throughout UI; Remove redundant name formatting and other unused functions in ModelPrinter and Helpers; Add CustomFunctionData::isEmpty(). * [Companion] Add LogicalSwitchData::isEmpty(). * [Companion] Fix small bug in HardwarePanel. * [Companion] Rename logical switches to "LSw##" in selections lists to avoid confusion with "L#" and "LS" hardware controls; remove unused RotaryEncoderString().
This commit is contained in:
committed by
Bertrand Songis
parent
04bcc70422
commit
72b1ad085f
@@ -156,7 +156,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
curveCB->setProperty("index", i);
|
||||
int numcurves = firmware->getCapability(NumCurves);
|
||||
for (int j=-numcurves; j<=numcurves; j++) {
|
||||
curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j);
|
||||
curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(&model, false), j);
|
||||
}
|
||||
curveCB->setCurrentIndex(model.limitData[i].curve.value+numcurves);
|
||||
connect(curveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited()));
|
||||
|
||||
@@ -337,6 +337,7 @@ void CustomFunctionsPanel::playMusic()
|
||||
#define CUSTOM_FUNCTION_REPEAT (1<<7)
|
||||
#define CUSTOM_FUNCTION_PLAY (1<<8)
|
||||
#define CUSTOM_FUNCTION_BL_COLOR (1<<9)
|
||||
#define CUSTOM_FUNCTION_SHOW_FUNC (1<<10)
|
||||
|
||||
void CustomFunctionsPanel::customFunctionEdited()
|
||||
{
|
||||
@@ -357,7 +358,7 @@ void CustomFunctionsPanel::functionEdited()
|
||||
RawSwitch swtch = functions[index].swtch;
|
||||
functions[index].clear();
|
||||
functions[index].swtch = swtch;
|
||||
functions[index].func = (AssignFunc)fswtchFunc[index]->itemData(fswtchFunc[index]->currentIndex()).toInt();
|
||||
functions[index].func = (AssignFunc)fswtchFunc[index]->currentData().toInt();
|
||||
refreshCustomFunction(index);
|
||||
emit modified();
|
||||
lock = false;
|
||||
@@ -382,7 +383,8 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
cfn.adjustMode = (AssignFunc)fswtchGVmode[i]->currentIndex();
|
||||
}
|
||||
|
||||
if (cfn.swtch.toValue()) {
|
||||
if (!cfn.isEmpty()) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_SHOW_FUNC;
|
||||
|
||||
if (func>=FuncOverrideCH1 && func<=FuncOverrideCH32) {
|
||||
if (model) {
|
||||
@@ -395,7 +397,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
cfn.param = fswtchParam[i]->value();
|
||||
}
|
||||
fswtchParam[i]->setValue(cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM | CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
}
|
||||
else if (func==FuncLogs) {
|
||||
@@ -456,7 +458,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
if (modified)
|
||||
cfn.param = fswtchParamT[i]->currentData().toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_ENABLE;
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE;
|
||||
}
|
||||
else if (func==FuncPlaySound || func==FuncPlayHaptic || func==FuncPlayValue || func==FuncPlayPrompt || func==FuncPlayBoth || func==FuncBackgroundMusic) {
|
||||
if (func != FuncBackgroundMusic) {
|
||||
@@ -467,7 +469,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
if (modified)
|
||||
cfn.param = fswtchParamT[i]->currentData().toInt();
|
||||
populateFuncParamCB(fswtchParamT[i], func, cfn.param);
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_REPEAT;
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_REPEAT;
|
||||
}
|
||||
else if (func==FuncPlayPrompt || func==FuncPlayBoth) {
|
||||
if (firmware->getCapability(VoicesAsNumbers)) {
|
||||
@@ -475,10 +477,10 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setMinimum(0);
|
||||
if (func==FuncPlayPrompt) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_REPEAT + CUSTOM_FUNCTION_GV_TOOGLE;
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM | CUSTOM_FUNCTION_REPEAT | CUSTOM_FUNCTION_GV_TOOGLE;
|
||||
}
|
||||
else {
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_REPEAT;
|
||||
widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM | CUSTOM_FUNCTION_REPEAT;
|
||||
fswtchParamGV[i]->setChecked(false);
|
||||
}
|
||||
fswtchParam[i]->setMaximum(func==FuncPlayBoth ? 254 : 255);
|
||||
@@ -563,7 +565,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
|
||||
}
|
||||
|
||||
fswtchFunc[i]->setVisible(cfn.swtch.toValue());
|
||||
fswtchFunc[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_SHOW_FUNC);
|
||||
fswtchParam[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_NUMERIC_PARAM);
|
||||
fswtchParamTime[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_TIME_PARAM);
|
||||
fswtchParamGV[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_TOOGLE);
|
||||
@@ -678,7 +680,7 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
|
||||
// b->model()->setData(index, v, Qt::UserRole - 1);
|
||||
}
|
||||
else {
|
||||
b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(), i);
|
||||
b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(model), i);
|
||||
if (i == value) {
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ void LogicalSwitchesPanel::populateAndSwitchCB(QComboBox *b, const RawSwitch & v
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
|
||||
for (int i=1; i<=firmware->getCapability(SwitchesPositions); i++) {
|
||||
for (int i=1; i <= Boards::getCapability(firmware->getBoard(), Board::SwitchPositions); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
|
||||
@@ -140,7 +140,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
QString str;
|
||||
bool newChannel = false;
|
||||
if (dest < 0) {
|
||||
str = modelPrinter.printMixerName(-dest);
|
||||
str = modelPrinter.printChannelName(abs(dest)-1);
|
||||
//highlight channel if needed
|
||||
if (-dest == (int)highlightedSource) {
|
||||
str = "<b>" + str + "</b>";
|
||||
@@ -150,7 +150,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
|
||||
else {
|
||||
MixData & mix = model->mixData[dest];
|
||||
//mix->destCh from 1 to 32
|
||||
str = modelPrinter.printMixerName(mix.destCh);
|
||||
str = modelPrinter.printChannelName(mix.destCh-1);
|
||||
|
||||
if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) {
|
||||
newChannel = true;
|
||||
|
||||
@@ -1104,7 +1104,7 @@ void SetupPanel::populateThrottleSourceCB()
|
||||
ui->throttleSource->addItem(firmware->getAnalogInputName(4+i), i);
|
||||
}
|
||||
for (int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
ui->throttleSource->addItem(ModelPrinter::printChannelName(i));
|
||||
ui->throttleSource->addItem(RawSource(SOURCE_TYPE_CH, i).toString(model, &generalSettings));
|
||||
}
|
||||
ui->throttleSource->setCurrentIndex(model->thrTraceSrc);
|
||||
lock = false;
|
||||
|
||||
Reference in New Issue
Block a user