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