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