|
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 |
|
22 #include "hbpushbutton.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 == "detailsViewPlayButton" ) |
|
86 { |
|
87 object = new HbPushButton(); |
|
88 object->setObjectName( name ); |
|
89 mWidgets.append( object ); |
|
90 } |
|
91 |
|
92 return object; |
|
93 } |
|
94 |
|
95 // ------------------------------------------------------------------------------------------------- |
|
96 // QMPXVideoPlaybackDocumentLoader::exist() |
|
97 // ------------------------------------------------------------------------------------------------- |
|
98 // |
|
99 int QMPXVideoPlaybackDocumentLoader::exist( const QString &name ) |
|
100 { |
|
101 int i = 0; |
|
102 |
|
103 for ( ; i < mWidgets.count() ; i++ ) |
|
104 { |
|
105 if( mWidgets[i]->objectName() == name ) |
|
106 { |
|
107 break; |
|
108 } |
|
109 } |
|
110 |
|
111 if ( i == mWidgets.count() ) |
|
112 { |
|
113 i = -1; |
|
114 } |
|
115 |
|
116 MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist %d"), i ); |
|
117 |
|
118 return i; |
|
119 } |
|
120 |
|
121 // End of file |