mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +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 <QDrag>
|
||||
#include <QMimeData>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QUndoStack>
|
||||
#include <QPainter>
|
||||
#include "core/filterpreset.h"
|
||||
|
@ -121,7 +121,7 @@ int ColumnNameProvider::rowCount(const QModelIndex&) const
|
|||
int ColumnNameProvider::mymatch(QString value) const
|
||||
{
|
||||
QString searchString = value.toLower();
|
||||
QRegExp re(" \\(.*\\)");
|
||||
QRegularExpression re(" \\(.*\\)");
|
||||
|
||||
searchString.replace("\"", "").replace(re, "").replace(" ", "").replace(".", "").replace("\n","");
|
||||
for (int i = 0; i < columnNames.count(); i++) {
|
||||
|
@ -894,12 +894,15 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
|||
} else {
|
||||
xml_params params;
|
||||
|
||||
QRegExp apdRe("^.*[/\\][0-9a-zA-Z]*_([0-9]{6})_([0-9]{6})\\.apd");
|
||||
if (txtLog) {
|
||||
parseTxtHeader(fileNames[i], params);
|
||||
} else if (apdRe.exactMatch(fileNames[i])) {
|
||||
xml_params_add(¶ms, "date", qPrintable("20" + apdRe.cap(1)));
|
||||
xml_params_add(¶ms, "time", qPrintable("1" + apdRe.cap(2)));
|
||||
} else {
|
||||
QRegularExpression apdRe("^.*[/\\][0-9a-zA-Z]*_([0-9]{6})_([0-9]{6})\\.apd\\z");
|
||||
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);
|
||||
parse_csv_file(qPrintable(fileNames[i]), ¶ms,
|
||||
|
@ -944,12 +947,16 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
|||
} else {
|
||||
xml_params params;
|
||||
|
||||
QRegExp apdRe("^.*[/\\][0-9a-zA-Z]*_([0-9]{6})_([0-9]{6})\\.apd");
|
||||
if (txtLog) {
|
||||
parseTxtHeader(fileNames[i], params);
|
||||
} else if (apdRe.exactMatch(fileNames[i])) {
|
||||
xml_params_add(¶ms, "date", qPrintable("20" + apdRe.cap(1)));
|
||||
xml_params_add(¶ms, "time", qPrintable("1" + apdRe.cap(2)));
|
||||
} else {
|
||||
QRegularExpression apdRe("\\A^.*[/\\][0-9a-zA-Z]*_([0-9]{6})_([0-9]{6})\\.apd\\z");
|
||||
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);
|
||||
parse_csv_file(qPrintable(fileNames[i]), ¶ms,
|
||||
|
|
Loading…
Reference in a new issue