CHttpImageDownloader Class Reference

#include <HttpImageDownloader.h>

List of all members.

Public Slots

void downloadImage (const QString &imageUrl)

Signals

void downloading (int)
void downloadComplete (QByteArray downloadedImageData, QString mainURL)

Public Member Functions

 CHttpImageDownloader (const QString &imageUrl, const QString &imageMainUrl, QObject *parent=0)
virtual ~CHttpImageDownloader ()
void setDownloadImageUrl (const QString &imageUrl)

Protected Member Functions

virtual void run ()

Private Slots

void httpRequestFinished (int requestId, bool error)
void readResponseHeader (const QHttpResponseHeader &responseHeader)
void updateDataReadProgress (int bytesRead, int totalBytes)

Private Attributes

QHttp * http
QBuffer buffer
int httpGetId
QString m_ImageUrl
QString m_ImageMainUrl


Detailed Description

CHttpImageDownloader class provides methods to download image files from the web servers.CHttpImageDownloader class runs in a different thread and once the image is downloaded 100%, it emits downloadComplete() signal. CHttpImageDownloader class also emits signal for progress of the downloaded image.

CHttpImageDownloader class also stores the thumbnail view URL and original view URL of the image, when download complete it emits original view URL with the downaloded image byte array.

Author:
vishwajeet <vishwajeet.dusane@gmail.com>

Constructor & Destructor Documentation

CHttpImageDownloader::CHttpImageDownloader ( const QString &  imageUrl,
const QString &  imageMainUrl,
QObject *  parent = 0 
)

Parameters:
imageUrl image URL that need to be downloaded
imageMainUrl image URL that need to be emitted with downloadComplete() signal
parent 

References http, httpRequestFinished(), m_ImageMainUrl, m_ImageUrl, readResponseHeader(), and updateDataReadProgress().

CHttpImageDownloader::~CHttpImageDownloader (  )  [virtual]


Member Function Documentation

void CHttpImageDownloader::setDownloadImageUrl ( const QString &  imageUrl  ) 

This function set the URL from which image needs to be downloaded.

Parameters:
imageUrl URL for the image loacation

References m_ImageUrl.

Referenced by CImageHolder::setOriginalPixmap().

Here is the caller graph for this function:

void CHttpImageDownloader::downloadImage ( const QString &  imageUrl  )  [slot]

This slot invoked download process for the set URL

Parameters:
imageUrl 

References buffer, http, and httpGetId.

Referenced by run().

void CHttpImageDownloader::run (  )  [protected, virtual]

References downloadImage(), and m_ImageUrl.

void CHttpImageDownloader::httpRequestFinished ( int  requestId,
bool  error 
) [private, slot]

void CHttpImageDownloader::readResponseHeader ( const QHttpResponseHeader &  responseHeader  )  [private, slot]

References http.

Referenced by CHttpImageDownloader().

void CHttpImageDownloader::updateDataReadProgress ( int  bytesRead,
int  totalBytes 
) [private, slot]

References downloading().

Referenced by CHttpImageDownloader().

void CHttpImageDownloader::downloading ( int   )  [signal]

This signal is emitted when image download from the web server is started. This signal emits progress in percent for the downloaded image. Progress emitted byt his signal range from 0-100

Parameters:
 

Referenced by updateDataReadProgress().

void CHttpImageDownloader::downloadComplete ( QByteArray  downloadedImageData,
QString  mainURL 
) [signal]

This signal is called when image is downloaded web server. This signal emits bytearray of the downloaded image and also original image URL.

Parameters:
downloadedImageData downloaded image data from the web server
mainURL URL for the original image

Referenced by httpRequestFinished().


Member Data Documentation

QHttp* CHttpImageDownloader::http [private]

QBuffer CHttpImageDownloader::buffer [private]


The documentation for this class was generated from the following files:

Generated on Mon Apr 27 15:25:35 2009 for PictureWall by  doxygen 1.5.6