Permalink
Browse files

Get mythnews compiling with Qt5.

  • Loading branch information...
daniel-kristjansson committed May 20, 2013
1 parent 8d7a29a commit 4715f1379a3521f50248d729e9688c289027efaf
@@ -21,11 +21,14 @@
#include <mythuiimage.h>
#include <mythsystem.h>
#include <mythuitext.h>
#include <httpcomms.h>
#include <mythdate.h>
#include <mythdirs.h>
#include <mythdb.h>
#if QT_VERSION < 0x050000
#include <httpcomms.h>
#endif
// MythNews headers
#include "mythnews.h"
#include "mythnewseditor.h"
@@ -311,9 +314,13 @@ void MythNews::updateInfoView(MythUIButtonListItem *selected)
.arg(qChecksum(url.toLocal8Bit().constData(),
url.toLocal8Bit().size()));
#if QT_VERSION < 0x050000
bool exists = QFile::exists(sFilename);
if (!exists)
HttpComms::getHttpFile(sFilename, url, 20000, 1, 2);
#else
#warning MythNews::updateInfoView() has not yet been ported to Qt5
#endif
if (m_thumbnailImage)
{
@@ -351,9 +358,13 @@ void MythNews::updateInfoView(MythUIButtonListItem *selected)
.arg(sitename)
.arg(extension);
#if QT_VERSION < 0x050000
bool exists = QFile::exists(sFilename);
if (!exists)
HttpComms::getHttpFile(sFilename, url, 20000, 1, 2);
#else
#warning MythNews::updateInfoView() has not yet been ported to Qt5
#endif
if (m_thumbnailImage)
{
@@ -439,9 +450,13 @@ void MythNews::updateInfoView(MythUIButtonListItem *selected)
.arg(sitename)
.arg(extension);
#if QT_VERSION < 0x050000
bool exists = QFile::exists(sFilename);
if (!exists)
HttpComms::getHttpFile(sFilename, url, 20000, 1, 2);
#else
#warning MythNews::updateInfoView() has not yet been ported to Qt5
#endif
if (m_thumbnailImage)
{
@@ -471,6 +486,7 @@ void MythNews::updateInfoView(MythUIButtonListItem *selected)
m_updatedText->SetText(text);
}
#if QT_VERSION < 0x050000
if (m_httpGrabber != NULL)
{
int progress = m_httpGrabber->getProgress();
@@ -485,6 +501,9 @@ void MythNews::updateInfoView(MythUIButtonListItem *selected)
m_updatedText->SetText(text);
}
}
#else
#warning MythNews::updateInfoView() has not yet been ported to Qt5
#endif
}
}
@@ -701,6 +720,7 @@ void MythNews::createProgress(const QString &title)
bool MythNews::getHttpFile(const QString &sFilename, const QString &cmdURL)
{
#if QT_VERSION < 0x050000
QMutexLocker locker(&m_lock);
int redirectCount = 0;
@@ -791,7 +811,12 @@ bool MythNews::getHttpFile(const QString &sFilename, const QString &cmdURL)
delete m_httpGrabber;
m_httpGrabber = NULL;
return res;
#else
#warning MythNews::getHttpFile() has not yet been ported to Qt5
(void) sFilename;
(void) cmdURL;
return false;
#endif
}
void MythNews::slotViewArticle(MythUIButtonListItem *articlesListItem)
@@ -2,14 +2,13 @@
#define MYTHNEWS_H
// MythTV headers
#include <httpcomms.h>
#include <mythscreentype.h>
// MythNews headers
#include "newssite.h"
class QTimer;
class HtppComms;
class HttpComms;
class MythUIText;
class MythUIImage;
class MythDialogBox;
@@ -34,15 +34,19 @@ NewsSite::NewsSite(const QString &name,
void NewsSite::deleteLater()
{
QMutexLocker locker(&m_lock);
#if QT_VERSION < 0x050000
MythHttpPool::GetSingleton()->RemoveListener(this);
#endif
m_articleList.clear();
QObject::deleteLater();
}
NewsSite::~NewsSite()
{
QMutexLocker locker(&m_lock);
#if QT_VERSION < 0x050000
MythHttpPool::GetSingleton()->RemoveListener(this);
#endif
}
void NewsSite::insertNewsArticle(const NewsArticle &item)
@@ -68,13 +72,17 @@ void NewsSite::retrieve(void)
m_updateErrorString = QString::null;
m_articleList.clear();
m_urlReq = QUrl(m_url);
#if QT_VERSION < 0x050000
MythHttpPool::GetSingleton()->AddUrlRequest(m_urlReq, this);
#endif
}
void NewsSite::stop(void)
{
QMutexLocker locker(&m_lock);
#if QT_VERSION < 0x050000
MythHttpPool::GetSingleton()->RemoveUrlRequest(m_urlReq, this);
#endif
}
bool NewsSite::successful(void) const
@@ -148,6 +156,7 @@ unsigned int NewsSite::timeSinceLastUpdate(void) const
return min;
}
#if QT_VERSION < 0x050000
void NewsSite::Update(QHttp::Error error,
const QString &error_str,
const QUrl &url,
@@ -215,6 +224,7 @@ void NewsSite::Update(QHttp::Error error,
emit finished(this);
}
#endif
void NewsSite::process(void)
{
@@ -6,15 +6,20 @@
using namespace std;
// MythTV headers
#include <QObject>
#if QT_VERSION < 0x050000
#include <mythhttppool.h>
#endif
// QT headers
#include <QString>
#include <QObject>
#include <QDateTime>
#include <QDomDocument>
#include <QVariant>
#include <QByteArray>
#include <QDateTime>
#include <QVariant>
#include <QObject>
#include <QString>
#include <QMutex>
#include <QUrl>
// MythNews headers
#include "newsarticle.h"
@@ -46,7 +51,10 @@ class NewsCategory
Q_DECLARE_METATYPE(NewsCategory*)
class NewsSite;
class NewsSite : public QObject, public MythHttpListener
class NewsSite : public QObject
#if QT_VERSION < 0x050000
, public MythHttpListener
#endif
{
Q_OBJECT
@@ -99,12 +107,14 @@ class NewsSite : public QObject, public MythHttpListener
bool successful(void) const;
QString errorMsg(void) const;
#if QT_VERSION < 0x050000
virtual void Update(QHttp::Error error,
const QString &error_str,
const QUrl &url,
uint http_status_id,
const QString &http_status_str,
const QByteArray &data);
#endif
private:
~NewsSite();

0 comments on commit 4715f13

Please sign in to comment.