videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/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:  2 %
       
    19 
       
    20 
       
    21 
       
    22 #include <hblistwidget.h>
       
    23 
       
    24 #include "mpxvideo_debug.h"
       
    25 #include "mpxvideoplaybackdocumentloader.h"
       
    26 
       
    27 
       
    28 // -------------------------------------------------------------------------------------------------
       
    29 // QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
       
    30 // -------------------------------------------------------------------------------------------------
       
    31 //
       
    32 QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()
       
    33 {
       
    34     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));
       
    35 }
       
    36 
       
    37 // -------------------------------------------------------------------------------------------------
       
    38 // QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
       
    39 // -------------------------------------------------------------------------------------------------
       
    40 //
       
    41 QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
       
    42 {
       
    43     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader") );
       
    44 
       
    45     for ( int i = 0 ; i < mWidgets.count() ; i++ )
       
    46     {
       
    47         mWidgets.removeAt( 0 );
       
    48     }
       
    49 }
       
    50 
       
    51 // -------------------------------------------------------------------------------------------------
       
    52 // QMPXVideoPlaybackDocumentLoader::findWidget()
       
    53 // -------------------------------------------------------------------------------------------------
       
    54 //
       
    55 QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
       
    56 {
       
    57     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget") );
       
    58 
       
    59     QGraphicsWidget *object = NULL;
       
    60 
       
    61     int index = exist( name );
       
    62 
       
    63     if ( index == -1 )
       
    64     {
       
    65         object = createWidget( name );
       
    66     }
       
    67     else
       
    68     {
       
    69         object = mWidgets[ index ];
       
    70     }
       
    71 
       
    72     return object;
       
    73 }
       
    74 
       
    75 // -------------------------------------------------------------------------------------------------
       
    76 // QMPXVideoPlaybackDocumentLoader::createWidget()
       
    77 // -------------------------------------------------------------------------------------------------
       
    78 //
       
    79 QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
       
    80 {
       
    81     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget") );
       
    82 
       
    83     QGraphicsWidget *object = NULL;
       
    84         
       
    85     if ( name == "fileDetails" )
       
    86     {
       
    87         object = new HbListWidget();
       
    88         object->setObjectName( name );
       
    89         mWidgets.append( object );
       
    90     }
       
    91     else if ( name == "content" )
       
    92     {
       
    93         object = new QGraphicsWidget();
       
    94         object->setObjectName( name );
       
    95         mWidgets.append( object );
       
    96     }
       
    97 
       
    98     return object;
       
    99 }
       
   100 
       
   101 // -------------------------------------------------------------------------------------------------
       
   102 // QMPXVideoPlaybackDocumentLoader::exist()
       
   103 // -------------------------------------------------------------------------------------------------
       
   104 //
       
   105 int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
       
   106 {
       
   107     int i = 0;
       
   108 
       
   109     for ( ; i < mWidgets.count() ; i++ )
       
   110     {
       
   111         if( mWidgets[i]->objectName() == name )
       
   112         {
       
   113             break;
       
   114         }
       
   115     }
       
   116 
       
   117     if ( i == mWidgets.count() )
       
   118     {
       
   119         i = -1;
       
   120     }
       
   121 
       
   122     MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist %d"), i );
       
   123 
       
   124     return i;
       
   125 }
       
   126 
       
   127 // -------------------------------------------------------------------------------------------------
       
   128 // QMPXVideoPlaybackDocumentLoader::load()
       
   129 // -------------------------------------------------------------------------------------------------
       
   130 //
       
   131 void QMPXVideoPlaybackDocumentLoader::load( 
       
   132         const QString &fileName, const QString &section , bool *ok )
       
   133 {
       
   134     Q_UNUSED( fileName );
       
   135     Q_UNUSED( section );
       
   136     Q_UNUSED( ok );
       
   137 }
       
   138 
       
   139 // End of file