From 48562aa23b01f7e6b516448854f2adc7360ec0ce Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 14 May 2022 01:11:15 +0100 Subject: [PATCH] Don't try to connect to radio we are already connected to --- selectradio.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/selectradio.cpp b/selectradio.cpp index 0862ace..61e0192 100644 --- a/selectradio.cpp +++ b/selectradio.cpp @@ -42,21 +42,29 @@ void selectRadio::setInUse(quint8 radio, quint8 busy, QString user, QString ip) ui->table->setItem(radio, 3, new QTableWidgetItem(user)); ui->table->setItem(radio, 4, new QTableWidgetItem(ip)); for (int f = 0; f < 5; f++) { - if (busy == 1) + if (busy == 1) + { ui->table->item(radio, f)->setBackground(Qt::darkGreen); - else if (busy == 2) + } + else if (busy == 2) + { ui->table->item(radio, f)->setBackground(Qt::red); + } else + { ui->table->item(radio, f)->setBackground(Qt::black); + } } } void selectRadio::on_table_cellClicked(int row, int col) { qInfo() << "Clicked on " << row << "," << col; - ui->table->selectRow(row); - emit selectedRadio(row); - this->setVisible(false); + if (ui->table->item(row, col)->backgroundColor() != Qt::darkGreen) { + ui->table->selectRow(row); + emit selectedRadio(row); + this->setVisible(false); + } }