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: Implements the Slideshow plugin beef, especially |
|
15 * MScreensaverPlugin interface |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_SLIDESHOWPLUGIN_H |
|
22 #define C_SLIDESHOWPLUGIN_H |
|
23 |
|
24 #include <gdi.h> |
|
25 #include <coecntrl.h> |
|
26 #include <e32cmn.h> |
|
27 #include <coecobs.h> |
|
28 #include <AknsSrvClient.h> |
|
29 #include <ScreensaverpluginIntDef.h> |
|
30 #include <screensaverplugin.h> |
|
31 #include <ScreensaverInternalPSKeys.h> |
|
32 |
|
33 #include <MCLFOperationObserver.h> |
|
34 #include <MCLFContentListingEngine.h> |
|
35 #include <MCLFItemListModel.h> |
|
36 |
|
37 #include "SlideshowModel.h" |
|
38 #include "SlideshowSlide.h" |
|
39 #include "SlideshowPluginUtils.h" |
|
40 |
|
41 class CEikonEnv; |
|
42 class CDRMHelper; |
|
43 class CRepositoryWatcher; |
|
44 class CRepository; |
|
45 |
|
46 |
|
47 /** |
|
48 * Encapsulates the Settings that are written into the central repository |
|
49 * @lib ScreenSaverAnimPlugin.lib |
|
50 * @since 3.1 |
|
51 */ |
|
52 class CSlideshowSettings : public CBase |
|
53 { |
|
54 public: |
|
55 CSlideshowSettings(); |
|
56 |
|
57 public: |
|
58 // Slideshow time |
|
59 TInt iSlideshowTime; |
|
60 |
|
61 // Lights time |
|
62 TInt iLightsTime; |
|
63 |
|
64 // Time a slide is displayed |
|
65 TInt iSlideTime; |
|
66 |
|
67 // Slideshow type |
|
68 TInt iSlideshowType; |
|
69 }; |
|
70 |
|
71 |
|
72 /** |
|
73 * Provides the Animated ScreenSaverPlugin functionality which implements |
|
74 * ScreenSaver Interface and gives a Netscape Browser Plugin Interface |
|
75 * to the format specific plugins like SVG, Flash, M3G etc. |
|
76 * @lib ScreenSaverAnimPlugin.lib |
|
77 * @since 3.1 |
|
78 */ |
|
79 class CSlideshowPlugin: public CScreensaverPluginInterfaceDefinition, |
|
80 public MCLFOperationObserver |
|
81 { |
|
82 enum TPluginState |
|
83 { |
|
84 EPluginStateLoading = 0, |
|
85 EPluginStateInitializing, |
|
86 EPluginStateRunning, |
|
87 EPluginStateStopping |
|
88 }; |
|
89 |
|
90 public: |
|
91 |
|
92 /** |
|
93 * Creator |
|
94 * @since 3.1 |
|
95 */ |
|
96 static CSlideshowPlugin* NewL(); |
|
97 |
|
98 /** |
|
99 * Destructor |
|
100 */ |
|
101 virtual ~CSlideshowPlugin(); |
|
102 |
|
103 private: |
|
104 /** |
|
105 * 2nd phase constructor |
|
106 * @since 3.1 |
|
107 */ |
|
108 void ConstructL(); |
|
109 |
|
110 /** |
|
111 * Default Constructor |
|
112 * @since 3.1 |
|
113 */ |
|
114 CSlideshowPlugin(); |
|
115 |
|
116 public: // Functions From CScreensaverPluginInterfaceDefinition |
|
117 |
|
118 /** |
|
119 * From MScreensaverPlugin, Method called by Screensaver |
|
120 * when plugin is being loaded into use |
|
121 * @param aHost Plugin host (Screensaver). |
|
122 * @since 3.1 |
|
123 */ |
|
124 virtual TInt InitializeL(MScreensaverPluginHost *aHost); |
|
125 |
|
126 /** |
|
127 * From MScreensaverPlugin, Method called by Screensaver |
|
128 * when plugin is allowed to draw |
|
129 * @since 3.1 |
|
130 */ |
|
131 virtual TInt Draw( CWindowGc& aGc ); |
|
132 |
|
133 /** |
|
134 * From MScreensaverPlugin, Method called by Themes application |
|
135 * to get localised name |
|
136 * @since 3.1 |
|
137 */ |
|
138 virtual const TDesC16& Name() const; |
|
139 |
|
140 /** |
|
141 * From MScreensaverPlugin, Method called by Screensaver |
|
142 * to get the capabilities of screensaver plugin |
|
143 * @since 3.1 |
|
144 */ |
|
145 virtual TInt Capabilities(); |
|
146 |
|
147 /** |
|
148 * From MScreensaverPlugin, Method called by Themes application |
|
149 * to configure the plugin or to pass e.g. selection notifications |
|
150 * to plugin |
|
151 * @since 3.1 |
|
152 */ |
|
153 virtual TInt PluginFunction( |
|
154 TScPluginCaps /* aFunction */, |
|
155 TAny* /* aParam */ ); |
|
156 |
|
157 /** |
|
158 * From MScreensaverPlugin, Method called by Screensaver |
|
159 * when there are screensaver events, such as starting and stopping |
|
160 * @since 3.1 |
|
161 */ |
|
162 virtual TInt HandleScreensaverEventL( |
|
163 TScreensaverEvent aEvent, |
|
164 TAny* aData ); |
|
165 |
|
166 |
|
167 public: // From MCLFOperationObserver |
|
168 |
|
169 /** |
|
170 * From MCLFOperationObserver. Called by CLF when e.g. a content listing |
|
171 * operation is finished. |
|
172 * @since S60 3.1 |
|
173 * @param aOperationEvent Operation event code of the event |
|
174 * @param aError System wide error code if the operation did not |
|
175 * succeed. |
|
176 */ |
|
177 virtual void HandleOperationEventL(TCLFOperationEvent aOperationEvent, |
|
178 TInt aError); |
|
179 |
|
180 |
|
181 public: // New Functions |
|
182 |
|
183 /** |
|
184 * Reads the settings from the central repository |
|
185 * @since 3.1 |
|
186 * @return System wide Error value |
|
187 */ |
|
188 TInt ReadSettings(); |
|
189 |
|
190 #if 0 |
|
191 /** |
|
192 * This method checks whether the set file exists currently |
|
193 * if not, it updates the filename string |
|
194 * This also checks if the rights are valid if the content is drm |
|
195 * if not, it updates the filename with the empty file name |
|
196 * returns True, if the Filename is updated |
|
197 * False, otherwise |
|
198 * @since 3.2 |
|
199 */ |
|
200 TBool UpdateFileName(); |
|
201 #endif |
|
202 |
|
203 /** |
|
204 * Called when there is a central repository settings change |
|
205 * @since 3.2 |
|
206 */ |
|
207 void HandleCRSettingsChange(TAny* aPtr); |
|
208 |
|
209 /** |
|
210 * Called by the repository watcher when there is a central |
|
211 * repository settings change |
|
212 * @since 3.2 |
|
213 */ |
|
214 static TInt HandleRepositoryCallBack(TAny* aPtr); |
|
215 |
|
216 /** |
|
217 * Called by the P & S subscriber when the subscribed key value changes |
|
218 * @since 3.2 |
|
219 */ |
|
220 static TInt HandleSettingsChanged(TAny* aPtr); |
|
221 |
|
222 private: // New functions |
|
223 |
|
224 /** |
|
225 * Connects the central repository session |
|
226 * @since 3.1 |
|
227 */ |
|
228 void InitializeCenRepL(); |
|
229 |
|
230 /** |
|
231 * Registers for central repository key changes |
|
232 * @since 3.1 |
|
233 */ |
|
234 void NotifyCenrepChangeL(); |
|
235 |
|
236 /** |
|
237 * Cancels registration for central repository key changes |
|
238 * @since 3.1 |
|
239 */ |
|
240 void NotifyCenrepChangeCancel(); |
|
241 |
|
242 /** |
|
243 * Disconnects the central repository session |
|
244 * @since 3.1 |
|
245 */ |
|
246 void UnInitializeCenRep(); |
|
247 |
|
248 void StartPlugin(); |
|
249 void StopPlugin(); |
|
250 void DrawCentered(CWindowGc& aGc, CSlideshowSlide* aSlide); |
|
251 void LoadSlidesL(); |
|
252 void LoadSlideSetL(); |
|
253 void LoadRandomSlidesL(); |
|
254 void SetDisplayMode(); |
|
255 void Lights(TInt aSecs); |
|
256 void ConfigureL(TAny* aParam); |
|
257 void UpdateDisplayInfo(); |
|
258 void FlushDrawBuffer(); |
|
259 |
|
260 TInt SettingsChanged(); |
|
261 |
|
262 void ConnectToCLFL(); |
|
263 void WaitForCLF(); |
|
264 void EndWaitForCLF(); |
|
265 |
|
266 private: |
|
267 // Pointer to the screensaver host |
|
268 MScreensaverPluginHost* iHost; |
|
269 |
|
270 // Display info |
|
271 TScreensaverDisplayInfo iDi; |
|
272 |
|
273 // Plugin state tracking |
|
274 TInt iState; |
|
275 |
|
276 // Resource file offset |
|
277 TInt iResourceOffset; |
|
278 |
|
279 // Handle to the central repository session |
|
280 CRepository* iSlideshowRepository; |
|
281 |
|
282 // Environment pointer |
|
283 CEikonEnv* iEikEnv; |
|
284 |
|
285 // Pointer to settings |
|
286 CSlideshowSettings* iSettings; |
|
287 |
|
288 // Slideshow model |
|
289 CSlideshowModel* iModel; |
|
290 |
|
291 // Pointer to Drm Helper |
|
292 CDRMHelper* iDrmHelper; |
|
293 |
|
294 // Cenrep watcher for settings change |
|
295 CRepositoryWatcher* iSlideshowCRWatcher; |
|
296 |
|
297 RProperty iSettingsChangedProperty; |
|
298 CPSSubscriber* iSettingsChangedSubscriber; |
|
299 |
|
300 // Localised name |
|
301 HBufC* iScreensaverName; |
|
302 |
|
303 // Gallery content listing engine |
|
304 MCLFContentListingEngine* iCLFEngine; |
|
305 |
|
306 // Gallery content listing model |
|
307 MCLFItemListModel* iCLFModel; |
|
308 |
|
309 // CLF status |
|
310 TInt iCLFError; |
|
311 |
|
312 // CLF model state |
|
313 TBool iCLFModelUpToDate; |
|
314 |
|
315 |
|
316 // Waiter |
|
317 CActiveSchedulerWait iWaiter; |
|
318 TBool iWaitActive; |
|
319 |
|
320 // Draw count |
|
321 TInt iDrawCount; |
|
322 TBool iTimerUpdated; |
|
323 }; |
|
324 |
|
325 |
|
326 #endif // C_SLIDESHOWPLUGIN_H |
|
327 // End Of file |
|