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 | |
| 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')
| -rw-r--r-- | widgets/displaytext.cpp | 19 | ||||
| -rw-r--r-- | widgets/mainwindow.cpp | 33 | ||||
| -rw-r--r-- | widgets/mainwindow.h | 4 | ||||
| -rw-r--r-- | widgets/widegraph.cpp | 28 | ||||
| -rw-r--r-- | widgets/widegraph.h | 2 |
5 files changed, 51 insertions, 35 deletions
diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp index ae865bc9..f0f17f64 100644 --- a/widgets/displaytext.cpp +++ b/widgets/displaytext.cpp @@ -13,7 +13,6 @@ #include <QListIterator> #include <QRegularExpression> #include <QScrollBar> -#include <QDebug> #include "Configuration.hpp" #include "Network/LotWUsers.hpp" @@ -126,8 +125,6 @@ namespace void DisplayText::appendText(QString const& text, QColor bg, QColor fg , QString const& call1, QString const& call2) { -// qDebug () << "DisplayText::appendText: text:" << text << "Nbsp pos:" << text.indexOf (QChar::Nbsp); - auto cursor = textCursor (); cursor.movePosition (QTextCursor::End); auto block_format = cursor.blockFormat (); @@ -548,12 +545,18 @@ namespace void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg, QColor const& fg, bool last_period_only) { - // qDebug () << "DisplayText::highlight_callsign: callsign:" << callsign << "last period:" << last_period_only; if (!callsign.size ()) { return; } - QRegularExpression target {QString {"<?"} + callsign + QString {">?"}, QRegularExpression::DontCaptureOption}; + auto regexp = callsign; + // allow for hashed callsigns and escape any regexp metacharacters + QRegularExpression target {QString {"<?"} + + regexp.replace (QLatin1Char {'+'}, QLatin1String {"\\+"}) + .replace (QLatin1Char {'.'}, QLatin1String {"\\."}) + .replace (QLatin1Char {'?'}, QLatin1String {"\\?"}) + + QString {">?"} + , QRegularExpression::DontCaptureOption}; QTextCharFormat old_format {currentCharFormat ()}; QTextCursor cursor {document ()}; if (last_period_only) @@ -568,10 +571,10 @@ void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg, { period_start = prior; } - while (!cursor.isNull () && cursor > period_start) + cursor = period_start; + while (!cursor.isNull ()) { - cursor = document ()->find (target, cursor - , QTextDocument::FindBackward | QTextDocument::FindWholeWords); + cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords); if (!cursor.isNull () && cursor.hasSelection ()) { if (bg.isValid () || fg.isValid ()) 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) diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 96999309..473761af 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -276,7 +276,7 @@ private slots: void on_actionWSPR_triggered(); void on_actionWSPR_LF_triggered(); void on_syncSpinBox_valueChanged(int n); - void on_TxPowerComboBox_currentIndexChanged(const QString &arg1); + void on_TxPowerComboBox_currentIndexChanged(int); void on_sbTxPercent_valueChanged(int n); void on_cbUploadWSPR_Spots_toggled(bool b); void WSPR_config(bool b); @@ -700,7 +700,7 @@ private: void genStdMsgs(QString rpt, bool unconditional = false); void genCQMsg(); void clearDX (); - void lookup(); + void lookup(bool lookupButtonClicked); void ba2msg(QByteArray ba, char* message); void msgtype(QString t, QLineEdit* tx); void stub(); diff --git a/widgets/widegraph.cpp b/widgets/widegraph.cpp index 6234f731..a78874c7 100644 --- a/widgets/widegraph.cpp +++ b/widgets/widegraph.cpp @@ -315,23 +315,29 @@ void WideGraph::setModeTx(QString modeTx) //setModeTx ui->widePlot->update(); } - //Current-Cumulative-Yellow -void WideGraph::on_spec2dComboBox_currentIndexChanged(const QString &arg1) +void WideGraph::on_spec2dComboBox_currentIndexChanged(int index) { ui->widePlot->setCurrent(false); ui->widePlot->setCumulative(false); ui->widePlot->setLinearAvg(false); ui->widePlot->setReference(false); ui->smoSpinBox->setEnabled(false); - if(arg1=="Current") ui->widePlot->setCurrent(true); - if(arg1=="Cumulative") ui->widePlot->setCumulative(true); - if(arg1=="Linear Avg") { - ui->widePlot->setLinearAvg(true); - ui->smoSpinBox->setEnabled(true); - } - if(arg1=="Reference") { - ui->widePlot->setReference(true); - } + switch (index) + { + case 0: // Current + ui->widePlot->setCurrent(true); + break; + case 1: // Cumulative + ui->widePlot->setCumulative(true); + break; + case 2: // Linear Avg + ui->widePlot->setLinearAvg(true); + ui->smoSpinBox->setEnabled(true); + break; + case 3: // Reference + ui->widePlot->setReference(true); + break; + } replot(); } diff --git a/widgets/widegraph.h b/widgets/widegraph.h index c87bab05..90f7b51a 100644 --- a/widgets/widegraph.h +++ b/widgets/widegraph.h @@ -68,7 +68,7 @@ protected: private slots: void on_waterfallAvgSpinBox_valueChanged(int arg1); void on_bppSpinBox_valueChanged(int arg1); - void on_spec2dComboBox_currentIndexChanged(const QString &arg1); + void on_spec2dComboBox_currentIndexChanged(int); void on_fSplitSpinBox_valueChanged(int n); void on_fStartSpinBox_valueChanged(int n); void on_paletteComboBox_activated(const QString &palette); |
