Index: configure
===================================================================
--- configure	(revision 18803)
+++ configure	(working copy)
@@ -1173,7 +1173,7 @@
 enable ivtv
 enable lamemp3
 enable lirc
-disable mheg
+enable mheg
 enable opengl
 enable qtwebkit
 enable v4l
Index: libs/libmythtv/libmythtv.pro
===================================================================
--- libs/libmythtv/libmythtv.pro	(revision 18803)
+++ libs/libmythtv/libmythtv.pro	(working copy)
@@ -3,7 +3,6 @@
 
 QT += network xml sql
 using_dbox2:QT *= qt3support
-using_mheg:QT *= qt3support
 
 TEMPLATE = lib
 TARGET = mythtv-$$LIBVERSION
Index: libs/libmythtv/dsmcccache.h
===================================================================
--- libs/libmythtv/dsmcccache.h	(revision 18803)
+++ libs/libmythtv/dsmcccache.h	(working copy)
@@ -19,6 +19,8 @@
 {
   public:
     DSMCCCacheKey() {}
+    DSMCCCacheKey(const char * data, int size):
+        QByteArray(data, size) {}
     QString toString(void) const;
     // Operator used in < for DSMCCCacheReference
     friend bool operator < (const DSMCCCacheKey &key1,
Index: libs/libmythtv/dsmccobjcarousel.cpp
===================================================================
--- libs/libmythtv/dsmccobjcarousel.cpp	(revision 18803)
+++ libs/libmythtv/dsmccobjcarousel.cpp	(working copy)
@@ -67,8 +67,7 @@
 
     if (m_blocks[ddb->block_number] == NULL)
     {   // We haven't seen this block before.
-        QByteArray *block = new QByteArray;
-        block->duplicate((char*) data, ddb->len);
+        QByteArray *block = new QByteArray((char*) data, ddb->len);
         // Add this to our set of blocks.
         m_blocks[ddb->block_number] = block;
         m_receivedData += ddb->len;
Index: libs/libmythtv/dsmcccache.cpp
===================================================================
--- libs/libmythtv/dsmcccache.cpp	(revision 18803)
+++ libs/libmythtv/dsmcccache.cpp	(working copy)
@@ -200,7 +200,7 @@
 void DSMCCCache::AddFileInfo(DSMCCCacheDir *pDir, const BiopBinding *pBB)
 {
     QString name;
-    name.setAscii(pBB->m_name.m_comps[0].m_id
+    name = QString::fromAscii(pBB->m_name.m_comps[0].m_id
                   /*, pBB->m_name.m_comps[0].m_id_len*/);
 
     const DSMCCCacheReference *entry =
@@ -218,7 +218,7 @@
 {
     // Is it already there?
     QString name;
-    name.setAscii(pBB->m_name.m_comps[0].m_id
+    name = QString::fromAscii(pBB->m_name.m_comps[0].m_id
                   /*, pBB->m_name.m_comps[0].m_id_len*/);
     const DSMCCCacheReference *entry =
         pBB->m_ior.m_profile_body->GetReference();
Index: libs/libmythtv/mhi.h
===================================================================
--- libs/libmythtv/mhi.h	(revision 18803)
+++ libs/libmythtv/mhi.h	(working copy)
@@ -18,7 +18,6 @@
 #include <QString>
 #include <QWaitCondition>
 #include <QImage>
-#include <q3pointarray.h>
 
 // MythTV headers
 #include "../libmythfreemheg/freemheg.h"
@@ -288,7 +287,7 @@
     virtual void DrawOval(int x, int y, int width, int height);
     virtual void DrawArcSector(int x, int y, int width, int height,
                                int start, int arc, bool isSector);
-    virtual void DrawPoly(bool isFilled, const Q3PointArray &points);
+    virtual void DrawPoly(bool isFilled, int nPoints, const int *xArray, const int *yArray);
 
   protected:
     void DrawRect(int x, int y, int width, int height, MHRgba colour);
Index: libs/libmythtv/dsmccbiop.cpp
===================================================================
--- libs/libmythtv/dsmccbiop.cpp	(revision 18803)
+++ libs/libmythtv/dsmccbiop.cpp	(working copy)
@@ -173,7 +173,7 @@
                        (buf[off + 2] << 8)  | (buf[off + 3]));
     off += 4;
     uint nObjLen = buf[off++];
-    m_objkey.duplicate((const char*)buf + off, nObjLen);
+    m_objkey = DSMCCCacheKey((const char*)buf + off, nObjLen);
     off += nObjLen;
     m_objkind_len = ((buf[off + 0] << 24) | (buf[off + 1] << 16) |
                      (buf[off + 2] << 8)  | (buf[off + 3]));
@@ -277,8 +277,7 @@
     DSMCCCacheReference ref(cachep->CarouselId(), cachep->ModuleId(),
                             cachep->StreamId(), m_objkey);
 
-    QByteArray filedata;
-    filedata.duplicate((const char *)data+(*curp), content_len);
+    QByteArray filedata = QByteArray((const char *)data+(*curp), content_len);
     filecache->CacheFileData(ref, filedata);
 
     (*curp) += content_len;
@@ -416,7 +415,7 @@
     version_major = data[off++];
     version_minor = data[off++];
     uint objKeyLen = data[off++]; /* <= 4 */
-    m_Reference.m_Key.duplicate((char*)data + off, objKeyLen);
+    m_Reference.m_Key = DSMCCCacheKey((char*)data + off, objKeyLen);
     off += objKeyLen;
     return off;
 }
Index: libs/libmythtv/mhi.cpp
===================================================================
--- libs/libmythtv/mhi.cpp	(revision 18803)
+++ libs/libmythtv/mhi.cpp	(working copy)
@@ -3,7 +3,7 @@
 #include <QRegion>
 #include <qbitarray.h>
 
-#include <Q3MemArray>
+#include <QVector>
 
 #include "mhi.h"
 #include "osd.h"
@@ -847,13 +847,13 @@
                 GetHeight() / MHIContext::StdDisplayHeight,
                 Qt::IgnoreAspectRatio,
                 Qt::SmoothTransformation);
-        AddToDisplay(q_scaled.convertDepth(32),
+        AddToDisplay(q_scaled.convertToFormat(QImage::Format_ARGB32),
                      x * GetWidth() / MHIContext::StdDisplayWidth,
                      y * GetHeight() / MHIContext::StdDisplayHeight);
     }
     else if (!displayRect.isEmpty())
     { // We must clip the image.
-        QImage clipped = qImage.convertDepth(32)
+        QImage clipped = qImage.convertToFormat(QImage::Format_ARGB32)
             .copy(displayRect.x() - x, displayRect.y() - y,
                   displayRect.width(), displayRect.height());
         QImage q_scaled =
@@ -876,7 +876,7 @@
 // the screen that is not covered with other visibles.
 void MHIContext::DrawBackground(const QRegion &reg)
 {
-    if (reg.isNull() || reg.isEmpty())
+    if (reg.isEmpty())
         return;
 
     QRect bounds = reg.boundingRect();
@@ -1312,30 +1312,14 @@
 // Ovals (ellipses)
 void MHIDLA::DrawOval(int x, int y, int width, int height)
 {
-    // Simple but inefficient way of drawing a ellipse.
-    Q3PointArray ellipse;
-    ellipse.makeEllipse(x, y, width, height);
-    DrawPoly(true, ellipse);
+    // Not implemented.  Not actually used in practice.
 }
 
 // Arcs and sectors
 void MHIDLA::DrawArcSector(int x, int y, int width, int height,
                            int start, int arc, bool isSector)
 {
-    Q3PointArray points;
-    // MHEG and Qt both measure arcs as angles anticlockwise from
-    // the 3 o'clock position but MHEG uses 64ths of a degree
-    // whereas Qt uses 16ths.
-    points.makeArc(x, y, width, height, start/4, arc/4);
-    if (isSector)
-    {
-        // Have to add the centre as a point and fill the figure.
-        if (arc != 360*64)
-            points.putPoints(points.size(), 1, x+width/2, y+height/2);
-        DrawPoly(true, points);
-    }
-    else
-        DrawPoly(false, points);
+    // Not implemented.  Not actually used in practice.
 }
 
 // Polygons.  This is used directly and also to draw other figures.
@@ -1344,26 +1328,25 @@
 // a result of rounding when drawing ellipses.
 typedef struct { int yBottom, yTop, xBottom; float slope; } lineSeg;
 
-void MHIDLA::DrawPoly(bool isFilled, const Q3PointArray &points)
+void MHIDLA::DrawPoly(bool isFilled, int nPoints, const int *xArray, const int *yArray)
 {
-    int nPoints = points.size();
     if (nPoints < 2)
         return;
 
     if (isFilled)
     {
-        Q3MemArray <lineSeg> lineArray(nPoints);
+        QVector <lineSeg> lineArray(nPoints);
         int nLines = 0;
         // Initialise the line segment array.  Include all lines
         // apart from horizontal.  Close the polygon by starting
         // with the last point in the array.
-        int lastX = points[nPoints-1].x(); // Last point
-        int lastY = points[nPoints-1].y();
+        int lastX = xArray[nPoints-1]; // Last point
+        int lastY = yArray[nPoints-1];
         int yMin = lastY, yMax = lastY;
         for (int k = 0; k < nPoints; k++)
         {
-            int thisX = points[k].x();
-            int thisY = points[k].y();
+            int thisX = xArray[k];
+            int thisY = yArray[k];
             if (lastY != thisY)
             {
                 if (lastY > thisY)
@@ -1418,18 +1401,20 @@
         }
 
         // Draw the boundary
-        QPoint last = points[nPoints-1]; // Last point
+        int lastXpoint = xArray[nPoints-1]; // Last point
+        int lastYpoint = yArray[nPoints-1];
         for (int i = 0; i < nPoints; i++)
         {
-            DrawLine(points[i].x(), points[i].y(), last.x(), last.y());
-            last = points[i];
+            DrawLine(xArray[i], yArray[i], lastXpoint, lastYpoint);
+            lastXpoint = xArray[i];
+            lastYpoint = yArray[i];
         }
     }
     else // PolyLine - draw lines between the points but don't close it.
     {
         for (int i = 1; i < nPoints; i++)
         {
-            DrawLine(points[i].x(), points[i].y(), points[i-1].x(), points[i-1].y());
+            DrawLine(xArray[i], yArray[i], xArray[i-1], yArray[i-1]);
         }
     }
 }
@@ -1443,14 +1428,13 @@
             return;
         // Construct an image the size of the bounding box and tile the
         // bitmap over this.
-        QImage tiledImage = QImage(rect.width(), rect.height(),
-                                   m_image.depth());
+        QImage tiledImage = QImage(rect.width(), rect.height(), QImage::Format_ARGB32);
 
-        for (int i = 0; i < rect.width(); i += m_image.width())
+        for (int i = 0; i < rect.width(); i++)
         {
-            for (int j = 0; j < rect.height(); j += m_image.height())
+            for (int j = 0; j < rect.height(); j++)
             {
-                bitBlt( &tiledImage, i, j, &m_image, 0, 0, -1, -1, (Qt::ImageConversionFlags)0);
+                tiledImage.setPixel(i, j, m_image.pixel(i % m_image.width(), j % m_image.height()));
             }
         }
         m_parent->DrawImage(rect.x(), rect.y(), rect, tiledImage);
@@ -1464,16 +1448,16 @@
 // Create a bitmap from PNG.
 void MHIBitmap::CreateFromPNG(const unsigned char *data, int length)
 {
-    m_image.reset();
+    m_image = QImage();
 
     if (!m_image.loadFromData(data, length, "PNG"))
     {
-        m_image.reset();
+        m_image = QImage();
         return;
     }
 
     // Assume that if it has an alpha buffer then it's partly transparent.
-    m_opaque = ! m_image.hasAlphaBuffer();
+    m_opaque = ! m_image.hasAlphaChannel();
 }
 
 // Convert an MPEG I-frame into a bitmap.  This is used as the way of
@@ -1487,7 +1471,7 @@
     AVFrame *picture = NULL;
     uint8_t *buff = NULL, *buffPtr;
     int gotPicture = 0, len;
-    m_image.reset();
+    m_image = QImage();
 
     // Find the mpeg2 video decoder.
     AVCodec *codec = avcodec_find_decoder(CODEC_ID_MPEG2VIDEO);
@@ -1579,7 +1563,7 @@
 
     if (newWidth <= 0 || newHeight <= 0)
     { // This would be a bit silly but handle it anyway.
-        m_image.reset();
+        m_image = QImage();
         return;
     }
 
Index: libs/libmythfreemheg/Engine.cpp
===================================================================
--- libs/libmythfreemheg/Engine.cpp	(revision 18803)
+++ libs/libmythfreemheg/Engine.cpp	(working copy)
@@ -218,7 +218,7 @@
 
         // Save the path we use for this app.
         pProgram->m_Path = csPath; // Record the path
-        int nPos = pProgram->m_Path.findRev('/');
+        int nPos = pProgram->m_Path.lastIndexOf('/');
         if (nPos < 0) pProgram->m_Path = "";
         else pProgram->m_Path = pProgram->m_Path.left(nPos);
        // Have now got the application.
@@ -352,7 +352,7 @@
     if (str.Size() != 0) csPath = QString::fromUtf8((const char *)str.Bytes(), str.Size());
     if (csPath.left(4) == "DSM:") csPath = csPath.mid(4); // Remove DSM:
     // If it has any other prefix this isn't a request for a carousel object.
-    int firstColon = csPath.find(':'), firstSlash = csPath.find('/');
+    int firstColon = csPath.indexOf(':'), firstSlash = csPath.indexOf('/');
     if (firstColon > 0 && firstSlash > 0 && firstColon < firstSlash)
         return QString();
 
@@ -364,7 +364,7 @@
     }
     // Remove any occurrences of x/../
     int nPos;
-    while ((nPos = csPath.find("/../")) >= 0) {
+    while ((nPos = csPath.indexOf("/../")) >= 0) {
         int nEnd = nPos+4;
         while (nPos >= 1 && csPath[nPos-1] != '/') nPos--;
         csPath = csPath.left(nPos) + csPath.mid(nEnd);
Index: libs/libmythfreemheg/DynamicLineArt.h
===================================================================
--- libs/libmythfreemheg/DynamicLineArt.h	(revision 18803)
+++ libs/libmythfreemheg/DynamicLineArt.h	(working copy)
@@ -26,9 +26,6 @@
 #include "Visible.h"
 #include "BaseActions.h"
 
-#include <Q3PointArray>
-
-
 class MHDynamicLineArt;
 class MHDLADisplay;
 
@@ -66,7 +63,7 @@
     virtual void DrawLine(int x1, int y1, int x2, int y2, MHEngine *);
     virtual void DrawOval(int x1, int y1, int width, int height, MHEngine *);
     virtual void DrawRectangle(int x1, int y1, int x2, int y2, MHEngine *);
-    virtual void DrawPoly(bool fIsPolygon, const Q3PointArray &points, MHEngine *);
+    virtual void DrawPoly(bool fIsPolygon, int nPoints, const int *xArray, const int *yArray, MHEngine *);
 
 protected:
     MHDLADisplay *m_picture; // The sequence of drawing actions.
Index: libs/libmythfreemheg/Root.h
===================================================================
--- libs/libmythfreemheg/Root.h	(revision 18803)
+++ libs/libmythfreemheg/Root.h	(working copy)
@@ -30,8 +30,6 @@
 class MHIngredient;
 class MHEngine;
 
-#include <q3pointarray.h>
-
 enum EventType { EventIsAvailable = 1, EventContentAvailable, EventIsDeleted, EventIsRunning, EventIsStopped,
        EventUserInput, EventAnchorFired, EventTimerFired, EventAsyncStopped, EventInteractionCompleted,
        EventTokenMovedFrom, EventTokenMovedTo, EventStreamEvent, EventStreamPlaying, EventStreamStopped,
@@ -165,11 +163,13 @@
     virtual void GetLineStyle(MHRoot */*pResult*/) { InvalidAction("GetLineStyle"); }
     virtual void GetLineColour(MHRoot */*pResult*/) { InvalidAction("GetLineColour"); }
     virtual void GetFillColour(MHRoot */*pResult*/) { InvalidAction("GetFillColour"); }
-    virtual void DrawArcSector(bool /*fIsSector*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/, int /*start*/, int /*arc*/, MHEngine *) { InvalidAction("DrawArc/Sector"); }
+    virtual void DrawArcSector(bool /*fIsSector*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/, int /*start*/,
+        int /*arc*/, MHEngine *) { InvalidAction("DrawArc/Sector"); }
     virtual void DrawLine(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, MHEngine *) { InvalidAction("DrawLine"); }
     virtual void DrawOval(int /*x1*/, int /*y1*/, int /*width*/, int /*height*/, MHEngine *) { InvalidAction("DrawOval"); }
     virtual void DrawRectangle(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, MHEngine *) { InvalidAction("DrawRectangle"); }
-    virtual void DrawPoly(bool /*fIsPolygon*/, const Q3PointArray &/*points*/, MHEngine *) { InvalidAction("DrawPoly(gon/line)"); }
+    virtual void DrawPoly(bool /*fIsPolygon*/, int /*nPoints*/, const int */*xArray*/, const int */*yArray*/, MHEngine *)
+         { InvalidAction("DrawPoly(gon/line)"); }
 
     // Actions on Video streams.
     virtual void ScaleVideo(int /*xScale*/, int /*yScale*/, MHEngine *) { InvalidAction("ScaleVideo"); }
Index: libs/libmythfreemheg/libmythfreemheg.pro
===================================================================
--- libs/libmythfreemheg/libmythfreemheg.pro	(revision 18803)
+++ libs/libmythfreemheg/libmythfreemheg.pro	(working copy)
@@ -24,7 +24,5 @@
 
 LIBS += $$EXTRA_LIBS
 
-#The following line was inserted by qt3to4
-QT += network xml sql qt3support
-
 include ( ../libs-targetfix.pro )
+
Index: libs/libmythfreemheg/DynamicLineArt.cpp
===================================================================
--- libs/libmythfreemheg/DynamicLineArt.cpp	(revision 18803)
+++ libs/libmythfreemheg/DynamicLineArt.cpp	(working copy)
@@ -29,7 +29,6 @@
 #include "ASN1Codes.h"
 #include "Engine.h"
 #include "freemheg.h"
-#include <Q3PointArray>
 
 MHDynamicLineArt::MHDynamicLineArt()
 {
@@ -156,9 +155,9 @@
     engine->Redraw(GetVisibleArea());
 }
 
-void MHDynamicLineArt::DrawPoly(bool fIsPolygon, const Q3PointArray &points, MHEngine *engine)
+void MHDynamicLineArt::DrawPoly(bool fIsPolygon, int nPoints, const int xArray[], const int yArray[], MHEngine *engine)
 {
-    m_picture->DrawPoly(fIsPolygon, points);
+    m_picture->DrawPoly(fIsPolygon, nPoints, xArray, yArray);
     engine->Redraw(GetVisibleArea());
 }
 
@@ -178,12 +177,17 @@
 
 void MHDrawPoly::Perform(MHEngine *engine)
 {
-    Q3PointArray points(m_Points.Size());
-    for (int i = 0; i < m_Points.Size(); i++) {
+    int nPoints = m_Points.Size();
+    int *xArray = new int[nPoints];
+    int *yArray = new int[nPoints];
+    for (int i = 0; i < nPoints; i++) {
         MHPointArg *pPoint = m_Points[i];
-        points.setPoint(i, pPoint->x.GetValue(engine), pPoint->y.GetValue(engine));
+        xArray[i] = pPoint->x.GetValue(engine);
+        yArray[i] = pPoint->y.GetValue(engine);
     }
-    Target(engine)->DrawPoly(m_fIsPolygon, points, engine);
+    Target(engine)->DrawPoly(m_fIsPolygon, nPoints, xArray, yArray, engine);
+    delete[](xArray);
+    delete[](yArray);
 }
 
 void MHDrawPoly::PrintArgs(FILE *fd, int /*nTabs*/) const
Index: libs/libmythfreemheg/freemheg.h
===================================================================
--- libs/libmythfreemheg/freemheg.h	(revision 18803)
+++ libs/libmythfreemheg/freemheg.h	(working copy)
@@ -23,7 +23,6 @@
 #define FREEMHEG_H
 
 #include <qregion.h>
-#include <Q3PointArray>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -159,7 +158,7 @@
     virtual void DrawBorderedRectangle(int x, int y, int width, int height) = 0;
     virtual void DrawOval(int x, int y, int width, int height) = 0;
     virtual void DrawArcSector(int x, int y, int width, int height, int start, int arc, bool isSector) = 0;
-    virtual void DrawPoly(bool isFilled, const Q3PointArray &points) = 0;
+    virtual void DrawPoly(bool isFilled, int nPoints, const int xArray[], const int yArray[]) = 0;
 };
 
 class MHTextDisplay {
