From a83c6c8a0cf326b67139b338ab7ed46583906dd9 Mon Sep 17 00:00:00 2001 From: Damjan Adamic Date: Mon, 30 Jun 2014 17:24:36 +0200 Subject: [PATCH] Fixes #1408 - Move down in Inputs tab not working --- companion/src/modeledit/inputs.cpp | 11 ++++++----- companion/src/modeledit/inputs.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp index 6ffa4c972..d6a62b380 100644 --- a/companion/src/modeledit/inputs.cpp +++ b/companion/src/modeledit/inputs.cpp @@ -7,6 +7,10 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g ModelPanel(parent, model, generalSettings, firmware), expoInserted(false) { + inputsCount = firmware->getCapability(VirtualInputs); + if (inputsCount == 0) + inputsCount = NUM_STICKS; + QGridLayout * exposLayout = new QGridLayout(this); ExposlistWidget = new MixersList(this, true); @@ -47,10 +51,6 @@ void InputsPanel::update() { lock = true; - int inputsCount = firmware->getCapability(VirtualInputs); - if (inputsCount == 0) - inputsCount = NUM_STICKS; - // curDest -> destination channel // i -> mixer number QByteArray qba; @@ -446,6 +446,7 @@ void InputsPanel::expolistWidget_KeyPress(QKeyEvent *event) int InputsPanel::gm_moveExpo(int idx, bool dir) //true=inc=down false=dec=up { + if(idx>C9X_MAX_EXPOS || (idx==C9X_MAX_EXPOS && dir)) return idx; int tdx = dir ? idx+1 : idx-1; @@ -463,7 +464,7 @@ int InputsPanel::gm_moveExpo(int idx, bool dir) //true=inc=down false=dec=up if(memcmp(&src,&temp,sizeof(ExpoData))==0) return idx; bool tgtempty=(memcmp(&tgt,&temp,sizeof(ExpoData))==0 ? 1:0); if(tgt.chn!=src.chn || tgtempty) { - if ((dir) && (src.chn<(NUM_STICKS-1))) src.chn++; + if ((dir) && (src.chn<(inputsCount-1))) src.chn++; if ((!dir) && (src.chn>0)) src.chn--; return idx; } diff --git a/companion/src/modeledit/inputs.h b/companion/src/modeledit/inputs.h index 83db760a6..d7298f6ae 100644 --- a/companion/src/modeledit/inputs.h +++ b/companion/src/modeledit/inputs.h @@ -34,6 +34,7 @@ class InputsPanel : public ModelPanel bool expoInserted; MixersList *ExposlistWidget; bool firstLine; + int inputsCount; int getExpoIndex(unsigned int dch); bool gm_insertExpo(int idx);