|
1 /* |
|
2 * Copyright (c) 2009 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 QMPXVideoPlaybackControlConfiguration |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: da1mmcf#17 % |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 |
|
24 #include <QGraphicsWidget> |
|
25 |
|
26 #include "mpxvideo_debug.h" |
|
27 #include "mpxvideoplaybackdocumentloader.h" |
|
28 #include "mpxvideoplaybackviewfiledetails.h" |
|
29 #include "mpxvideoplaybackcontrolconfiguration.h" |
|
30 #include "mpxvideoplaybackcontrolscontroller.h" |
|
31 |
|
32 |
|
33 // ================= MEMBER FUNCTIONS ============================================================== |
|
34 |
|
35 // ------------------------------------------------------------------------------------------------- |
|
36 // CMPXVideoPlaybackControlConfiguration::CMPXVideoPlaybackControlConfiguration() |
|
37 // ------------------------------------------------------------------------------------------------- |
|
38 // |
|
39 QMPXVideoPlaybackControlConfiguration::QMPXVideoPlaybackControlConfiguration( |
|
40 QMPXVideoPlaybackControlsController* controller) |
|
41 : mControlsController( controller ) |
|
42 { |
|
43 createControlList(); |
|
44 } |
|
45 |
|
46 // ------------------------------------------------------------------------------------------------- |
|
47 // QMPXVideoPlaybackControlConfiguration::~QMPXVideoPlaybackControlConfiguration() |
|
48 // Destructor. |
|
49 // ------------------------------------------------------------------------------------------------- |
|
50 // |
|
51 QMPXVideoPlaybackControlConfiguration::~QMPXVideoPlaybackControlConfiguration() |
|
52 { |
|
53 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::~QMPXVideoPlaybackControlConfiguration")); |
|
54 |
|
55 mControlsList.clear(); |
|
56 } |
|
57 |
|
58 // ------------------------------------------------------------------------------------------------- |
|
59 // QMPXVideoPlaybackControlConfiguration::createControlList() |
|
60 // ------------------------------------------------------------------------------------------------- |
|
61 // |
|
62 void QMPXVideoPlaybackControlConfiguration::createControlList() |
|
63 { |
|
64 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::createControlList()")); |
|
65 |
|
66 QMPXVideoPlaybackViewFileDetails* fileDetails = mControlsController->fileDetails(); |
|
67 |
|
68 if ( fileDetails->mPlaybackMode != EMPXVideoLocal ) |
|
69 { |
|
70 // |
|
71 // if it's not local mode, add branding animation control to show while initializing |
|
72 // |
|
73 addControlToList( EMPXBufferingAnimation ); |
|
74 } |
|
75 |
|
76 addControlToList( EMPXStatusPane ); |
|
77 |
|
78 emit controlListUpdated(); |
|
79 } |
|
80 |
|
81 // ------------------------------------------------------------------------------------------------- |
|
82 // QMPXVideoPlaybackControlConfiguration::controlList |
|
83 // ------------------------------------------------------------------------------------------------- |
|
84 // |
|
85 QList<TMPXVideoPlaybackControls>& QMPXVideoPlaybackControlConfiguration::controlList() |
|
86 { |
|
87 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::controlList()")); |
|
88 |
|
89 return mControlsList; |
|
90 } |
|
91 |
|
92 // ------------------------------------------------------------------------------------------------- |
|
93 // QMPXVideoPlaybackControlConfiguration::updateControlList |
|
94 // ------------------------------------------------------------------------------------------------- |
|
95 // |
|
96 void QMPXVideoPlaybackControlConfiguration::updateControlList( |
|
97 TMPXVideoPlaybackControlCommandIds event ) |
|
98 { |
|
99 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlList(%d)"), event); |
|
100 |
|
101 QGraphicsWidget *widget = |
|
102 mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) ); |
|
103 |
|
104 switch ( event ) |
|
105 { |
|
106 case EMPXControlCmdFullScreenViewOpened: |
|
107 { |
|
108 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlList() full screen view")); |
|
109 |
|
110 widget->setVisible( true ); |
|
111 |
|
112 deleteControlFromList( EMPXDetailsViewPlaybackWindow ); |
|
113 deleteControlFromList( EMPXFileDetailsWidget ); |
|
114 deleteControlFromList( EMPXIndicatorBitmap ); |
|
115 |
|
116 break; |
|
117 } |
|
118 case EMPXControlCmdDetailsViewOpened: |
|
119 { |
|
120 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlList() details view")); |
|
121 |
|
122 widget->setVisible( false ); |
|
123 |
|
124 deleteControlFromList( EMPXIndicatorBitmap ); |
|
125 |
|
126 addControlToList( EMPXDetailsViewPlaybackWindow ); |
|
127 |
|
128 addControlToList( EMPXFileDetailsWidget ); |
|
129 |
|
130 break; |
|
131 } |
|
132 case EMPXControlCmdTvOutConnected: |
|
133 case EMPXControlCmdAudionOnlyViewOpened: |
|
134 { |
|
135 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlList() audion only view")); |
|
136 |
|
137 widget->setVisible( false ); |
|
138 |
|
139 deleteControlFromList( EMPXDetailsViewPlaybackWindow ); |
|
140 |
|
141 addControlToList( EMPXIndicatorBitmap ); |
|
142 addControlToList( EMPXFileDetailsWidget ); |
|
143 |
|
144 break; |
|
145 } |
|
146 case EMPXControlCmdTvOutDisconnected: |
|
147 { |
|
148 break; |
|
149 } |
|
150 default: |
|
151 { |
|
152 break; |
|
153 } |
|
154 } |
|
155 |
|
156 emit controlListUpdated(); |
|
157 } |
|
158 |
|
159 // ------------------------------------------------------------------------------------------------- |
|
160 // QMPXVideoPlaybackControlConfiguration::deleteControlFromList |
|
161 // ------------------------------------------------------------------------------------------------- |
|
162 // |
|
163 void QMPXVideoPlaybackControlConfiguration::deleteControlFromList( |
|
164 TMPXVideoPlaybackControls control ) |
|
165 { |
|
166 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::deleteControlFromList(%d)"), control); |
|
167 |
|
168 mControlsList.removeAll( control ); |
|
169 } |
|
170 |
|
171 // ------------------------------------------------------------------------------------------------- |
|
172 // QMPXVideoPlaybackControlConfiguration::addControlToList |
|
173 // ------------------------------------------------------------------------------------------------- |
|
174 // |
|
175 void QMPXVideoPlaybackControlConfiguration::addControlToList( |
|
176 TMPXVideoPlaybackControls control ) |
|
177 { |
|
178 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::addControlToList(%d)"), control); |
|
179 |
|
180 if ( ! mControlsList.contains( control ) ) |
|
181 { |
|
182 mControlsList.append( control ); |
|
183 } |
|
184 } |
|
185 |
|
186 // ------------------------------------------------------------------------------------------------- |
|
187 // QMPXVideoPlaybackControlConfiguration::updateControlsWithFileDetails |
|
188 // ------------------------------------------------------------------------------------------------- |
|
189 // |
|
190 void QMPXVideoPlaybackControlConfiguration::updateControlsWithFileDetails() |
|
191 { |
|
192 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlsWithFileDetails()")); |
|
193 |
|
194 addControlToList( EMPXControlBar ); |
|
195 |
|
196 if ( mControlsController->fileDetails()->mVideoEnabled ) |
|
197 { |
|
198 MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlsWithFileDetails() video enabled")); |
|
199 |
|
200 QGraphicsWidget *widget = |
|
201 mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) ); |
|
202 widget->setVisible( true ); |
|
203 } |
|
204 |
|
205 emit controlListUpdated(); |
|
206 } |
|
207 |
|
208 // End of File |