videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp
changeset 52 e3cecb93e76a
parent 47 45e72b57a2fd
child 59 a76e86df7ccd
equal deleted inserted replaced
47:45e72b57a2fd 52:e3cecb93e76a
    13 *
    13 *
    14 * Description:   VideoCollectionViewPlugin class implementation
    14 * Description:   VideoCollectionViewPlugin class implementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 76.1.1 %
    18 // Version : %version: 76.1.7 %
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <qcoreapplication.h>
    21 #include <qcoreapplication.h>
    22 #include <xqserviceutil.h>
    22 #include <xqserviceutil.h>
    23 #include <xqplugin.h>
    23 #include <xqplugin.h>
    30 #include <qabstractitemmodel.h>
    30 #include <qabstractitemmodel.h>
    31 #include <hbmessagebox.h>
    31 #include <hbmessagebox.h>
    32 #include <hblistwidget.h>
    32 #include <hblistwidget.h>
    33 #include <hblistwidgetitem.h>
    33 #include <hblistwidgetitem.h>
    34 #include <hblistviewitem.h>
    34 #include <hblistviewitem.h>
       
    35 #include <hbparameterlengthlimiter.h>
       
    36 #include <hbtextitem.h>
    35 #include <cmath>
    37 #include <cmath>
    36 #include <thumbnailmanager_qt.h>
    38 #include <thumbnailmanager_qt.h>
    37 #include <shareui.h>
    39 #include <shareui.h>
    38 
    40 
    39 #include "videocollectionclient.h"
    41 #include "videocollectionclient.h"
    85     , mNavKeyBackAction( 0 )
    87     , mNavKeyBackAction( 0 )
    86     , mTitleAnim( 0 )
    88     , mTitleAnim( 0 )
    87     , mThumbLabel( 0 )
    89     , mThumbLabel( 0 )
    88     , mThumbnailManager( 0 )
    90     , mThumbnailManager( 0 )
    89     , mCollectionWrapper( VideoCollectionWrapper::instance() )
    91     , mCollectionWrapper( VideoCollectionWrapper::instance() )
       
    92     , mShareUi(0)
    90 {
    93 {
    91 	FUNC_LOG;
    94 	FUNC_LOG;
    92 }
    95 }
    93 
    96 
    94 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
   111 	mLoader.reset();
   114 	mLoader.reset();
   112 
   115 
   113 	mActivated = false;
   116 	mActivated = false;
   114 
   117 
   115 	bool ok = false;
   118 	bool ok = false;
   116 	
   119 
   117 	//Load the details view docml first
   120 	//Load the details view docml first
   118 	mLoader.load(VIDEO_DETAILS_DOCML, &ok);
   121 	mLoader.load(VIDEO_DETAILS_DOCML, &ok);
   119 	
   122 
   120 	if(!ok)
   123 	if(!ok)
   121 	{
   124 	{
   122 	    ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load docml.");
   125 	    ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load docml.");
   123 		return;
   126 		return;
   124 	}
   127 	}
   125 
   128 
   126 	//Load portrait section by default as only vertical orientation is currently supported by videoplayer
   129 	//Load portrait section by default as only vertical orientation is currently supported by videoplayer
   127 	mLoader.load(VIDEO_DETAILS_DOCML, VIDEO_DETAILS_PORTRAIT, &ok);
   130 	mLoader.load(VIDEO_DETAILS_DOCML, VIDEO_DETAILS_PORTRAIT, &ok);
   128 	
   131 
   129 	if(!ok)
   132 	if(!ok)
   130 	{
   133 	{
   131 	    ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load portrait view.");
   134 	    ERROR(-1, "VideoFileDetailsViewPlugin::createView() failed to load portrait view.");
   132 		return;
   135 		return;
   133 	}
   136 	}
   174 	// no deallocation needed for this since
   177 	// no deallocation needed for this since
   175 	// stackedwidget takes ownership
   178 	// stackedwidget takes ownership
   176 	mThumbLabel = new VideoDetailsLabel;
   179 	mThumbLabel = new VideoDetailsLabel;
   177 	mThumbLabel->setAlignment(Qt::AlignCenter);
   180 	mThumbLabel->setAlignment(Qt::AlignCenter);
   178 	mThumbLabel->setObjectName(VIDEO_DETAILS_OBJECT_NAME_THUMBLABEL);
   181 	mThumbLabel->setObjectName(VIDEO_DETAILS_OBJECT_NAME_THUMBLABEL);
   179 	
   182 
   180 	connect(mThumbLabel, SIGNAL(clicked(bool)), this, SLOT(startPlaybackSlot()));
   183 	connect(mThumbLabel, SIGNAL(clicked(bool)), this, SLOT(startPlaybackSlot()));
   181 
   184 
   182 	thumbWidget->addWidget(mThumbLabel);
   185 	thumbWidget->addWidget(mThumbLabel);
   183 
   186 
   184 	// Load details title.
   187 	// Load details title.
   209 	}
   212 	}
   210 
   213 
   211 	// Create navigation keys.
   214 	// Create navigation keys.
   212 	mNavKeyBackAction = new HbAction(Hb::BackNaviAction);
   215 	mNavKeyBackAction = new HbAction(Hb::BackNaviAction);
   213 	mNavKeyBackAction->setObjectName(VIDEO_DETAILS_OBJECT_NAME_NAVKEY_BACK);
   216 	mNavKeyBackAction->setObjectName(VIDEO_DETAILS_OBJECT_NAME_NAVKEY_BACK);
   214 	
   217 
   215 	if (!mThumbnailManager)
   218 	if (!mThumbnailManager)
   216 	{
   219 	{
   217 		mThumbnailManager = new ThumbnailManager();
   220 		mThumbnailManager = new ThumbnailManager();
   218 	}
   221 	}
   219 
   222 
   220 	connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)),
   223 	connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)),
   221 			this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int)));
   224 			this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int)));
   222 	
   225 
   223     HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET);
   226     HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET);
   224     if(!list)
   227     if(!list)
   225     {
   228     {
   226         ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget.");
   229         ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget.");
   227         return;
   230         return;
   228     }
   231     }
   229     
   232 
   230     list->setEnabledAnimations(HbAbstractItemView::None);
   233     list->setEnabledAnimations(HbAbstractItemView::None);
   231 }
   234 }
   232 
   235 
   233 // ---------------------------------------------------------------------------
   236 // ---------------------------------------------------------------------------
   234 // Destroy view
   237 // Destroy view
   248     	mVideoServices = 0;
   251     	mVideoServices = 0;
   249     }
   252     }
   250 
   253 
   251     delete mNavKeyBackAction;
   254     delete mNavKeyBackAction;
   252     mNavKeyBackAction = 0;
   255     mNavKeyBackAction = 0;
   253     
   256 
   254     delete mThumbnailManager;
   257     delete mThumbnailManager;
   255     mThumbnailManager = 0;
   258     mThumbnailManager = 0;
   256     
   259 
   257     disconnect();
   260     disconnect();
   258     mLoader.reset();
   261     mLoader.reset();
   259 }
   262 }
   260 
   263 
   261 // ---------------------------------------------------------------------------
   264 // ---------------------------------------------------------------------------
   270         HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
   273         HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
   271 
   274 
   272         HbView *currentView = mainWnd->currentView();
   275         HbView *currentView = mainWnd->currentView();
   273         if(currentView && mNavKeyBackAction)
   276         if(currentView && mNavKeyBackAction)
   274         {
   277         {
   275         	if (connect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back())))
   278         	if (connect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back())), Qt::UniqueConnection)
   276         	{
   279         	{
   277         		currentView->setNavigationAction(mNavKeyBackAction);
   280         		currentView->setNavigationAction(mNavKeyBackAction);
   278         	}
   281         	}
   279         	else
   282         	else
   280         	{
   283         	{
   312 
   315 
   313 		VideoServices::TVideoService service = VideoServices::ENoService;
   316 		VideoServices::TVideoService service = VideoServices::ENoService;
   314 		if (mIsService && mVideoServices)
   317 		if (mIsService && mVideoServices)
   315 		{
   318 		{
   316 		    service = mVideoServices->currentService();
   319 		    service = mVideoServices->currentService();
   317 		    
   320 
   318             HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
   321             HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
   319             mainWnd->currentView()->setTitle(mVideoServices->contextTitle());
   322             mainWnd->currentView()->setTitle(mVideoServices->contextTitle());
   320 		}
   323 		}
   321 
   324 
   322         HbPushButton* button = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON);
   325         HbPushButton* button = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON);
   323 		if(!button)
   326 		if(!button)
   324 		{
   327 		{
   325 		    ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details button.");
   328 		    ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details button.");
   326 		    return;
   329 		    return;
   327 		}
   330 		}
   328 				
   331 
   329 	    // Fix the size of the thumbnail, as that needs to be in 16:9
   332 	    // Fix the size of the thumbnail, as that needs to be in 16:9
   330 	    qreal width = button->size().width();
   333 	    qreal width = button->size().width();
   331 	    qreal height = width * 9 / 16;
   334 	    qreal height = width * 9 / 16;
   332 	    
   335 
   333 	    HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL);
   336 	    HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL);
   334 	    thumbWidget->setPreferredWidth(width);
   337 	    thumbWidget->setPreferredWidth(width);
   335 	    thumbWidget->setPreferredHeight(height);
   338 	    thumbWidget->setPreferredHeight(height);
   336 	    
   339 
   337 		if (service == VideoServices::EUriFetcher)
   340 		if (service == VideoServices::EUriFetcher)
   338 		{
   341 		{
   339             button->setText(hbTrId("txt_videos_button_attach"));
   342 			HbIcon icon = HbIcon("qtg_mono_attach");
   340 
   343 			button->setIcon(icon);
   341             connect(button, SIGNAL(clicked(bool)), this, SLOT(getFileUri()));
   344 
   342             connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)));
   345             connect(button, SIGNAL(clicked(bool)), this, SLOT(getFileUri()), Qt::UniqueConnection);
       
   346             connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)), Qt::UniqueConnection);
   343 		}
   347 		}
   344 		else
   348 		else
   345 		{
   349 		{
   346 			connect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot()));
   350 			connect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot()), Qt::UniqueConnection);
   347 			button->setText(hbTrId("txt_videos_opt_share"));
   351 
       
   352 			HbIcon icon = HbIcon("qtg_mono_share");
       
   353 			button->setIcon(icon);
   348     	}
   354     	}
   349 
   355 
   350         connect(mainWnd,
   356         connect(mainWnd,
   351                 SIGNAL(orientationChanged(Qt::Orientation)),
   357                 SIGNAL(orientationChanged(Qt::Orientation)),
   352                 this, SLOT(orientationChange(Qt::Orientation)));
   358                 this, SLOT(orientationChange(Qt::Orientation)),
       
   359                 Qt::UniqueConnection);
   353 
   360 
   354         connect(&mCollectionWrapper,
   361         connect(&mCollectionWrapper,
   355                SIGNAL(asyncStatus(int, QVariant&)),
   362                SIGNAL(asyncStatus(int, QVariant&)),
   356                this, SLOT(handleErrorSlot(int, QVariant&)));
   363                this, SLOT(handleErrorSlot(int, QVariant&)),
       
   364                Qt::UniqueConnection);
   357 
   365 
   358         // setup title size in order for animation to be enabled if needed
   366         // setup title size in order for animation to be enabled if needed
   359         mTitleAnim->setMinimumWidth(hbInstance->allMainWindows().value(0)->width()-50);
   367         mTitleAnim->setMinimumWidth(hbInstance->allMainWindows().value(0)->width()-50);
   360         mTitleAnim->adjustSize();
   368         mTitleAnim->adjustSize();
   361 
   369 
   412 		else
   420 		else
   413 		{
   421 		{
   414 			disconnect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot()));
   422 			disconnect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot()));
   415 		}
   423 		}
   416     }
   424     }
       
   425     delete mShareUi;
       
   426     mShareUi = 0;
   417 }
   427 }
   418 
   428 
   419 // ---------------------------------------------------------------------------
   429 // ---------------------------------------------------------------------------
   420 // Get view
   430 // Get view
   421 // ---------------------------------------------------------------------------
   431 // ---------------------------------------------------------------------------
   492     using namespace VideoCollectionCommon;
   502     using namespace VideoCollectionCommon;
   493 
   503 
   494     int detailCount = sizeof(VideoDetailLabelKeys) / sizeof(int);
   504     int detailCount = sizeof(VideoDetailLabelKeys) / sizeof(int);
   495 
   505 
   496     QMap<QString, QVariant> metadata = variant.toMap();
   506     QMap<QString, QVariant> metadata = variant.toMap();
   497     
   507 
   498     HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET);
   508     HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET);
   499     if(!list)
   509     if(!list)
   500     {
   510     {
   501         ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget.");
   511         ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget.");
   502         return;
   512         return;
   503     }
   513     }
   504     
   514 
   505     if(list->count())
   515     if(list->count())
   506     {
   516     {
   507         list->clear();
   517         list->clear();
   508     }
   518     }
   509 
   519 
   512 
   522 
   513     for(int i = 0; i< detailCount; i++) {
   523     for(int i = 0; i< detailCount; i++) {
   514         if (metadata.contains(VideoDetailLabelKeys[i]))
   524         if (metadata.contains(VideoDetailLabelKeys[i]))
   515         {
   525         {
   516             HbListWidgetItem* listWidgetItem = new HbListWidgetItem();
   526             HbListWidgetItem* listWidgetItem = new HbListWidgetItem();
   517             listWidgetItem->setEnabled(false);
       
   518             listWidgetItem->setText( hbTrId(VideoDetailLabels[i]));
   527             listWidgetItem->setText( hbTrId(VideoDetailLabels[i]));
   519             listWidgetItem->setSecondaryText(metadata[VideoDetailLabelKeys[i]].toString());
   528             listWidgetItem->setSecondaryText(metadata[VideoDetailLabelKeys[i]].toString());
   520             list->addItem(listWidgetItem);
   529             list->addItem(listWidgetItem);
       
   530             
       
   531             // following is required to change wrapping-mode for the second row
       
   532             HbListViewItem *viewItem = static_cast<HbListViewItem*>(list->viewItem(list->row(listWidgetItem)));
       
   533             if(viewItem)
       
   534             {
       
   535                 HbTextItem *secondLine = static_cast<HbTextItem*>(viewItem->primitive("text-2"));
       
   536                 if(secondLine)
       
   537                 {
       
   538                     secondLine->setTextWrapping(Hb::TextWrapAnywhere);
       
   539                 }
       
   540             }
   521         }
   541         }
   522     }
   542     }
   523 
   543 
   524     // start title animation
   544     // start title animation
   525     mTitleAnim->startAnimation();
   545     mTitleAnim->startAnimation();
   562 // ---------------------------------------------------------------------------
   582 // ---------------------------------------------------------------------------
   563 //
   583 //
   564 void VideoFileDetailsViewPlugin::sendVideoSlot()
   584 void VideoFileDetailsViewPlugin::sendVideoSlot()
   565 {
   585 {
   566 	FUNC_LOG;
   586 	FUNC_LOG;
   567 //	HbMessageBox::information(tr("Not implemented yet"));
   587 
   568 	
       
   569     if(mVideoId != TMPXItemId::InvalidId())
   588     if(mVideoId != TMPXItemId::InvalidId())
   570     {
   589     {
   571         ShareUi dialog;
   590         if(!mShareUi)
       
   591         {
       
   592             mShareUi = new ShareUi();
       
   593         }
   572         QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   594         QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   573         QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
   595         QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
   574         if(variant.isValid())
   596         if(variant.isValid())
   575         {
   597         {
   576             QStringList fileList;
   598             QStringList fileList;
   577             fileList.append(variant.toString());
   599             fileList.append(variant.toString());
   578             dialog.send(fileList, true);
   600             mShareUi->send(fileList, true);
   579         }
   601         }
   580     }
   602     }
   581 }
   603 }
   582 
   604 
   583 // ---------------------------------------------------------------------------
   605 // ---------------------------------------------------------------------------
   592 		QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   614 		QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   593 		QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyTitle);
   615 		QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyTitle);
   594 
   616 
   595         if (variant.isValid())
   617         if (variant.isValid())
   596         {
   618         {
   597             QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg(
   619         	QString text = HbParameterLengthLimiter(hbTrId("txt_videos_info_do_you_want_to_delete_1")).
   598 			   variant.toString());
   620         			arg(variant.toString());
   599 
   621 
   600             HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion);
   622             HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion);
   601             messageBox->setAttribute(Qt::WA_DeleteOnClose);
   623             messageBox->setAttribute(Qt::WA_DeleteOnClose);
       
   624             messageBox->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No);
   602             messageBox->setObjectName(VIDEO_DETAILS_OBJECT_NAME_DELETE_VIDEO);
   625             messageBox->setObjectName(VIDEO_DETAILS_OBJECT_NAME_DELETE_VIDEO);
   603             messageBox->open(this, SLOT(deleteVideoDialogFinished(HbAction *)));
   626             messageBox->open(this, SLOT(deleteVideoDialogFinished(int)));
   604         }
   627         }
   605     }
   628     }
   606 }
   629 }
   607 
   630 
   608 // ---------------------------------------------------------------------------
   631 // ---------------------------------------------------------------------------
   609 // deleteVideoDialogFinished
   632 // deleteVideoDialogFinished
   610 // ---------------------------------------------------------------------------
   633 // ---------------------------------------------------------------------------
   611 //
   634 //
   612 void VideoFileDetailsViewPlugin::deleteVideoDialogFinished(HbAction *action)
   635 void VideoFileDetailsViewPlugin::deleteVideoDialogFinished(int action)
   613 {
   636 {
   614     FUNC_LOG;
   637     FUNC_LOG;
   615     HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
       
   616     QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   638     QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   617     if(action == dlg->actions().at(0) && modelIndex.isValid()) 
   639     if(action == HbMessageBox::Yes && modelIndex.isValid())
   618     {
   640     {
   619         deleteItem(modelIndex);
   641         deleteItem(modelIndex);
   620     }
   642     }
   621 }
   643 }
   622 
   644 
   664     if(errorCode == VideoCollectionCommon::statusSingleDeleteFail)
   686     if(errorCode == VideoCollectionCommon::statusSingleDeleteFail)
   665     {
   687     {
   666         QString format = hbTrId("txt_videos_info_unable_to_delete_1_it_is_current");
   688         QString format = hbTrId("txt_videos_info_unable_to_delete_1_it_is_current");
   667         if(additional.isValid())
   689         if(additional.isValid())
   668         {
   690         {
   669            msg = format.arg(additional.toString());
   691            msg = HbParameterLengthLimiter(format).arg(additional.toString());
   670         }
   692         }
   671     }
   693     }
   672     if(msg.count() > 0)
   694     if(msg.count() > 0)
   673     {
   695     {
   674         // show msg box if there's something to show
   696         // show msg box if there's something to show
   688 {
   710 {
   689 	FUNC_LOG;
   711 	FUNC_LOG;
   690     Q_UNUSED(clientData);
   712     Q_UNUSED(clientData);
   691     Q_UNUSED(id);
   713     Q_UNUSED(id);
   692 
   714 
   693 	QSize size(mThumbLabel->size().toSize());
   715 	HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL);
       
   716 	if(!thumbWidget)
       
   717 	{
       
   718 	    ERROR(-1, "VideoFileDetailsViewPlugin::thumbnailReadySlot() failed to load thumbnail widget.");
       
   719 	    return;
       
   720 	}
       
   721 
       
   722 	QSize size(thumbWidget->size().toSize());
   694 
   723 
   695 	if (!errorCode)
   724 	if (!errorCode)
   696 	{
   725 	{
   697 		QImage sourceImage = pixmap.toImage();
   726 		QImage sourceImage = pixmap.toImage();
   698 
   727 
   707 			}
   736 			}
   708 			sourceImage = sourceImage.scaled(size, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
   737 			sourceImage = sourceImage.scaled(size, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
   709 		}
   738 		}
   710 
   739 
   711 		int difference(0);
   740 		int difference(0);
   712 		QRect rect = mThumbLabel->rect().toRect();
   741 		QRect rect = thumbWidget->rect().toRect();
   713 
   742 
   714 		if(sourceImage.width() > size.width())
   743 		if(sourceImage.width() > size.width())
   715 		{
   744 		{
   716 			difference = sourceImage.width() - size.width();
   745 			difference = sourceImage.width() - size.width();
   717 			difference = (difference/2)+1;
   746 			difference = (difference/2)+1;
   785     // Check if we have already the icon.
   814     // Check if we have already the icon.
   786     if(!mPlayIcon.isNull())
   815     if(!mPlayIcon.isNull())
   787     {
   816     {
   788         return mPlayIcon;
   817         return mPlayIcon;
   789     }
   818     }
   790     
   819 
   791     // Compose the icon.
   820     // Compose the icon.
   792     HbIcon play =        HbIcon("qtg_mono_play");
   821     HbIcon play =        HbIcon("qtg_mono_play");
   793     HbIcon topLeft =     HbIcon("qtg_fr_popup_trans_tl");
   822     HbIcon topLeft =     HbIcon("qtg_fr_popup_trans_tl");
   794     HbIcon top =         HbIcon("qtg_fr_popup_trans_t");
   823     HbIcon top =         HbIcon("qtg_fr_popup_trans_t");
   795     HbIcon topRight =    HbIcon("qtg_fr_popup_trans_tr");
   824     HbIcon topRight =    HbIcon("qtg_fr_popup_trans_tr");
   800     HbIcon bottom =      HbIcon("qtg_fr_popup_trans_b");
   829     HbIcon bottom =      HbIcon("qtg_fr_popup_trans_b");
   801     HbIcon bottomRight = HbIcon("qtg_fr_popup_trans_br");
   830     HbIcon bottomRight = HbIcon("qtg_fr_popup_trans_br");
   802 
   831 
   803     int width = topLeft.width() + top.width() + topRight.width();
   832     int width = topLeft.width() + top.width() + topRight.width();
   804     int height = topLeft.height() + center.height() + bottomLeft.height();
   833     int height = topLeft.height() + center.height() + bottomLeft.height();
   805     
   834 
   806     mPlayIcon = QPixmap(width, height);
   835     mPlayIcon = QPixmap(width, height);
   807     
   836 
   808     QPainter painter(&mPlayIcon);
   837     QPainter painter(&mPlayIcon);
   809     painter.fillRect(mPlayIcon.rect(), Qt::white);
   838     painter.fillRect(mPlayIcon.rect(), Qt::white);
   810     
   839 
   811     painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
   840     painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
   812     
   841 
   813     int x = 0;
   842     int x = 0;
   814     int y = 0;
   843     int y = 0;
   815 
   844 
   816     // Draw top
   845     // Draw top
   817     painter.drawPixmap(QPoint(x, y), topLeft.pixmap());
   846     painter.drawPixmap(QPoint(x, y), topLeft.pixmap());
   818     x += left.width();
   847     x += left.width();
   819     
   848 
   820     painter.drawPixmap(QPoint(x, y), top.pixmap());
   849     painter.drawPixmap(QPoint(x, y), top.pixmap());
   821     x += top.width();
   850     x += top.width();
   822 
   851 
   823     painter.drawPixmap(QPoint(x, y), topRight.pixmap());
   852     painter.drawPixmap(QPoint(x, y), topRight.pixmap());
   824     y += top.height();
   853     y += top.height();
   825     
   854 
   826     // Draw center
   855     // Draw center
   827     x = 0;
   856     x = 0;
   828     painter.drawPixmap(QPoint(x, y), left.pixmap());
   857     painter.drawPixmap(QPoint(x, y), left.pixmap());
   829     x += left.width();
   858     x += left.width();
   830     
   859 
   831     painter.drawPixmap(QPoint(x, y), center.pixmap());
   860     painter.drawPixmap(QPoint(x, y), center.pixmap());
   832     x += center.width();
   861     x += center.width();
   833 
   862 
   834     painter.drawPixmap(QPoint(x, y), right.pixmap());
   863     painter.drawPixmap(QPoint(x, y), right.pixmap());
   835     y += center.height();
   864     y += center.height();
   836     
   865 
   837     // Draw bottom
   866     // Draw bottom
   838     x = 0;
   867     x = 0;
   839     painter.drawPixmap(QPoint(x, y), bottomLeft.pixmap());
   868     painter.drawPixmap(QPoint(x, y), bottomLeft.pixmap());
   840     x += left.width();
   869     x += left.width();
   841     
   870 
   842     painter.drawPixmap(QPoint(x, y), bottom.pixmap());
   871     painter.drawPixmap(QPoint(x, y), bottom.pixmap());
   843     x += top.width();
   872     x += top.width();
   844     
   873 
   845     painter.drawPixmap(QPoint(x, y), bottomRight.pixmap());
   874     painter.drawPixmap(QPoint(x, y), bottomRight.pixmap());
   846     
   875 
   847     // Draw play icon
   876     // Draw play icon
   848     play.setSize(mPlayIcon.size());
   877     play.setSize(mPlayIcon.size());
   849     play.setColor(Qt::white);
   878     play.setColor(Qt::white);
   850     painter.drawPixmap(mPlayIcon.rect(), play.pixmap());
   879     painter.drawPixmap(mPlayIcon.rect(), play.pixmap());
   851     painter.end();
   880     painter.end();
   852     
   881 
   853     return mPlayIcon;
   882     return mPlayIcon;
   854 }
   883 }
   855 
   884 
   856 // ---------------------------------------------------------------------------
   885 // ---------------------------------------------------------------------------
   857 // findWidget
   886 // findWidget