|
1 /* |
|
2 * Copyright (c) 2006 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 Audio effects view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <bautils.h> |
|
22 #include <eikmenub.h> |
|
23 #include <AknUtils.h> |
|
24 #include <hlplch.h> |
|
25 #include <data_caging_path_literals.hrh> |
|
26 #include <avkon.rsg> |
|
27 #include <mpxuser.h> |
|
28 |
|
29 #include <mpxplaybackutility.h> |
|
30 #include <mpxaudioeffectsview.rsg> |
|
31 #include "mpxaudioeffectengine.h" |
|
32 |
|
33 #include "mpxaudioeffectsmodel.h" |
|
34 #include "mpxaudioeffectsviewcontainer.h" |
|
35 #include "mpxaudioeffectsviewimp.h" |
|
36 #include "mpxaudioeffects.hrh" |
|
37 |
|
38 |
|
39 // CONSTANTS |
|
40 _LIT( KMPXAudioEffectsRscPath, "mpxaudioeffectsview.rsc" ); |
|
41 |
|
42 |
|
43 // ======== MEMBER FUNCTIONS ======== |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // C++ default constructor can NOT contain any code, that |
|
47 // might leave. |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CMPXAudioEffectsViewImp::CMPXAudioEffectsViewImp() |
|
51 { |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // Symbian 2nd phase constructor can leave. |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 void CMPXAudioEffectsViewImp::ConstructL() |
|
59 { |
|
60 //get resource file |
|
61 TParse parse; |
|
62 parse.Set( KMPXAudioEffectsRscPath, &KDC_APP_RESOURCE_DIR, NULL ); |
|
63 TFileName resourceFile( parse.FullName() ); |
|
64 User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) ); |
|
65 BaflUtils::NearestLanguageFile( |
|
66 CCoeEnv::Static()->FsSession(), resourceFile ); |
|
67 iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resourceFile ); |
|
68 BaseConstructL( R_AUDIOEFFECTS_SETTINGSLIST_VIEW ); |
|
69 |
|
70 // Get the playback utility instance from engine |
|
71 iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault ); |
|
72 |
|
73 iModel = CMPXAudioEffectsModel::NewL( *iPlaybackUtility ); |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // Two-phased constructor. |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 CMPXAudioEffectsViewImp* CMPXAudioEffectsViewImp::NewL() |
|
81 { |
|
82 CMPXAudioEffectsViewImp* self = CMPXAudioEffectsViewImp::NewLC(); |
|
83 CleanupStack::Pop( self ); |
|
84 return self; |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // Two-phased constructor. |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 CMPXAudioEffectsViewImp* CMPXAudioEffectsViewImp::NewLC() |
|
92 { |
|
93 CMPXAudioEffectsViewImp* self = new ( ELeave ) CMPXAudioEffectsViewImp(); |
|
94 CleanupStack::PushL( self ); |
|
95 self->ConstructL(); |
|
96 return self; |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // Destructor |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 CMPXAudioEffectsViewImp::~CMPXAudioEffectsViewImp() |
|
104 { |
|
105 delete iModel; |
|
106 |
|
107 if ( iPlaybackUtility ) |
|
108 { |
|
109 iPlaybackUtility->Close(); |
|
110 } |
|
111 |
|
112 if ( iResourceOffset ) |
|
113 { |
|
114 CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); |
|
115 } |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CMPXAudioEffectsViewImp::ChangeSelectedItemL |
|
120 // (other items were commented in a header). |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 void CMPXAudioEffectsViewImp::ChangeSelectedItemL() |
|
124 { |
|
125 if( iContainer ) |
|
126 { |
|
127 iContainer->ChangeSelectedItemL(); |
|
128 } |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CMPXAudioEffectsViewImp::Id |
|
133 // (other items were commented in a header). |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 TUid CMPXAudioEffectsViewImp::Id() const |
|
137 { |
|
138 return TUid::Uid( KMPXAudioEffectsViewId ); |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CMPXAudioEffectsViewImp::HandleCommandL |
|
143 // (other items were commented in a header). |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 void CMPXAudioEffectsViewImp::HandleCommandL( TInt aCommand ) |
|
147 { |
|
148 switch ( aCommand ) |
|
149 { |
|
150 case ESettingsListCmdChange: |
|
151 { |
|
152 ChangeSelectedItemL(); |
|
153 break; |
|
154 } |
|
155 case EAknCmdHelp: |
|
156 case ESettingsListCmdHelp: |
|
157 { |
|
158 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), |
|
159 AppUi()->AppHelpContextL()); |
|
160 break; |
|
161 } |
|
162 default: |
|
163 { |
|
164 // Pass the command to AppUi to handle. |
|
165 AppUi()->HandleCommandL( aCommand ); |
|
166 break; |
|
167 } |
|
168 } |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CMPXAudioEffectsViewImp::DoActivateL |
|
173 // (other items were commented in a header). |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 void CMPXAudioEffectsViewImp::DoActivateL( |
|
177 const TVwsViewId& aPrevViewId, |
|
178 TUid /*aCustomMessageId*/, |
|
179 const TDesC8& /*aCustomMessage*/ ) |
|
180 { |
|
181 StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
182 iPreviousView = aPrevViewId; |
|
183 |
|
184 if (!iContainer) |
|
185 { |
|
186 iContainer = new ( ELeave ) CMPXAudioEffectsViewContainer(); |
|
187 iContainer->SetMopParent( this ); |
|
188 iContainer->ConstructL( ClientRect(), iModel ); |
|
189 AppUi()->AddToStackL( *this, iContainer ); |
|
190 } |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CMPXAudioEffectsViewImp::DoDeactivate |
|
195 // (other items were commented in a header). |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 void CMPXAudioEffectsViewImp::DoDeactivate() |
|
199 { |
|
200 if ( iContainer ) |
|
201 { |
|
202 AppUi()->RemoveFromStack( iContainer ); |
|
203 delete iContainer; |
|
204 iContainer = NULL; |
|
205 } |
|
206 } |
|
207 |
|
208 // --------------------------------------------------------------------------- |
|
209 // From CAknView |
|
210 // Processes user commands. |
|
211 // --------------------------------------------------------------------------- |
|
212 // |
|
213 void CMPXAudioEffectsViewImp::ProcessCommandL( TInt aCommand ) |
|
214 { |
|
215 MPX_DEBUG2("ProcessCommandL::ProcessCommandL(%d): entering", aCommand); |
|
216 if ( aCommand == EAknCmdExit ) |
|
217 { |
|
218 HandleCommandL( aCommand ); |
|
219 } |
|
220 CAknView::ProcessCommandL( aCommand ); |
|
221 MPX_DEBUG1("ProcessCommandL::ProcessCommandL(): exiting"); |
|
222 } |
|
223 |
|
224 // End of File |