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 |
|
|
18 |
// Version : %version: 10 %
|
|
19 |
|
|
20 |
|
|
21 |
#include <hbmenu.h>
|
|
22 |
#include <hblabel.h>
|
|
23 |
#include <hbaction.h>
|
|
24 |
#include <hbinstance.h>
|
|
25 |
|
|
26 |
#include <w32std.h>
|
|
27 |
|
|
28 |
#include "mpxvideo_debug.h"
|
|
29 |
#include "hbvideobaseplaybackview.h"
|
|
30 |
#include "mpxvideoplaybackdocumentloader.h"
|
|
31 |
#include "mpxvideoplaybackstatuspanecontrol.h"
|
|
32 |
#include "mpxvideoplaybackcontrolscontroller.h"
|
|
33 |
|
|
34 |
|
|
35 |
// -------------------------------------------------------------------------------------------------
|
|
36 |
// QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()
|
|
37 |
// -------------------------------------------------------------------------------------------------
|
|
38 |
//
|
|
39 |
QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl(
|
|
40 |
QMPXVideoPlaybackControlsController* controller,
|
|
41 |
TMPXVideoPlaybackControls index,
|
|
42 |
HbWidget* widget,
|
|
43 |
TUint controlproperties )
|
|
44 |
: QMPXVideoPlaybackFullScreenControl( controller, index, widget, controlproperties )
|
|
45 |
, mActionBack( NULL )
|
|
46 |
{
|
|
47 |
MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()"));
|
|
48 |
|
|
49 |
mActionBack = new HbAction( Hb::BackAction );
|
|
50 |
|
|
51 |
//
|
|
52 |
// Press "back" key means going back to previous view if it's avaiable
|
|
53 |
//
|
|
54 |
connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
|
|
55 |
hbInstance->allMainWindows()[0]->addSoftKeyAction( Hb::SecondarySoftKey , mActionBack );
|
|
56 |
|
|
57 |
connect( mController->view()->menu(), SIGNAL( aboutToShow() ), this, SLOT( handleAboutToShow() ) );
|
|
58 |
connect( mController->view()->menu(), SIGNAL( aboutToHide() ), this, SLOT( handleAboutToHide() ) );
|
|
59 |
|
|
60 |
QGraphicsWidget *widget1 = mController->layoutLoader()->findWidget( QString( "title" ) );
|
|
61 |
mTitleLabel = qobject_cast<HbLabel*>( widget1 );
|
|
62 |
}
|
|
63 |
|
|
64 |
// -------------------------------------------------------------------------------------------------
|
|
65 |
// QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
|
|
66 |
// -------------------------------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
|
|
69 |
{
|
|
70 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl"));
|
|
71 |
|
|
72 |
disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
|
|
73 |
disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
|
|
74 |
hbInstance->allMainWindows()[0]->removeSoftKeyAction( Hb::SecondarySoftKey , mActionBack );
|
|
75 |
|
|
76 |
disconnect( mController->view()->menu(), SIGNAL( aboutToShow() ), this, SLOT( handleAboutToShow() ) );
|
|
77 |
disconnect( mController->view()->menu(), SIGNAL( aboutToHide() ), this, SLOT( handleAboutToHide() ) );
|
|
78 |
|
|
79 |
mController->view()->menu()->close();
|
|
80 |
|
|
81 |
if ( mActionBack )
|
|
82 |
{
|
|
83 |
delete mActionBack;
|
|
84 |
mActionBack = NULL;
|
|
85 |
}
|
|
86 |
}
|
|
87 |
|
|
88 |
// -------------------------------------------------------------------------------------------------
|
|
89 |
// QMPXVideoPlaybackStatusPaneControl::setVisible()
|
|
90 |
// -------------------------------------------------------------------------------------------------
|
|
91 |
//
|
|
92 |
void QMPXVideoPlaybackStatusPaneControl::setVisible( bool visible )
|
|
93 |
{
|
|
94 |
mVisible = visible;
|
|
95 |
|
|
96 |
if ( mVisible )
|
|
97 |
{
|
|
98 |
mController->view()->showItems(
|
|
99 |
Hb::IndicatorItems | Hb::TitlePaneItem | Hb::SecondarySoftKeyItem | Hb::TitleBarItem );
|
|
100 |
|
|
101 |
if ( mController->viewMode() == EFullScreenView ||
|
|
102 |
mController->viewMode() == EDetailsView )
|
|
103 |
{
|
|
104 |
mTitleLabel->setVisible( true );
|
|
105 |
}
|
|
106 |
}
|
|
107 |
else
|
|
108 |
{
|
|
109 |
mController->view()->menu()->close();
|
|
110 |
mController->view()->hideItems( Hb::AllItems );
|
|
111 |
|
|
112 |
mTitleLabel->setVisible( false );
|
|
113 |
}
|
|
114 |
}
|
|
115 |
|
|
116 |
// -------------------------------------------------------------------------------------------------
|
|
117 |
// QMPXVideoPlaybackStatusPaneControl::isVisible()
|
|
118 |
// -------------------------------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
bool QMPXVideoPlaybackStatusPaneControl::isVisible()
|
|
121 |
{
|
|
122 |
return mVisible;
|
|
123 |
}
|
|
124 |
|
|
125 |
// -------------------------------------------------------------------------------------------------
|
|
126 |
// QMPXVideoPlaybackStatusPaneControl::setVisibility()
|
|
127 |
// -------------------------------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
void QMPXVideoPlaybackStatusPaneControl::setVisibility( TMPXPlaybackState state )
|
|
130 |
{
|
|
131 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::setVisibility()"));
|
|
132 |
|
|
133 |
switch( state )
|
|
134 |
{
|
|
135 |
case EPbStatePlaying:
|
|
136 |
case EPbStatePaused:
|
|
137 |
{
|
|
138 |
setMenu( mController->fileDetails() );
|
|
139 |
break;
|
|
140 |
}
|
|
141 |
case EPbStatePluginSeeking:
|
|
142 |
case EPbStateBuffering:
|
|
143 |
case EPbStateNotInitialised:
|
|
144 |
case EPbStateInitialising:
|
|
145 |
{
|
|
146 |
mController->view()->menu()->clearActions();
|
|
147 |
break;
|
|
148 |
}
|
|
149 |
}
|
|
150 |
|
|
151 |
QMPXVideoPlaybackFullScreenControl::setVisibility( state );
|
|
152 |
}
|
|
153 |
|
|
154 |
// -------------------------------------------------------------------------------------------------
|
|
155 |
// QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()
|
|
156 |
// -------------------------------------------------------------------------------------------------
|
|
157 |
//
|
|
158 |
void QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails(
|
|
159 |
QMPXVideoPlaybackViewFileDetails* details )
|
|
160 |
{
|
|
161 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()"));
|
|
162 |
|
|
163 |
//
|
|
164 |
// If it's details view, need to go back to the default playback view with secondary key
|
|
165 |
// If not, we need to go back to the collection view with the secondary key
|
|
166 |
//
|
|
167 |
if ( mController->viewMode() == EDetailsView )
|
|
168 |
{
|
|
169 |
disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
|
|
170 |
connect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
|
|
171 |
}
|
|
172 |
else
|
|
173 |
{
|
|
174 |
disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
|
|
175 |
connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
|
|
176 |
}
|
|
177 |
|
|
178 |
setMenu( details );
|
|
179 |
}
|
|
180 |
|
|
181 |
// -------------------------------------------------------------------------------------------------
|
|
182 |
// QMPXVideoPlaybackStatusPaneControl::setMenu()
|
|
183 |
// -------------------------------------------------------------------------------------------------
|
|
184 |
//
|
|
185 |
void QMPXVideoPlaybackStatusPaneControl::setMenu( QMPXVideoPlaybackViewFileDetails* details )
|
|
186 |
{
|
|
187 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::setMenu()"));
|
|
188 |
|
|
189 |
//
|
|
190 |
// Set menu
|
|
191 |
//
|
|
192 |
mController->view()->menu()->clearActions();
|
|
193 |
|
|
194 |
if ( ! details->mTvOutConnected || ! details->mTvOutPlayAllowed )
|
|
195 |
{
|
|
196 |
if ( details->mVideoEnabled && mController->viewMode() != EDetailsView )
|
|
197 |
{
|
|
198 |
mController->view()->menu()->addAction( tr( "Subtitle" ) );
|
|
199 |
}
|
|
200 |
}
|
|
201 |
}
|
|
202 |
|
|
203 |
// -------------------------------------------------------------------------------------------------
|
|
204 |
// QMPXVideoPlaybackStatusPaneControl::handleAboutToShow()
|
|
205 |
// -------------------------------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
void QMPXVideoPlaybackStatusPaneControl::handleAboutToShow()
|
|
208 |
{
|
|
209 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::handleAboutToShow()"));
|
|
210 |
|
|
211 |
mController->resetDisappearingTimers( EMPXTimerCancel );
|
|
212 |
}
|
|
213 |
|
|
214 |
// -------------------------------------------------------------------------------------------------
|
|
215 |
// QMPXVideoPlaybackStatusPaneControl::handleAboutToHide()
|
|
216 |
// -------------------------------------------------------------------------------------------------
|
|
217 |
//
|
|
218 |
void QMPXVideoPlaybackStatusPaneControl::handleAboutToHide()
|
|
219 |
{
|
|
220 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::handleAboutToHide()"));
|
|
221 |
|
|
222 |
mController->resetDisappearingTimers( EMPXTimerReset );
|
|
223 |
}
|
|
224 |
|
|
225 |
// -------------------------------------------------------------------------------------------------
|
|
226 |
// QMPXVideoPlaybackStatusPaneControl::controlListUpdated()
|
|
227 |
// -------------------------------------------------------------------------------------------------
|
|
228 |
//
|
|
229 |
void QMPXVideoPlaybackStatusPaneControl::controlListUpdated(
|
|
230 |
QMPXVideoPlaybackViewFileDetails* details )
|
|
231 |
{
|
|
232 |
setMenu( details );
|
|
233 |
}
|
|
234 |
|
|
235 |
// -------------------------------------------------------------------------------------------------
|
|
236 |
// QMPXVideoPlaybackStatusPaneControl::openFullScreenView()
|
|
237 |
// -------------------------------------------------------------------------------------------------
|
|
238 |
//
|
|
239 |
void QMPXVideoPlaybackStatusPaneControl::openFullScreenView()
|
|
240 |
{
|
|
241 |
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::openFullScreenView()"));
|
|
242 |
|
|
243 |
mController->changeViewMode( EFullScreenView );
|
|
244 |
}
|
|
245 |
|
|
246 |
// End of file
|