videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackdocumentloader.cpp
changeset 52 e3cecb93e76a
parent 47 45e72b57a2fd
child 59 a76e86df7ccd
equal deleted inserted replaced
47:45e72b57a2fd 52:e3cecb93e76a
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of QMPXVideoPlaybackDocumentLoader
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version:  4 %
       
    19 
       
    20 
       
    21 
       
    22 #include <hblistwidget.h>
       
    23 #include <hblabel.h>
       
    24 #include <hbtransparentwindow.h>
       
    25 #include <hbratingslider.h>
       
    26 
       
    27 #include "mpxvideo_debug.h"
       
    28 #include "mpxvideoplaybackdocumentloader.h"
       
    29 #include "mpxvideoplaybackcontrolscontroller.h"
       
    30 
       
    31 #include "mpxvideoplaybackcontrolbar.h"
       
    32 #include "mpxvideoplaybackfiledetailswidget.h"
       
    33 #include "mpxvideoplaybackcontrolconfiguration.h"
       
    34 #include "mpxvideoplaybackdetailsplaybackwindow.h"
       
    35 
       
    36 
       
    37 // -------------------------------------------------------------------------------------------------
       
    38 // QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
       
    39 // -------------------------------------------------------------------------------------------------
       
    40 //
       
    41 QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader( 
       
    42         QMPXVideoPlaybackControlsController *controller )
       
    43 {
       
    44     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));
       
    45     mController = controller;
       
    46 }
       
    47 
       
    48 // -------------------------------------------------------------------------------------------------
       
    49 // QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
       
    50 // -------------------------------------------------------------------------------------------------
       
    51 //
       
    52 QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
       
    53 {
       
    54     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader : mWidgets.count(%d)"), 
       
    55             mWidgets.count() );
       
    56 
       
    57     for ( int i = 0 ; i < mWidgets.count() ; i++ )
       
    58     {
       
    59         mWidgets.removeAt( 0 );
       
    60     }
       
    61 }
       
    62 
       
    63 // -------------------------------------------------------------------------------------------------
       
    64 // QMPXVideoPlaybackDocumentLoader::findWidget()
       
    65 // -------------------------------------------------------------------------------------------------
       
    66 //
       
    67 QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
       
    68 {
       
    69     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget(%s)"), name.data() );
       
    70 
       
    71     QGraphicsWidget *object = NULL;
       
    72 
       
    73     //int index = exist( name );
       
    74     mIndex = exist( name );
       
    75 
       
    76     if ( mIndex == -1 )
       
    77     {
       
    78         object = createWidget( name );
       
    79     }
       
    80     else
       
    81     {
       
    82         object = mWidgets[ mIndex ];
       
    83     }
       
    84     
       
    85     return object;
       
    86 }
       
    87 
       
    88 // -------------------------------------------------------------------------------------------------
       
    89 // QMPXVideoPlaybackDocumentLoader::createWidget()
       
    90 // -------------------------------------------------------------------------------------------------
       
    91 //
       
    92 QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
       
    93 {
       
    94     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget(%s)"), name.data() );
       
    95 
       
    96     QGraphicsWidget *object = NULL;
       
    97     
       
    98     if ( name == "transparentWindow" ||
       
    99          name == "small_transparentWindow" )
       
   100     {
       
   101         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating transparentWindow") );
       
   102         
       
   103         object = new HbTransparentWindow();
       
   104         object->setObjectName( name );
       
   105         
       
   106         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[transparentWindow] to object list") );
       
   107         mWidgets.append( object );                
       
   108     }
       
   109     else if ( name == "content" || name == "bitmapLayout" )
       
   110     {
       
   111         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating HbWidget") );
       
   112         
       
   113         object = new HbWidget();
       
   114         object->setObjectName( name );
       
   115         
       
   116         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[HbWidget] to object list") );                        
       
   117         mWidgets.append( object );
       
   118     }
       
   119     else if ( name == "title" || name == "bufferingIcon" || 
       
   120               name == "tvOutBitmap" || name == "realAudioOnlyBitmap" ||
       
   121               name == "partialAudioOnlyBitmap" || name == "audioOnlyBitmap" )
       
   122     {
       
   123         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating HbLabel") );
       
   124         
       
   125         object = new HbLabel();
       
   126         object->setObjectName( name );
       
   127         
       
   128         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[HbLabel] to object list") );                
       
   129         mWidgets.append( object );
       
   130     }
       
   131     else if ( name == "controlBarLayout" )
       
   132     {
       
   133         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating controlBarLayout") );
       
   134     
       
   135         object = new QMPXVideoPlaybackControlBar( mController );
       
   136         object->setObjectName( name );
       
   137         
       
   138         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[controlBarLayout] to object list") );                        
       
   139         mWidgets.append( object );
       
   140     }
       
   141     else if ( name == "fileDetailsLayout" )
       
   142     {
       
   143         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating fileDetailsLayout") );
       
   144     
       
   145         object = new QMPXVideoPlaybackFileDetailsWidget( mController );
       
   146         object->setObjectName( name );
       
   147         
       
   148         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[fileDetailsLayout] to object list") );                        
       
   149         mWidgets.append( object );
       
   150     }
       
   151     else if ( name == "detailsPlaybackWindow" )
       
   152     {
       
   153         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating detailsPlaybackWindow") );
       
   154     
       
   155         object = new QMPXVideoPlaybackDetailsPlaybackWindow( mController );
       
   156         object->setObjectName( name );
       
   157         
       
   158         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[detailsPlaybackWindow] to object list") );                        
       
   159         mWidgets.append( object );
       
   160     }
       
   161     else if ( name == "fileDetails" )
       
   162     {
       
   163         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating HbListWidget") );
       
   164         
       
   165         object = new HbListWidget();
       
   166         object->setObjectName( name );
       
   167         
       
   168         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[HbListWidget] to object list") );                        
       
   169         mWidgets.append( object );
       
   170     }
       
   171     else if ( name == "nonLocalPlayback" )
       
   172     {
       
   173         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating HbRatingSlider") );
       
   174         
       
   175         object = new HbRatingSlider();
       
   176         object->setObjectName( name );
       
   177         
       
   178         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[HbRatingSlider] to object list") );                        
       
   179         mWidgets.append( object );
       
   180     }
       
   181     else if ( name == "rnLogoBitmap" )
       
   182     {
       
   183         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating rnLogoBitmap") );
       
   184         
       
   185         object = new HbWidget();
       
   186         object->setObjectName( name );
       
   187 
       
   188         MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[rnLogoBitmap] to object list") );                        
       
   189         mWidgets.append( object );
       
   190     }
       
   191 
       
   192     return object;
       
   193 }
       
   194 
       
   195 // -------------------------------------------------------------------------------------------------
       
   196 // QMPXVideoPlaybackDocumentLoader::exist()
       
   197 // -------------------------------------------------------------------------------------------------
       
   198 //
       
   199 int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
       
   200 {    
       
   201     int i = 0;
       
   202 
       
   203     for ( ; i < mWidgets.count() ; i++ )
       
   204     {
       
   205         if( mWidgets[i]->objectName() == name )
       
   206         {
       
   207             break;
       
   208         }
       
   209     }
       
   210 
       
   211     if ( i == mWidgets.count() )
       
   212     {
       
   213         i = -1;
       
   214     }
       
   215 
       
   216     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist(%s) returns %d"), 
       
   217             name.data(), i );
       
   218 
       
   219     return i;
       
   220 }
       
   221 
       
   222 // -------------------------------------------------------------------------------------------------
       
   223 // QMPXVideoPlaybackDocumentLoader::load()
       
   224 // -------------------------------------------------------------------------------------------------
       
   225 //
       
   226 void QMPXVideoPlaybackDocumentLoader::load( 
       
   227         const QString &fileName, const QString &section , bool *ok )
       
   228 {
       
   229     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::load(fileName=%s, section=%s)"), 
       
   230             fileName.data(), section.data() );
       
   231     
       
   232     Q_UNUSED( fileName );
       
   233     Q_UNUSED( section );
       
   234     *ok = true;
       
   235 }
       
   236 
       
   237 // -------------------------------------------------------------------------------------------------
       
   238 // QMPXVideoPlaybackDocumentLoader::load()
       
   239 // -------------------------------------------------------------------------------------------------
       
   240 //
       
   241 void QMPXVideoPlaybackDocumentLoader::load( 
       
   242         const QString &fileName, bool *ok )
       
   243 {
       
   244     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::load(fileName=%s)"), fileName.data() );
       
   245     Q_UNUSED( fileName );
       
   246     *ok = true;
       
   247 }
       
   248 
       
   249 // -------------------------------------------------------------------------------------------------
       
   250 // QMPXVideoPlaybackDocumentLoader::isVisible()
       
   251 // -------------------------------------------------------------------------------------------------
       
   252 //
       
   253 bool QMPXVideoPlaybackDocumentLoader::isVisible( int index )
       
   254 {
       
   255     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::isVisible(%d)"), index );
       
   256     
       
   257     return mWidgets[ index ]->isVisible();
       
   258 }
       
   259 
       
   260 // End of file