Skip to content

Commit

Permalink
Remove use of deprecated QRegExp.
Browse files Browse the repository at this point in the history
  • Loading branch information
srcejon committed Jun 10, 2024
1 parent 4f822b4 commit 4171663
Show file tree
Hide file tree
Showing 18 changed files with 257 additions and 211 deletions.
7 changes: 4 additions & 3 deletions plugins/channelrx/demodais/aisdemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <QDesktopServices>
#include <QMessageBox>
#include <QAction>
#include <QRegExp>
#include <QRegularExpression>
#include <QClipboard>
#include <QFileDialog>
#include <QScrollBar>
Expand Down Expand Up @@ -636,9 +636,10 @@ void AISDemodGUI::filterRow(int row)
bool hidden = false;
if (m_settings.m_filterMMSI != "")
{
QRegExp re(m_settings.m_filterMMSI);
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterMMSI));
QTableWidgetItem *fromItem = ui->messages->item(row, MESSAGE_COL_MMSI);
if (!re.exactMatch(fromItem->text()))
QRegularExpressionMatch match = re.match(fromItem->text());
if (!match.hasMatch())
hidden = true;
}
ui->messages->setRowHidden(row, hidden);
Expand Down
1 change: 0 additions & 1 deletion plugins/channelrx/demodapt/aptdemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <QDebug>
#include <QMessageBox>
#include <QAction>
#include <QRegExp>
#include <QFileDialog>
#include <QFileInfo>
#include <QGraphicsScene>
Expand Down
7 changes: 4 additions & 3 deletions plugins/channelrx/demoddab/dabdemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <QDebug>
#include <QAction>
#include <QRegExp>
#include <QRegularExpression>

#include "dabdemodgui.h"

Expand Down Expand Up @@ -423,9 +423,10 @@ void DABDemodGUI::filterRow(int row)
bool hidden = false;
if (m_settings.m_filter != "")
{
QRegExp re(m_settings.m_filter);
QRegularExpression re(m_settings.m_filter);
QTableWidgetItem *fromItem = ui->programs->item(row, PROGRAMS_COL_NAME);
if (re.indexIn(fromItem->text()) == -1)
QRegularExpressionMatch match = re.match(fromItem->text());
if (!match.hasMatch())
hidden = true;
}
ui->programs->setRowHidden(row, hidden);
Expand Down
6 changes: 3 additions & 3 deletions plugins/channelrx/demoddsc/dscdemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <QAction>
#include <QClipboard>
#include <QFileDialog>
#include <QRegExp>
#include <QScrollBar>
#include <QMenu>
#include <QDesktopServices>
Expand Down Expand Up @@ -467,8 +466,9 @@ void DSCDemodGUI::filterRow(int row)
if (m_settings.m_filter != "")
{
QTableWidgetItem *item = ui->messages->item(row, m_settings.m_filterColumn);
QRegExp re(m_settings.m_filter);
if (!re.exactMatch(item->text())) {
QRegularExpression re(m_settings.m_filter);
QRegularExpressionMatch match = re.match(item->text());
if (!match.hasMatch()) {
hidden = true;
}
}
Expand Down
7 changes: 4 additions & 3 deletions plugins/channelrx/demodendoftrain/endoftraindemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <QDebug>
#include <QMessageBox>
#include <QAction>
#include <QRegExp>
#include <QRegularExpression>
#include <QFileDialog>
#include <QScrollBar>

Expand Down Expand Up @@ -345,9 +345,10 @@ void EndOfTrainDemodGUI::filterRow(int row)
bool hidden = false;
if (m_settings.m_filterFrom != "")
{
QRegExp re(m_settings.m_filterFrom);
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterFrom));
QTableWidgetItem *fromItem = ui->packets->item(row, PACKETS_COL_ADDRESS);
if (!re.exactMatch(fromItem->text()))
QRegularExpressionMatch match = re.match(fromItem->text());
if (!match.hasMatch())
hidden = true;
}
ui->packets->setRowHidden(row, hidden);
Expand Down
12 changes: 7 additions & 5 deletions plugins/channelrx/demodpacket/packetdemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <QDebug>
#include <QMessageBox>
#include <QAction>
#include <QRegExp>
#include <QRegularExpression>
#include <QFileDialog>
#include <QScrollBar>

