26
|
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 |
#include <mdesession.h>
|
|
37 |
#include <mdequery.h>
|
|
38 |
|
|
39 |
#include "SlideshowModel.h"
|
|
40 |
#include "SlideshowSlide.h"
|
|
41 |
#include "SlideshowPluginUtils.h"
|
|
42 |
|
|
43 |
class CEikonEnv;
|
|
44 |
class CDRMHelper;
|
|
45 |
class CRepositoryWatcher;
|
|
46 |
class CRepository;
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Encapsulates the Settings that are written into the central repository
|
|
50 |
* @lib ScreenSaverAnimPlugin.lib
|
|
51 |
* @since 3.1
|
|
52 |
*/
|
|
53 |
class CSlideshowSettings : public CBase
|
|
54 |
{
|
|
55 |
public:
|
|
56 |
CSlideshowSettings();
|
|
57 |
|
|
58 |
public:
|
|
59 |
// Slideshow time
|
|
60 |
TInt iSlideshowTime;
|
|
61 |
|
|
62 |
// Lights time
|
|
63 |
TInt iLightsTime;
|
|
64 |
|
|
65 |
// Time a slide is displayed
|
|
66 |
TInt iSlideTime;
|
|
67 |
|
|
68 |
// Slideshow type
|
|
69 |
TInt iSlideshowType;
|
|
70 |
};
|
|
71 |
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Provides the Animated ScreenSaverPlugin functionality which implements
|
|
75 |
* ScreenSaver Interface and gives a Netscape Browser Plugin Interface
|
|
76 |
* to the format specific plugins like SVG, Flash, M3G etc.
|
|
77 |
* @lib ScreenSaverAnimPlugin.lib
|
|
78 |
* @since 3.1
|
|
79 |
*/
|
|
80 |
class CSlideshowPlugin: public CScreensaverPluginInterfaceDefinition,
|
|
81 |
public MMdESessionObserver,
|
|
82 |
public MMdEQueryObserver
|
|
83 |
{
|
|
84 |
enum TPluginState
|
|
85 |
{
|
|
86 |
EPluginStateLoading = 0,
|
|
87 |
EPluginStateInitializing,
|
|
88 |
EPluginStateRunning,
|
|
89 |
EPluginStateStopping
|
|
90 |
};
|
|
91 |
|
|
92 |
public:
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Creator
|
|
96 |
* @since 3.1
|
|
97 |
*/
|
|
98 |
static CSlideshowPlugin* NewL();
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Destructor
|
|
102 |
*/
|
|
103 |
virtual ~CSlideshowPlugin();
|
|
104 |
|
|
105 |
private:
|
|
106 |
/**
|
|
107 |
* 2nd phase constructor
|
|
108 |
* @since 3.1
|
|
109 |
*/
|
|
110 |
void ConstructL();
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Default Constructor
|
|
114 |
* @since 3.1
|
|
115 |
*/
|
|
116 |
CSlideshowPlugin();
|
|
117 |
|
|
118 |
public: // Functions From CScreensaverPluginInterfaceDefinition
|
|
119 |
|
|
120 |
/**
|
|
121 |
* From MScreensaverPlugin, Method called by Screensaver
|
|
122 |
* when plugin is being loaded into use
|
|
123 |
* @param aHost Plugin host (Screensaver).
|
|
124 |
* @since 3.1
|
|
125 |
*/
|
|
126 |
virtual TInt InitializeL(MScreensaverPluginHost *aHost);
|
|
127 |
|
|
128 |
/**
|
|
129 |
* From MScreensaverPlugin, Method called by Screensaver
|
|
130 |
* when plugin is allowed to draw
|
|
131 |
* @since 3.1
|
|
132 |
*/
|
|
133 |
virtual TInt Draw( CWindowGc& aGc );
|
|
134 |
|
|
135 |
/**
|
|
136 |
* From MScreensaverPlugin, Method called by Themes application
|
|
137 |
* to get localised name
|
|
138 |
* @since 3.1
|
|
139 |
*/
|
|
140 |
virtual const TDesC16& Name() const;
|
|
141 |
|
|
142 |
/**
|
|
143 |
* From MScreensaverPlugin, Method called by Screensaver
|
|
144 |
* to get the capabilities of screensaver plugin
|
|
145 |
* @since 3.1
|
|
146 |
*/
|
|
147 |
virtual TInt Capabilities();
|
|
148 |
|
|
149 |
/**
|
|
150 |
* From MScreensaverPlugin, Method called by Themes application
|
|
151 |
* to configure the plugin or to pass e.g. selection notifications
|
|
152 |
* to plugin
|
|
153 |
* @since 3.1
|
|
154 |
*/
|
|
155 |
virtual TInt PluginFunction(
|
|
156 |
TScPluginCaps /* aFunction */,
|
|
157 |
TAny* /* aParam */ );
|
|
158 |
|
|
159 |
/**
|
|
160 |
* From MScreensaverPlugin, Method called by Screensaver
|
|
161 |
* when there are screensaver events, such as starting and stopping
|
|
162 |
* @since 3.1
|
|
163 |
*/
|
|
164 |
virtual TInt HandleScreensaverEventL(
|
|
165 |
TScreensaverEvent aEvent,
|
|
166 |
TAny* aData );
|
|
167 |
|
|
168 |
public: // from MMdESessionObserver
|
|
169 |
/**
|
|
170 |
* Called to notify the observer that opening the session has been
|
|
171 |
* completed and, if the opening succeeded, the session is ready for use.
|
|
172 |
*
|
|
173 |
* @param aSession session
|
|
174 |
* @param aError <code>KErrNone</code>, if opening the session succeeded;
|
|
175 |
* or one of the system-wide error codes, if opening the
|
|
176 |
* session failed
|
|
177 |
*/
|
|
178 |
void HandleSessionOpened(CMdESession& aSession, TInt aError);
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Called to notify the observer about errors, which are not a direct
|
|
182 |
* consequence of the operations initiated by the client but caused by
|
|
183 |
* some external source (e.g., other clients). The error cannot be
|
|
184 |
* recovered and all on-going operations initiated by the client have been
|
|
185 |
* aborted. Any attempts to continue using the session will cause a panic.
|
|
186 |
* The client should close the session immediately and try to open a new
|
|
187 |
* session, if it needs to continue using the metadata engine.
|
|
188 |
*
|
|
189 |
* @param aSession session
|
|
190 |
* @param aError one of the system-wide error codes
|
|
191 |
*/
|
|
192 |
void HandleSessionError(CMdESession& aSession, TInt aError);
|
|
193 |
|
|
194 |
public: // from MMdEQueryObserver
|
|
195 |
/**
|
|
196 |
* Called to notify the observer that new results have been received
|
|
197 |
* in the query.
|
|
198 |
*
|
|
199 |
* @param aQuery Query instance that received new results.
|
|
200 |
* @param aFirstNewItemIndex Index of the first new item that was added
|
|
201 |
* to the result item array.
|
|
202 |
* @param aNewItemCount Number of items added to the result item
|
|
203 |
* array.
|
|
204 |
*/
|
|
205 |
void HandleQueryNewResults(CMdEQuery& aQuery,
|
|
206 |
TInt aFirstNewItemIndex,
|
|
207 |
TInt aNewItemCount);
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Called to notify the observer that the query has been completed,
|
|
211 |
* or that an error has occured.
|
|
212 |
*
|
|
213 |
* @param aQuery Query instance.
|
|
214 |
* @param aError <code>KErrNone</code>, if the query was completed
|
|
215 |
* successfully. Otherwise one of the system-wide error
|
|
216 |
* codes.
|
|
217 |
*/
|
|
218 |
void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);
|
|
219 |
|
|
220 |
public: // New Functions
|
|
221 |
|
|
222 |
/**
|
|
223 |
* Reads the settings from the central repository
|
|
224 |
* @since 3.1
|
|
225 |
* @return System wide Error value
|
|
226 |
*/
|
|
227 |
TInt ReadSettings();
|
|
228 |
|
|
229 |
#if 0
|
|
230 |
/**
|
|
231 |
* This method checks whether the set file exists currently
|
|
232 |
* if not, it updates the filename string
|
|
233 |
* This also checks if the rights are valid if the content is drm
|
|
234 |
* if not, it updates the filename with the empty file name
|
|
235 |
* returns True, if the Filename is updated
|
|
236 |
* False, otherwise
|
|
237 |
* @since 3.2
|
|
238 |
*/
|
|
239 |
TBool UpdateFileName();
|
|
240 |
#endif
|
|
241 |
|
|
242 |
/**
|
|
243 |
* Called when there is a central repository settings change
|
|
244 |
* @since 3.2
|
|
245 |
*/
|
|
246 |
void HandleCRSettingsChange(TAny* aPtr);
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Called by the repository watcher when there is a central
|
|
250 |
* repository settings change
|
|
251 |
* @since 3.2
|
|
252 |
*/
|
|
253 |
static TInt HandleRepositoryCallBack(TAny* aPtr);
|
|
254 |
|
|
255 |
/**
|
|
256 |
* Called by the P & S subscriber when the subscribed key value changes
|
|
257 |
* @since 3.2
|
|
258 |
*/
|
|
259 |
static TInt HandleSettingsChanged(TAny* aPtr);
|
|
260 |
|
|
261 |
private: // New functions
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Connects the central repository session
|
|
265 |
* @since 3.1
|
|
266 |
*/
|
|
267 |
void InitializeCenRepL();
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Registers for central repository key changes
|
|
271 |
* @since 3.1
|
|
272 |
*/
|
|
273 |
void NotifyCenrepChangeL();
|
|
274 |
|
|
275 |
/**
|
|
276 |
* Cancels registration for central repository key changes
|
|
277 |
* @since 3.1
|
|
278 |
*/
|
|
279 |
void NotifyCenrepChangeCancel();
|
|
280 |
|
|
281 |
/**
|
|
282 |
* Disconnects the central repository session
|
|
283 |
* @since 3.1
|
|
284 |
*/
|
|
285 |
void UnInitializeCenRep();
|
|
286 |
|
|
287 |
void StartPlugin();
|
|
288 |
void StopPlugin();
|
|
289 |
void DrawCentered(CWindowGc& aGc, CSlideshowSlide* aSlide);
|
|
290 |
void LoadSlidesL();
|
|
291 |
void LoadSlideSetL();
|
|
292 |
void LoadRandomSlidesL();
|
|
293 |
void SetDisplayMode();
|
|
294 |
void Lights(TInt aSecs);
|
|
295 |
void ConfigureL(TAny* aParam);
|
|
296 |
void UpdateDisplayInfo();
|
|
297 |
void FlushDrawBuffer();
|
|
298 |
|
|
299 |
TInt SettingsChanged();
|
|
300 |
|
|
301 |
void ConnectToMDSSessionL();
|
|
302 |
void WaitForMDS();
|
|
303 |
void EndWaitForMDS();
|
|
304 |
void LoadImagesToModel(const CMdEQuery& aQuery,
|
|
305 |
TInt aFirstNewItemIndex = 0,
|
|
306 |
TInt aNewItemCount = 0);
|
|
307 |
void AppendSlideToModelL(TDesC& aFileName, TBool aIsOnMC);
|
|
308 |
void OpenQueryL();
|
|
309 |
|
|
310 |
private:
|
|
311 |
// Pointer to the screensaver host
|
|
312 |
MScreensaverPluginHost* iHost;
|
|
313 |
|
|
314 |
// Display info
|
|
315 |
TScreensaverDisplayInfo iDi;
|
|
316 |
|
|
317 |
// Resource file offset
|
|
318 |
TInt iResourceOffset;
|
|
319 |
|
|
320 |
// Handle to the central repository session
|
|
321 |
CRepository* iSlideshowRepository;
|
|
322 |
|
|
323 |
// Environment pointer
|
|
324 |
CEikonEnv* iEikEnv;
|
|
325 |
|
|
326 |
// Pointer to settings
|
|
327 |
CSlideshowSettings* iSettings;
|
|
328 |
|
|
329 |
// Slideshow model
|
|
330 |
CSlideshowModel* iModel;
|
|
331 |
|
|
332 |
// Pointer to Drm Helper
|
|
333 |
CDRMHelper* iDrmHelper;
|
|
334 |
|
|
335 |
// Cenrep watcher for settings change
|
|
336 |
CRepositoryWatcher* iSlideshowCRWatcher;
|
|
337 |
|
|
338 |
RProperty iSettingsChangedProperty;
|
|
339 |
CPSSubscriber* iSettingsChangedSubscriber;
|
|
340 |
|
|
341 |
// Localised name
|
|
342 |
HBufC* iScreensaverName;
|
|
343 |
|
|
344 |
// Waiter
|
|
345 |
CActiveSchedulerWait iWaiter;
|
|
346 |
TBool iWaitActive;
|
|
347 |
|
|
348 |
// Draw count
|
|
349 |
TInt iDrawCount;
|
|
350 |
TBool iTimerUpdated;
|
|
351 |
|
|
352 |
//loading state
|
|
353 |
TBool iIsLoadFinished;
|
|
354 |
|
|
355 |
// MDS session
|
|
356 |
CMdESession* iMdESession;
|
|
357 |
};
|
|
358 |
|
|
359 |
|
|
360 |
#endif // C_SLIDESHOWPLUGIN_H
|
|
361 |
// End Of file
|