35
|
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 QMPXVideoPlaybackControlBar
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
37
|
18 |
// Version : %version: 6 %
|
35
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
#include "mpxvideo_debug.h"
|
37
|
23 |
#include "mpxvideoplaybacktoolbar.h"
|
35
|
24 |
#include "mpxvideoplaybackcontrolbar.h"
|
|
25 |
#include "mpxvideoplaybackprogressbar.h"
|
|
26 |
#include "mpxcommonvideoplaybackview.hrh"
|
|
27 |
#include "mpxvideoplaybackdocumentloader.h"
|
|
28 |
#include "mpxvideoplaybackcontrolscontroller.h"
|
|
29 |
|
|
30 |
|
|
31 |
// -------------------------------------------------------------------------------------------------
|
|
32 |
// QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar()
|
|
33 |
// -------------------------------------------------------------------------------------------------
|
|
34 |
//
|
|
35 |
QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar(
|
|
36 |
QMPXVideoPlaybackControlsController* controller )
|
|
37 |
: mController( controller )
|
|
38 |
, mProgressBar( NULL )
|
|
39 |
{
|
|
40 |
MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar"));
|
|
41 |
|
37
|
42 |
//
|
|
43 |
// button bar
|
|
44 |
//
|
|
45 |
mToolBar = new QMPXVideoPlaybackToolBar( mController );
|
35
|
46 |
}
|
|
47 |
|
|
48 |
// -------------------------------------------------------------------------------------------------
|
|
49 |
// QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()
|
|
50 |
// -------------------------------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()
|
|
53 |
{
|
|
54 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()"));
|
|
55 |
|
37
|
56 |
if ( mToolBar )
|
|
57 |
{
|
|
58 |
delete mToolBar;
|
|
59 |
mToolBar = NULL;
|
|
60 |
}
|
35
|
61 |
}
|
|
62 |
|
|
63 |
// -------------------------------------------------------------------------------------------------
|
|
64 |
// QMPXVideoPlaybackControlBar::initialize()
|
|
65 |
// -------------------------------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
void QMPXVideoPlaybackControlBar::initialize()
|
|
68 |
{
|
|
69 |
MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::initialize()"));
|
|
70 |
|
|
71 |
QMPXVideoPlaybackDocumentLoader *loader = mController->layoutLoader();
|
|
72 |
|
|
73 |
//
|
|
74 |
// Don't need to initialize buttons once it gets initialized
|
|
75 |
//
|
37
|
76 |
if ( mProgressBar == NULL )
|
35
|
77 |
{
|
|
78 |
//
|
|
79 |
// progress bar
|
|
80 |
//
|
37
|
81 |
QGraphicsWidget *widget = loader->findWidget( QString( "progressBarLayout" ) );
|
35
|
82 |
mProgressBar = qobject_cast<QMPXVideoPlaybackProgressBar*>( widget );
|
|
83 |
|
|
84 |
if ( mProgressBar )
|
|
85 |
{
|
|
86 |
mProgressBar->initialize();
|
|
87 |
}
|
|
88 |
}
|
|
89 |
}
|
|
90 |
|
|
91 |
// -------------------------------------------------------------------------------------------------
|
|
92 |
// QMPXVideoPlaybackControlBar::updateState()
|
|
93 |
// -------------------------------------------------------------------------------------------------
|
|
94 |
//
|
|
95 |
void QMPXVideoPlaybackControlBar::updateState( TMPXPlaybackState state )
|
|
96 |
{
|
|
97 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::updateState() state = %d"), state );
|
|
98 |
|
37
|
99 |
if ( mToolBar )
|
35
|
100 |
{
|
37
|
101 |
mToolBar->updateState( state );
|
35
|
102 |
}
|
|
103 |
|
|
104 |
if ( mProgressBar )
|
|
105 |
{
|
|
106 |
mProgressBar->updateState( state );
|
|
107 |
}
|
|
108 |
}
|
|
109 |
|
|
110 |
// -------------------------------------------------------------------------------------------------
|
|
111 |
// QMPXVideoPlaybackControlBar::aspectRatioChanged()
|
|
112 |
// -------------------------------------------------------------------------------------------------
|
|
113 |
//
|
|
114 |
void QMPXVideoPlaybackControlBar::aspectRatioChanged( int aspectRatio )
|
|
115 |
{
|
|
116 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio );
|
|
117 |
|
37
|
118 |
if ( mToolBar )
|
35
|
119 |
{
|
37
|
120 |
mToolBar->aspectRatioChanged( aspectRatio );
|
35
|
121 |
}
|
|
122 |
}
|
|
123 |
|
|
124 |
// -------------------------------------------------------------------------------------------------
|
|
125 |
// QMPXVideoPlaybackControlBar::updateWithFileDetails()
|
|
126 |
// -------------------------------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
void QMPXVideoPlaybackControlBar::updateWithFileDetails(
|
|
129 |
QMPXVideoPlaybackViewFileDetails* details )
|
|
130 |
{
|
|
131 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::updateWithFileDetails()"));
|
|
132 |
|
37
|
133 |
if ( mToolBar )
|
35
|
134 |
{
|
37
|
135 |
mToolBar->updateWithFileDetails( details );
|
35
|
136 |
}
|
|
137 |
|
|
138 |
if ( mProgressBar )
|
|
139 |
{
|
|
140 |
mProgressBar->updateWithFileDetails( details );
|
|
141 |
}
|
|
142 |
}
|
|
143 |
|
|
144 |
// -------------------------------------------------------------------------------------------------
|
|
145 |
// QMPXVideoPlaybackControlBar::setVisibleToControlBar()
|
|
146 |
// -------------------------------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
void QMPXVideoPlaybackControlBar::setVisibleToControlBar( bool visible )
|
|
149 |
{
|
36
|
150 |
MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::setVisibleToControlBar()"),
|
|
151 |
_L("visible = %d, current visibility = %d"), visible, isVisible() );
|
35
|
152 |
|
37
|
153 |
if ( visible != isVisible() )
|
35
|
154 |
{
|
37
|
155 |
setVisible( visible );
|
|
156 |
mToolBar->setVisible( visible );
|
35
|
157 |
}
|
|
158 |
}
|
|
159 |
|
|
160 |
// -------------------------------------------------------------------------------------------------
|
|
161 |
// QMPXVideoPlaybackControlBar::appeared()
|
|
162 |
// -------------------------------------------------------------------------------------------------
|
|
163 |
//
|
|
164 |
void QMPXVideoPlaybackControlBar::appeared( const HbEffect::EffectStatus &status )
|
|
165 |
{
|
|
166 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::appeared()"));
|
|
167 |
|
|
168 |
if ( status.reason == Hb::EffectFinished )
|
|
169 |
{
|
|
170 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::appeared() successful"));
|
|
171 |
}
|
|
172 |
else
|
|
173 |
{
|
|
174 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::appeared() NOT successful"));
|
|
175 |
}
|
|
176 |
}
|
|
177 |
|
|
178 |
// -------------------------------------------------------------------------------------------------
|
|
179 |
// QMPXVideoPlaybackControlBar::disappeared()
|
|
180 |
// -------------------------------------------------------------------------------------------------
|
|
181 |
//
|
|
182 |
void QMPXVideoPlaybackControlBar::disappeared( const HbEffect::EffectStatus &status )
|
|
183 |
{
|
|
184 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::disappeared()"));
|
|
185 |
|
|
186 |
if ( status.reason == Hb::EffectFinished )
|
|
187 |
{
|
36
|
188 |
setVisible( false );
|
|
189 |
|
35
|
190 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::disappeared() successful"));
|
|
191 |
}
|
|
192 |
else
|
|
193 |
{
|
|
194 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::disappeared() NOT successful"));
|
|
195 |
}
|
|
196 |
}
|
|
197 |
|
|
198 |
// -------------------------------------------------------------------------------------------------
|
|
199 |
// QMPXVideoPlaybackControlBar::durationChanged()
|
|
200 |
// -------------------------------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
void QMPXVideoPlaybackControlBar::durationChanged( int duration )
|
|
203 |
{
|
|
204 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::durationChanged()"));
|
|
205 |
|
|
206 |
if ( mProgressBar )
|
|
207 |
{
|
|
208 |
mProgressBar->durationChanged( duration );
|
|
209 |
}
|
36
|
210 |
|
37
|
211 |
if ( mToolBar )
|
36
|
212 |
{
|
37
|
213 |
mToolBar->durationChanged( duration );
|
36
|
214 |
}
|
35
|
215 |
}
|
|
216 |
|
|
217 |
// -------------------------------------------------------------------------------------------------
|
|
218 |
// QMPXVideoPlaybackControlBar::positionChanged()
|
|
219 |
// -------------------------------------------------------------------------------------------------
|
|
220 |
//
|
|
221 |
void QMPXVideoPlaybackControlBar::positionChanged( int position )
|
|
222 |
{
|
|
223 |
MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::positionChanged()"));
|
|
224 |
|
|
225 |
if ( mProgressBar )
|
|
226 |
{
|
|
227 |
mProgressBar->positionChanged( position );
|
|
228 |
}
|
36
|
229 |
|
37
|
230 |
if ( mToolBar )
|
36
|
231 |
{
|
37
|
232 |
mToolBar->positionChanged( position );
|
36
|
233 |
}
|
35
|
234 |
}
|
|
235 |
|
|
236 |
//End of file
|