videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp
branchGCC_SURGE
changeset 48 ebbeb6bcda56
parent 47 45e72b57a2fd
equal deleted inserted replaced
27:7bf7319dbddd 48:ebbeb6bcda56
    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: 19 %
    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>
    36 
    40 
    37 // -------------------------------------------------------------------------------------------------
    41 // -------------------------------------------------------------------------------------------------
    38 // QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()
    42 // QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()
    39 // -------------------------------------------------------------------------------------------------
    43 // -------------------------------------------------------------------------------------------------
    40 //
    44 //
    41 QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl( 
    45 QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl(
    42         QMPXVideoPlaybackControlsController* controller, 
    46         QMPXVideoPlaybackControlsController* controller,
    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 // -------------------------------------------------------------------------------------------------
    92 // QMPXVideoPlaybackStatusPaneControl::setVisible()
    97 // QMPXVideoPlaybackStatusPaneControl::setVisible()
    93 // -------------------------------------------------------------------------------------------------
    98 // -------------------------------------------------------------------------------------------------
    94 //
    99 //
    95 void QMPXVideoPlaybackStatusPaneControl::setVisible( bool visible )
   100 void QMPXVideoPlaybackStatusPaneControl::setVisible( bool visible )
    96 {
   101 {
       
   102     MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::setVisible visible = %d"), visible);
       
   103 
    97     mVisible = visible;
   104     mVisible = visible;
    98 
   105 
    99     if ( mVisible )
   106     if ( mVisible )
   100     {
   107     {
   101         mController->view()->setTitleBarVisible( true );
   108         mController->view()->setTitleBarVisible( true );
   102         mController->view()->setStatusBarVisible( true );
   109         mController->view()->setStatusBarVisible( true );
   103 
   110 
   104         if ( mController->viewMode() == EFullScreenView ||
   111         if ( mController->viewMode() == EFullScreenView ||
   105              mController->viewMode() == EDetailsView )
   112              mController->viewMode() == EDetailsView )
   106         {
   113         {
   107             mTitleLabel->setVisible( true );
   114             mTitleLayout->setVisible( true );
   108         }
   115         }
   109     }
   116     }
   110     else
   117     else
   111     {
   118     {
   112         mController->view()->menu()->close();
   119         mController->view()->menu()->close();
   113         mController->view()->setTitleBarVisible( false );
   120         mController->view()->setTitleBarVisible( false );
   114         mController->view()->setStatusBarVisible( false );
   121         mController->view()->setStatusBarVisible( false );
   115 
   122 
   116         mTitleLabel->setVisible( false );
   123         mTitleLayout->setVisible( false );
   117     }
   124     }
   118 }
   125 }
   119 
   126 
   120 // -------------------------------------------------------------------------------------------------
   127 // -------------------------------------------------------------------------------------------------
   121 // QMPXVideoPlaybackStatusPaneControl::isVisible()
   128 // QMPXVideoPlaybackStatusPaneControl::isVisible()
   162 void QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails(
   169 void QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails(
   163         QMPXVideoPlaybackViewFileDetails* details )
   170         QMPXVideoPlaybackViewFileDetails* details )
   164 {
   171 {
   165     MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()"));
   172     MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()"));
   166 
   173 
       
   174     if ( ! mTitleLabel )
       
   175     {
       
   176         //
       
   177         // If title is not available, show clip name
       
   178         //
       
   179         QString title = mController->fileDetails()->mTitle;
       
   180 
       
   181         if ( title.count() == 0 )
       
   182         {
       
   183             QFileInfo fileInfo( mController->fileDetails()->mClipName );
       
   184             title = fileInfo.completeBaseName();
       
   185         }
       
   186 
       
   187         QGraphicsWidget *qWidget = mController->layoutLoader()->findWidget( QString( "title" ) );
       
   188         mTitleLabel = qobject_cast<HbLabel*>( qWidget );
       
   189         mTitleLabel->setPlainText( title );
       
   190 
       
   191         qWidget = mController->layoutLoader()->findWidget( QString( "titleGroupBox" ) );
       
   192         mTitleGroupBox = qobject_cast<HbGroupBox*>( qWidget );
       
   193         mTitleGroupBox->setHeading( title );
       
   194 
       
   195         mTitleLayout = mController->layoutLoader()->findWidget( QString( "titleLayout" ) );
       
   196 
       
   197         //
       
   198         // Set framedrawer for semi transparent background
       
   199         //
       
   200         HbFrameItem *frameItem = new HbFrameItem();
       
   201         frameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" );
       
   202         frameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
       
   203         frameItem->frameDrawer().setFillWholeRect( true );
       
   204         mTitleLabel->setBackgroundItem( frameItem );
       
   205     }
       
   206 
   167     switch( mController->viewMode() )
   207     switch( mController->viewMode() )
   168     {
   208     {
   169         case EFullScreenView:
   209         case EFullScreenView:
   170         {
   210         {
   171             //
   211             //
   172             // Set TitleBar transparent and go back to preview view with back key
   212             // Set TitleBar transparent and go back to preview view with back key
   173             // 
   213             //
   174             disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   214             disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   175             connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   215             connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   176 
   216 
   177             mController->view()->setViewFlags( 
   217             mController->view()->setViewFlags( mController->view()->viewFlags() |
   178                     HbView::HbViewFlags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent ) );
   218                                                HbView::ViewTitleBarTransparent |
       
   219                                                HbView::ViewStatusBarTransparent );
       
   220 
       
   221             mTitleLabel->setVisible( true );
       
   222             mTitleGroupBox->setVisible( false );
       
   223 
   179             break;
   224             break;
   180         }
   225         }
   181         case EDetailsView:
   226         case EDetailsView:
   182         {
   227         {
   183             //
   228             //
   184             // Set TitleBar opaque and go back to full screen view with back key
   229             // Set TitleBar opaque and go back to full screen view with back key
   185             // 
   230             //
   186             disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   231             disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   187             connect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   232             connect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   188 
   233 
   189             mController->view()->setViewFlags( HbView::ViewFlagNone );
   234             mController->view()->setViewFlags( HbView::ViewFlagNone );
   190 
   235 
       
   236             mTitleGroupBox->setVisible( true );
       
   237             mTitleLabel->setVisible( false );
       
   238 
   191             break;
   239             break;
   192         }
   240         }
   193         case EAudioOnlyView:
   241         case EAudioOnlyView:
   194         {
   242         {
   195             //
   243             //
   196             // Set TitleBar opaque and go back to preview view with back key
   244             // Set TitleBar opaque and go back to preview view with back key
   197             // 
   245             //
   198             disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   246             disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
   199             connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   247             connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
   200 
   248 
   201             mController->view()->setViewFlags( HbView::ViewFlagNone );
   249             mController->view()->setViewFlags( HbView::ViewFlagNone );
   202             break;
   250             break;
   203         }
   251         }
   204     }
   252     }
   205 
   253 
   206     setMenu( details );
   254     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 }
   255 }
   222 
   256 
   223 // -------------------------------------------------------------------------------------------------
   257 // -------------------------------------------------------------------------------------------------
   224 // QMPXVideoPlaybackStatusPaneControl::setMenu()
   258 // QMPXVideoPlaybackStatusPaneControl::setMenu()
   225 // -------------------------------------------------------------------------------------------------
   259 // -------------------------------------------------------------------------------------------------