videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp
changeset 24 7d93ee07fb27
parent 20 b9e04db066d4
child 46 adbe7d5ba2f5
--- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp	Fri May 14 15:53:50 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp	Thu May 27 12:53:14 2010 +0300
@@ -15,12 +15,16 @@
 *
 */
 
-// Version : %version: 15 %
+// Version : %version: 16 %
+
 
 
+#include <QFileInfo>
+
 #include <hbmenu.h>
 #include <hblabel.h>
 #include <hbaction.h>
+#include <hbgroupbox.h>
 #include <hbinstance.h>
 #include <hbframeitem.h>
 #include <hbframedrawer.h>
@@ -45,10 +49,14 @@
         TUint controlproperties )
     : QMPXVideoPlaybackFullScreenControl( controller, index, widget, controlproperties )
     , mActionBack( NULL )
-    , mFrameItem( NULL )
+    , mTitleLabel( NULL )
+    , mTitleGroupBox( NULL )
+    , mTitleLayout( NULL )
 {
     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()"));
 
+    Q_UNUSED( widget );
+
     mActionBack = new HbAction( Hb::BackNaviAction );
 
     //
@@ -59,9 +67,6 @@
 
     connect( mController->view()->menu(), SIGNAL( aboutToShow() ), this, SLOT( handleAboutToShow() ) );
     connect( mController->view()->menu(), SIGNAL( aboutToHide() ), this, SLOT( handleAboutToHide() ) );
-
-    QGraphicsWidget *widget1 = mController->layoutLoader()->findWidget( QString( "title" ) );
-    mTitleLabel = qobject_cast<HbLabel*>( widget1 );
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -104,7 +109,7 @@
         if ( mController->viewMode() == EFullScreenView ||
              mController->viewMode() == EDetailsView )
         {
-            mTitleLabel->setVisible( true );
+            mTitleLayout->setVisible( true );
         }
     }
     else
@@ -113,7 +118,7 @@
         mController->view()->setTitleBarVisible( false );
         mController->view()->setStatusBarVisible( false );
 
-        mTitleLabel->setVisible( false );
+        mTitleLayout->setVisible( false );
     }
 }
 
@@ -164,6 +169,39 @@
 {
     MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()"));
 
+    if ( ! mTitleLabel )
+    {
+        //
+        // If title is not available, show clip name
+        //
+        QString title = mController->fileDetails()->mTitle;
+
+        if ( title.count() == 0 )
+        {
+            QFileInfo fileInfo( mController->fileDetails()->mClipName );
+            title = fileInfo.baseName ();
+        }
+
+        QGraphicsWidget *qWidget = mController->layoutLoader()->findWidget( QString( "title" ) );
+        mTitleLabel = qobject_cast<HbLabel*>( qWidget );
+        mTitleLabel->setPlainText( title );
+
+        qWidget = mController->layoutLoader()->findWidget( QString( "titleGroupBox" ) );
+        mTitleGroupBox = qobject_cast<HbGroupBox*>( qWidget );
+        mTitleGroupBox->setHeading( title );
+
+        mTitleLayout = mController->layoutLoader()->findWidget( QString( "titleLayout" ) );
+
+        //
+        // Set framedrawer for semi transparent background
+        //
+        HbFrameItem *frameItem = new HbFrameItem();
+        frameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" );
+        frameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
+        frameItem->frameDrawer().setFillWholeRect( true );
+        mTitleLabel->setBackgroundItem( frameItem );
+    }
+
     switch( mController->viewMode() )
     {
         case EFullScreenView:
@@ -176,6 +214,10 @@
 
             mController->view()->setViewFlags( 
                     HbView::HbViewFlags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent ) );
+
+            mTitleLabel->setVisible( true );
+            mTitleGroupBox->setVisible( false );
+
             break;
         }
         case EDetailsView:
@@ -188,6 +230,9 @@
 
             mController->view()->setViewFlags( HbView::ViewFlagNone );
 
+            mTitleGroupBox->setVisible( true );
+            mTitleLabel->setVisible( false );
+
             break;
         }
         case EAudioOnlyView:
@@ -204,20 +249,6 @@
     }
 
     setMenu( details );
-
-    //
-    // Set framedrawer for semi transparent background
-    //
-    if ( ! mFrameItem )
-    {
-        mFrameItem = new HbFrameItem ( mTitleLabel );
-        mFrameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" );
-        mFrameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
-        mFrameItem->frameDrawer().setFillWholeRect( true );
-    }
-
-    mFrameItem->setGeometry( mTitleLabel->boundingRect() );
-    mFrameItem->setVisible( ( mController->viewMode() == EFullScreenView )? ETrue:EFalse ); 
 }
 
 // -------------------------------------------------------------------------------------------------