aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/CommandLineOptions
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2020-10-25 21:24:43 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2020-10-25 21:24:43 +0000
commitff83ab580c847f8f8e684f3b1d7bc100ff2f1510 (patch)
treea5578067bb808e2a252c173664ee34afdc87bbfd /src/plugins/CommandLineOptions
parent95c8717ceeb61baccdcc5929fecf1faa3e2e98cf (diff)
downloadqmmp-ff83ab580c847f8f8e684f3b1d7bc100ff2f1510.tar.gz
qmmp-ff83ab580c847f8f8e684f3b1d7bc100ff2f1510.tar.bz2
qmmp-ff83ab580c847f8f8e684f3b1d7bc100ff2f1510.zip
ported some code to QRegularExpression
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9529 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/CommandLineOptions')
-rw-r--r--src/plugins/CommandLineOptions/SeekOption/seekoption.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp b/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp
index ce4ff6ffe..77786ec0a 100644
--- a/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp
+++ b/src/plugins/CommandLineOptions/SeekOption/seekoption.cpp
@@ -20,7 +20,7 @@
#include <QtPlugin>
#include <QLocale>
-#include <QRegExp>
+#include <QRegularExpression>
#include <qmmp/soundcore.h>
#include "seekoption.h"
@@ -52,13 +52,14 @@ QString SeekOption::executeCommand(int id, const QStringList &args)
int seek_pos = -1;
int elapsed = core->elapsed() / 1000;
- QRegExp seek_regexp1 ("^([0-9]{1,4})$");
- QRegExp seek_regexp2 ("^([0-9]{1,2}):([0-9]{1,2})$");
+ static const QRegularExpression seek_regexp1 ("^([0-9]{1,4})$");
+ static const QRegularExpression seek_regexp2 ("^([0-9]{1,2}):([0-9]{1,2})$");
- if(seek_regexp1.indexIn(args.first()) != -1)
- seek_pos = seek_regexp1.cap(1).toInt();
- else if(seek_regexp2.indexIn(args.first()) != -1)
- seek_pos = seek_regexp2.cap(1).toInt()*60 + seek_regexp2.cap(2).toInt();
+ QRegularExpressionMatch match;
+ if((match = seek_regexp1.match(args.first())).hasMatch())
+ seek_pos = match.captured(1).toInt();
+ else if((match = seek_regexp2.match(args.first())).hasMatch())
+ seek_pos = match.captured(1).toInt()*60 + match.captured(2).toInt();
switch (id) {
case SEEK: //seek absolute