[Kilpper] Port QRegExp to QRegularExpression
ClosedPublic

Authored by ahmadsamir on Mar 7 2020, 3:40 PM.

Details

Test Plan

make && ctest
klipper still seems to work

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ahmadsamir created this revision.Mar 7 2020, 3:40 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 7 2020, 3:40 PM
ahmadsamir requested review of this revision.Mar 7 2020, 3:40 PM

Rebase; and friendly ping

apol added inline comments.Mar 27 2020, 2:21 PM
klipper/urlgrabber.h
185–186

Why did you change how it works right here?

ahmadsamir added inline comments.Mar 27 2020, 2:38 PM
klipper/urlgrabber.h
185–186

I find it confusing to call the pattern "regExp" and the QRegExp object "m_myRegExp".

apol added inline comments.Mar 27 2020, 3:38 PM
klipper/urlgrabber.h
185–186

Then call it m_regularExpression?

ahmadsamir added inline comments.Mar 27 2020, 5:19 PM
klipper/urlgrabber.h
185–186

Another point (which I forgot since it has been some time since I last looked at this patch), QRegExp stores the match info in itself, whereas QRegularExpression stores the match info in a QRegularExpressionMatch object (returned from calling QRegularExpression::match()), so if I use a m_regularExpression I'll have to add a getter for it, so that it can be called from URLGrabber::matchingActions().

apol added inline comments.Mar 27 2020, 5:44 PM
klipper/urlgrabber.h
185–186

Then you want to store a match?

ahmadsamir added inline comments.Mar 27 2020, 6:21 PM
klipper/urlgrabber.h
185–186

The code stores the QRegularExpression::capturedTexts(), m_regexCapturedTexts, which is eventually what ClipCommandProcess uses.

apol accepted this revision.Mar 28 2020, 12:23 AM
apol added inline comments.
klipper/urlgrabber.h
185–186

I think it's a silly way to do the port but okay, probably works and we get to move on.

This revision is now accepted and ready to land.Mar 28 2020, 12:23 AM
ahmadsamir added inline comments.Mar 28 2020, 7:36 AM
klipper/urlgrabber.h
185–186

What is silly about it?

The original code in ClipCommandProcess used:
const QStringList matches = action.regExpMatches();
which was:
QStringList regExpMatches() const { return m_myRegExp.capturedTexts(); }

This revision was automatically updated to reflect the committed changes.