Opened 5 years ago

Closed 5 years ago

#12355 closed Patch - Feature (Fixed)

Qt5 Feature Patch - Various Qt5 deprecated construct patches

Reported by: Gary Buhrmaster <gary.buhrmaster@…> Owned by: stuartm
Priority: major Milestone: 0.28
Component: Qt5 issues Version: Master Head
Severity: medium Keywords: Qt5 feature
Cc: Ticket locked: no

Description

Currently, to support compilation with Qt5, MythTV is using QT_DISABLE_DEPRECATED_BEFORE to support legacy Qt4 features. The following patches replace legacy (deprecated) code with current code constructs, replacing the deprecated code(s) and where necessary surrounded by a version check for Qt5, making it safe for any supported Qt version.

These patches were essentially done by semi-automated identification and code copy/paste, but have not been tested in battle. They passed the eyeball test, and compile (on Linux). Caveat emptor.

While multiple (small) patches were created in order to allow the devs to more easily review them, they are intended to be applied as a set.

Patch 0: Replace QRect intersect with intersected (renamed in Qt4.2)

github ref: https://github.com/garybuhrmaster/mythtv/commit/99aec945b40d56c04c54f2702c8408c523661c70
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/99aec945b40d56c04c54f2702c8408c523661c70.patch

Patch 1: Qt4 QUrl addQueryItem to Qt5 QUrlQuery addQueryItem porting for libs/libmythfreemheg/Programs.cpp

github ref: https://github.com/garybuhrmaster/mythtv/commit/e883a81b1e03c3ff8ebfc44c0c88cb27ce06e866
git git-am ref: https://github.com/garybuhrmaster/mythtv/commit/e883a81b1e03c3ff8ebfc44c0c88cb27ce06e866.patch

Patch 2: Replace fromAscii to fromLatin1 for libs/libmythtv/cardutil.cpp

github ref: https://github.com/garybuhrmaster/mythtv/commit/e7bd1c2c4f465e6ab6759001b8919b3c54c98ca6
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/e7bd1c2c4f465e6ab6759001b8919b3c54c98ca6.patch

Patch 3: Replace fromAscii to fromLatin1 for libs/libmythtv/dsmcccache.cpp

github ref: https://github.com/garybuhrmaster/mythtv/commit/e49b1358a2ed52037b896bce2f2fda85f7520c8c
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/e49b1358a2ed52037b896bce2f2fda85f7520c8c.patch

Patch 4: Replace fromAscii to fromLatin1 for libs/libmythui/cecadapter.cpp

github ref: https://github.com/garybuhrmaster/mythtv/commit/900c47d870797ca25b5fb9bdd2312ec9bbd385a3
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/900c47d870797ca25b5fb9bdd2312ec9bbd385a3.patch

Patch 5: Qt4 QUrl to Qt5 QUrl/QUrlQuery porting for libs/libmythtv/AirPlay/mythairplayserver.cpp

github ref: https://github.com/garybuhrmaster/mythtv/commit/f774cd45b4c9a13a3762598409d4dfb1772f6f7b
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/f774cd45b4c9a13a3762598409d4dfb1772f6f7b.patch

Patch 6: Add QUrlQuery for Qt5 upnp porting libs/libmythupnp/upnpdevice.h (included elsewhere)

github ref: https://github.com/garybuhrmaster/mythtv/commit/af207867def689bd5fbf7dd72496124e25b2ebe7
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/af207867def689bd5fbf7dd72496124e25b2ebe7.patch

Patch 7: Port Qt4 cert.isValid to Qt5 constructs (date checks and blacklist) in libs/libmythupnp/httpserver.cpp

github ref: https://github.com/garybuhrmaster/mythtv/commit/a6041a5b647d458210a7d21c2b9b8ae9630e754d
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/a6041a5b647d458210a7d21c2b9b8ae9630e754d.patch

Patch 8: Qt4 QUrl to Qt5 QUrl/QUrlQuery porting for upnpcdstv

github ref: https://github.com/garybuhrmaster/mythtv/commit/744568cf69e0594bd3b2ccd030966593efb9c908
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/744568cf69e0594bd3b2ccd030966593efb9c908.patch

