videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/stub/src/mpxvideoplaybackdocumentloader.cpp
author hgs
Thu, 01 Apr 2010 23:32:44 +0300
changeset 35 3738fe97f027
parent 34 bbb98528c666
permissions -rw-r--r--
201011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  Implementation of QMPXVideoPlaybackDocumentLoader
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
// Version : %version:  1 %
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
#include <hbwidget.h>
hgs
parents:
diff changeset
    22
#include <hbtransparentwindow.h>
hgs
parents:
diff changeset
    23
#include <hblabel.h>
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
#include "mpxvideo_debug.h"
hgs
parents:
diff changeset
    26
#include "mpxvideoplaybackdocumentloader.h"
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
hgs
parents:
diff changeset
    29
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    30
// QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
hgs
parents:
diff changeset
    31
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    32
//
hgs
parents:
diff changeset
    33
QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()
hgs
parents:
diff changeset
    34
{
hgs
parents:
diff changeset
    35
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));    
hgs
parents:
diff changeset
    36
}
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    39
// QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
hgs
parents:
diff changeset
    40
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    41
//
hgs
parents:
diff changeset
    42
QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
hgs
parents:
diff changeset
    43
{
hgs
parents:
diff changeset
    44
    MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader") );
hgs
parents:
diff changeset
    45
hgs
parents:
diff changeset
    46
    for ( int i = 0 ; i < mWidgets.count() ; i++ )
hgs
parents:
diff changeset
    47
    {
hgs
parents:
diff changeset
    48
        mWidgets.removeAt( 0 );
hgs
parents:
diff changeset
    49
    }
hgs
parents:
diff changeset
    50
}
hgs
parents:
diff changeset
    51
hgs
parents:
diff changeset
    52
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    53
// QMPXVideoPlaybackDocumentLoader::findWidget()
hgs
parents:
diff changeset
    54
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    55
//
hgs
parents:
diff changeset
    56
QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
hgs
parents:
diff changeset
    57
{
hgs
parents:
diff changeset
    58
    MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget") );
hgs
parents:
diff changeset
    59
hgs
parents:
diff changeset
    60
    QGraphicsWidget *object = NULL;
hgs
parents:
diff changeset
    61
hgs
parents:
diff changeset
    62
    int index = exist( name );
hgs
parents:
diff changeset
    63
hgs
parents:
diff changeset
    64
    if ( index == -1 )
hgs
parents:
diff changeset
    65
    {
hgs
parents:
diff changeset
    66
        object = createWidget( name );
hgs
parents:
diff changeset
    67
    }
hgs
parents:
diff changeset
    68
    else
hgs
parents:
diff changeset
    69
    {
hgs
parents:
diff changeset
    70
        object = mWidgets[ index ];
hgs
parents:
diff changeset
    71
    }
hgs
parents:
diff changeset
    72
hgs
parents:
diff changeset
    73
    return object;
hgs
parents:
diff changeset
    74
}
hgs
parents:
diff changeset
    75
hgs
parents:
diff changeset
    76
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    77
// QMPXVideoPlaybackDocumentLoader::createWidget()
hgs
parents:
diff changeset
    78
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    79
//
hgs
parents:
diff changeset
    80
QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
hgs
parents:
diff changeset
    81
{
hgs
parents:
diff changeset
    82
    MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget") );
hgs
parents:
diff changeset
    83
hgs
parents:
diff changeset
    84
    QGraphicsWidget *object = NULL;
hgs
parents:
diff changeset
    85
        
hgs
parents:
diff changeset
    86
    if ( name == "transparentWindow" )
hgs
parents:
diff changeset
    87
    {
hgs
parents:
diff changeset
    88
        MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating transparentWindow") );
hgs
parents:
diff changeset
    89
        
hgs
parents:
diff changeset
    90
        object = new HbTransparentWindow();
hgs
parents:
diff changeset
    91
		object->setObjectName( name );
hgs
parents:
diff changeset
    92
        
hgs
parents:
diff changeset
    93
        MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending to object list") );
hgs
parents:
diff changeset
    94
        mWidgets.append( object );                
hgs
parents:
diff changeset
    95
    }
hgs
parents:
diff changeset
    96
    else if ( name == "title" )
hgs
parents:
diff changeset
    97
    {        
hgs
parents:
diff changeset
    98
        object = new HbLabel();
hgs
parents:
diff changeset
    99
		object->setObjectName( name );
hgs
parents:
diff changeset
   100
        mWidgets.append( object );
hgs
parents:
diff changeset
   101
    }
hgs
parents:
diff changeset
   102
hgs
parents:
diff changeset
   103
    return object;
hgs
parents:
diff changeset
   104
}
hgs
parents:
diff changeset
   105
hgs
parents:
diff changeset
   106
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   107
// QMPXVideoPlaybackDocumentLoader::exist()
hgs
parents:
diff changeset
   108
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   109
//
hgs
parents:
diff changeset
   110
int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
hgs
parents:
diff changeset
   111
{
hgs
parents:
diff changeset
   112
    int i = 0;
hgs
parents:
diff changeset
   113
hgs
parents:
diff changeset
   114
    for ( ; i < mWidgets.count() ; i++ )
hgs
parents:
diff changeset
   115
    {
hgs
parents:
diff changeset
   116
        if( mWidgets[i]->objectName() == name )
hgs
parents:
diff changeset
   117
        {
hgs
parents:
diff changeset
   118
            break;
hgs
parents:
diff changeset
   119
        }
hgs
parents:
diff changeset
   120
    }
hgs
parents:
diff changeset
   121
hgs
parents:
diff changeset
   122
    if ( i == mWidgets.count() )
hgs
parents:
diff changeset
   123
    {
hgs
parents:
diff changeset
   124
        i = -1;
hgs
parents:
diff changeset
   125
    }
hgs
parents:
diff changeset
   126
hgs
parents:
diff changeset
   127
    MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist %d"), i );
hgs
parents:
diff changeset
   128
hgs
parents:
diff changeset
   129
    return i;
hgs
parents:
diff changeset
   130
}
hgs
parents:
diff changeset
   131
hgs
parents:
diff changeset
   132
// End of file