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