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