From e4b5f98d589fb649ed4682a27fca88694820a960 Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 20 Jun 2014 16:16:16 +0200 Subject: [PATCH] Fixes #1331 --- companion/src/helpers.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 0cbc60b2d..364c1d7b5 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -479,8 +479,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin void populateGVCB(QComboBox *b, int value) { - int selected=0; - int nullitem; + bool selected = false; b->clear(); @@ -490,29 +489,22 @@ void populateGVCB(QComboBox *b, int value) b->addItem(QObject::tr("-GV%1").arg(-i), gval); if (value == gval) { b->setCurrentIndex(b->count()-1); - selected=1; + selected = true; } } - b->addItem("---", 0); - - nullitem=b->count()-1; - if (value == 0) { - b->setCurrentIndex(b->count()-1); - selected=1; - } - for (int i=1; i<=pgvars; i++) { int16_t gval = (int16_t)(10000+i); b->addItem(QObject::tr("GV%1").arg(i), gval); if (value == gval) { b->setCurrentIndex(b->count()-1); - selected=1; + selected = true; } } - if (selected==0) - b->setCurrentIndex(nullitem); + if (!selected) { + b->setCurrentIndex(pgvars); + } } void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData & model, unsigned int flags)