videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp
changeset 24 7d93ee07fb27
parent 20 b9e04db066d4
child 46 adbe7d5ba2f5
equal deleted inserted replaced
20:b9e04db066d4 24:7d93ee07fb27
    13 *
    13 *
    14 * Description:  Implementation of QMPXVideoPlaybackStatusPaneControl
    14 * Description:  Implementation of QMPXVideoPlaybackStatusPaneControl
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 15 %
    18 // Version : %version: 16 %
    19 
    19 
       
    20 
       
    21 
       
    22 #include <QFileInfo>
    20 
    23 
    21 #include <hbmenu.h>
    24 #include <hbmenu.h>
    22 #include <hblabel.h>
    25 #include <hblabel.h>
    23 #include <hbaction.h>
    26 #include <hbaction.h>
       
    27 #include <hbgroupbox.h>
    24 #include <hbinstance.h>
    28 #include <hbinstance.h>
    25 #include <hbframeitem.h>
    29 #include <hbframeitem.h>
    26 #include <hbframedrawer.h>
    30 #include <hbframedrawer.h>
    27 
    31 
    28 #include <w32std.h>
    32 #include <w32std.h>
    43         TMPXVideoPlaybackControls index, 
    47         TMPXVideoPlaybackControls index, 
    44         HbWidget* widget, 
    48         HbWidget* widget, 
    45         TUint controlproperties )
    49         TUint controlproperties )
    46     : QMPXVideoPlaybackFullScreenControl( controller, index, widget, controlproperties )
    50     : QMPXVideoPlaybackFullScreenControl( controller, index, widget, controlproperties )
    47     , mActionBack( NULL )
    51     , mActionBack( NULL )
    48     , mFrameItem( NULL )
    52     , mTitleLabel( NULL )
       
    53     , mTitleGroupBox( NULL )
       
    54     , mTitleLayout( NULL )
    49 {
    55 {
    50     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()"));
    56     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()"));
       
    57 
       
    58     Q_UNUSED( widget );
    51 
    59 
    52     mActionBack = new HbAction( Hb::BackNaviAction );
    60     mActionBack = new HbAction( Hb::BackNaviAction );
    53 
    61 
    54     //
    62     //
    55     // Press "back" key means going back to previous view if it's avaiable
    63     // Press "back" key means going back to previous view if it's avaiable
    57     connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
    65     connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
    58     mController->view()->setNavigationAction( mActionBack );
    66     mController->view()->setNavigationAction( mActionBack );
    59 
    67 
    60     connect( mController->view()->menu(), SIGNAL( aboutToShow() ), this, SLOT( handleAboutToShow() ) );
    68     connect( mController->view()->menu(), SIGNAL( aboutToShow() ), this, SLOT( handleAboutToShow() ) );
    61     connect( mController->view()->menu(), SIGNAL( aboutToHide() ), this, SLOT( handleAboutToHide() ) );
    69     connect( mController->view()->menu(), SIGNAL( aboutToHide() ), this, SLOT( handleAboutToHide() ) );
    62 
       
    63     QGraphicsWidget *widget1 = mController->layoutLoader()->findWidget( QString( "title" ) );
       
    64     mTitleLabel = qobject_cast<HbLabel*>( widget1 );
       
    65 }
    70 }
    66 
    71 
    67 // -------------------------------------------------------------------------------------------------
    72 // -------------------------------------------------------------------------------------------------
    68 // QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
    73 // QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
    69 // -------------------------------------------------------------------------------------------------
    74 // -------------------------------------------------------------------------------------------------
   102         mController->view()->setStatusBarVisible( true );
   107         mController->view()->setStatusBarVisible( true );
   103 
   108 
   104         if ( mController->viewMode() == EFullScreenView ||
   109         if ( mController->viewMode() == EFullScreenView ||
   105              mController->viewMode() == EDetailsView )
   110              mController->viewMode() == EDetailsView )
   106         {
   111         {
   107             mTitleLabel->setVisible( true );
   112             mTitleLayout->setVisible( true );
   108         }
   113         }
   109     }
   114     }
   110     else
   115     else
   111     {
   116     {
   112         mController->view()->menu()->close();
   117         mController->view()->menu()->close();
   113         mController->view()->setTitleBarVisible( false );
   118         mController->view()->setTitleBarVisible( false );
   114         mController->view()->setStatusBarVisible( false );
   119         mController->view()->setStatusBarVisible( false );
   115 
   120 
   116         mTitleLabel->setVisible( false );
   121         mTitleLayout->setVisible( false );
   117     }
   122     }
   118 }
   123 }
   119 
   124 
   120 // -------------------------------------------------------------------------------------------------
   125 // -------------------------------------------------------------------------------------------------
   121 // QMPXVideoPlaybackStatusPaneControl::isVisible()
   126 // QMPXVideoPlaybackStatusPaneControl::isVisible()
   161 //
   166 //
   162 void QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails(
   167 void QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails(
   163         QMPXVideoPlaybackViewFileDetails* details )
   168         QMPXVideoPlaybackViewFileDetails* details )
   164 {
   169 {
   165     MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()"));
   170     MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()"));
       
   171 
       
   172     if ( ! mTitleLabel )
       
   173     {
       
   174         //
       
   175         // If title is not available, show clip name
       
   176         //
       
   177         QString title = mController->fileDetails()->mTitle;
       
   178 
       
   179         if ( title.count() == 0 )
       
   180         {
       
   181             QFileInfo fileInfo( mController->fileDetails()->mClipName );
       
   182             title = fileInfo.baseName ();
       
   183         }
       
   184 
       
   185         QGraphicsWidget *qWidget = mController->layoutLoader()->findWidget( QString( "title" ) );
       
   186         mTitleLabel = qobject_cast<HbLabel*>( qWidget );
       
   187         mTitleLabel->setPlainText( title );
       
   188 
       
   189         qWidget = mController->layoutLoader()->findWidget( QString( "titleGroupBox" ) );
       
   190         mTitleGroupBox = qobject_cast<HbGroupBox*>( qWidget );
       
   191         mTitleGroupBox->setHeading( title );
       
   192 
       
   193         mTitleLayout = mController->layoutLoader()->findWidget( QString( "titleLayout" ) );
       
   194 
       
   195         //
       
   196         // Set framedrawer for semi transparent background
       
   197         //
       
   198         HbFrameItem *frameItem = new HbFrameItem();
       
   199         frameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" );
       
   200         frameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
       
   201         frameItem->frameDrawer().setFillWholeRect( true );
       
   202         mTitleLabel->setBackgroundItem( frameItem );
       
   203     }
   166 
   204 
   167     switch( mController->viewMode() )
   205     switch( mController->viewMode() )
   168     {
   206     {
   169         case EFullScreenView:
   207         case EFullScreenView:
   170         {
   208         {
   174             disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   212             disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   175             connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   213             connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   176 
   214 
   177             mController->view()->setViewFlags( 
   215             mController->view()->setViewFlags( 
   178                     HbView::HbViewFlags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent ) );
   216                     HbView::HbViewFlags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent ) );
       
   217 
       
   218             mTitleLabel->setVisible( true );
       
   219             mTitleGroupBox->setVisible( false );
       
   220 
   179             break;
   221             break;
   180         }
   222         }
   181         case EDetailsView:
   223         case EDetailsView:
   182         {
   224         {
   183             //
   225             //
   186             disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   228             disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   187             connect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   229             connect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   188 
   230 
   189             mController->view()->setViewFlags( HbView::ViewFlagNone );
   231             mController->view()->setViewFlags( HbView::ViewFlagNone );
   190 
   232 
       
   233             mTitleGroupBox->setVisible( true );
       
   234             mTitleLabel->setVisible( false );
       
   235 
   191             break;
   236             break;
   192         }
   237         }
   193         case EAudioOnlyView:
   238         case EAudioOnlyView:
   194         {
   239         {
   195             //
   240             //
   202             break;
   247             break;
   203         }
   248         }
   204     }
   249     }
   205 
   250 
   206     setMenu( details );
   251     setMenu( details );
   207 
       
   208     //
       
   209     // Set framedrawer for semi transparent background
       
   210     //
       
   211     if ( ! mFrameItem )
       
   212     {
       
   213         mFrameItem = new HbFrameItem ( mTitleLabel );
       
   214         mFrameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" );
       
   215         mFrameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
       
   216         mFrameItem->frameDrawer().setFillWholeRect( true );
       
   217     }
       
   218 
       
   219     mFrameItem->setGeometry( mTitleLabel->boundingRect() );
       
   220     mFrameItem->setVisible( ( mController->viewMode() == EFullScreenView )? ETrue:EFalse ); 
       
   221 }
   252 }
   222 
   253 
   223 // -------------------------------------------------------------------------------------------------
   254 // -------------------------------------------------------------------------------------------------
   224 // QMPXVideoPlaybackStatusPaneControl::setMenu()
   255 // QMPXVideoPlaybackStatusPaneControl::setMenu()
   225 // -------------------------------------------------------------------------------------------------
   256 // -------------------------------------------------------------------------------------------------