summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2021-12-06 18:54:46 -0600
committerMikaƫl Capelle <capelle.mikael@gmail.com>2022-04-19 15:17:23 +0200
commitfb4cd4375c0a547129b454c376a32d752bc70422 (patch)
tree7356323bee8287eb7a843e5d182592cfa9cbd0ce /src/mainwindow.cpp
parentc4b2be45d29a247422e60bb8fdf1664c10384eee (diff)
Remove dependency on Core5Compat
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 906e40d6..e792abf5 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -132,7 +132,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QPushButton>
#include <QRadioButton>
#include <QRect>
-#include <QRegExp>
#include <QResizeEvent>
#include <QScopedPointer>
#include <QSizePolicy>
@@ -3472,14 +3471,16 @@ QString MainWindow::queryRestore(const QString &filePath)
QFileInfoList files = pluginFileInfo.absoluteDir().entryInfoList(QStringList(pattern), QDir::Files, QDir::Name);
SelectionDialog dialog(tr("Choose backup to restore"), this);
- QRegExp exp(pluginFileInfo.fileName() + PATTERN_BACKUP_REGEX);
- QRegExp exp2(pluginFileInfo.fileName() + "\\.(.*)");
+ QRegularExpression exp(QRegularExpression::anchoredPattern(pluginFileInfo.fileName() + PATTERN_BACKUP_REGEX));
+ QRegularExpression exp2(QRegularExpression::anchoredPattern(pluginFileInfo.fileName() + "\\.(.*)"));
for(const QFileInfo &info : boost::adaptors::reverse(files)) {
- if (exp.exactMatch(info.fileName())) {
- QDateTime time = QDateTime::fromString(exp.cap(1), PATTERN_BACKUP_DATE);
- dialog.addChoice(time.toString(), "", exp.cap(1));
- } else if (exp2.exactMatch(info.fileName())) {
- dialog.addChoice(exp2.cap(1), "", exp2.cap(1));
+ auto match = exp.match(info.fileName());
+ auto match2 = exp2.match(info.fileName());
+ if (match.hasMatch()) {
+ QDateTime time = QDateTime::fromString(match.captured(1), PATTERN_BACKUP_DATE);
+ dialog.addChoice(time.toString(), "", match.captured(1));
+ } else if (match2.hasMatch()) {
+ dialog.addChoice(match2.captured(1), "", match2.captured(1));
}
}