fix(cpn): cannot select correct script file for 'Lua Script' SF/GF (#7087)

This commit is contained in:
philmoz
2026-02-09 09:52:58 +10:00
committed by GitHub
parent 2da6a5a331
commit 26617473d7
2 changed files with 4 additions and 3 deletions
+3 -3
View File
@@ -98,12 +98,12 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
} }
if (IS_STM32(firmware->getBoard())) { if (IS_STM32(firmware->getBoard())) {
scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/RGBLED", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength)); scriptsSetRGB = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/RGBLED", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
for (int i = 0; i < fswCapability; i++) { for (int i = 0; i < fswCapability; i++) {
if (functions[i].func == FuncRGBLed) { if (functions[i].func == FuncRGBLed) {
QString temp = functions[i].paramarm; QString temp = functions[i].paramarm;
if (!temp.isEmpty()) { if (!temp.isEmpty()) {
scriptsSet.insert(temp); scriptsSetRGB.insert(temp);
} }
} }
} }
@@ -557,7 +557,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool changed)
Helpers::getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, 8); Helpers::getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, 8);
cfn.repeatParam = fswtchRepeat[i]->currentData().toInt(); cfn.repeatParam = fswtchRepeat[i]->currentData().toInt();
} }
Helpers::populateFileComboBox(fswtchParamArmT[i], scriptsSet, cfn.paramarm); Helpers::populateFileComboBox(fswtchParamArmT[i], func == FuncPlayScript ? scriptsSet : scriptsSetRGB, cfn.paramarm);
fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatLuaId)); fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatLuaId));
fswtchRepeat[i]->setCurrentIndex(fswtchRepeat[i]->findData(cfn.repeatParam)); fswtchRepeat[i]->setCurrentIndex(fswtchRepeat[i]->findData(cfn.repeatParam));
} }
@@ -96,6 +96,7 @@ class CustomFunctionsPanel : public GenericPanel
QSet<QString> tracksSet; QSet<QString> tracksSet;
QSet<QString> scriptsSet; QSet<QString> scriptsSet;
QSet<QString> scriptsSetRGB;
int mediaPlayerCurrent; int mediaPlayerCurrent;
QComboBox * fswtchSwtch[CPN_MAX_SPECIAL_FUNCTIONS]; QComboBox * fswtchSwtch[CPN_MAX_SPECIAL_FUNCTIONS];
QComboBox * fswtchFunc[CPN_MAX_SPECIAL_FUNCTIONS]; QComboBox * fswtchFunc[CPN_MAX_SPECIAL_FUNCTIONS];