Expand Down Expand Up @@ -330,16 +330,18 @@ void PacketDemodGUI::filterRow(int row)
bool hidden = false;
if (m_settings.m_filterFrom != "")
{
QRegExp re(m_settings.m_filterFrom);
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterFrom));
QTableWidgetItem *fromItem = ui->packets->item(row, PACKET_COL_FROM);
if (!re.exactMatch(fromItem->text()))
QRegularExpressionMatch match = re.match(fromItem->text());
if (!match.hasMatch())
hidden = true;
}
if (m_settings.m_filterTo != "")
{
QRegExp re(m_settings.m_filterTo);
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterTo));
QTableWidgetItem *toItem = ui->packets->item(row, PACKET_COL_TO);
if (!re.exactMatch(toItem->text()))
QRegularExpressionMatch match = re.match(toItem->text());
if (!match.hasMatch())
hidden = true;
}
if (m_settings.m_filterPID != "")
Expand Down
7 changes: 4 additions & 3 deletions plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <QDesktopServices>
#include <QMessageBox>
#include <QAction>
#include <QRegExp>
#include <QRegularExpression>
#include <QClipboard>
#include <QFileDialog>
#include <QScrollBar>
Expand Down Expand Up @@ -473,9 +473,10 @@ void RadiosondeDemodGUI::filterRow(int row)
bool hidden = false;
if (m_settings.m_filterSerial != "")
{
QRegExp re(m_settings.m_filterSerial);
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterSerial));
QTableWidgetItem *fromItem = ui->frames->item(row, FRAME_COL_SERIAL);
if (!re.exactMatch(fromItem->text()))
QRegularExpressionMatch match = re.match(fromItem->text());
if (!match.hasMatch())
hidden = true;
}
ui->frames->setRowHidden(row, hidden);
Expand Down
9 changes: 5 additions & 4 deletions plugins/channelrx/radioastronomy/radioastronomygui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <QDebug>
#include <QMessageBox>
#include <QAction>
#include <QRegExp>
#include <QRegularExpression>
#include <QClipboard>
#include <QFileDialog>
#include <QImage>
Expand Down Expand Up @@ -6054,10 +6054,11 @@ void RadioAstronomyGUI::networkManagerFinished(QNetworkReply *reply)
else
{
QString answer = reply->readAll();
QRegExp re("a href=\\\"download.php([^\"]*)\"");
if (re.indexIn(answer) != -1)
QRegularExpression re("a href=\\\"download.php([^\"]*)\"");
QRegularExpressionMatch match = re.match(answer);
if (match.hasMatch())
{
QString filename = re.capturedTexts()[1];
QString filename = match.capturedTexts()[1];
qDebug() << "RadioAstronomyGUI: Downloading LAB reference data: " << filename;
m_dlm.download(QUrl("https://www.astro.uni-bonn.de/hisurvey/euhou/LABprofile/download.php" + filename), m_filenameLAB);
}
Expand Down
5 changes: 3 additions & 2 deletions plugins/feature/aprs/aprsgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,10 @@ void APRSGUI::filterMessageRow(int row)
bool hidden = false;
if (m_settings.m_filterAddressee != "")
{
QRegExp re(m_settings.m_filterAddressee);
QRegularExpression re(m_settings.m_filterAddressee);
QTableWidgetItem *addressee = ui->messagesTable->item(row, MESSAGE_COL_ADDRESSEE);
if (!re.exactMatch(addressee->text()))
QRegularExpressionMatch match = re.match(addressee->text());
if (!match.hasMatch())
hidden = true;
}
ui->messagesTable->setRowHidden(row, hidden);
Expand Down
9 changes: 5 additions & 4 deletions plugins/feature/satellitetracker/satnogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <QHash>
#include <QJsonArray>
#include <QJsonObject>
#include <QRegExp>
#include <QRegularExpression>

struct SatNogsTransmitter {

Expand Down Expand Up @@ -196,10 +196,11 @@ struct SatNogsSatellite {
// tle0 is of the form:
// MOZHAYETS 4 (RS-22)
// GOES 9 [-]
QRegExp re("([A-Za-z0-9\\- ]+)([\\(]([A-Z0-9\\- ]+)[\\)])?");
if (re.indexIn(tle->m_tle0) != -1)
QRegularExpression re("([A-Za-z0-9\\- ]+)([\\(]([A-Z0-9\\- ]+)[\\)])?");
QRegularExpressionMatch match = re.match(tle->m_tle0);
if (match.hasMatch())
{
QStringList groups = re.capturedTexts();
QStringList groups = match.capturedTexts();
m_name = groups[1].trimmed();
if ((groups.size() >= 4) && (groups[3] != "-") && !groups[3].isEmpty())
m_names = QStringList({groups[3].trimmed()});
Expand Down
32 changes: 17 additions & 15 deletions plugins/feature/startracker/startrackergui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <algorithm>
#include <QMessageBox>
#include <QLineEdit>
#include <QRegExp>
#include <QRegularExpression>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QGraphicsScene>
Expand Down Expand Up @@ -1253,8 +1253,8 @@ void StarTrackerGUI::plotGalacticLineOfSight()
}

// Calculate Galactic longitude we're observing
float ra = Astronomy::raToDecimal(m_settings.m_ra);
float dec = Astronomy::decToDecimal(m_settings.m_dec);
float ra = Units::raToDecimal(m_settings.m_ra);
float dec = Units::decToDecimal(m_settings.m_dec);
double l, b;
Astronomy::equatorialToGalactic(ra, dec, l, b);

Expand Down Expand Up @@ -1365,8 +1365,8 @@ void StarTrackerGUI::plotSkyTemperatureChart()
}

QScatterSeries *series = new QScatterSeries();
float ra = Astronomy::raToDecimal(m_settings.m_ra);
float dec = Astronomy::decToDecimal(m_settings.m_dec);
float ra = Units::raToDecimal(m_settings.m_ra);
float dec = Units::decToDecimal(m_settings.m_dec);

double beamWidth = m_settings.m_beamwidth;
// Ellipse not supported, so draw circle on shorter axis
Expand Down Expand Up @@ -1664,8 +1664,8 @@ void StarTrackerGUI::plotElevationLineChart()
}
else
{
rd.ra = Astronomy::raToDecimal(m_settings.m_ra);
rd.dec = Astronomy::decToDecimal(m_settings.m_dec);
rd.ra = Units::raToDecimal(m_settings.m_ra);
rd.dec = Units::decToDecimal(m_settings.m_dec);
aa = Astronomy::raDecToAzAlt(rd, m_settings.m_latitude, m_settings.m_longitude, dt, !m_settings.m_jnow);
}

Expand Down Expand Up @@ -1850,8 +1850,8 @@ void StarTrackerGUI::plotElevationPolarChart()
}
else
{
rd.ra = Astronomy::raToDecimal(m_settings.m_ra);
rd.dec = Astronomy::decToDecimal(m_settings.m_dec);
rd.ra = Units::raToDecimal(m_settings.m_ra);
rd.dec = Units::decToDecimal(m_settings.m_dec);
aa = Astronomy::raDecToAzAlt(rd, m_settings.m_latitude, m_settings.m_longitude, dt, !m_settings.m_jnow);
}

