Ticket #5606: 5606-qt4-port-v1.patch
File 5606-qt4-port-v1.patch, 10.6 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/dsmccobjcarousel.cpp
67 67 68 68 if (m_blocks[ddb->block_number] == NULL) 69 69 { // We haven't seen this block before. 70 QByteArray *block = new QByteArray; 71 block->duplicate((char*) data, ddb->len); 70 QByteArray *block = new QByteArray((const char*) data, ddb->len); 72 71 // Add this to our set of blocks. 73 72 m_blocks[ddb->block_number] = block; 74 73 m_receivedData += ddb->len; -
libs/libmythtv/dsmcccache.h
18 18 class DSMCCCacheKey: public QByteArray 19 19 { 20 20 public: 21 DSMCCCacheKey(const char *data, uint sz) : QByteArray(data, (int) sz) {} 21 22 DSMCCCacheKey() {} 22 23 QString toString(void) const; 23 24 // Operator used in < for DSMCCCacheReference -
libs/libmythtv/dsmcccache.cpp
199 199 // Add a file to the directory. 200 200 void DSMCCCache::AddFileInfo(DSMCCCacheDir *pDir, const BiopBinding *pBB) 201 201 { 202 QString name; 203 name.setAscii(pBB->m_name.m_comps[0].m_id 204 /*, pBB->m_name.m_comps[0].m_id_len*/); 202 QString name = QString::fromAscii(pBB->m_name.m_comps[0].m_id); 205 203 206 204 const DSMCCCacheReference *entry = 207 205 pBB->m_ior.m_profile_body->GetReference(); … … 217 215 void DSMCCCache::AddDirInfo(DSMCCCacheDir *pDir, const BiopBinding *pBB) 218 216 { 219 217 // Is it already there? 220 QString name; 221 name.setAscii(pBB->m_name.m_comps[0].m_id 222 /*, pBB->m_name.m_comps[0].m_id_len*/); 218 QString name = QString::fromAscii(pBB->m_name.m_comps[0].m_id); 223 219 const DSMCCCacheReference *entry = 224 220 pBB->m_ior.m_profile_body->GetReference(); 225 221 -
libs/libmythtv/mhi.h
18 18 #include <QString> 19 19 #include <QWaitCondition> 20 20 #include <QImage> 21 22 #ifdef QT3_SUPPORT 21 23 #include <q3pointarray.h> 24 #endif 22 25 23 26 // MythTV headers 24 27 #include "../libmythfreemheg/freemheg.h" … … 288 291 virtual void DrawOval(int x, int y, int width, int height); 289 292 virtual void DrawArcSector(int x, int y, int width, int height, 290 293 int start, int arc, bool isSector); 294 #ifdef QT3_SUPPORT 291 295 virtual void DrawPoly(bool isFilled, const Q3PointArray &points); 296 #else 297 virtual void DrawPoly(bool isFilled, const QPolygon &points); 298 #endif 292 299 293 300 protected: 294 301 void DrawRect(int x, int y, int width, int height, MHRgba colour); -
libs/libmythtv/dsmccbiop.cpp
173 173 (buf[off + 2] << 8) | (buf[off + 3])); 174 174 off += 4; 175 175 uint nObjLen = buf[off++]; 176 m_objkey .duplicate((const char*)buf + off, nObjLen);176 m_objkey = DSMCCCacheKey((const char*)buf + off, nObjLen); 177 177 off += nObjLen; 178 178 m_objkind_len = ((buf[off + 0] << 24) | (buf[off + 1] << 16) | 179 179 (buf[off + 2] << 8) | (buf[off + 3])); … … 277 277 DSMCCCacheReference ref(cachep->CarouselId(), cachep->ModuleId(), 278 278 cachep->StreamId(), m_objkey); 279 279 280 QByteArray filedata; 281 filedata.duplicate((const char *)data+(*curp), content_len); 280 QByteArray filedata = QByteArray((const char *)(data+(*curp)), content_len); 282 281 filecache->CacheFileData(ref, filedata); 283 282 284 283 (*curp) += content_len; … … 416 415 version_major = data[off++]; 417 416 version_minor = data[off++]; 418 417 uint objKeyLen = data[off++]; /* <= 4 */ 419 m_Reference.m_Key .duplicate((char*)data + off, objKeyLen);418 m_Reference.m_Key = DSMCCCacheKey((const char*)data + off, objKeyLen); 420 419 off += objKeyLen; 421 420 return off; 422 421 } -
libs/libmythtv/mhi.cpp
1 1 #include <unistd.h> 2 2 3 #include <QPainter> 3 4 #include <QRegion> 4 5 #include <qbitarray.h> 5 6 6 #include <Q3MemArray> 7 #ifdef QT3_SUPPORT 8 #include <q3memarray.h> 9 #endif 7 10 8 11 #include "mhi.h" 9 12 #include "osd.h" … … 847 850 GetHeight() / MHIContext::StdDisplayHeight, 848 851 Qt::IgnoreAspectRatio, 849 852 Qt::SmoothTransformation); 850 AddToDisplay(q_scaled.convert Depth(32),853 AddToDisplay(q_scaled.convertToFormat(QImage::Format_RGB32), 851 854 x * GetWidth() / MHIContext::StdDisplayWidth, 852 855 y * GetHeight() / MHIContext::StdDisplayHeight); 853 856 } 854 857 else if (!displayRect.isEmpty()) 855 858 { // We must clip the image. 856 QImage clipped = qImage.convert Depth(32)859 QImage clipped = qImage.convertToFormat(QImage::Format_RGB32) 857 860 .copy(displayRect.x() - x, displayRect.y() - y, 858 861 displayRect.width(), displayRect.height()); 859 862 QImage q_scaled = … … 876 879 // the screen that is not covered with other visibles. 877 880 void MHIContext::DrawBackground(const QRegion ®) 878 881 { 879 if (reg.is Null() || reg.isEmpty())882 if (reg.isEmpty()) 880 883 return; 881 884 882 885 QRect bounds = reg.boundingRect(); … … 1313 1316 void MHIDLA::DrawOval(int x, int y, int width, int height) 1314 1317 { 1315 1318 // Simple but inefficient way of drawing a ellipse. 1319 1320 #ifndef QT3_SUPPORT 1321 QPolygon ellipse; 1322 # warning MHEG not supported with Qt4 1323 #else 1316 1324 Q3PointArray ellipse; 1317 1325 ellipse.makeEllipse(x, y, width, height); 1326 #endif 1327 1318 1328 DrawPoly(true, ellipse); 1319 1329 } 1320 1330 … … 1322 1332 void MHIDLA::DrawArcSector(int x, int y, int width, int height, 1323 1333 int start, int arc, bool isSector) 1324 1334 { 1325 Q3PointArray points;1326 1335 // MHEG and Qt both measure arcs as angles anticlockwise from 1327 1336 // the 3 o'clock position but MHEG uses 64ths of a degree 1328 1337 // whereas Qt uses 16ths. 1338 1339 #ifndef QT3_SUPPORT 1340 QPolygon points; 1341 # warning MHEG not supported with Qt4 1342 #else 1343 Q3PointArray points; 1329 1344 points.makeArc(x, y, width, height, start/4, arc/4); 1345 #endif 1346 1330 1347 if (isSector) 1331 1348 { 1332 1349 // Have to add the centre as a point and fill the figure. … … 1344 1361 // a result of rounding when drawing ellipses. 1345 1362 typedef struct { int yBottom, yTop, xBottom; float slope; } lineSeg; 1346 1363 1364 #ifndef QT3_SUPPORT 1365 void MHIDLA::DrawPoly(bool isFilled, const QPolygon &points) 1366 #else 1347 1367 void MHIDLA::DrawPoly(bool isFilled, const Q3PointArray &points) 1368 #endif 1348 1369 { 1349 1370 int nPoints = points.size(); 1350 1371 if (nPoints < 2) 1351 1372 return; 1352 1373 1374 #ifndef QT3_SUPPORT 1375 #warning MHEG not supported with Qt4 1376 #else 1353 1377 if (isFilled) 1354 1378 { 1355 1379 Q3MemArray <lineSeg> lineArray(nPoints); … … 1432 1456 DrawLine(points[i].x(), points[i].y(), points[i-1].x(), points[i-1].y()); 1433 1457 } 1434 1458 } 1459 #endif // QT3_SUPPORT 1435 1460 } 1436 1461 1437 1462 … … 1444 1469 // Construct an image the size of the bounding box and tile the 1445 1470 // bitmap over this. 1446 1471 QImage tiledImage = QImage(rect.width(), rect.height(), 1447 m_image. depth());1472 m_image.format()); 1448 1473 1449 1474 for (int i = 0; i < rect.width(); i += m_image.width()) 1450 1475 { 1451 1476 for (int j = 0; j < rect.height(); j += m_image.height()) 1452 1477 { 1453 bitBlt( &tiledImage, i, j, &m_image, 0, 0, -1, -1, (Qt::ImageConversionFlags)0); 1478 if (tiledImage.isNull() || m_image.isNull()) 1479 continue; 1480 QPainter p(&tiledImage); 1481 p.drawImage(QPoint(i,j), m_image, QRect(0,0,-1,-1), 1482 (Qt::ImageConversionFlags)0); 1454 1483 } 1455 1484 } 1456 1485 m_parent->DrawImage(rect.x(), rect.y(), rect, tiledImage); … … 1464 1493 // Create a bitmap from PNG. 1465 1494 void MHIBitmap::CreateFromPNG(const unsigned char *data, int length) 1466 1495 { 1467 m_image .reset();1496 m_image = QImage(); 1468 1497 1469 1498 if (!m_image.loadFromData(data, length, "PNG")) 1470 1499 { 1471 m_image .reset();1500 m_image = QImage(); 1472 1501 return; 1473 1502 } 1474 1503 1475 1504 // Assume that if it has an alpha buffer then it's partly transparent. 1476 m_opaque = ! m_image.hasAlphaBuffer(); 1505 bool can_be_transparent = 1506 QImage::Format_ARGB32 == m_image.format() || 1507 QImage::Format_ARGB32_Premultiplied == m_image.format(); 1508 #if QT_VERSION >= 0x040400 1509 can_be_transparent |= 1510 QImage::Format_ARGB8565_Premultiplied == m_image.format() || 1511 QImage::Format_ARGB8555_Premultiplied == m_image.format() || 1512 QImage::Format_ARGB6666_Premultiplied == m_image.format() || 1513 QImage::Format_ARGB4444_Premultiplied == m_image.format(); 1514 #endif 1515 m_opaque = !can_be_transparent; 1477 1516 } 1478 1517 1479 1518 // Convert an MPEG I-frame into a bitmap. This is used as the way of … … 1487 1526 AVFrame *picture = NULL; 1488 1527 uint8_t *buff = NULL, *buffPtr; 1489 1528 int gotPicture = 0, len; 1490 m_image .reset();1529 m_image = QImage(); 1491 1530 1492 1531 // Find the mpeg2 video decoder. 1493 1532 AVCodec *codec = avcodec_find_decoder(CODEC_ID_MPEG2VIDEO); … … 1579 1618 1580 1619 if (newWidth <= 0 || newHeight <= 0) 1581 1620 { // This would be a bit silly but handle it anyway. 1582 m_image .reset();1621 m_image = QImage(); 1583 1622 return; 1584 1623 } 1585 1624 -
libs/libmythfreemheg/freemheg.h
23 23 #define FREEMHEG_H 24 24 25 25 #include <qregion.h> 26 #include <Q3PointArray>27 26 #include <stdio.h> 28 27 #include <stdlib.h> 28 #ifdef QT3_SUPPORT 29 #include <q3pointarray.h> 30 #endif 29 31 30 32 class MHDLADisplay; 31 33 class MHTextDisplay; … … 159 161 virtual void DrawBorderedRectangle(int x, int y, int width, int height) = 0; 160 162 virtual void DrawOval(int x, int y, int width, int height) = 0; 161 163 virtual void DrawArcSector(int x, int y, int width, int height, int start, int arc, bool isSector) = 0; 164 165 #ifdef QT3_SUPPORT 162 166 virtual void DrawPoly(bool isFilled, const Q3PointArray &points) = 0; 167 #else 168 virtual void DrawPoly(bool isFilled, const QPolygon &points) = 0; 169 #endif 170 163 171 }; 164 172 165 173 class MHTextDisplay {