30
|
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 QMPXVideoPlaybackStatusPaneControl
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
38
|
18 |
// Version : %version: 16 %
|
|
19 |
|
30
|
20 |
|
|
21 |
|
38
|
22 |
#include <QFileInfo>
|
|
23 |
|
30
|
24 |
#include <hbmenu.h>
|
|
25 |
#include <hblabel.h>
|
|
26 |
#include <hbaction.h>
|
38
|
27 |
#include <hbgroupbox.h>
|
30
|
28 |
#include <hbinstance.h>
|
34
|
29 |
#include <hbframeitem.h>
|
|
30 |
#include <hbframedrawer.h>
|
30
|
31 |
|
|
32 |
#include <w32std.h>
|
|
33 |
|
|
34 |
#include "mpxvideo_debug.h"
|
|
35 |
#include "hbvideobaseplaybackview.h"
|
|
36 |
#include "mpxvideoplaybackdocumentloader.h"
|
|
37 |
#include "mpxvideoplaybackstatuspanecontrol.h"
|
|
38 |
#include "mpxvideoplaybackcontrolscontroller.h"
|
|
39 |
|
|
40 |
|
|
41 |
// -------------------------------------------------------------------------------------------------
|
|
42 |
// QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()
|
|
43 |
// -------------------------------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl(
|
|
46 |
QMPXVideoPlaybackControlsController* controller,
|
|
47 |
TMPXVideoPlaybackControls index,
|
|
48 |
HbWidget* widget,
|
|
49 |
TUint controlproperties )
|
|
50 |
: QMPXVideoPlaybackFullScreenControl( controller, index, widget, controlproperties )
|
|
51 |
, mActionBack( NULL )
|
38
|
52 |
, mTitleLabel( NULL )
|
|
53 |
, mTitleGroupBox( NULL )
|
|
54 |
, mTitleLayout( NULL )
|
30
|
55 |
{
|
|
56 |
MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()"));
|
|
57 |
|
38
|
58 |
Q_UNUSED( widget );
|
|
59 |
|
35
|
60 |
mActionBack = new HbAction( Hb::BackNaviAction );
|
30
|
61 |
|
|
62 |
//
|
|
63 |
// Press "back" key means going back to previous view if it's avaiable
|
|
64 |
//
|
|
65 |
connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
|
36
|
66 |
mController->view()->setNavigationAction( mActionBack );
|
30
|
67 |
|
|
68 |
connect( mController->view()->menu(), SIGNAL( aboutToShow() ), this, SLOT( handleAboutToShow() ) );
|
|
69 |
connect( mController->view()->menu(), SIGNAL( aboutToHide() ), this, SLOT( handleAboutToHide() ) );
|
|
70 |
}
|
|
71 |
|
|
72 |
// -------------------------------------------------------------------------------------------------
|
|
73 |
// QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
|
|
74 |
// -------------------------------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
|
|
77 |
{
|
37
|
78 |
MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl"));
|
30
|
79 |
|
|
80 |
disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
|
|
81 |
disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
|
36
|
82 |
mController->view()->setNavigationAction( 0 );
|
30
|
83 |
|
|
84 |
disconnect( mController->view()->menu(), SIGNAL( aboutToShow() ), this, SLOT( handleAboutToShow() ) );
|
|
85 |
disconnect( mController->view()->menu(), SIGNAL( aboutToHide() ), this, SLOT( handleAboutToHide() ) );
|
|
86 |
|
|
87 |
mController->view()->menu()->close();
|
|
88 |
|
|
89 |
if ( mActionBack )
|
|
90 |
{
|
|
91 |
delete mActionBack;
|
|
92 |
mActionBack = NULL;
|
|
93 |
}
|
|
94 |
}
|
|
95 |
|
|
96 |
// -------------------------------------------------------------------------------------------------
|
|
97 |
// QMPXVideoPlaybackStatusPaneControl::setVisible()
|
|
98 |
// -------------------------------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
void QMPXVideoPlaybackStatusPaneControl::setVisible( bool visible )
|
|
101 |
{
|
|
102 |
mVisible = visible;
|
|
103 |
|
|
104 |
if ( mVisible )
|
|
105 |
{
|
36
|
106 |
mController->view()->setTitleBarVisible( true );
|
|
107 |
mController->view()->setStatusBarVisible( true );
|
30
|
108 |
|
|
109 |
if ( mController->viewMode() == EFullScreenView ||
|
|
110 |
mController->viewMode() == EDetailsView )
|
|
111 |
{
|
38
|
112 |
mTitleLayout->setVisible( true );
|
30
|
113 |
}
|
|
114 |
}
|
|
115 |
else
|
|
116 |
{
|
|
117 |
mController->view()->menu()->close();
|
36
|
118 |
mController->view()->setTitleBarVisible( false );
|
|
119 |
mController->view()->setStatusBarVisible( false );
|
30
|
120 |
|
38
|
121 |
mTitleLayout->setVisible( false );
|
30
|
122 |
}
|
|
123 |
}
|
|
124 |
|
|
125 |
// -------------------------------------------------------------------------------------------------
|
|
126 |
// QMPXVideoPlaybackStatusPaneControl::isVisible()
|
|
127 |
// -------------------------------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
bool QMPXVideoPlaybackStatusPaneControl::isVisible()
|
|
130 |
{
|
|
131 |
return mVisible;
|
|
132 |
}
|
|
133 |
|
|
134 |
// -------------------------------------------------------------------------------------------------
|
|
135 |
// QMPXVideoPlaybackStatusPaneControl::setVisibility()
|
|
136 |
// -------------------------------------------------------------------------------------------------
|
|
137 |
//
|
|
138 |
void QMPXVideoPlaybackStatusPaneControl::setVisibility( TMPXPlaybackState state )
|
|
139 |
{
|
|
140 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::setVisibility()"));
|
|
141 |
|
|
142 |
switch( state )
|
|
143 |
{
|
|
144 |
case EPbStatePlaying:
|
|
145 |
case EPbStatePaused:
|
|
146 |
{
|
|
147 |
setMenu( mController->fileDetails() );
|
|
148 |
break;
|
|
149 |
}
|
|
150 |
case EPbStatePluginSeeking:
|
|
151 |
case EPbStateBuffering:
|
|
152 |
case EPbStateNotInitialised:
|
|
153 |
case EPbStateInitialising:
|
|
154 |
{
|
|
155 |
mController->view()->menu()->clearActions();
|
|
156 |
break;
|
|
157 |
}
|
|
158 |
}
|
|
159 |
|
|
160 |
QMPXVideoPlaybackFullScreenControl::setVisibility( state );
|
|
161 |
}
|
|
162 |
|
|
163 |
// -------------------------------------------------------------------------------------------------
|
|
164 |
// QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()
|
|
165 |
// -------------------------------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails(
|
|
168 |
QMPXVideoPlaybackViewFileDetails* details )
|
|
169 |
{
|
|
170 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()"));
|
|
171 |
|
38
|
172 |
if ( ! mTitleLabel )
|
|
173 |
{
|
|
174 |
//
|
|
175 |
// If title is not available, show clip name
|
|
176 |
//
|
|
177 |
QString title = mController->fileDetails()->mTitle;
|
|
178 |
|
|
179 |
if ( title.count() == 0 )
|
|
180 |
{
|
|
181 |
QFileInfo fileInfo( mController->fileDetails()->mClipName );
|
|
182 |
title = fileInfo.baseName ();
|
|
183 |
}
|
|
184 |
|
|
185 |
QGraphicsWidget *qWidget = mController->layoutLoader()->findWidget( QString( "title" ) );
|
|
186 |
mTitleLabel = qobject_cast<HbLabel*>( qWidget );
|
|
187 |
mTitleLabel->setPlainText( title );
|
|
188 |
|
|
189 |
qWidget = mController->layoutLoader()->findWidget( QString( "titleGroupBox" ) );
|
|
190 |
mTitleGroupBox = qobject_cast<HbGroupBox*>( qWidget );
|
|
191 |
mTitleGroupBox->setHeading( title );
|
|
192 |
|
|
193 |
mTitleLayout = mController->layoutLoader()->findWidget( QString( "titleLayout" ) );
|
|
194 |
|
|
195 |
//
|
|
196 |
// Set framedrawer for semi transparent background
|
|
197 |
//
|
|
198 |
HbFrameItem *frameItem = new HbFrameItem();
|
|
199 |
frameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" );
|
|
200 |
frameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
|
|
201 |
frameItem->frameDrawer().setFillWholeRect( true );
|
|
202 |
mTitleLabel->setBackgroundItem( frameItem );
|
|
203 |
}
|
|
204 |
|
34
|
205 |
switch( mController->viewMode() )
|
30
|
206 |
{
|
34
|
207 |
case EFullScreenView:
|
|
208 |
{
|
|
209 |
//
|
|
210 |
// Set TitleBar transparent and go back to preview view with back key
|
|
211 |
//
|
|
212 |
disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
|
|
213 |
connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
|
|
214 |
|
36
|
215 |
mController->view()->setViewFlags(
|
|
216 |
HbView::HbViewFlags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent ) );
|
38
|
217 |
|
|
218 |
mTitleLabel->setVisible( true );
|
|
219 |
mTitleGroupBox->setVisible( false );
|
|
220 |
|
34
|
221 |
break;
|
|
222 |
}
|
|
223 |
case EDetailsView:
|
|
224 |
{
|
|
225 |
//
|
|
226 |
// Set TitleBar opaque and go back to full screen view with back key
|
|
227 |
//
|
|
228 |
disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
|
|
229 |
connect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
|
|
230 |
|
36
|
231 |
mController->view()->setViewFlags( HbView::ViewFlagNone );
|
34
|
232 |
|
38
|
233 |
mTitleGroupBox->setVisible( true );
|
|
234 |
mTitleLabel->setVisible( false );
|
|
235 |
|
34
|
236 |
break;
|
|
237 |
}
|
|
238 |
case EAudioOnlyView:
|
|
239 |
{
|
|
240 |
//
|
|
241 |
// Set TitleBar opaque and go back to preview view with back key
|
|
242 |
//
|
|
243 |
disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
|
|
244 |
connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
|
|
245 |
|
36
|
246 |
mController->view()->setViewFlags( HbView::ViewFlagNone );
|
34
|
247 |
break;
|
|
248 |
}
|
30
|
249 |
}
|
|
250 |
|
|
251 |
setMenu( details );
|
|
252 |
}
|
|
253 |
|
|
254 |
// -------------------------------------------------------------------------------------------------
|
|
255 |
// QMPXVideoPlaybackStatusPaneControl::setMenu()
|
|
256 |
// -------------------------------------------------------------------------------------------------
|
|
257 |
//
|
|
258 |
void QMPXVideoPlaybackStatusPaneControl::setMenu( QMPXVideoPlaybackViewFileDetails* details )
|
|
259 |
{
|
|
260 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::setMenu()"));
|
|
261 |
|
|
262 |
//
|
34
|
263 |
// No available menu for now
|
30
|
264 |
//
|
34
|
265 |
Q_UNUSED( details );
|
30
|
266 |
}
|
|
267 |
|
|
268 |
// -------------------------------------------------------------------------------------------------
|
|
269 |
// QMPXVideoPlaybackStatusPaneControl::handleAboutToShow()
|
|
270 |
// -------------------------------------------------------------------------------------------------
|
|
271 |
//
|
|
272 |
void QMPXVideoPlaybackStatusPaneControl::handleAboutToShow()
|
|
273 |
{
|
|
274 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::handleAboutToShow()"));
|
|
275 |
|
|
276 |
mController->resetDisappearingTimers( EMPXTimerCancel );
|
|
277 |
}
|
|
278 |
|
|
279 |
// -------------------------------------------------------------------------------------------------
|
|
280 |
// QMPXVideoPlaybackStatusPaneControl::handleAboutToHide()
|
|
281 |
// -------------------------------------------------------------------------------------------------
|
|
282 |
//
|
|
283 |
void QMPXVideoPlaybackStatusPaneControl::handleAboutToHide()
|
|
284 |
{
|
|
285 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::handleAboutToHide()"));
|
|
286 |
|
|
287 |
mController->resetDisappearingTimers( EMPXTimerReset );
|
|
288 |
}
|
|
289 |
|
|
290 |
// -------------------------------------------------------------------------------------------------
|
|
291 |
// QMPXVideoPlaybackStatusPaneControl::controlListUpdated()
|
|
292 |
// -------------------------------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
void QMPXVideoPlaybackStatusPaneControl::controlListUpdated(
|
|
295 |
QMPXVideoPlaybackViewFileDetails* details )
|
|
296 |
{
|
|
297 |
setMenu( details );
|
|
298 |
}
|
|
299 |
|
|
300 |
// -------------------------------------------------------------------------------------------------
|
|
301 |
// QMPXVideoPlaybackStatusPaneControl::openFullScreenView()
|
|
302 |
// -------------------------------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
void QMPXVideoPlaybackStatusPaneControl::openFullScreenView()
|
|
305 |
{
|
|
306 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::openFullScreenView()"));
|
|
307 |
|
|
308 |
mController->changeViewMode( EFullScreenView );
|
|
309 |
}
|
|
310 |
|
|
311 |
// End of file
|