mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 19:36:15 +00:00
cleanup: replace QRegExp with QRegularExpression
Qt 6 will drop support for QRegExp. Use QRegularExpression instead. The syntax for matches and captures has changed and needed to be adjusted. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8e4b2d9b82
commit
7a6f2581e8
1 changed files with 17 additions and 10 deletions
|
@ -7,7 +7,7 @@
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "core/filterpreset.h"
|
#include "core/filterpreset.h"
|
||||||
|
@ -121,7 +121,7 @@ int ColumnNameProvider::rowCount(const QModelIndex&) const
|
||||||
int ColumnNameProvider::mymatch(QString value) const
|
int ColumnNameProvider::mymatch(QString value) const
|
||||||
{
|
{
|
||||||
QString searchString = value.toLower();
|
QString searchString = value.toLower();
|
||||||
QRegExp re(" \\(.*\\)");
|
QRegularExpression re(" \\(.*\\)");
|
||||||
|
|
||||||
searchString.replace("\"", "").replace(re, "").replace(" ", "").replace(".", "").replace("\n","");
|
searchString.replace("\"", "").replace(re, "").replace(" ", "").replace(".", "").replace("\n","");
|
||||||
for (int i = 0; i < columnNames.count(); i++) {
|
for (int i = 0; i < columnNames.count(); i++) {
|
||||||
|
@ -894,12 +894,15 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
||||||
} else {
|
} else {
|
||||||
xml_params params;
|
xml_params params;
|
||||||
|
|
||||||
QRegExp apdRe("^.*[/\\][0-9a-zA-Z]*_([0-9]{6})_([0-9]{6})\\.apd");
|
|
||||||
if (txtLog) {
|
if (txtLog) {
|
||||||
parseTxtHeader(fileNames[i], params);
|
parseTxtHeader(fileNames[i], params);
|
||||||
} else if (apdRe.exactMatch(fileNames[i])) {
|
} else {
|
||||||
xml_params_add(¶ms, "date", qPrintable("20" + apdRe.cap(1)));
|
QRegularExpression apdRe("^.*[/\\][0-9a-zA-Z]*_([0-9]{6})_([0-9]{6})\\.apd\\z");
|
||||||
xml_params_add(¶ms, "time", qPrintable("1" + apdRe.cap(2)));
|
QRegularExpressionMatch match = apdRe.match(fileNames[i]);
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
xml_params_add(¶ms, "date", qPrintable("20" + match.captured(1)));
|
||||||
|
xml_params_add(¶ms, "time", qPrintable("1" + match.captured(2)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setup_csv_params(r, params);
|
setup_csv_params(r, params);
|
||||||
parse_csv_file(qPrintable(fileNames[i]), ¶ms,
|
parse_csv_file(qPrintable(fileNames[i]), ¶ms,
|
||||||
|
@ -944,12 +947,16 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
||||||
} else {
|
} else {
|
||||||
xml_params params;
|
xml_params params;
|
||||||
|
|
||||||
QRegExp apdRe("^.*[/\\][0-9a-zA-Z]*_([0-9]{6})_([0-9]{6})\\.apd");
|
|
||||||
if (txtLog) {
|
if (txtLog) {
|
||||||
parseTxtHeader(fileNames[i], params);
|
parseTxtHeader(fileNames[i], params);
|
||||||
} else if (apdRe.exactMatch(fileNames[i])) {
|
} else {
|
||||||
xml_params_add(¶ms, "date", qPrintable("20" + apdRe.cap(1)));
|
QRegularExpression apdRe("\\A^.*[/\\][0-9a-zA-Z]*_([0-9]{6})_([0-9]{6})\\.apd\\z");
|
||||||
xml_params_add(¶ms, "time", qPrintable("1" + apdRe.cap(2)));
|
QRegularExpressionMatch match = apdRe.match(fileNames[i]);
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
xml_params_add(¶ms, "date", qPrintable("20" + match.captured(1)));
|
||||||
|
xml_params_add(¶ms, "time", qPrintable("1" + match.captured(2)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
setup_csv_params(r, params);
|
setup_csv_params(r, params);
|
||||||
parse_csv_file(qPrintable(fileNames[i]), ¶ms,
|
parse_csv_file(qPrintable(fileNames[i]), ¶ms,
|
||||||
|
|
Loading…
Add table
Reference in a new issue