Ticket #5606: mheg-qt4.patch

File mheg-qt4.patch, 18.1 KB (added by David Matthews <dm@…>, 11 years ago)

Patches for Qt4

  • configure

     
    11731173enable ivtv
    11741174enable lamemp3
    11751175enable lirc
    1176 disable mheg
     1176enable mheg
    11771177enable opengl
    11781178enable qtwebkit
    11791179enable v4l
  • libs/libmythtv/libmythtv.pro

     
    33
    44QT += network xml sql
    55using_dbox2:QT *= qt3support
    6 using_mheg:QT *= qt3support
    76
    87TEMPLATE = lib
    98TARGET = mythtv-$$LIBVERSION
  • libs/libmythtv/dsmcccache.h

     
    1919{
    2020  public:
    2121    DSMCCCacheKey() {}
     22    DSMCCCacheKey(const char * data, int size):
     23        QByteArray(data, size) {}
    2224    QString toString(void) const;
    2325    // Operator used in < for DSMCCCacheReference
    2426    friend bool operator < (const DSMCCCacheKey &key1,
  • libs/libmythtv/dsmccobjcarousel.cpp

     
    6767
    6868    if (m_blocks[ddb->block_number] == NULL)
    6969    {   // We haven't seen this block before.
    70         QByteArray *block = new QByteArray;
    71         block->duplicate((char*) data, ddb->len);
     70        QByteArray *block = new QByteArray((char*) data, ddb->len);
    7271        // Add this to our set of blocks.
    7372        m_blocks[ddb->block_number] = block;
    7473        m_receivedData += ddb->len;
  • libs/libmythtv/dsmcccache.cpp

     
    200200void DSMCCCache::AddFileInfo(DSMCCCacheDir *pDir, const BiopBinding *pBB)
    201201{
    202202    QString name;
    203     name.setAscii(pBB->m_name.m_comps[0].m_id
     203    name = QString::fromAscii(pBB->m_name.m_comps[0].m_id
    204204                  /*, pBB->m_name.m_comps[0].m_id_len*/);
    205205
    206206    const DSMCCCacheReference *entry =
     
    218218{
    219219    // Is it already there?
    220220    QString name;
    221     name.setAscii(pBB->m_name.m_comps[0].m_id
     221    name = QString::fromAscii(pBB->m_name.m_comps[0].m_id
    222222                  /*, pBB->m_name.m_comps[0].m_id_len*/);
    223223    const DSMCCCacheReference *entry =
    224224        pBB->m_ior.m_profile_body->GetReference();
  • libs/libmythtv/mhi.h

     
    1818#include <QString>
    1919#include <QWaitCondition>
    2020#include <QImage>
    21 #include <q3pointarray.h>
    2221
    2322// MythTV headers
    2423#include "../libmythfreemheg/freemheg.h"
     
    288287    virtual void DrawOval(int x, int y, int width, int height);
    289288    virtual void DrawArcSector(int x, int y, int width, int height,
    290289                               int start, int arc, bool isSector);
    291     virtual void DrawPoly(bool isFilled, const Q3PointArray &points);
     290    virtual void DrawPoly(bool isFilled, int nPoints, const int *xArray, const int *yArray);
    292291
    293292  protected:
    294293    void DrawRect(int x, int y, int width, int height, MHRgba colour);
  • libs/libmythtv/dsmccbiop.cpp

     
    173173                       (buf[off + 2] << 8)  | (buf[off + 3]));
    174174    off += 4;
    175175    uint nObjLen = buf[off++];
    176     m_objkey.duplicate((const char*)buf + off, nObjLen);
     176    m_objkey = DSMCCCacheKey((const char*)buf + off, nObjLen);
    177177    off += nObjLen;
    178178    m_objkind_len = ((buf[off + 0] << 24) | (buf[off + 1] << 16) |
    179179                     (buf[off + 2] << 8)  | (buf[off + 3]));
     
    277277    DSMCCCacheReference ref(cachep->CarouselId(), cachep->ModuleId(),
    278278                            cachep->StreamId(), m_objkey);
    279279
    280     QByteArray filedata;
    281     filedata.duplicate((const char *)data+(*curp), content_len);
     280    QByteArray filedata = QByteArray((const char *)data+(*curp), content_len);
    282281    filecache->CacheFileData(ref, filedata);
    283282
    284283    (*curp) += content_len;
     
    416415    version_major = data[off++];
    417416    version_minor = data[off++];
    418417    uint objKeyLen = data[off++]; /* <= 4 */
    419     m_Reference.m_Key.duplicate((char*)data + off, objKeyLen);
     418    m_Reference.m_Key = DSMCCCacheKey((char*)data + off, objKeyLen);
    420419    off += objKeyLen;
    421420    return off;
    422421}
  • libs/libmythtv/mhi.cpp

     
    33#include <QRegion>
    44#include <qbitarray.h>
    55
    6 #include <Q3MemArray>
     6#include <QVector>
    77
    88#include "mhi.h"
    99#include "osd.h"
     
    847847                GetHeight() / MHIContext::StdDisplayHeight,
    848848                Qt::IgnoreAspectRatio,
    849849                Qt::SmoothTransformation);
    850         AddToDisplay(q_scaled.convertDepth(32),
     850        AddToDisplay(q_scaled.convertToFormat(QImage::Format_ARGB32),
    851851                     x * GetWidth() / MHIContext::StdDisplayWidth,
    852852                     y * GetHeight() / MHIContext::StdDisplayHeight);
    853853    }
    854854    else if (!displayRect.isEmpty())
    855855    { // We must clip the image.
    856         QImage clipped = qImage.convertDepth(32)
     856        QImage clipped = qImage.convertToFormat(QImage::Format_ARGB32)
    857857            .copy(displayRect.x() - x, displayRect.y() - y,
    858858                  displayRect.width(), displayRect.height());
    859859        QImage q_scaled =
     
    876876// the screen that is not covered with other visibles.
    877877void MHIContext::DrawBackground(const QRegion &reg)
    878878{
    879     if (reg.isNull() || reg.isEmpty())
     879    if (reg.isEmpty())
    880880        return;
    881881
    882882    QRect bounds = reg.boundingRect();
     
    13121312// Ovals (ellipses)
    13131313void MHIDLA::DrawOval(int x, int y, int width, int height)
    13141314{
    1315     // Simple but inefficient way of drawing a ellipse.
    1316     Q3PointArray ellipse;
    1317     ellipse.makeEllipse(x, y, width, height);
    1318     DrawPoly(true, ellipse);
     1315    // Not implemented.  Not actually used in practice.
    13191316}
    13201317
    13211318// Arcs and sectors
    13221319void MHIDLA::DrawArcSector(int x, int y, int width, int height,
    13231320                           int start, int arc, bool isSector)
    13241321{
    1325     Q3PointArray points;
    1326     // MHEG and Qt both measure arcs as angles anticlockwise from
    1327     // the 3 o'clock position but MHEG uses 64ths of a degree
    1328     // whereas Qt uses 16ths.
    1329     points.makeArc(x, y, width, height, start/4, arc/4);
    1330     if (isSector)
    1331     {
    1332         // Have to add the centre as a point and fill the figure.
    1333         if (arc != 360*64)
    1334             points.putPoints(points.size(), 1, x+width/2, y+height/2);
    1335         DrawPoly(true, points);
    1336     }
    1337     else
    1338         DrawPoly(false, points);
     1322    // Not implemented.  Not actually used in practice.
    13391323}
    13401324
    13411325// Polygons.  This is used directly and also to draw other figures.
     
    13441328// a result of rounding when drawing ellipses.
    13451329typedef struct { int yBottom, yTop, xBottom; float slope; } lineSeg;
    13461330
    1347 void MHIDLA::DrawPoly(bool isFilled, const Q3PointArray &points)
     1331void MHIDLA::DrawPoly(bool isFilled, int nPoints, const int *xArray, const int *yArray)
    13481332{
    1349     int nPoints = points.size();
    13501333    if (nPoints < 2)
    13511334        return;
    13521335
    13531336    if (isFilled)
    13541337    {
    1355         Q3MemArray <lineSeg> lineArray(nPoints);
     1338        QVector <lineSeg> lineArray(nPoints);
    13561339        int nLines = 0;
    13571340        // Initialise the line segment array.  Include all lines
    13581341        // apart from horizontal.  Close the polygon by starting
    13591342        // with the last point in the array.
    1360         int lastX = points[nPoints-1].x(); // Last point
    1361         int lastY = points[nPoints-1].y();
     1343        int lastX = xArray[nPoints-1]; // Last point
     1344        int lastY = yArray[nPoints-1];
    13621345        int yMin = lastY, yMax = lastY;
    13631346        for (int k = 0; k < nPoints; k++)
    13641347        {
    1365             int thisX = points[k].x();
    1366             int thisY = points[k].y();
     1348            int thisX = xArray[k];
     1349            int thisY = yArray[k];
    13671350            if (lastY != thisY)
    13681351            {
    13691352                if (lastY > thisY)
     
    14181401        }
    14191402
    14201403        // Draw the boundary
    1421         QPoint last = points[nPoints-1]; // Last point
     1404        int lastXpoint = xArray[nPoints-1]; // Last point
     1405        int lastYpoint = yArray[nPoints-1];
    14221406        for (int i = 0; i < nPoints; i++)
    14231407        {
    1424             DrawLine(points[i].x(), points[i].y(), last.x(), last.y());
    1425             last = points[i];
     1408            DrawLine(xArray[i], yArray[i], lastXpoint, lastYpoint);
     1409            lastXpoint = xArray[i];
     1410            lastYpoint = yArray[i];
    14261411        }
    14271412    }
    14281413    else // PolyLine - draw lines between the points but don't close it.
    14291414    {
    14301415        for (int i = 1; i < nPoints; i++)
    14311416        {
    1432             DrawLine(points[i].x(), points[i].y(), points[i-1].x(), points[i-1].y());
     1417            DrawLine(xArray[i], yArray[i], xArray[i-1], yArray[i-1]);
    14331418        }
    14341419    }
    14351420}
     
    14431428            return;
    14441429        // Construct an image the size of the bounding box and tile the
    14451430        // bitmap over this.
    1446         QImage tiledImage = QImage(rect.width(), rect.height(),
    1447                                    m_image.depth());
     1431        QImage tiledImage = QImage(rect.width(), rect.height(), QImage::Format_ARGB32);
    14481432
    1449         for (int i = 0; i < rect.width(); i += m_image.width())
     1433        for (int i = 0; i < rect.width(); i++)
    14501434        {
    1451             for (int j = 0; j < rect.height(); j += m_image.height())
     1435            for (int j = 0; j < rect.height(); j++)
    14521436            {
    1453                 bitBlt( &tiledImage, i, j, &m_image, 0, 0, -1, -1, (Qt::ImageConversionFlags)0);
     1437                tiledImage.setPixel(i, j, m_image.pixel(i % m_image.width(), j % m_image.height()));
    14541438            }
    14551439        }
    14561440        m_parent->DrawImage(rect.x(), rect.y(), rect, tiledImage);
     
    14641448// Create a bitmap from PNG.
    14651449void MHIBitmap::CreateFromPNG(const unsigned char *data, int length)
    14661450{
    1467     m_image.reset();
     1451    m_image = QImage();
    14681452
    14691453    if (!m_image.loadFromData(data, length, "PNG"))
    14701454    {
    1471         m_image.reset();
     1455        m_image = QImage();
    14721456        return;
    14731457    }
    14741458
    14751459    // Assume that if it has an alpha buffer then it's partly transparent.
    1476     m_opaque = ! m_image.hasAlphaBuffer();
     1460    m_opaque = ! m_image.hasAlphaChannel();
    14771461}
    14781462
    14791463// Convert an MPEG I-frame into a bitmap.  This is used as the way of
     
    14871471    AVFrame *picture = NULL;
    14881472    uint8_t *buff = NULL, *buffPtr;
    14891473    int gotPicture = 0, len;
    1490     m_image.reset();
     1474    m_image = QImage();
    14911475
    14921476    // Find the mpeg2 video decoder.
    14931477    AVCodec *codec = avcodec_find_decoder(CODEC_ID_MPEG2VIDEO);
     
    15791563
    15801564    if (newWidth <= 0 || newHeight <= 0)
    15811565    { // This would be a bit silly but handle it anyway.
    1582         m_image.reset();
     1566        m_image = QImage();
    15831567        return;
    15841568    }
    15851569
  • libs/libmythfreemheg/Engine.cpp

     
    218218
    219219        // Save the path we use for this app.
    220220        pProgram->m_Path = csPath; // Record the path
    221         int nPos = pProgram->m_Path.findRev('/');
     221        int nPos = pProgram->m_Path.lastIndexOf('/');
    222222        if (nPos < 0) pProgram->m_Path = "";
    223223        else pProgram->m_Path = pProgram->m_Path.left(nPos);
    224224       // Have now got the application.
     
    352352    if (str.Size() != 0) csPath = QString::fromUtf8((const char *)str.Bytes(), str.Size());
    353353    if (csPath.left(4) == "DSM:") csPath = csPath.mid(4); // Remove DSM:
    354354    // If it has any other prefix this isn't a request for a carousel object.
    355     int firstColon = csPath.find(':'), firstSlash = csPath.find('/');
     355    int firstColon = csPath.indexOf(':'), firstSlash = csPath.indexOf('/');
    356356    if (firstColon > 0 && firstSlash > 0 && firstColon < firstSlash)
    357357        return QString();
    358358
     
    364364    }
    365365    // Remove any occurrences of x/../
    366366    int nPos;
    367     while ((nPos = csPath.find("/../")) >= 0) {
     367    while ((nPos = csPath.indexOf("/../")) >= 0) {
    368368        int nEnd = nPos+4;
    369369        while (nPos >= 1 && csPath[nPos-1] != '/') nPos--;
    370370        csPath = csPath.left(nPos) + csPath.mid(nEnd);
  • libs/libmythfreemheg/DynamicLineArt.h

     
    2626#include "Visible.h"
    2727#include "BaseActions.h"
    2828
    29 #include <Q3PointArray>
    30 
    31 
    3229class MHDynamicLineArt;
    3330class MHDLADisplay;
    3431
     
    6663    virtual void DrawLine(int x1, int y1, int x2, int y2, MHEngine *);
    6764    virtual void DrawOval(int x1, int y1, int width, int height, MHEngine *);
    6865    virtual void DrawRectangle(int x1, int y1, int x2, int y2, MHEngine *);
    69     virtual void DrawPoly(bool fIsPolygon, const Q3PointArray &points, MHEngine *);
     66    virtual void DrawPoly(bool fIsPolygon, int nPoints, const int *xArray, const int *yArray, MHEngine *);
    7067
    7168protected:
    7269    MHDLADisplay *m_picture; // The sequence of drawing actions.
  • libs/libmythfreemheg/Root.h

     
    3030class MHIngredient;
    3131class MHEngine;
    3232
    33 #include <q3pointarray.h>
    34 
    3533enum EventType { EventIsAvailable = 1, EventContentAvailable, EventIsDeleted, EventIsRunning, EventIsStopped,
    3634       EventUserInput, EventAnchorFired, EventTimerFired, EventAsyncStopped, EventInteractionCompleted,
    3735       EventTokenMovedFrom, EventTokenMovedTo, EventStreamEvent, EventStreamPlaying, EventStreamStopped,
     
    165163    virtual void GetLineStyle(MHRoot */*pResult*/) { InvalidAction("GetLineStyle"); }
    166164    virtual void GetLineColour(MHRoot */*pResult*/) { InvalidAction("GetLineColour"); }
    167165    virtual void GetFillColour(MHRoot */*pResult*/) { InvalidAction("GetFillColour"); }
    168     virtual void DrawArcSector(bool /*fIsSector*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/, int /*start*/, int /*arc*/, MHEngine *) { InvalidAction("DrawArc/Sector"); }
     166    virtual void DrawArcSector(bool /*fIsSector*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/, int /*start*/,
     167        int /*arc*/, MHEngine *) { InvalidAction("DrawArc/Sector"); }
    169168    virtual void DrawLine(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, MHEngine *) { InvalidAction("DrawLine"); }
    170169    virtual void DrawOval(int /*x1*/, int /*y1*/, int /*width*/, int /*height*/, MHEngine *) { InvalidAction("DrawOval"); }
    171170    virtual void DrawRectangle(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, MHEngine *) { InvalidAction("DrawRectangle"); }
    172     virtual void DrawPoly(bool /*fIsPolygon*/, const Q3PointArray &/*points*/, MHEngine *) { InvalidAction("DrawPoly(gon/line)"); }
     171    virtual void DrawPoly(bool /*fIsPolygon*/, int /*nPoints*/, const int */*xArray*/, const int */*yArray*/, MHEngine *)
     172         { InvalidAction("DrawPoly(gon/line)"); }
    173173
    174174    // Actions on Video streams.
    175175    virtual void ScaleVideo(int /*xScale*/, int /*yScale*/, MHEngine *) { InvalidAction("ScaleVideo"); }
  • libs/libmythfreemheg/libmythfreemheg.pro

     
    2424
    2525LIBS += $$EXTRA_LIBS
    2626
    27 #The following line was inserted by qt3to4
    28 QT += network xml sql qt3support
    29 
    3027include ( ../libs-targetfix.pro )
     28
  • libs/libmythfreemheg/DynamicLineArt.cpp

     
    2929#include "ASN1Codes.h"
    3030#include "Engine.h"
    3131#include "freemheg.h"
    32 #include <Q3PointArray>
    3332
    3433MHDynamicLineArt::MHDynamicLineArt()
    3534{
     
    156155    engine->Redraw(GetVisibleArea());
    157156}
    158157
    159 void MHDynamicLineArt::DrawPoly(bool fIsPolygon, const Q3PointArray &points, MHEngine *engine)
     158void MHDynamicLineArt::DrawPoly(bool fIsPolygon, int nPoints, const int xArray[], const int yArray[], MHEngine *engine)
    160159{
    161     m_picture->DrawPoly(fIsPolygon, points);
     160    m_picture->DrawPoly(fIsPolygon, nPoints, xArray, yArray);
    162161    engine->Redraw(GetVisibleArea());
    163162}
    164163
     
    178177
    179178void MHDrawPoly::Perform(MHEngine *engine)
    180179{
    181     Q3PointArray points(m_Points.Size());
    182     for (int i = 0; i < m_Points.Size(); i++) {
     180    int nPoints = m_Points.Size();
     181    int *xArray = new int[nPoints];
     182    int *yArray = new int[nPoints];
     183    for (int i = 0; i < nPoints; i++) {
    183184        MHPointArg *pPoint = m_Points[i];
    184         points.setPoint(i, pPoint->x.GetValue(engine), pPoint->y.GetValue(engine));
     185        xArray[i] = pPoint->x.GetValue(engine);
     186        yArray[i] = pPoint->y.GetValue(engine);
    185187    }
    186     Target(engine)->DrawPoly(m_fIsPolygon, points, engine);
     188    Target(engine)->DrawPoly(m_fIsPolygon, nPoints, xArray, yArray, engine);
     189    delete[](xArray);
     190    delete[](yArray);
    187191}
    188192
    189193void MHDrawPoly::PrintArgs(FILE *fd, int /*nTabs*/) const
  • libs/libmythfreemheg/freemheg.h

     
    2323#define FREEMHEG_H
    2424
    2525#include <qregion.h>
    26 #include <Q3PointArray>
    2726#include <stdio.h>
    2827#include <stdlib.h>
    2928
     
    159158    virtual void DrawBorderedRectangle(int x, int y, int width, int height) = 0;
    160159    virtual void DrawOval(int x, int y, int width, int height) = 0;
    161160    virtual void DrawArcSector(int x, int y, int width, int height, int start, int arc, bool isSector) = 0;
    162     virtual void DrawPoly(bool isFilled, const Q3PointArray &points) = 0;
     161    virtual void DrawPoly(bool isFilled, int nPoints, const int xArray[], const int yArray[]) = 0;
    163162};
    164163
    165164class MHTextDisplay {