mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -05:00
Remove use of obsolete QRegExp
This commit is contained in:
parent
b6146caf36
commit
427d17351d
@ -19,7 +19,7 @@
|
||||
#include <QDockWidget>
|
||||
#include <QDebug>
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
@ -433,15 +433,15 @@ void PagerDemodGUI::filterRow(int row)
|
||||
bool hidden = false;
|
||||
if (m_settings.m_filterAddress != "")
|
||||
{
|
||||
QRegExp re(m_settings.m_filterAddress);
|
||||
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterAddress));
|
||||
QTableWidgetItem *fromItem = ui->messages->item(row, PagerDemodSettings::MESSAGE_COL_ADDRESS);
|
||||
if (!re.exactMatch(fromItem->text())) {
|
||||
QRegularExpressionMatch match = re.match(fromItem->text());
|
||||
if (!match.hasMatch()) {
|
||||
hidden = true;
|
||||
}
|
||||
}
|
||||
ui->messages->setRowHidden(row, hidden);
|
||||
}
|
||||
|
||||
void PagerDemodGUI::filter()
|
||||
{
|
||||
for (int i = 0; i < ui->messages->rowCount(); i++) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <QNetworkDatagram>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "util/ax25.h"
|
||||
|
||||
@ -205,11 +205,12 @@ void PERTesterWorker::rx()
|
||||
|
||||
void PERTesterWorker::tx()
|
||||
{
|
||||
QRegExp ax25Dst("^%\\{ax25\\.dst=([A-Za-z0-9-]+)\\}");
|
||||
QRegExp ax25Src("^%\\{ax25\\.src=([A-Za-z0-9-]+)\\}");
|
||||
QRegExp num("^%\\{num\\}");
|
||||
QRegExp data("^%\\{data=([0-9]+),([0-9]+)\\}");
|
||||
QRegExp hex("^(0x)?([0-9a-fA-F]?[0-9a-fA-F])");
|
||||
QRegularExpression ax25Dst("^%\\{ax25\\.dst=([A-Za-z0-9-]+)\\}");
|
||||
QRegularExpression ax25Src("^%\\{ax25\\.src=([A-Za-z0-9-]+)\\}");
|
||||
QRegularExpression num("^%\\{num\\}");
|
||||
QRegularExpression data("^%\\{data=([0-9]+),([0-9]+)\\}");
|
||||
QRegularExpression hex("^(0x)?([0-9a-fA-F]?[0-9a-fA-F])");
|
||||
QRegularExpressionMatch match;
|
||||
QByteArray bytes;
|
||||
int pos = 0;
|
||||
|
||||
@ -217,34 +218,34 @@ void PERTesterWorker::tx()
|
||||
{
|
||||
if (m_settings.m_packet[pos] == '%')
|
||||
{
|
||||
if (ax25Dst.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1)
|
||||
if ((match = ax25Dst.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
|
||||
{
|
||||
// AX.25 destination callsign & SSID
|
||||
QString address = ax25Dst.capturedTexts()[1];
|
||||
QString address = match.captured(1);
|
||||
bytes.append(AX25Packet::encodeAddress(address));
|
||||
pos += ax25Dst.matchedLength();
|
||||
pos += match.capturedLength();
|
||||
}
|
||||
else if (ax25Src.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1)
|
||||
else if ((match = ax25Src.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
|
||||
{
|
||||
// AX.25 source callsign & SSID
|
||||
QString address = ax25Src.capturedTexts()[1];
|
||||
QString address = match.captured(1);
|
||||
bytes.append(AX25Packet::encodeAddress(address, 1));
|
||||
pos += ax25Src.matchedLength();
|
||||
pos += match.capturedLength();
|
||||
}
|
||||
else if (num.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1)
|
||||
else if ((match = num.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
|
||||
{
|
||||
// Big endian packet number
|
||||
bytes.append((m_tx >> 24) & 0xff);
|
||||
bytes.append((m_tx >> 16) & 0xff);
|
||||
bytes.append((m_tx >> 8) & 0xff);
|
||||
bytes.append(m_tx & 0xff);
|
||||
pos += num.matchedLength();
|
||||
pos += match.capturedLength();
|
||||
}
|
||||
else if (data.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1)
|
||||
else if ((match = data.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
|
||||
{
|
||||
// Constrained random number of random bytes
|
||||
int minBytes = data.capturedTexts()[1].toInt();
|
||||
int maxBytes = data.capturedTexts()[2].toInt();
|
||||
int minBytes = match.captured(1).toInt();
|
||||
int maxBytes = match.captured(2).toInt();
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
std::uniform_int_distribution<> distr0(minBytes, maxBytes);
|
||||
@ -252,7 +253,7 @@ void PERTesterWorker::tx()
|
||||
int count = distr0(gen);
|
||||
for (int i = 0; i < count; i++)
|
||||
bytes.append(distr1(gen));
|
||||
pos += data.matchedLength();
|
||||
pos += match.capturedLength();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -278,12 +279,12 @@ void PERTesterWorker::tx()
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (hex.indexIn(m_settings.m_packet, pos, QRegExp::CaretAtOffset) != -1)
|
||||
else if ((match = hex.match(m_settings.m_packet, pos, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption)).hasMatch())
|
||||
{
|
||||
// Hex byte
|
||||
int value = hex.capturedTexts()[2].toInt(nullptr, 16);
|
||||
int value = match.captured(2).toInt(nullptr, 16);
|
||||
bytes.append(value);
|
||||
pos += hex.matchedLength();
|
||||
pos += match.capturedLength();
|
||||
}
|
||||
else if ((m_settings.m_packet[pos] == ' ') || (m_settings.m_packet[pos] == ',') || (m_settings.m_packet[pos] == ':'))
|
||||
{
|
||||
|
@ -82,9 +82,6 @@ target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
${TARGET_LIB_GUI}
|
||||
${SGP4_LIBRARIES}
|
||||
)
|
||||
if (Qt6_FOUND)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE Qt::Core5Compat)
|
||||
endif()
|
||||
|
||||
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})
|
||||
|
||||
|
@ -702,7 +702,6 @@ if (LIBSIGMF_FOUND)
|
||||
endif()
|
||||
if (Qt6_FOUND)
|
||||
target_link_libraries(sdrbase
|
||||
Qt::Core5Compat
|
||||
Qt::CorePrivate
|
||||
)
|
||||
endif()
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "util/message.h"
|
||||
@ -472,16 +472,19 @@ void WavFileRecord::writeHeader(QFile& sampleFile, Header& header)
|
||||
bool WavFileRecord::getCenterFrequency(QString fileName, quint64& centerFrequency)
|
||||
{
|
||||
// Attempt to extract center frequency from filename
|
||||
QRegExp freqkRE("(([0-9]+)kHz)");
|
||||
QRegExp freqRE("(([0-9]+)Hz)");
|
||||
if (freqkRE.indexIn(fileName))
|
||||
QRegularExpression freqkRE("(([0-9]+)kHz)");
|
||||
QRegularExpression freqRE("(([0-9]+)Hz)");
|
||||
QRegularExpressionMatch freqkREMatch = freqkRE.match(fileName);
|
||||
QRegularExpressionMatch freqREMatch = freqRE.match(fileName);
|
||||
|
||||
if (freqkREMatch.hasMatch())
|
||||
{
|
||||
centerFrequency = freqkRE.capturedTexts()[2].toLongLong() * 1000LL;
|
||||
centerFrequency = freqkREMatch.capturedTexts()[2].toLongLong() * 1000LL;
|
||||
return true;
|
||||
}
|
||||
else if (freqRE.indexIn(fileName))
|
||||
else if (freqREMatch.hasMatch())
|
||||
{
|
||||
centerFrequency = freqRE.capturedTexts()[2].toLongLong();
|
||||
centerFrequency = freqREMatch.capturedTexts()[2].toLongLong();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -490,17 +493,18 @@ bool WavFileRecord::getCenterFrequency(QString fileName, quint64& centerFrequenc
|
||||
bool WavFileRecord::getStartTime(QString fileName, QDateTime& startTime)
|
||||
{
|
||||
// Attempt to extract start time from filename
|
||||
QRegExp dateTimeRE("([12][0-9][0-9][0-9]).?([01][0-9]).?([0-3][0-9]).?([0-2][0-9]).?([0-5][0-9]).?([0-5][0-9])");
|
||||
if (dateTimeRE.indexIn(fileName) != -1)
|
||||
QRegularExpression dateTimeRE("([12][0-9][0-9][0-9]).?([01][0-9]).?([0-3][0-9]).?([0-2][0-9]).?([0-5][0-9]).?([0-5][0-9])");
|
||||
QRegularExpressionMatch match = dateTimeRE.match(fileName);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
startTime = QDateTime(QDate(
|
||||
dateTimeRE.capturedTexts()[1].toInt(),
|
||||
dateTimeRE.capturedTexts()[2].toInt(),
|
||||
dateTimeRE.capturedTexts()[3].toInt()),
|
||||
match.capturedTexts()[1].toInt(),
|
||||
match.capturedTexts()[2].toInt(),
|
||||
match.capturedTexts()[3].toInt()),
|
||||
QTime(
|
||||
dateTimeRE.capturedTexts()[4].toInt(),
|
||||
dateTimeRE.capturedTexts()[5].toInt(),
|
||||
dateTimeRE.capturedTexts()[6].toInt()));
|
||||
match.capturedTexts()[4].toInt(),
|
||||
match.capturedTexts()[5].toInt(),
|
||||
match.capturedTexts()[6].toInt()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user