57
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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 the License "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: View class for Video settings list view.*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
// Version : %version: 9 %
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
// INCLUDE FILES
|
|
23 |
#include <avkon.hrh>
|
|
24 |
#include <aknViewAppUi.h>
|
|
25 |
#include <akntabgrp.h>
|
|
26 |
#include <akntitle.h> // CAknTitlePane
|
|
27 |
#include <featmgr.h>
|
|
28 |
#include <eikmenup.h>
|
|
29 |
#include <barsread.h>
|
|
30 |
#include <eiktxlbm.h>
|
|
31 |
#include <MediaSettings.rsg>
|
|
32 |
#include <gstabhelper.h>
|
|
33 |
#include <hlplch.h> // For HlpLauncher
|
|
34 |
|
|
35 |
#include "GSVideoPlugin.h"
|
|
36 |
#include "mediasettings.hrh"
|
|
37 |
#include <mediasettings.mbg>
|
|
38 |
#include "GSMediaPlayerVideoView.h"
|
|
39 |
#include "MPSettingsVideoContainer.h"
|
|
40 |
#include "MPSettingsConstants.h"
|
|
41 |
#include "MPSettingsModelForROP.h"
|
|
42 |
#include "mpxlog.h"
|
|
43 |
|
|
44 |
// ================= MEMBER FUNCTIONS =======================
|
|
45 |
|
|
46 |
// -----------------------------------------------------------------------------
|
|
47 |
// CGSMediaPlayerVideoView::CGSMediaPlayerVideoView
|
|
48 |
// C++ default constructor can NOT contain any code, that
|
|
49 |
// might leave.
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
CGSMediaPlayerVideoView::CGSMediaPlayerVideoView(
|
|
53 |
CMPSettingsModelForROP* aModel,
|
|
54 |
CArrayPtrFlat<MGSTabbedView>* /* aTabViewArray */ )
|
|
55 |
: iModel( aModel)
|
|
56 |
{
|
|
57 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::CGSMediaPlayerVideoView()");
|
|
58 |
}
|
|
59 |
|
|
60 |
// ---------------------------------------------------------
|
|
61 |
// CGSMediaPlayerVideoView::ConstructL(const TRect& aRect)
|
|
62 |
// Symbian OS two-phased constructor
|
|
63 |
// ---------------------------------------------------------
|
|
64 |
//
|
|
65 |
void CGSMediaPlayerVideoView::ConstructL(CArrayPtrFlat<MGSTabbedView>* aTabViewArray)
|
|
66 |
{
|
|
67 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::ConstructL()");
|
|
68 |
iTabHelper = CGSTabHelper::NewL();
|
|
69 |
aTabViewArray->AppendL(this);
|
|
70 |
BaseConstructL(R_GS_MPSETT_VIDEO_VIEW);
|
|
71 |
}
|
|
72 |
|
|
73 |
// -----------------------------------------------------------------------------
|
|
74 |
// CGSMediaPlayerVideoView::NewLC
|
|
75 |
// Two-phased constructor.
|
|
76 |
// -----------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
CGSMediaPlayerVideoView* CGSMediaPlayerVideoView::NewLC(
|
|
79 |
CMPSettingsModelForROP* aModel,
|
|
80 |
CArrayPtrFlat<MGSTabbedView>* aTabViewArray )
|
|
81 |
{
|
|
82 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::NewLC()");
|
|
83 |
CGSMediaPlayerVideoView* self =
|
|
84 |
new(ELeave) CGSMediaPlayerVideoView( aModel, aTabViewArray );
|
|
85 |
|
|
86 |
CleanupStack::PushL(self);
|
|
87 |
self->ConstructL( aTabViewArray );
|
|
88 |
|
|
89 |
return self;
|
|
90 |
}
|
|
91 |
|
|
92 |
// ---------------------------------------------------------
|
|
93 |
// CGSMediaPlayerVideoView::~CGSMediaPlayerVideoView()
|
|
94 |
// Destructor
|
|
95 |
// ---------------------------------------------------------
|
|
96 |
//
|
|
97 |
CGSMediaPlayerVideoView::~CGSMediaPlayerVideoView()
|
|
98 |
{
|
|
99 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::~CGSMediaPlayerVideoView()");
|
|
100 |
if ( iContainer )
|
|
101 |
{
|
|
102 |
AppUi()->RemoveFromStack( iContainer );
|
|
103 |
delete iContainer;
|
|
104 |
}
|
|
105 |
delete iTabHelper;
|
|
106 |
}
|
|
107 |
|
|
108 |
// ---------------------------------------------------------
|
|
109 |
// TUid CGSMediaPlayerVideoView::Id
|
|
110 |
// ---------------------------------------------------------
|
|
111 |
//
|
|
112 |
TUid CGSMediaPlayerVideoView::Id() const
|
|
113 |
{
|
|
114 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::Id()");
|
|
115 |
return KMPSettVideoViewId;
|
|
116 |
}
|
|
117 |
|
|
118 |
// ---------------------------------------------------------
|
|
119 |
// CGSMediaPlayerVideoView::HandleCommandL
|
|
120 |
// ---------------------------------------------------------
|
|
121 |
//
|
|
122 |
void CGSMediaPlayerVideoView::HandleCommandL( TInt aCommand )
|
|
123 |
{
|
|
124 |
MPX_DEBUG2(_L("#MS# CGSMediaPlayerVideoView::HandleCommandL(%d)"),aCommand);
|
|
125 |
CGSVideoPlugin* parent =
|
|
126 |
static_cast<CGSVideoPlugin*> (
|
|
127 |
AppUi()->View( KGSVideoPluginUid ) );
|
|
128 |
switch ( aCommand )
|
|
129 |
{
|
|
130 |
case EMPSettCmdChange:
|
|
131 |
{
|
|
132 |
static_cast<CMPSettingsVideoContainer*>(iContainer)->EditCurrentItemFromMenuL(ETrue);
|
|
133 |
break;
|
|
134 |
}
|
|
135 |
|
|
136 |
case EMPMiddleSoftKeyChange:
|
|
137 |
{
|
|
138 |
static_cast<CMPSettingsVideoContainer*>(iContainer)->EditCurrentItemFromMenuL(EFalse);
|
|
139 |
break;
|
|
140 |
}
|
|
141 |
|
|
142 |
case EAknSoftkeyBack:
|
|
143 |
{
|
|
144 |
parent->SetCurrentItem(EGSMediaSettingsVideoIndex);
|
|
145 |
parent->ResetSelectedItemIndex();
|
|
146 |
AppUi()->ActivateLocalViewL(KGSVideoPluginUid);
|
|
147 |
break;
|
|
148 |
}
|
|
149 |
|
|
150 |
case EMPSettCmdHelp:
|
|
151 |
{
|
|
152 |
if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
153 |
{
|
|
154 |
HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
|
|
155 |
AppUi()->AppHelpContextL() );
|
|
156 |
}
|
|
157 |
break;
|
|
158 |
}
|
|
159 |
|
|
160 |
default:
|
|
161 |
{
|
|
162 |
AppUi()->HandleCommandL(aCommand);
|
|
163 |
break;
|
|
164 |
}
|
|
165 |
}
|
|
166 |
}
|
|
167 |
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
// CGSMediaPlayerVideoView::DoActivateL
|
|
170 |
// Activate this view
|
|
171 |
// ---------------------------------------------------------------------------
|
|
172 |
//
|
|
173 |
void CGSMediaPlayerVideoView::DoActivateL( const TVwsViewId& /* aPrevViewId */,
|
|
174 |
TUid /*aCustomMessageId*/,
|
|
175 |
const TDesC8& /*aCustomMessage*/ )
|
|
176 |
{
|
|
177 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::DoActivateL()");
|
|
178 |
if( iContainer )
|
|
179 |
{
|
|
180 |
AppUi()->RemoveFromViewStack( *this, iContainer );
|
|
181 |
delete iContainer;
|
|
182 |
iContainer = NULL;
|
|
183 |
}
|
|
184 |
|
|
185 |
CreateContainerL();
|
|
186 |
AppUi()->AddToViewStackL( *this, iContainer );
|
|
187 |
|
|
188 |
CGSVideoPlugin* parent =
|
|
189 |
static_cast<CGSVideoPlugin*> (
|
|
190 |
AppUi()->View( KGSVideoPluginUid ) );
|
|
191 |
|
|
192 |
if( parent )
|
|
193 |
{
|
|
194 |
iTabHelper->CreateTabGroupL( Id(),
|
|
195 |
static_cast<CArrayPtrFlat<MGSTabbedView> *> (parent->TabbedViews() ) );
|
|
196 |
}
|
|
197 |
iContainer->SetRect( ClientRect() );
|
|
198 |
iContainer->ActivateL();
|
|
199 |
|
|
200 |
DynInitContainerL();
|
|
201 |
}
|
|
202 |
|
|
203 |
// ---------------------------------------------------------------------------
|
|
204 |
// CGSMediaPlayerVideoView::DoDeactivate
|
|
205 |
// Deactivate this view
|
|
206 |
// ---------------------------------------------------------------------------
|
|
207 |
//
|
|
208 |
void CGSMediaPlayerVideoView::DoDeactivate()
|
|
209 |
{
|
|
210 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::DoDeactivate()");
|
|
211 |
if ( iContainer )
|
|
212 |
{
|
|
213 |
CEikTextListBox* listbox = iContainer->ListBox();
|
|
214 |
if (listbox)
|
|
215 |
{
|
|
216 |
iCurrentItem = listbox->CurrentItemIndex();
|
|
217 |
iTopItemIndex = listbox->TopItemIndex();
|
|
218 |
}
|
|
219 |
|
|
220 |
AppUi()->RemoveFromStack( iContainer );
|
|
221 |
delete iContainer;
|
|
222 |
iContainer = NULL;
|
|
223 |
iTabHelper->RemoveTabGroup();
|
|
224 |
}
|
|
225 |
}
|
|
226 |
|
|
227 |
// ---------------------------------------------------------------------------
|
|
228 |
// CGSMediaPlayerVideoView::Container
|
|
229 |
// Returns network container item
|
|
230 |
// ---------------------------------------------------------------------------
|
|
231 |
//
|
|
232 |
CMPSettingsBaseContainer* CGSMediaPlayerVideoView::Container()
|
|
233 |
{
|
|
234 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::Container()");
|
|
235 |
return static_cast <CMPSettingsVideoContainer*> ( iContainer );
|
|
236 |
}
|
|
237 |
|
|
238 |
// ---------------------------------------------------------------------------
|
|
239 |
// CGSMediaPlayerVideoView::DynInitMenuPaneL
|
|
240 |
// Before showing a options menu
|
|
241 |
// ---------------------------------------------------------------------------
|
|
242 |
//
|
|
243 |
void CGSMediaPlayerVideoView::DynInitMenuPaneL( TInt aResourceId,
|
|
244 |
CEikMenuPane* aMenuPane)
|
|
245 |
{
|
|
246 |
MPX_DEBUG2(_L("#MS# CGSMediaPlayerVideoView::DynInitMenuPaneL(0x%X)"),aResourceId);
|
|
247 |
if ( aResourceId == R_MPSETT_APP_MENU )
|
|
248 |
{
|
|
249 |
// Help should be displayed only if the feature is supported according
|
|
250 |
// to Feature Manager
|
|
251 |
if ( !FeatureManager::FeatureSupported(KFeatureIdHelp) )
|
|
252 |
{
|
|
253 |
aMenuPane->SetItemDimmed(EMPSettCmdHelp, ETrue);
|
|
254 |
}
|
|
255 |
|
|
256 |
}
|
|
257 |
}
|
|
258 |
|
|
259 |
// ---------------------------------------------------------------------------
|
|
260 |
// CGSMediaPlayerVideoView::NewContainerL()
|
|
261 |
// Creates new iContainer.
|
|
262 |
// ---------------------------------------------------------------------------
|
|
263 |
void CGSMediaPlayerVideoView::NewContainerL()
|
|
264 |
{
|
|
265 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::NewContainerL()");
|
|
266 |
iContainer = new (ELeave) CMPSettingsVideoContainer(iModel);
|
|
267 |
}
|
|
268 |
|
|
269 |
// -----------------------------------------------------------------------------
|
|
270 |
// CGSMediaPlayerVideoView::HandleClientRectChange
|
|
271 |
// Handle screen size change.
|
|
272 |
// -----------------------------------------------------------------------------
|
|
273 |
//
|
|
274 |
void CGSMediaPlayerVideoView::HandleClientRectChange()
|
|
275 |
{
|
|
276 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::HandleClientRectChange()");
|
|
277 |
if ( iContainer )
|
|
278 |
{
|
|
279 |
iContainer->SetRect( ClientRect() );
|
|
280 |
}
|
|
281 |
}
|
|
282 |
|
|
283 |
// ---------------------------------------------------------------------------
|
|
284 |
// CGSMediaPlayerVideoView::CreateContainerL()
|
|
285 |
// Creates new iContainer.
|
|
286 |
// ---------------------------------------------------------------------------
|
|
287 |
//
|
|
288 |
void CGSMediaPlayerVideoView::CreateContainerL()
|
|
289 |
{
|
|
290 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::CreateContainerL()");
|
|
291 |
NewContainerL();
|
|
292 |
__ASSERT_DEBUG(
|
|
293 |
iContainer, User::Panic( KGSDoActivateError, EGSViewPanicNullPtr ) );
|
|
294 |
iContainer->SetMopParent( this );
|
|
295 |
|
|
296 |
TRAPD( error, iContainer->ConstructL( ClientRect() ) );
|
|
297 |
if ( error )
|
|
298 |
{
|
|
299 |
delete iContainer;
|
|
300 |
iContainer = NULL;
|
|
301 |
User::Leave( error );
|
|
302 |
}
|
|
303 |
}
|
|
304 |
|
|
305 |
// ---------------------------------------------------------------------------
|
|
306 |
// CGSMediaPlayerVideoView::CreateTabIconL()
|
|
307 |
// Creates icon for tab.
|
|
308 |
// ---------------------------------------------------------------------------
|
|
309 |
//
|
|
310 |
CGulIcon* CGSMediaPlayerVideoView::CreateTabIconL()
|
|
311 |
{
|
|
312 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::CreateTabIconL()");
|
|
313 |
CGulIcon* icon;
|
|
314 |
TFileName fileName;
|
|
315 |
|
|
316 |
CGSVideoPlugin* parent =
|
|
317 |
static_cast<CGSVideoPlugin*> (
|
|
318 |
AppUi()->View( KGSVideoPluginUid ) );
|
|
319 |
|
|
320 |
if( parent )
|
|
321 |
{
|
|
322 |
parent->LocateFilePathL( fileName );
|
|
323 |
}
|
|
324 |
|
|
325 |
icon = AknsUtils::CreateGulIconL(
|
|
326 |
AknsUtils::SkinInstance(),
|
|
327 |
KAknsIIDDefault,
|
|
328 |
fileName,
|
|
329 |
EMbmMediasettingsQgn_prop_set_mp_video_tab2,
|
|
330 |
EMbmMediasettingsQgn_prop_set_mp_video_tab2_mask );
|
|
331 |
|
|
332 |
return icon;
|
|
333 |
}
|
|
334 |
|
|
335 |
// ---------------------------------------------------------------------------
|
|
336 |
// CGSMediaPlayerVideoView::DynInitContainerL
|
|
337 |
// ---------------------------------------------------------------------------
|
|
338 |
//
|
|
339 |
void CGSMediaPlayerVideoView::DynInitContainerL()
|
|
340 |
{
|
|
341 |
MPX_FUNC("#MS# CGSMediaPlayerVideoView::DynInitContainerL()");
|
|
342 |
CEikTextListBox* listbox = iContainer->ListBox();
|
|
343 |
|
|
344 |
listbox->SetTopItemIndex(iTopItemIndex);
|
|
345 |
|
|
346 |
if ( iCurrentItem >= 0 &&
|
|
347 |
iCurrentItem < listbox->Model()->NumberOfItems()) // magic
|
|
348 |
{
|
|
349 |
listbox->SetCurrentItemIndexAndDraw(iCurrentItem);
|
|
350 |
}
|
|
351 |
}
|
|
352 |
|
|
353 |
// ---------------------------------------------------------------------------
|
|
354 |
// CGSMediaPlayerVideoView::HandleClientRectChange
|
|
355 |
// ---------------------------------------------------------------------------
|
|
356 |
//
|
|
357 |
void CGSMediaPlayerVideoView::SetCurrentItem(TInt aIndex)
|
|
358 |
{
|
|
359 |
MPX_DEBUG2(_L("#MS# CGSMediaPlayerVideoView::SetCurrentItem(%d)"),aIndex);
|
|
360 |
iCurrentItem = aIndex;
|
|
361 |
}
|
|
362 |
// End of File
|
|
363 |
|