|
1 /* |
|
2 * Copyright (c) 2008-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: Icon manager for DRM rights icons |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 * @internal reviewed 03/07/2007 by Rowland Cook |
|
23 */ |
|
24 |
|
25 #ifndef C_GLXDRMICONMANAGER_H |
|
26 #define C_GLXDRMICONMANAGER_H |
|
27 |
|
28 #include <e32base.h> |
|
29 |
|
30 #include "glxiconmanager.h" |
|
31 |
|
32 /** |
|
33 * CGlxDRMIconManager |
|
34 * |
|
35 * Icon manager for visuals |
|
36 * Handles adding default or broken icon if required. |
|
37 * If thumbnail not present look for icon attribute |
|
38 * @author M Byrne |
|
39 * @lib glxvisuallistmanager |
|
40 */ |
|
41 struct TIconInfo; |
|
42 class CAlfVisual; |
|
43 class CGlxDRMUtility; |
|
44 class TGlxMediaId; |
|
45 class CAlfTexture; |
|
46 |
|
47 NONSHARABLE_CLASS( CGlxDrmIconManager ) : public CGlxIconManager |
|
48 { |
|
49 public: |
|
50 /** |
|
51 * Static constructor |
|
52 * @param aMediaList reference to media list |
|
53 * @param aVisualList reference to associated visual list |
|
54 * @return pointer to CGlxVisualIconManager instance |
|
55 */ |
|
56 IMPORT_C static CGlxDrmIconManager* NewL(MGlxMediaList& aMediaList, |
|
57 MGlxVisualList& aVisualList); |
|
58 |
|
59 /** |
|
60 * Destructor |
|
61 */ |
|
62 IMPORT_C ~CGlxDrmIconManager(); |
|
63 |
|
64 /** |
|
65 * Remove overlay icon (when enter full-screen) |
|
66 * @param aIndex list index of item |
|
67 * @param aInvalidIcon ETrue if DRM invalid icon present |
|
68 */ |
|
69 void RemoveOverlayIcon(TInt aIndex, TBool aInvalidIcon); |
|
70 |
|
71 /** |
|
72 * Remove overlay icons (when exit full-screen) |
|
73 */ |
|
74 void AddOverlayIconsL(); |
|
75 |
|
76 private: // From MGlxMediaListObserver |
|
77 /// See @ref MGlxMediaListObserver::HandleItemAddedL |
|
78 void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); |
|
79 |
|
80 /// See @ref MGlxMediaListObserver::HandleMediaL |
|
81 void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); |
|
82 |
|
83 /// See @ref MGlxMediaListObserver::HandleItemRemovedL |
|
84 void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); |
|
85 |
|
86 /// See @ref MGlxMediaListObserver::HandleItemModifiedL |
|
87 void HandleItemModifiedL(const RArray<TInt>& aItemIndexes, MGlxMediaList* aList); |
|
88 |
|
89 /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL |
|
90 void HandleAttributesAvailableL(TInt aItemIndex, |
|
91 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList); |
|
92 |
|
93 /// See @ref MGlxMediaListObserver::HandleFocusChangedL |
|
94 void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); |
|
95 |
|
96 /// See @ref MGlxMediaListObserver::HandleItemSelectedL |
|
97 void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); |
|
98 |
|
99 /// See @ref MGlxMediaListObserver::HandleMessageL |
|
100 void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); |
|
101 |
|
102 private: // from MGlxVisualListObserver |
|
103 /** @see MGlxVisualListObserver::HandleFocusChangedL */ |
|
104 void HandleFocusChangedL( TInt aFocusIndex, TReal32 aItemsPerSecond, MGlxVisualList* aList, NGlxListDefs::TFocusChangeType aType ); |
|
105 /** @see MGlxVisualListObserver::HandleSizeChanged */ |
|
106 void HandleSizeChanged( const TSize& aSize, MGlxVisualList* aList ); |
|
107 /** @see MGlxVisualListObserver::HandleVisualRemoved */ |
|
108 void HandleVisualRemoved( const CAlfVisual* aVisual, MGlxVisualList* aList ); |
|
109 /** @see MGlxVisualListObserver::HandleVisualAddedL */ |
|
110 void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); |
|
111 |
|
112 private: |
|
113 /** |
|
114 * Identifiers for DRM icons |
|
115 */ |
|
116 enum TGlxVisualIcon |
|
117 { |
|
118 EDRMRightsValidIcon, |
|
119 EDRMRightsInvalidIcon |
|
120 }; |
|
121 |
|
122 private: |
|
123 /** |
|
124 * Constructor |
|
125 * @param aMediaList pointer to media list |
|
126 * @param aVisualList reference to associated visual list |
|
127 */ |
|
128 CGlxDrmIconManager(MGlxMediaList& aMediaList, MGlxVisualList& aVisualList); |
|
129 |
|
130 /** |
|
131 * 2nd phase construction |
|
132 */ |
|
133 void ConstructL(); |
|
134 |
|
135 /** |
|
136 * Check if thumbnail icon has already been generated |
|
137 * @param aIconInfo TIconInfo struct for icon |
|
138 * @return position of icon in iThumbnailIcons, |
|
139 * KErrNotFound if icon not present |
|
140 */ |
|
141 TInt ThumbnailIconArrayPos(TIconInfo& aIconInfo); |
|
142 |
|
143 |
|
144 /** |
|
145 * Check if thumbnail attribute is present for specifed vis. |
|
146 * If not add icon if present or add default icon |
|
147 * @param pointer to visual may be NULL |
|
148 * @param aIndex index of item is media list |
|
149 * @param aForceIcon force icon to be draw |
|
150 */ |
|
151 void CheckDRMRightsL(CAlfVisual* aVisual, |
|
152 TInt aIndex, TBool aForceIcon = ETrue); |
|
153 |
|
154 /** |
|
155 * Add item to array of items with valid DRM icons |
|
156 * @param aId id of item |
|
157 */ |
|
158 void AddValidIconL(TGlxMediaId& aId); |
|
159 |
|
160 /** |
|
161 * Add item to array of items with invalid DRM icons |
|
162 * @param aId id of item |
|
163 */ |
|
164 void AddInvalidIconL(TGlxMediaId& aId); |
|
165 |
|
166 /** |
|
167 * Check if item should have DRM icon of specified type |
|
168 * @param aId id of item |
|
169 * @param icon type (valid or invalid) |
|
170 * @return ETrue if should have icon |
|
171 */ |
|
172 TBool ShouldHaveIcon(TGlxMediaId& aId, TGlxVisualIcon& aType); |
|
173 |
|
174 private: |
|
175 /** Maintain count of number of icons handled by manager */ |
|
176 TInt iIconCount; |
|
177 |
|
178 // array of thumbnail icons added via icon attribute |
|
179 RArray<TIconInfo> iThumbnailIcons; |
|
180 |
|
181 /** Pointer to DRM utulity class owned */ |
|
182 CGlxDRMUtility* iDRMUtility; |
|
183 |
|
184 /** Array of items with valid DRM status */ |
|
185 RArray<TGlxMediaId> iValidDRMItems; |
|
186 |
|
187 /** Array of items with invalid DRM status */ |
|
188 RArray<TGlxMediaId> iInvalidDRMItems; |
|
189 |
|
190 CAlfTexture* iDRMSendForbidTexture; |
|
191 |
|
192 CAlfTexture* iDRMRightsExpiredTexture; |
|
193 }; |
|
194 |
|
195 #endif // C_GLXDRMICONMANAGER_H |