1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-21 15:25:17 +03:00

A couple of bugs in telemetry bars fixed

This commit is contained in:
bsongis 2014-03-17 11:33:22 +01:00
parent e2c26ac295
commit a082a9a53e
7 changed files with 47 additions and 33 deletions

View file

@ -95,31 +95,6 @@ void populateRotEncCB(QComboBox *b, int value, int renumber)
b->setCurrentIndex(value);
}
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last=false, int hubproto=0)
{
int telem_hub[] = {0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,0,2,2,1,1,1,1,1,1};
b->clear();
b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString());
for (unsigned int i = 0; i <= (last ? TELEMETRY_SOURCES_DISPLAY_COUNT : TELEMETRY_SOURCES_STATUS_COUNT); i++) {
b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString());
if (!(i>=sizeof(telem_hub)/sizeof(int) || telem_hub[i]==0 || ((telem_hub[i]>=hubproto) && hubproto!=0))) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
}
if (value>=sizeof(telem_hub)/sizeof(int))
b->setCurrentIndex(0);
else if (telem_hub[value]==0 || ((telem_hub[value]>=hubproto) && hubproto!=0)) {
b->setCurrentIndex(value);
}
b->setMaxVisibleItems(10);
}
QString getProtocolStr(const int proto)
{
static const char *strings[] = { "OFF",