|
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 : Grid view Observers |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef GLXGRIDVIEWMLOBSERVER_H_ |
|
20 #define GLXGRIDVIEWMLOBSERVER_H_ |
|
21 |
|
22 // Photos Headers |
|
23 #include <mglxmedialistobserver.h> |
|
24 #include <glxfiltergeneraldefs.h> |
|
25 |
|
26 // CONSTANTS |
|
27 const TInt KNoOfPages(3); |
|
28 const TInt KBufferTresholdSize(3); // in rows |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CGlxMediaList; |
|
32 class CHgGrid; |
|
33 class CGlxDRMUtility; |
|
34 class MHgScrollBufferObserver; |
|
35 //class CHgContextUtility; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 class CGlxGridViewMLObserver: public CBase, |
|
39 public MGlxMediaListObserver |
|
40 |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * |
|
47 * @return Pointer to newly created object. |
|
48 */ |
|
49 IMPORT_C static CGlxGridViewMLObserver* NewL( |
|
50 MHgScrollBufferObserver& aHgScrollBufferObs, |
|
51 MGlxMediaList& aMediaList, CHgGrid* aHgGrid, |
|
52 TGlxFilterItemType aFilterType = EGlxFilterVideoAndImages); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CGlxGridViewMLObserver(); |
|
58 |
|
59 public: // from MGlxMediaListObserver |
|
60 void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); |
|
61 void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList*/* aList */); |
|
62 void HandleAttributesAvailableL( TInt aItemIndex, |
|
63 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList ); |
|
64 void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, |
|
65 TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); |
|
66 void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); |
|
67 void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); |
|
68 void HandleError( TInt aError ); |
|
69 void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, |
|
70 MGlxMediaList* aList ); |
|
71 void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); |
|
72 void HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList ); |
|
73 void HandlePopulatedL( MGlxMediaList* aList ); |
|
74 |
|
75 private: |
|
76 |
|
77 /** |
|
78 * C++ default constructor. |
|
79 */ |
|
80 CGlxGridViewMLObserver(MHgScrollBufferObserver& aHgScrollBufferObs, |
|
81 MGlxMediaList& aMediaList, CHgGrid* aHgGrid, |
|
82 TGlxFilterItemType aFilterType); |
|
83 |
|
84 /** |
|
85 * By default Symbian 2nd phase constructor is private. |
|
86 */ |
|
87 void ConstructL(); |
|
88 |
|
89 /** |
|
90 * HandleErrorL is added to make the compiler happy by reducing codescanner warnings |
|
91 * No extra purpose |
|
92 */ |
|
93 void HandleErrorL(); |
|
94 |
|
95 /** |
|
96 * Checks the availability of relevant thumbnail(Quality or Speed) attribute |
|
97 * @param aIndex Media index to check the thumbnail attribute |
|
98 * @return ETrue if relevant thumbnail available |
|
99 * EFalse if relevant thumbnail not available |
|
100 */ |
|
101 TBool HasRelevantThumbnail(TInt aIndex); |
|
102 |
|
103 /** |
|
104 * RefreshScreenL - Refreshes the Hg Grid based on the attributes available index |
|
105 * |
|
106 */ |
|
107 void RefreshScreenL(TInt aItemIndex,const RArray<TMPXAttribute>& aAttributes); |
|
108 |
|
109 /** |
|
110 * UpdateItemsL - Update the items with the DRM/video icon and date/time |
|
111 * |
|
112 */ |
|
113 void UpdateItemsL (TInt aItemIndex,const RArray<TMPXAttribute>& aAttributes); |
|
114 |
|
115 /** |
|
116 * DisplayErrorNoteL - Show an error note based on input parameter |
|
117 * @param aError The error based on which the error note is to be shown. |
|
118 */ |
|
119 void DisplayErrorNoteL(TInt aError); |
|
120 |
|
121 /** |
|
122 * SetDefaultIconL - Sets the default icon for grid. |
|
123 * @param aTransparent - ETrue to set transparent icon; EFalse to set default icon. |
|
124 */ |
|
125 void SetDefaultIconL(TBool aTransparent); |
|
126 |
|
127 /** |
|
128 * SetIconL - Sets the grid cell icon with the given parameters |
|
129 * @param aItemIndex - The grid cell index |
|
130 * @param aBitmapId - The bitmap id |
|
131 * @param aMaskId - The mask id |
|
132 * @param aFlags - The indicator flags |
|
133 */ |
|
134 void SetIconL(TInt aItemIndex, TInt aBitmapId, TInt aMaskId, TInt aFlags); |
|
135 |
|
136 private: |
|
137 // Hg Grid scroll buffer observer |
|
138 MHgScrollBufferObserver& iHgScrollBufferObs; |
|
139 |
|
140 MGlxMediaList& iMediaList; |
|
141 |
|
142 // Instance of HG Grid |
|
143 CHgGrid* iHgGrid; |
|
144 |
|
145 // Provides DRM related functionality |
|
146 CGlxDRMUtility* iDRMUtility; |
|
147 |
|
148 TSize iGridIconSize; |
|
149 |
|
150 // The Resource file name from which icons to be read |
|
151 TFileName iIconsFileName; |
|
152 |
|
153 //No of visible items in a page/view |
|
154 TInt iItemsPerPage; |
|
155 |
|
156 //Flag to indicate the grid default icon set status |
|
157 TBool iIsDefaultIconSet; |
|
158 |
|
159 // Variable to check if the error in disk (e.g disk error) has been shown to the user. |
|
160 // If a disk is full the user should not be intimated everytime over and over again. |
|
161 TInt iDiskErrorIntimated; |
|
162 |
|
163 // Modified Indexes array to refresh the screen |
|
164 RArray<TInt> iModifiedIndexes; |
|
165 |
|
166 //Grid Thumbnail Attribs |
|
167 TMPXAttribute iQualityTnAttrib; |
|
168 TMPXAttribute iSpeedTnAttrib; |
|
169 // Filtertype, Image / Video |
|
170 TGlxFilterItemType iFilterType; |
|
171 }; |
|
172 #endif //GLXGRIDVIEWMLOBSERVER_H_ |