From 3323597a8a5c297990c4bfd5e1383bbfabd9aa10 Mon Sep 17 00:00:00 2001 From: Neil Horne Date: Sun, 6 Sep 2020 18:58:33 +1000 Subject: [PATCH] Companion fix global and special functions context menu (#7885) --- companion/src/modeledit/customfunctions.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 1bf06cfd6..36dba9c97 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -587,7 +587,7 @@ void CustomFunctionsPanel::update() { updateDataModels(); lock = true; - for (int i=0; iclear(); - for (unsigned int i=0; i=FuncOverrideCH1 && i<=FuncOverrideCH32) && (!model || !firmware->getCapability(SafetyChannelCustomFunction))) || ((i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) || ((i==FuncPlayScript && !IS_HORUS_OR_TARANIS(firmware->getBoard()))) || @@ -677,7 +677,7 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value) else { b->addItem(CustomFunctionData(AssignFunc(i)).funcToString(model), i); if (i == value) { - b->setCurrentIndex(b->count()-1); + b->setCurrentIndex(b->count() - 1); } } } @@ -748,7 +748,7 @@ void CustomFunctionsPanel::cmMoveDown() void CustomFunctionsPanel::cmClear(bool prompt) { if (prompt) { - if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear Special Function. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) + if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear Function. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) return; } @@ -759,10 +759,10 @@ void CustomFunctionsPanel::cmClear(bool prompt) void CustomFunctionsPanel::cmClearAll() { - if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all Special Functions. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) + if (QMessageBox::question(this, CPN_STR_APP_NAME, tr("Clear all Functions. Are you sure?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) return; - for (int i=0; icurves[fswCapability - 1].isEmpty())); + return ((selectedIndex < fswCapability - 1) && (functions[fswCapability - 1].isEmpty())); } bool CustomFunctionsPanel::moveDownAllowed() const