videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp
changeset 50 21fe8338c6bf
parent 44 518105d52e45
child 55 4bfa887905cf
equal deleted inserted replaced
49:824471cb468a 50:21fe8338c6bf
    13 *
    13 *
    14 * Description:   VideoCollectionViewPlugin class implementation
    14 * Description:   VideoCollectionViewPlugin class implementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 76.1.5 %
    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>
    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>
    35 #include <hbparameterlengthlimiter.h>
       
    36 #include <hbtextitem.h>
    36 #include <cmath>
    37 #include <cmath>
    37 #include <thumbnailmanager_qt.h>
    38 #include <thumbnailmanager_qt.h>
    38 #include <shareui.h>
    39 #include <shareui.h>
    39 
    40 
    40 #include "videocollectionclient.h"
    41 #include "videocollectionclient.h"
    86     , mNavKeyBackAction( 0 )
    87     , mNavKeyBackAction( 0 )
    87     , mTitleAnim( 0 )
    88     , mTitleAnim( 0 )
    88     , mThumbLabel( 0 )
    89     , mThumbLabel( 0 )
    89     , mThumbnailManager( 0 )
    90     , mThumbnailManager( 0 )
    90     , mCollectionWrapper( VideoCollectionWrapper::instance() )
    91     , mCollectionWrapper( VideoCollectionWrapper::instance() )
       
    92     , mShareUi(0)
    91 {
    93 {
    92 	FUNC_LOG;
    94 	FUNC_LOG;
    93 }
    95 }
    94 
    96 
    95 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
   271         HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
   273         HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
   272 
   274 
   273         HbView *currentView = mainWnd->currentView();
   275         HbView *currentView = mainWnd->currentView();
   274         if(currentView && mNavKeyBackAction)
   276         if(currentView && mNavKeyBackAction)
   275         {
   277         {
   276         	if (connect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back())))
   278         	if (connect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back())), Qt::UniqueConnection)
   277         	{
   279         	{
   278         		currentView->setNavigationAction(mNavKeyBackAction);
   280         		currentView->setNavigationAction(mNavKeyBackAction);
   279         	}
   281         	}
   280         	else
   282         	else
   281         	{
   283         	{
   338 		if (service == VideoServices::EUriFetcher)
   340 		if (service == VideoServices::EUriFetcher)
   339 		{
   341 		{
   340 			HbIcon icon = HbIcon("qtg_mono_attach");
   342 			HbIcon icon = HbIcon("qtg_mono_attach");
   341 			button->setIcon(icon);
   343 			button->setIcon(icon);
   342 
   344 
   343             connect(button, SIGNAL(clicked(bool)), this, SLOT(getFileUri()));
   345             connect(button, SIGNAL(clicked(bool)), this, SLOT(getFileUri()), Qt::UniqueConnection);
   344             connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)));
   346             connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)), Qt::UniqueConnection);
   345 		}
   347 		}
   346 		else
   348 		else
   347 		{
   349 		{
   348 			connect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot()));
   350 			connect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot()), Qt::UniqueConnection);
   349 
   351 
   350 			HbIcon icon = HbIcon("qtg_mono_share");
   352 			HbIcon icon = HbIcon("qtg_mono_share");
   351 			button->setIcon(icon);
   353 			button->setIcon(icon);
   352     	}
   354     	}
   353 
   355 
   354         connect(mainWnd,
   356         connect(mainWnd,
   355                 SIGNAL(orientationChanged(Qt::Orientation)),
   357                 SIGNAL(orientationChanged(Qt::Orientation)),
   356                 this, SLOT(orientationChange(Qt::Orientation)));
   358                 this, SLOT(orientationChange(Qt::Orientation)),
       
   359                 Qt::UniqueConnection);
   357 
   360 
   358         connect(&mCollectionWrapper,
   361         connect(&mCollectionWrapper,
   359                SIGNAL(asyncStatus(int, QVariant&)),
   362                SIGNAL(asyncStatus(int, QVariant&)),
   360                this, SLOT(handleErrorSlot(int, QVariant&)));
   363                this, SLOT(handleErrorSlot(int, QVariant&)),
       
   364                Qt::UniqueConnection);
   361 
   365 
   362         // 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
   363         mTitleAnim->setMinimumWidth(hbInstance->allMainWindows().value(0)->width()-50);
   367         mTitleAnim->setMinimumWidth(hbInstance->allMainWindows().value(0)->width()-50);
   364         mTitleAnim->adjustSize();
   368         mTitleAnim->adjustSize();
   365 
   369 
   416 		else
   420 		else
   417 		{
   421 		{
   418 			disconnect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot()));
   422 			disconnect(button, SIGNAL(clicked(bool)), this, SLOT(sendVideoSlot()));
   419 		}
   423 		}
   420     }
   424     }
       
   425     delete mShareUi;
       
   426     mShareUi = 0;
   421 }
   427 }
   422 
   428 
   423 // ---------------------------------------------------------------------------
   429 // ---------------------------------------------------------------------------
   424 // Get view
   430 // Get view
   425 // ---------------------------------------------------------------------------
   431 // ---------------------------------------------------------------------------
   516 
   522 
   517     for(int i = 0; i< detailCount; i++) {
   523     for(int i = 0; i< detailCount; i++) {
   518         if (metadata.contains(VideoDetailLabelKeys[i]))
   524         if (metadata.contains(VideoDetailLabelKeys[i]))
   519         {
   525         {
   520             HbListWidgetItem* listWidgetItem = new HbListWidgetItem();
   526             HbListWidgetItem* listWidgetItem = new HbListWidgetItem();
   521             listWidgetItem->setEnabled(false);
       
   522             listWidgetItem->setText( hbTrId(VideoDetailLabels[i]));
   527             listWidgetItem->setText( hbTrId(VideoDetailLabels[i]));
   523             listWidgetItem->setSecondaryText(metadata[VideoDetailLabelKeys[i]].toString());
   528             listWidgetItem->setSecondaryText(metadata[VideoDetailLabelKeys[i]].toString());
   524             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             }
   525         }
   541         }
   526     }
   542     }
   527 
   543 
   528     // start title animation
   544     // start title animation
   529     mTitleAnim->startAnimation();
   545     mTitleAnim->startAnimation();
   566 // ---------------------------------------------------------------------------
   582 // ---------------------------------------------------------------------------
   567 //
   583 //
   568 void VideoFileDetailsViewPlugin::sendVideoSlot()
   584 void VideoFileDetailsViewPlugin::sendVideoSlot()
   569 {
   585 {
   570 	FUNC_LOG;
   586 	FUNC_LOG;
   571 //	HbMessageBox::information(tr("Not implemented yet"));
       
   572 
   587 
   573     if(mVideoId != TMPXItemId::InvalidId())
   588     if(mVideoId != TMPXItemId::InvalidId())
   574     {
   589     {
   575         ShareUi dialog;
   590         if(!mShareUi)
       
   591         {
       
   592             mShareUi = new ShareUi();
       
   593         }
   576         QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   594         QModelIndex modelIndex = mModel->indexOfId(mVideoId);
   577         QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
   595         QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
   578         if(variant.isValid())
   596         if(variant.isValid())
   579         {
   597         {
   580             QStringList fileList;
   598             QStringList fileList;
   581             fileList.append(variant.toString());
   599             fileList.append(variant.toString());
   582             dialog.send(fileList, true);
   600             mShareUi->send(fileList, true);
   583         }
   601         }
   584     }
   602     }
   585 }
   603 }
   586 
   604 
   587 // ---------------------------------------------------------------------------
   605 // ---------------------------------------------------------------------------