#include <ImageHolder.h>
Public Slots | |
void | imageDownloaded (QByteArray imageData) |
void | imageDownloadProgress (int progress) |
Public Member Functions | |
CImageHolder (QWidget *parent=0) | |
virtual | ~CImageHolder () |
void | setPixmap (const QPixmap &imageItem) |
QPixmap | pixmap () const |
void | setOriginalPixmap () |
void | setImagePath (const QString &path) |
Private Attributes | |
QString | m_ImagePath |
CHttpImageDownloader * | m_pImageLoader |
CImageHolder provide API to place image on the constructed QLabel widget like setPixmap().
CImageHolder also reponds to the event like zooom in and zoom out. On zoom in event it scales the set image to the size of the widget. and on the zoom out event it sets the previous scaled image on the widget so that image loading happens only once for the zoom in event. For zoom in and zoom out event in case of google searched images CImageHolder class uses CHttpImageDownloader class oject to download those images from the internet. Once those images are downloaded from the internet, They are scaled to fit into scaled widget size.
CImageHolder::CImageHolder | ( | QWidget * | parent = 0 |
) |
References imageDownloaded(), imageDownloadProgress(), and m_pImageLoader.
CImageHolder::~CImageHolder | ( | ) | [virtual] |
References m_pImageLoader.
void CImageHolder::setPixmap | ( | const QPixmap & | imageItem | ) |
This function set pixmap to the QLabel widget. This pixmap is supposed to be thumbnail size of the original image. While zoom out event occurs this function is called and the thumbnail view of the image is set.
imageItem |
References m_pImageLoader.
Referenced by CustomLabel::imageZoomedOut(), and CustomLabel::setPixmap().
QPixmap CImageHolder::pixmap | ( | ) | const |
void CImageHolder::setOriginalPixmap | ( | ) |
This function is set the original image to the QLabel. It is called when zoom in event occurs, this way image smooth transmission is done from thumbnail view to original pixmap view.
References m_ImagePath, m_pImageLoader, and CHttpImageDownloader::setDownloadImageUrl().
Referenced by CustomLabel::imageZoomedIn().
void CImageHolder::setImagePath | ( | const QString & | path | ) |
This function sets the absolute path of the image or URL of the particular image. Image path is required when zoom in event has occured and smooth image transmission is required from thumbnail view to original image.
Differentiation between local image path and URL is done at runtime when image needs to be changed.
path | URL or absolute path to original image |
References m_ImagePath.
Referenced by CustomLabel::setImagePath().
void CImageHolder::imageDownloaded | ( | QByteArray | imageData | ) | [slot] |
This slot is called from CHttpImageDownloader object when image data is downloaded from the web.However it is not guranteed that downloaded data is actual image or not. This is resolved at the time setting up downloaded image on the QLabel. If the downlaoaded image is not able to create QImage object out of it then appropriate text message is set.
imageData | downloaded image data from web |
Referenced by CImageHolder().
void CImageHolder::imageDownloadProgress | ( | int | progress | ) | [slot] |
This slot is called for monitoring download progress of image.
progress | download progress in percent |
Referenced by CImageHolder().
QString CImageHolder::m_ImagePath [private] |
Referenced by setImagePath(), and setOriginalPixmap().
CHttpImageDownloader* CImageHolder::m_pImageLoader [private] |
Referenced by CImageHolder(), setOriginalPixmap(), setPixmap(), and ~CImageHolder().