diff options
| author | Christoph Berg <christoph.berg@credativ.de> | 2020-06-10 12:34:51 +0200 |
|---|---|---|
| committer | Christoph Berg <christoph.berg@credativ.de> | 2020-06-10 12:34:51 +0200 |
| commit | 400776e1b7e1992e26c95e2ca79eada65b53aca6 (patch) | |
| tree | 899589883a2c9be2264af0505039e93594a11bda /widgets/mainwindow.cpp | |
| parent | bb8622557f9a325e9a925834a5487a32584d0675 (diff) | |
| parent | ee0e1a654b7e64accea78a5aa66ec1e62bd352c8 (diff) | |
Update upstream source from tag 'upstream/2.2.1+repack'
Update to upstream version '2.2.1+repack'
with Debian dir c0f0555345d2c71b60736c230e3b91e85d74b675
Diffstat (limited to 'widgets/mainwindow.cpp')
| -rw-r--r-- | widgets/mainwindow.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 37dad9eb..1f7313a5 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -812,7 +812,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, char const * const power[] = {"1 mW","2 mW","5 mW","10 mW","20 mW","50 mW","100 mW","200 mW","500 mW", "1 W","2 W","5 W","10 W","20 W","50 W","100 W","200 W","500 W","1 kW"}; for(auto i = 0u; i < sizeof power / sizeof power[0]; ++i) { //Initialize dBm values - ui->TxPowerComboBox->addItem (QString {"%1 dBm %2"}.arg (int ((10. * i / 3.) + .5)).arg (power[i])); + auto dBm = int ((10. * i / 3.) + .5); + ui->TxPowerComboBox->addItem (QString {"%1 dBm %2"}.arg (dBm).arg (power[i]), dBm); } m_dateTimeRcvdRR73=QDateTime::currentDateTimeUtc(); @@ -2065,7 +2066,7 @@ void MainWindow::keyPressEvent (QKeyEvent * e) break; case Qt::Key_L: if(e->modifiers() & Qt::ControlModifier) { - lookup(); + lookup(true); genStdMsgs(m_rpt); return; } @@ -4912,12 +4913,10 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie // i.e. compound version of same base call ui->dxCallEntry->setText (hiscall); } - if (hisgrid.contains (grid_regexp)) { if(ui->dxGridEntry->text().mid(0,4) != hisgrid) ui->dxGridEntry->setText(hisgrid); } - if (!ui->dxGridEntry->text ().size ()) - lookup(); + lookup(false); m_hisGrid = ui->dxGridEntry->text(); QString rpt = message.report(); @@ -5325,9 +5324,10 @@ void MainWindow::clearDX () m_QSOProgress = CALLING; } -void MainWindow::lookup() //lookup() +void MainWindow::lookup(bool lookupButtonClicked) { QString hisCall {ui->dxCallEntry->text()}; + QString hisgrid0 {ui->dxGridEntry->text()}; if (!hisCall.size ()) return; QFile f {m_config.writeable_data_dir ().absoluteFilePath ("CALL3.TXT")}; if (f.open (QIODevice::ReadOnly | QIODevice::Text)) @@ -5337,7 +5337,13 @@ void MainWindow::lookup() //lookup() for(int i=0; i<999999; i++) { n=f.readLine(c,sizeof(c)); if(n <= 0) { - ui->dxGridEntry->clear (); + if(lookupButtonClicked) { + QString msg=hisCall + tr(" not found in CALL3.TXT"); + MessageBox::information_message (this, msg); + } + if(!hisgrid0.contains(grid_regexp)) { + ui->dxGridEntry->clear(); + } break; } QString t=QString(c); @@ -5348,9 +5354,11 @@ void MainWindow::lookup() //lookup() if(i1>0) { hisgrid=hisgrid.mid(0,4); } else { - hisgrid=hisgrid.mid(0,4) + hisgrid.mid(4,2).toLower(); + hisgrid=hisgrid.mid(0,6).toUpper(); + } + if(hisgrid.left(4)==hisgrid0.left(4) or (hisgrid0.size()==0)) { + ui->dxGridEntry->setText(hisgrid); } - ui->dxGridEntry->setText(hisgrid); break; } } @@ -5360,7 +5368,7 @@ void MainWindow::lookup() //lookup() void MainWindow::on_lookupButton_clicked() //Lookup button { - lookup(); + lookup(true); } void MainWindow::on_addButton_clicked() //Add button @@ -7781,10 +7789,9 @@ void MainWindow::uploadResponse(QString response) } } -void MainWindow::on_TxPowerComboBox_currentIndexChanged(const QString &arg1) +void MainWindow::on_TxPowerComboBox_currentIndexChanged(int index) { - int i1=arg1.indexOf(" "); - m_dBm=arg1.mid(0,i1).toInt(); + m_dBm = ui->TxPowerComboBox->itemData (index).toInt (); } void MainWindow::on_sbTxPercent_valueChanged(int n) |
