diff -r 2a272ef608c4 -r 3507212d340e messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp Tue Aug 03 21:34:40 2010 +0530 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp Fri Aug 06 23:19:50 2010 +0530 @@ -34,6 +34,8 @@ const QString VIDEO_MIMETYPE("video"); const QString TEXT_MIMETYPE("text"); +static const char VIDEO_ICON[] = "qtg_large_video_player"; + //--------------------------------------------------------------- //UniViewerBodyWidget::UniViewerBodyWidget // @see header file @@ -54,98 +56,6 @@ } //--------------------------------------------------------------- -//UniViewerBodyWidget::setImage -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::setPixmap(UniMessageInfo *info) -{ - setHasPixmap(true); - //create image item instance - if (!mPixmapItem) { - mPixmapItem = new UniViewerPixmapWidget(this); - HbStyle::setItemName(mPixmapItem, "pixmap"); - } - mPixmapItem->hide(); - mPixmapItem->populate(info); - - this->repolish(); -} - -//--------------------------------------------------------------- -//UniViewerBodyWidget::setAudio -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::setAudio(UniMessageInfo *info) -{ - if (!mAudioItem) { - mAudioItem = new UniViewerAudioWidget(this); - HbStyle::setItemName(mAudioItem, "audioItem"); - } - mAudioItem->hide(); - mAudioItem->populate(info); - - this->repolish(); -} - -//--------------------------------------------------------------- -//UniViewerBodyWidget::setVideo -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::setVideo(UniMessageInfo *info) -{ - setHasPixmap(true); - //create image item instance - if (!mPixmapItem) { - mPixmapItem = new UniViewerPixmapWidget(this); - HbStyle::setItemName(mPixmapItem, "pixmap"); - connect(mPixmapItem, SIGNAL(setOverlayIcon(QString)), this, SLOT(setOverlayIcon(QString))); - } - mPixmapItem->hide(); - mPixmapItem->populate(info); - - this->repolish(); -} - -//--------------------------------------------------------------- -//UniViewerBodyWidget::setText -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::setText(QString text) -{ - setHasText(true); - - if (!mTextItem) { - mTextItem = new UniViewerTextItem(this); - HbStyle::setItemName(mTextItem, "textItem"); - connect(mTextItem, SIGNAL(sendMessage(const QString&)), this, - SIGNAL(sendMessage(const QString&))); - } - mTextItem->hide(); - text.replace(QChar::ParagraphSeparator, QChar::LineSeparator); - text.replace('\r', QChar::LineSeparator); - mTextItem->setText(text); - - this->repolish(); -} - -//--------------------------------------------------------------- -// UniViewerBodyWidget::setSlideCounter -// @see header file -//--------------------------------------------------------------- -void UniViewerBodyWidget::setSlideCounter(QString &slideCounter) -{ - if (!mSlideCounter) { - mSlideCounter = new HbTextItem(this); - HbStyle::setItemName(mSlideCounter, "slideCounter"); - } - - mSlideCounter->hide(); - mSlideCounter->setText(slideCounter); - - this->repolish(); -} - -//--------------------------------------------------------------- // UniViewerBodyWidget::setHasText // @see header file //--------------------------------------------------------------- @@ -263,18 +173,24 @@ } //--------------------------------------------------------------- -// UniViewerBodyWidget::setOverlayIcon +// UniViewerBodyWidget::setText // @see header file //--------------------------------------------------------------- -void UniViewerBodyWidget::setOverlayIcon(const QString &iconName) +void UniViewerBodyWidget::setText(QString text) { - if (!mOverlayItem) { - mOverlayItem = new HbIconItem(this); - HbStyle::setItemName(mOverlayItem, "overlayItem"); + setHasText(true); + + if (!mTextItem) { + mTextItem = new UniViewerTextItem(this); + mTextItem->setObjectName("textItem"); + HbStyle::setItemName(mTextItem, "textItem"); + connect(mTextItem, SIGNAL(sendMessage(const QString&)), this, + SIGNAL(sendMessage(const QString&))); } - - mOverlayItem->hide(); - mOverlayItem->setIconName(iconName); + mTextItem->hide(); + text.replace(QChar::ParagraphSeparator, QChar::LineSeparator); + text.replace('\r', QChar::LineSeparator); + mTextItem->setText(text); this->repolish(); } @@ -429,4 +345,115 @@ return szHint; } +//--------------------------------------------------------------- +//UniViewerBodyWidget::setPixmap +// @see header file +//--------------------------------------------------------------- +void UniViewerBodyWidget::setPixmap(UniMessageInfo *info) +{ + setHasPixmap(true); + //create image item instance + if (!mPixmapItem) { + mPixmapItem = new UniViewerPixmapWidget(this); + HbStyle::setItemName(mPixmapItem, "pixmap"); + } + mPixmapItem->hide(); + mPixmapItem->populate(info); + + this->repolish(); +} + +//--------------------------------------------------------------- +//UniViewerBodyWidget::setAudio +// @see header file +//--------------------------------------------------------------- +void UniViewerBodyWidget::setAudio(UniMessageInfo *info) +{ + if (!mAudioItem) { + mAudioItem = new UniViewerAudioWidget(this); + HbStyle::setItemName(mAudioItem, "audioItem"); + } + mAudioItem->hide(); + mAudioItem->populate(info); + + this->repolish(); +} + +//--------------------------------------------------------------- +//UniViewerBodyWidget::setVideo +// @see header file +//--------------------------------------------------------------- +void UniViewerBodyWidget::setVideo(UniMessageInfo *info) +{ + setHasPixmap(true); + //create image item instance + if (!mPixmapItem) { + mPixmapItem = new UniViewerPixmapWidget(this); + HbStyle::setItemName(mPixmapItem, "pixmap"); + connect(mPixmapItem, SIGNAL(thumbnailFound(bool, UniMessageInfo*)), this, + SLOT(onThumbnailFound(bool, UniMessageInfo*))); + } + mPixmapItem->hide(); + mPixmapItem->populate(info); + + this->repolish(); +} + +//--------------------------------------------------------------- +// UniViewerBodyWidget::setSlideCounter +// @see header file +//--------------------------------------------------------------- +void UniViewerBodyWidget::setSlideCounter(QString &slideCounter) +{ + if (!mSlideCounter) { + mSlideCounter = new HbTextItem(this); + HbStyle::setItemName(mSlideCounter, "slideCounter"); + } + + mSlideCounter->hide(); + mSlideCounter->setText(slideCounter); + + this->repolish(); +} + +//--------------------------------------------------------------- +// UniViewerBodyWidget::setOverlayIcon +// @see header file +//--------------------------------------------------------------- +void UniViewerBodyWidget::setOverlayIcon(const QString &iconName) +{ + if (!mOverlayItem) { + mOverlayItem = new HbIconItem(this); + HbStyle::setItemName(mOverlayItem, "overlayItem"); + } + + mOverlayItem->hide(); + mOverlayItem->setIconName(iconName); + + this->repolish(); +} + +//--------------------------------------------------------------- +// UniViewerBodyWidget::onThumbnailFound +// @see header file +//--------------------------------------------------------------- +void UniViewerBodyWidget::onThumbnailFound(bool result, UniMessageInfo *info) +{ + if (result) { + // Thumbnail generation success + setOverlayIcon(VIDEO_ICON); + } + else { + // Show video content in audio widget. + setAudio(info); + + // Remove the pixmap widget. + setHasPixmap(false); + if (mPixmapItem) { + HbStyle::setItemName(mPixmapItem, ""); + mPixmapItem->hide(); + } + } +} + // EOF