99 // |
104 // |
100 // FW button |
105 // FW button |
101 // |
106 // |
102 widget = loader->findWidget( QString( "ffButton" ) ); |
107 widget = loader->findWidget( QString( "ffButton" ) ); |
103 HbPushButton *ffButton = qobject_cast<HbPushButton*>( widget ); |
108 HbPushButton *ffButton = qobject_cast<HbPushButton*>( widget ); |
104 connect( ffButton, SIGNAL( pressed() ), this, SLOT( startFFSeeking() ) ); |
109 connect( ffButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); |
105 connect( ffButton, SIGNAL( released() ), this, SLOT( endSeeking() ) ); |
110 connect( ffButton, SIGNAL( longPress( QPointF ) ), this, SLOT( ffPressing() ) ); |
|
111 connect( ffButton, SIGNAL( released() ), this, SLOT( ffReleased() ) ); |
106 mButtons.append( ffButton ); |
112 mButtons.append( ffButton ); |
107 |
113 |
108 // |
114 // |
109 // Aspect ratio button |
115 // Aspect ratio button |
110 // |
116 // |
133 HbPushButton *detailsButton = qobject_cast<HbPushButton*>( widget ); |
139 HbPushButton *detailsButton = qobject_cast<HbPushButton*>( widget ); |
134 connect( detailsButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); |
140 connect( detailsButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); |
135 connect( detailsButton, SIGNAL( released() ), this, SLOT( openDetailsView() ) ); |
141 connect( detailsButton, SIGNAL( released() ), this, SLOT( openDetailsView() ) ); |
136 mButtons.append( detailsButton ); |
142 mButtons.append( detailsButton ); |
137 |
143 |
|
144 // |
|
145 // Attach button |
|
146 // |
|
147 widget = loader->findWidget( QString( "attachButton" ) ); |
|
148 HbPushButton *attachButton = qobject_cast<HbPushButton*>( widget ); |
|
149 connect( attachButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); |
|
150 connect( attachButton, SIGNAL( released() ), mController, SLOT( attachVideo() ) ); |
|
151 mButtons.append( attachButton ); |
|
152 |
138 for ( int i = 0 ; i < EMPXButtonCount ; i++ ) |
153 for ( int i = 0 ; i < EMPXButtonCount ; i++ ) |
139 { |
154 { |
140 mButtons[i]->setFlag( QGraphicsItem::ItemIsFocusable, false ); |
155 mButtons[i]->setFlag( QGraphicsItem::ItemIsFocusable, false ); |
|
156 } |
|
157 |
|
158 mDuration = (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier; |
|
159 |
|
160 // |
|
161 // obtain layout for aspect ratio which contains all 3 aspect ratio buttons: |
|
162 // natural, stretch, zoom |
|
163 // |
|
164 widget = loader->findWidget( QString( "aspectRatioButtons" ) ); |
|
165 |
|
166 if ( mController->isAttachOperation() ) |
|
167 { |
|
168 // |
|
169 // disable 3 aspect ratio buttons |
|
170 // |
|
171 widget->setVisible( false ); |
|
172 |
|
173 // |
|
174 // enable "attach" button |
|
175 // |
|
176 mButtons[EMPXButtonAttach]->setVisible( true ); |
|
177 } |
|
178 else |
|
179 { |
|
180 // |
|
181 // enable 3 aspect ratio buttons |
|
182 // |
|
183 widget->setVisible( true ); |
|
184 |
|
185 // |
|
186 // disable "attach" button |
|
187 // |
|
188 mButtons[EMPXButtonAttach]->setVisible( false ); |
141 } |
189 } |
142 } |
190 } |
143 } |
191 } |
144 |
192 |
145 // ------------------------------------------------------------------------------------------------- |
193 // ------------------------------------------------------------------------------------------------- |
153 mController->resetDisappearingTimers( EMPXTimerReset ); |
201 mController->resetDisappearingTimers( EMPXTimerReset ); |
154 mController->handleCommand( EMPXPbvCmdPlay ); |
202 mController->handleCommand( EMPXPbvCmdPlay ); |
155 } |
203 } |
156 |
204 |
157 // ------------------------------------------------------------------------------------------------- |
205 // ------------------------------------------------------------------------------------------------- |
158 // QMPXVideoPlaybackButtonBar::startFFSeeking() |
206 // QMPXVideoPlaybackButtonBar::ffPressing() |
159 // ------------------------------------------------------------------------------------------------- |
207 // ------------------------------------------------------------------------------------------------- |
160 // |
208 // |
161 void QMPXVideoPlaybackButtonBar::startFFSeeking() |
209 void QMPXVideoPlaybackButtonBar::ffPressing() |
162 { |
210 { |
163 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::startFFSeeking()")); |
211 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::ffPressing()"), |
164 |
212 _L("mSeekingState = %d"), mSeekingState ); |
165 mButtons[EMPXButtonFF]->setSelected( true ); |
213 |
166 |
214 if ( mSeekingState == EMPXNotSeeking ) |
167 mController->resetDisappearingTimers( EMPXTimerCancel ); |
215 { |
168 mController->handleCommand( EMPXPbvCmdSeekForward ); |
216 mSeekingState = EMPXFastForwarding; |
169 } |
217 mButtons[EMPXButtonFF]->setSelected( true ); |
170 |
218 |
171 // ------------------------------------------------------------------------------------------------- |
219 mController->handleCommand( EMPXPbvCmdSeekForward ); |
172 // QMPXVideoPlaybackButtonBar::startRWSeeking() |
220 } |
173 // ------------------------------------------------------------------------------------------------- |
221 } |
174 // |
222 |
175 void QMPXVideoPlaybackButtonBar::startRWSeeking() |
223 // ------------------------------------------------------------------------------------------------- |
176 { |
224 // QMPXVideoPlaybackButtonBar::rwPressing() |
177 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::startRWSeeking()")); |
225 // ------------------------------------------------------------------------------------------------- |
178 |
226 // |
179 mButtons[EMPXButtonRW]->setSelected( true ); |
227 void QMPXVideoPlaybackButtonBar::rwPressing() |
180 |
228 { |
181 mController->resetDisappearingTimers( EMPXTimerCancel ); |
229 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::rwPressing()"), |
182 mController->handleCommand( EMPXPbvCmdSeekBackward ); |
230 _L("mSeekingState = %d"), mSeekingState ); |
183 } |
231 |
184 |
232 |
185 // ------------------------------------------------------------------------------------------------- |
233 if ( mSeekingState == EMPXNotSeeking ) |
186 // QMPXVideoPlaybackButtonBar::endSeeking() |
234 { |
187 // ------------------------------------------------------------------------------------------------- |
235 mSeekingState = EMPXRewinding; |
188 // |
236 mButtons[EMPXButtonRW]->setSelected( true ); |
189 void QMPXVideoPlaybackButtonBar::endSeeking() |
237 |
190 { |
238 mController->handleCommand( EMPXPbvCmdSeekBackward ); |
191 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::endSeeking()")); |
239 } |
192 |
240 } |
193 mButtons[EMPXButtonFF]->setSelected( false ); |
241 |
194 mButtons[EMPXButtonRW]->setSelected( false ); |
242 // ------------------------------------------------------------------------------------------------- |
|
243 // QMPXVideoPlaybackButtonBar::ffReleased() |
|
244 // ------------------------------------------------------------------------------------------------- |
|
245 // |
|
246 void QMPXVideoPlaybackButtonBar::ffReleased() |
|
247 { |
|
248 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::ffReleased()"), |
|
249 _L("mSeekingState = %d"), mSeekingState ); |
|
250 |
|
251 if ( mSeekingState == EMPXFastForwarding ) |
|
252 { |
|
253 mSeekingState = EMPXNotSeeking; |
|
254 mController->handleCommand( EMPXPbvCmdEndSeek ); |
|
255 mButtons[EMPXButtonFF]->setSelected( false ); |
|
256 } |
|
257 else |
|
258 { |
|
259 int temp = mPosition + KMPXFastForward; |
|
260 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::ffReleased() temp position = %d"), temp); |
|
261 |
|
262 // |
|
263 // If it has the playing time which is less than KMPXFastForward, ignore |
|
264 // |
|
265 if ( temp < mDuration ) |
|
266 { |
|
267 mController->handleCommand( EMPXPbvCmdSetPosition, temp ); |
|
268 } |
|
269 } |
195 |
270 |
196 mController->resetDisappearingTimers( EMPXTimerReset ); |
271 mController->resetDisappearingTimers( EMPXTimerReset ); |
197 mController->handleCommand( EMPXPbvCmdEndSeek ); |
272 } |
|
273 |
|
274 // ------------------------------------------------------------------------------------------------- |
|
275 // QMPXVideoPlaybackButtonBar::rwReleased() |
|
276 // ------------------------------------------------------------------------------------------------- |
|
277 // |
|
278 void QMPXVideoPlaybackButtonBar::rwReleased() |
|
279 { |
|
280 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::rwReleased()"), |
|
281 _L("mSeekingState = %d"), mSeekingState ); |
|
282 |
|
283 if ( mSeekingState == EMPXRewinding ) |
|
284 { |
|
285 mSeekingState = EMPXNotSeeking; |
|
286 mController->handleCommand( EMPXPbvCmdEndSeek ); |
|
287 mButtons[EMPXButtonRW]->setSelected( false ); |
|
288 } |
|
289 else |
|
290 { |
|
291 int temp = mPosition + KMPXRewind; |
|
292 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::rwReleased() temp position = %d"), temp); |
|
293 |
|
294 // |
|
295 // If it played less than KMPXRewind, jump to 0 |
|
296 // |
|
297 if ( temp < 0 ) |
|
298 { |
|
299 temp = 0; |
|
300 } |
|
301 |
|
302 mController->handleCommand( EMPXPbvCmdSetPosition, temp ); |
|
303 } |
|
304 |
|
305 mController->resetDisappearingTimers( EMPXTimerReset ); |
198 } |
306 } |
199 |
307 |
200 // ------------------------------------------------------------------------------------------------- |
308 // ------------------------------------------------------------------------------------------------- |
201 // QMPXVideoPlaybackButtonBar::pause() |
309 // QMPXVideoPlaybackButtonBar::pause() |
202 // ------------------------------------------------------------------------------------------------- |
310 // ------------------------------------------------------------------------------------------------- |
215 // |
323 // |
216 void QMPXVideoPlaybackButtonBar::changeAspectRatio() |
324 void QMPXVideoPlaybackButtonBar::changeAspectRatio() |
217 { |
325 { |
218 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::changeAspectRatio()")); |
326 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::changeAspectRatio()")); |
219 |
327 |
220 mController->resetDisappearingTimers( EMPXTimerReset ); |
328 if ( ! mController->isAttachOperation() ) |
221 |
329 { |
222 TMPXVideoPlaybackViewCommandIds cmd = EMPXPbvCmdNaturalAspectRatio; |
330 mController->resetDisappearingTimers( EMPXTimerReset ); |
223 |
331 |
224 if ( mButtons[EMPXButtonStretch]->isVisible() ) |
332 TMPXVideoPlaybackViewCommandIds cmd = EMPXPbvCmdNaturalAspectRatio; |
225 { |
333 |
226 cmd = EMPXPbvCmdStretchAspectRatio; |
334 if ( mButtons[EMPXButtonStretch]->isVisible() ) |
227 } |
335 { |
228 else if ( mButtons[EMPXButtonZoom]->isVisible() ) |
336 cmd = EMPXPbvCmdStretchAspectRatio; |
229 { |
337 } |
230 cmd = EMPXPbvCmdZoomAspectRatio; |
338 else if ( mButtons[EMPXButtonZoom]->isVisible() ) |
231 } |
339 { |
232 |
340 cmd = EMPXPbvCmdZoomAspectRatio; |
233 mController->handleCommand( cmd ); |
341 } |
|
342 |
|
343 mController->handleCommand( cmd ); |
|
344 } |
234 } |
345 } |
235 |
346 |
236 // ------------------------------------------------------------------------------------------------- |
347 // ------------------------------------------------------------------------------------------------- |
237 // QMPXVideoPlaybackButtonBar::updateState() |
348 // QMPXVideoPlaybackButtonBar::updateState() |
238 // ------------------------------------------------------------------------------------------------- |
349 // ------------------------------------------------------------------------------------------------- |
276 // |
396 // |
277 void QMPXVideoPlaybackButtonBar::aspectRatioChanged( int aspectRatio ) |
397 void QMPXVideoPlaybackButtonBar::aspectRatioChanged( int aspectRatio ) |
278 { |
398 { |
279 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio ); |
399 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio ); |
280 |
400 |
281 switch( aspectRatio ) |
401 if ( ! mController->isAttachOperation() ) |
282 { |
402 { |
283 case EMMFNatural: |
403 switch( aspectRatio ) |
284 { |
404 { |
285 mButtons[EMPXButtonNatural]->setVisible( false ); |
405 case EMMFNatural: |
286 mButtons[EMPXButtonStretch]->setVisible( true ); |
406 { |
287 mButtons[EMPXButtonZoom]->setVisible( false ); |
407 mButtons[EMPXButtonNatural]->setVisible( false ); |
288 break; |
408 mButtons[EMPXButtonStretch]->setVisible( true ); |
289 } |
409 mButtons[EMPXButtonZoom]->setVisible( false ); |
290 case EMMFStretch: |
410 break; |
291 { |
411 } |
292 mButtons[EMPXButtonNatural]->setVisible( false ); |
412 case EMMFStretch: |
293 mButtons[EMPXButtonStretch]->setVisible( false ); |
413 { |
294 mButtons[EMPXButtonZoom]->setVisible( true ); |
414 mButtons[EMPXButtonNatural]->setVisible( false ); |
295 break; |
415 mButtons[EMPXButtonStretch]->setVisible( false ); |
296 } |
416 mButtons[EMPXButtonZoom]->setVisible( true ); |
297 default: |
417 break; |
298 { |
418 } |
299 mButtons[EMPXButtonNatural]->setVisible( true ); |
419 default: |
300 mButtons[EMPXButtonStretch]->setVisible( false ); |
420 { |
301 mButtons[EMPXButtonZoom]->setVisible( false ); |
421 mButtons[EMPXButtonNatural]->setVisible( true ); |
302 break; |
422 mButtons[EMPXButtonStretch]->setVisible( false ); |
303 } |
423 mButtons[EMPXButtonZoom]->setVisible( false ); |
|
424 break; |
|
425 } |
|
426 } |
304 } |
427 } |
305 } |
428 } |
306 |
429 |
307 // ------------------------------------------------------------------------------------------------- |
430 // ------------------------------------------------------------------------------------------------- |
308 // QMPXVideoPlaybackButtonBar::handleButtonPressed() |
431 // QMPXVideoPlaybackButtonBar::handleButtonPressed() |
322 void QMPXVideoPlaybackButtonBar::updateWithFileDetails( |
445 void QMPXVideoPlaybackButtonBar::updateWithFileDetails( |
323 QMPXVideoPlaybackViewFileDetails* details ) |
446 QMPXVideoPlaybackViewFileDetails* details ) |
324 { |
447 { |
325 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateWithFileDetails()")); |
448 MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateWithFileDetails()")); |
326 |
449 |
327 if ( ! details->mVideoEnabled || |
450 if ( ! mController->isAttachOperation() ) |
328 details->mVideoHeight <= 0 || |
451 { |
329 details->mVideoWidth <= 0 || |
452 if ( ! details->mVideoEnabled || |
330 details->mTvOutConnected ) |
453 details->mVideoHeight <= 0 || |
331 { |
454 details->mVideoWidth <= 0 || |
332 mButtons[EMPXButtonNatural]->setEnabled( false ); |
455 details->mTvOutConnected ) |
333 mButtons[EMPXButtonStretch]->setEnabled( false ); |
456 { |
334 mButtons[EMPXButtonZoom]->setEnabled( false ); |
457 mButtons[EMPXButtonNatural]->setEnabled( false ); |
335 } |
458 mButtons[EMPXButtonStretch]->setEnabled( false ); |
336 else |
459 mButtons[EMPXButtonZoom]->setEnabled( false ); |
337 { |
460 } |
338 mButtons[EMPXButtonNatural]->setEnabled( true ); |
461 else |
339 mButtons[EMPXButtonStretch]->setEnabled( true ); |
462 { |
340 mButtons[EMPXButtonZoom]->setEnabled( true ); |
463 mButtons[EMPXButtonNatural]->setEnabled( true ); |
|
464 mButtons[EMPXButtonStretch]->setEnabled( true ); |
|
465 mButtons[EMPXButtonZoom]->setEnabled( true ); |
|
466 } |
341 } |
467 } |
342 |
468 |
343 // |
469 // |
344 // for audio-only clips and tv-out, default view is audionOnlyView |
470 // for audio-only clips and tv-out, default view is audionOnlyView |
345 // therefore, dim details button |
471 // therefore, dim details button |