Patch 9: Qt4 QUrl to Qt5 QUrl/QUrlQuery porting for upnpcdsmusic

github ref: https://github.com/garybuhrmaster/mythtv/commit/39f48ff94a585c2376c853ad405f3dcaa774e4ae
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/39f48ff94a585c2376c853ad405f3dcaa774e4ae.patch

Patch 10: Qt4 QUrl to Qt5 QUrl/QUrlQuery porting for upnpcdsvideo

github ref: https://github.com/garybuhrmaster/mythtv/commit/c9235dc3c450171b08aa7f6fc9c3caa409923d22
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/c9235dc3c450171b08aa7f6fc9c3caa409923d22.patch

IMPORTANT NOTE:

This last patch removes the QT_DISABLE_DEPRECATED_BEFORE compatibility define. Do NOT apply this until (a) patch in ticket #12067 is also applied, AND all devs have agreed to using Qt5 constructs (with version checking where needed) for future work.

Patch 11: Remove QT_DISABLE_DEPRECATED_BEFORE

github ref: https://github.com/garybuhrmaster/mythtv/commit/e8e712e539922e44b5085bd6de0019250b4693de
github git-am ref: https://github.com/garybuhrmaster/mythtv/commit/e8e712e539922e44b5085bd6de0019250b4693de.patch

Change History (8)

comment:1 Changed 5 years ago by Gary Buhrmaster <gary.buhrmaster@…>

Darn. Somehow I missed ticket #11871, where DanielK created a previous patch that includes many of the same changes. However, since that time, new files have been added (thank you stuartm for the new upnp features) that require additional changes. This ticket is essentially a superset of #11871, although I note that he and I had slight differences in coding style for the airplay update.

Anyway, sorry, a bit more work for the dev(s) to consider how best to proceed when and if they want to look to remove the deprecated compatibility define.

comment:2 Changed 5 years ago by Gary Buhrmaster <gary.buhrmaster@…>

Looks like patch 3/4 are being independently done by stuartm. I think patch 7 will now be a conflict (since I addressed the isValid certificate case differently).

Perhaps this ticket should be closed, since it appears that the patches are being independently worked.

comment:3 Changed 5 years ago by stuartm

Milestone: unknown0.28
Owner: set to stuartm
Priority: minormajor
Status: newaccepted

comment:4 Changed 5 years ago by stuartm

Gary, sorry, again ... I simply forgot that you still had QT5 patches outstanding. I don't mind using your fixes to save myself the trouble. Especially the fiddly QUrl work.

I'm targeting 5.2 on the deprecated define, which is beyond what we need to do but it should mean we stay ahead of any code removal in future QT releases. Little gems like the removal of qBinaryFind (neither std::binary_search or std::lower_bound are straight swaps) will keep us busy.

comment:5 Changed 5 years ago by stuartm

FYI, I skipped the blacklist check for certs as that's more relevant for clients, not a server and because most users will be using self-signed certificates which won't appear in a public blacklist anyway.

Added benefit was that it didn't need wrapping in a QT5 ifdef either

Last edited 5 years ago by stuartm (previous) (diff)

comment:6 in reply to:  4 Changed 5 years ago by Gary Buhrmaster <gary.buhrmaster@…>

Replying to stuartm:

Gary, sorry, again ... I simply forgot that you still had QT5 patches outstanding.

No problem. I was just trying to be ahead of the game, and as such, too far for memory, apparently.

I don't mind using your fixes to save myself the trouble. Especially the fiddly QUrl work.

I should note that all of my patches were constructed to support both Qt4.8 and Qt5 so that they could be applied before the devs committed to Qt5 as a requirement. Now that Qt5 will be a requirement, some simplification could be performed (or not).

comment:7 Changed 5 years ago by gigem

Component: MythTV - GeneralQt5 issues

comment:8 Changed 5 years ago by stuartm

Resolution: Fixed
Status: acceptedclosed

I believe all patches, or at least all the changes, have now been applied in master. Please correct me if I'm wrong.

Note: See TracTickets for help on using tickets.