Expand Down Expand Up @@ -2282,12 +2282,13 @@ bool StarTrackerGUI::readSolarFlux()
// 000000 000019 000027 000037 000056 000073 000116 000202 000514 sfu
// Occasionally, file will contain ////// in a column, presumably to indicate no data
// Values can be negative
QRegExp re("([0-9]{2})([0-9]{2})([0-9]{2}) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+)");
QRegularExpression re("([0-9]{2})([0-9]{2})([0-9]{2}) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+)");
QRegularExpressionMatch match = re.match(string);

if (re.indexIn(string) != -1)
if (match.hasMatch())
{
for (int i = 0; i < 8; i++)
m_solarFluxes[i] = re.capturedTexts()[i+4].toInt();
m_solarFluxes[i] = match.capturedTexts()[i+4].toInt();
m_solarFluxesValid = true;
displaySolarFlux();
plotChart();
Expand Down Expand Up @@ -2322,11 +2323,12 @@ void StarTrackerGUI::networkManagerFinished(QNetworkReply *reply)
else
{
QString answer = reply->readAll();
QRegExp re("\\<th\\>Observed Flux Density\\<\\/th\\>\\<td\\>([0-9]+(\\.[0-9]+)?)\\<\\/td\\>");
QRegularExpression re("\\<th\\>Observed Flux Density\\<\\/th\\>\\<td\\>([0-9]+(\\.[0-9]+)?)\\<\\/td\\>");
QRegularExpressionMatch match = re.match(answer);

if (re.indexIn(answer) != -1)
if (match.hasMatch())
{
m_solarFlux = re.capturedTexts()[1].toDouble();
m_solarFlux = match.capturedTexts()[1].toDouble();
displaySolarFlux();
}
else
Expand Down
4 changes: 2 additions & 2 deletions plugins/feature/startracker/startrackerworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,8 @@ void StarTrackerWorker::update()
else
{
// Convert RA/Dec to Alt/Az
rd.ra = Astronomy::raToDecimal(m_settings.m_ra);
rd.dec = Astronomy::decToDecimal(m_settings.m_dec);
rd.ra = Units::raToDecimal(m_settings.m_ra);
rd.dec = Units::decToDecimal(m_settings.m_dec);
aa = Astronomy::raDecToAzAlt(rd, m_settings.m_latitude, m_settings.m_longitude, dt, !m_settings.m_jnow);
Astronomy::equatorialToGalactic(rd.ra, rd.dec, l, b);
}
Expand Down
Loading

0 comments on commit 4171663

Please sign in to comment.