Ticket #11871: qt5-phase2.patch

File qt5-phase2.patch, 11.4 KB (added by danielk, 7 years ago)

Get rid of deprecated calls in mythtv proper.

  • mythtv/configure

    diff --git a/mythtv/configure b/mythtv/configure
    index ce65536..7dc1dcf 100755
    a b if ! is_qmake5 $qmake ; then 
    44764476  if ! expr $($qmake -query QT_VERSION) : "4\.[8-9]\.[0-9]" >/dev/null; then
    44774477      die "Qt4.8 or newer is required to build MythTV."
    44784478  fi
    4479 else
    4480     check_cxxflags -DQT_DISABLE_DEPRECATED_BEFORE
    44814479fi
    44824480
    44834481if test x"$qmakespecs" != x; then
  • mythtv/libs/libmythfreemheg/Programs.cpp

    diff --git a/mythtv/libs/libmythfreemheg/Programs.cpp b/mythtv/libs/libmythfreemheg/Programs.cpp
    index 1d47df9..1459572 100644
    a b  
    3030#include "freemheg.h"
    3131
    3232#include <QStringList>
     33
     34#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     35#include <QUrlQuery>
     36#endif
     37
    3338#include <QUrl>
    3439#if HAVE_GETTIMEOFDAY == 0
    3540#include <sys/timeb.h>
    void MHResidentProgram::CallProgram(bool fIsFork, const MHObjectRef &success, co 
    867872                    QString name = QString::fromUtf8((const char *)string.Bytes(), string.Size());
    868873                    MHUnion un;
    869874                    un.GetValueFrom(*(args.GetAt(i+1)), engine);
     875#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     876                    QUrlQuery query(url);
     877                    query.addQueryItem(name, un.Printable());
     878                    url.setQuery(query);
     879#else
    870880                    url.addQueryItem(name, un.Printable());
     881#endif
    871882                }
    872883
    873884                MHLOG(MHLogNotifications, QString("NOTE ReturnData %1")
  • mythtv/libs/libmythfreemheg/Stream.cpp

    diff --git a/mythtv/libs/libmythfreemheg/Stream.cpp b/mythtv/libs/libmythfreemheg/Stream.cpp
    index 8fedc98..9d7f0ca 100644
    a b void MHVideo::Display(MHEngine *engine) 
    438438    // m_nDecodeWidth/720 by m_nDecodeHeight/576.
    439439    QRect videoRect = QRect(m_nPosX + m_nXDecodeOffset, m_nPosY + m_nYDecodeOffset,
    440440                            m_nDecodeWidth, m_nDecodeHeight);
    441     QRect displayRect = videoRect.intersect(QRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nBoxHeight));
     441    QRect displayRect = videoRect.intersected(QRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nBoxHeight));
    442442    engine->GetContext()->DrawVideo(videoRect, displayRect);
    443443}
    444444
  • mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp

    diff --git a/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp b/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp
    index ab0f393..28fe91f 100644
    a b  
    88#include <QCoreApplication>
    99#include <QKeyEvent>
    1010#include <QCryptographicHash>
     11#include <QUrl>
     12
     13#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     14#include <QUrlQuery>
     15#endif
    1116
    1217#include "mthread.h"
    1318#include "mythdate.h"
    class APHTTPRequest 
    273278            return;
    274279        m_method = vals[0].trimmed();
    275280        QUrl url = QUrl::fromEncoded(vals[1].trimmed());
    276         m_uri = url.encodedPath();
     281        m_uri = url.path(QUrl::FullyDecoded).toLatin1();
     282#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    277283        m_queries = url.encodedQueryItems();
     284#else
     285        m_queries.clear();
     286        QList<QPair<QString, QString> > queries = QUrlQuery(url).queryItems(QUrl::FullyDecoded);
     287        QList<QPair<QString, QString> >::const_iterator qit;
     288        for (qit = queries.begin(); qit != queries.end(); ++qit)
     289        {
     290            QPair<QByteArray, QByteArray> val((*qit).first.toLatin1(), (*qit).second.toLatin1());
     291            m_queries.push_back(val);
     292        }
     293#endif
    278294        if (m_method.isEmpty() || m_uri.isEmpty())
    279295            return;
    280296
  • mythtv/libs/libmythtv/cardutil.cpp

    diff --git a/mythtv/libs/libmythtv/cardutil.cpp b/mythtv/libs/libmythtv/cardutil.cpp
    index 9e4324c..08cf38b 100644
    a b bool CardUtil::GetV4LInfo( 
    17891789    memset(&capability, 0, sizeof(struct v4l2_capability));
    17901790    if (ioctl(videofd, VIDIOC_QUERYCAP, &capability) >= 0)
    17911791    {
    1792         card = QString::fromAscii((const char*)capability.card);
    1793         driver = QString::fromAscii((const char*)capability.driver);
     1792        card = QString::fromLatin1((const char*)capability.card);
     1793        driver = QString::fromLatin1((const char*)capability.driver);
    17941794        version = capability.version;
    17951795        capabilities = capability.capabilities;
    17961796    }
    bool CardUtil::GetV4LInfo( 
    17991799    {
    18001800        struct video_capability capability;
    18011801        if (ioctl(videofd, VIDIOCGCAP, &capability) >= 0)
    1802             card = QString::fromAscii((const char*)capability.name);
     1802            card = QString::fromLatin1((const char*)capability.name);
    18031803    }
    18041804#endif // USING_V4L1
    18051805#endif // USING_V4L2
  • mythtv/libs/libmythtv/dsmcccache.cpp

    diff --git a/mythtv/libs/libmythtv/dsmcccache.cpp b/mythtv/libs/libmythtv/dsmcccache.cpp
    index 1ad323c..905c7aa 100644
    a b void DSMCCCache::CacheFileData(const DSMCCCacheReference &ref, 
    206206void DSMCCCache::AddFileInfo(DSMCCCacheDir *pDir, const BiopBinding *pBB)
    207207{
    208208    QString name;
    209     name = QString::fromAscii(pBB->m_name.m_comps[0].m_id
     209    name = QString::fromLatin1(pBB->m_name.m_comps[0].m_id
    210210                  /*, pBB->m_name.m_comps[0].m_id_len*/);
    211211
    212212    const DSMCCCacheReference *entry =
    void DSMCCCache::AddDirInfo(DSMCCCacheDir *pDir, const BiopBinding *pBB) 
    224224{
    225225    // Is it already there?
    226226    QString name;
    227     name = QString::fromAscii(pBB->m_name.m_comps[0].m_id
     227    name = QString::fromLatin1(pBB->m_name.m_comps[0].m_id
    228228                  /*, pBB->m_name.m_comps[0].m_id_len*/);
    229229    const DSMCCCacheReference *entry =
    230230        pBB->m_ior.m_profile_body->GetReference();
  • mythtv/libs/libmythtv/recorders/cetonstreamhandler.cpp

    diff --git a/mythtv/libs/libmythtv/recorders/cetonstreamhandler.cpp b/mythtv/libs/libmythtv/recorders/cetonstreamhandler.cpp
    index a83986b..d1b0a0d 100644
    a b  
    1919
    2020#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    2121#include <QHttp>
     22#else
     23#include <QUrlQuery>
    2224#endif
    2325
    2426// MythTV headers
    bool CetonStreamHandler::TuneFrequency( 
    335337    _last_frequency = frequency;
    336338    _last_modulation = modulation;
    337339
     340#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    338341    QUrl params;
     342#else
     343    QUrlQuery params;
     344#endif
     345
    339346    params.addQueryItem("instance_id", QString::number(_tuner));
    340347    params.addQueryItem("frequency", QString::number(frequency));
    341348    params.addQueryItem("modulation",modulation_id);
    bool CetonStreamHandler::TuneProgram(uint program) 
    375382
    376383    _last_program = program;
    377384
     385#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    378386    QUrl params;
     387#else
     388    QUrlQuery params;
     389#endif
     390
    379391    params.addQueryItem("instance_id", QString::number(_tuner));
    380392    params.addQueryItem("program", QString::number(program));
    381393
    bool CetonStreamHandler::PerformTuneVChannel(const QString &vchannel) 
    398410{
    399411    LOG(VB_RECORD, LOG_INFO, LOC + QString("PerformTuneVChannel(%1)").arg(vchannel));
    400412
     413#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    401414    QUrl params;
     415#else
     416    QUrlQuery params;
     417#endif
     418
    402419    params.addQueryItem("instance_id", QString::number(_tuner));
    403420    params.addQueryItem("channel", vchannel);
    404421
    QString CetonStreamHandler::GetVar( 
    472489    QString loc = LOC + QString("DoGetVar(%1,%2,%3,%4) - ")
    473490        .arg(_ip_address).arg(_tuner).arg(section,variable);
    474491
     492#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    475493    QUrl params;
     494#else
     495    QUrlQuery params;
     496#endif
     497
    476498    params.addQueryItem("i", QString::number(_tuner));
    477499    params.addQueryItem("s", section);
    478500    params.addQueryItem("v", variable);
    QStringList CetonStreamHandler::GetProgramList() 
    504526    QString loc = LOC + QString("CetonHTTP: DoGetProgramList(%1,%2) - ")
    505527        .arg(_ip_address).arg(_tuner);
    506528
     529#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    507530    QUrl params;
     531#else
     532    QUrlQuery params;
     533#endif
     534
    508535    params.addQueryItem("i", QString::number(_tuner));
    509536
    510537    QString response;
    QStringList CetonStreamHandler::GetProgramList() 
    531558    return regex.cap(2).split(", ");
    532559}
    533560
     561#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     562
    534563bool CetonStreamHandler::HttpRequest(
    535564    const QString &method, const QString &script, const QUrl &params,
    536565    QString &response, uint &status_code) const
    537566{
    538 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    539567    QHttp http;
    540568    http.setHost(_ip_address);
    541569
    bool CetonStreamHandler::HttpRequest( 
    580608    status_code = resp_header.statusCode();
    581609    response = QString(http.readAll());
    582610    return true;
     611}
     612
    583613#else
     614
     615bool CetonStreamHandler::HttpRequest(
     616    const QString &/*method*/, const QString &/*script*/, const QUrlQuery &/*params*/,
     617    QString &/*response*/, uint &/*status_code*/) const
     618{
    584619#warning CetonStreamHandler::HttpRequest() not yet ported to Qt5
    585620    return false;
    586 #endif
    587621}
     622
     623#endif
  • mythtv/libs/libmythtv/recorders/cetonstreamhandler.h

    diff --git a/mythtv/libs/libmythtv/recorders/cetonstreamhandler.h b/mythtv/libs/libmythtv/recorders/cetonstreamhandler.h
    index 5b0b622..899ea7e 100644
    a b  
    2121
    2222class CetonStreamHandler;
    2323class CetonChannel;
     24class QUrlQuery;
    2425class QUrl;
    2526
    2627class CetonStreamHandler : public IPTVStreamHandler
    class CetonStreamHandler : public IPTVStreamHandler 
    5758
    5859    QString GetVar(const QString &section, const QString &variable) const;
    5960    QStringList GetProgramList();
     61#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    6062    bool HttpRequest(const QString &method, const QString &script,
    6163                     const QUrl &params,
    6264                     QString &response, uint &status_code) const;
    63 
     65#else
     66    bool HttpRequest(const QString &method, const QString &script,
     67                     const QUrlQuery &params,
     68                     QString &response, uint &status_code) const;
     69#endif
    6470
    6571  private:
    6672    QString     _ip_address;
  • mythtv/libs/libmythui/cecadapter.cpp

    diff --git a/mythtv/libs/libmythui/cecadapter.cpp b/mythtv/libs/libmythui/cecadapter.cpp
    index edad8f6..eb2a6f1 100644
    a b class CECAdapterPriv 
    8080        if (num_devices < 1)
    8181            return results;
    8282        for (uint8_t i = 0; i < num_devices; i++)
    83             results << QString::fromAscii(devices[i].comm);
     83            results << QString::fromLatin1(devices[i].comm);
    8484        UnloadLibCec(adapter);
    8585        return results;
    8686    }
    class CECAdapterPriv 
    155155            .arg(num_devices));
    156156        for (uint8_t i = 0; i < num_devices; i++)
    157157        {
    158             QString comm = QString::fromAscii(devices[i].comm);
     158            QString comm = QString::fromLatin1(devices[i].comm);
    159159            bool match = find ? (comm == defaultDevice) : (i == 0);
    160160            devicenum = match ? i : devicenum;
    161161            LOG(VB_GENERAL, LOG_INFO, LOC +
    162162                QString("Device %1: path '%2' com port '%3' %4").arg(i + 1)
    163                 .arg(QString::fromAscii(devices[i].path)).arg(comm)
     163                .arg(QString::fromLatin1(devices[i].path)).arg(comm)
    164164                .arg(match ? "SELECTED" : ""));
    165165        }
    166166
    167167        // open adapter
    168         QString path = QString::fromAscii(devices[devicenum].path);
    169         QString comm = QString::fromAscii(devices[devicenum].comm);
     168        QString path = QString::fromLatin1(devices[devicenum].path);
     169        QString comm = QString::fromLatin1(devices[devicenum].comm);
    170170        LOG(VB_GENERAL, LOG_INFO, LOC + QString("Trying to open device %1 (%2).")
    171171            .arg(path).arg(comm));
    172172