|
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: Implementation of preview thumbnail binding for the |
|
15 * list view |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef _GLXPREVIEWTHUMBNAILBINDING_H_ |
|
23 #define _GLXPREVIEWTHUMBNAILBINDING_H_ |
|
24 |
|
25 |
|
26 #include "glxbinding.h" // The binding is created by the binding set factory. |
|
27 #include "glxmedialistiterator.h" // Interface for going through items in the list in a non-sequential order |
|
28 #include "mglxmedialistobserver.h" // Observes for changes in media list |
|
29 #include <memory> |
|
30 |
|
31 |
|
32 class GlxThumbnailVariantType; |
|
33 class CGlxUiUtility; |
|
34 class CGlxThumbnailContext; // Fetch context to retrieve thumbnails |
|
35 |
|
36 // CLASS DECLARATION |
|
37 /** |
|
38 * Implementation of preview thumbnail binding for the |
|
39 * list view. |
|
40 * |
|
41 */ |
|
42 |
|
43 NONSHARABLE_CLASS(CGlxPreviewThumbnailBinding) : public CGlxSingleTagBinding, |
|
44 public MGlxMediaListObserver |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Two phase construction |
|
50 * @param aMulTag Mul field that the binding corresponds to |
|
51 */ |
|
52 static CGlxPreviewThumbnailBinding* NewL (); |
|
53 |
|
54 /** |
|
55 * Two phase construction |
|
56 */ |
|
57 static CGlxPreviewThumbnailBinding* NewLC( ); // takes ownership |
|
58 |
|
59 |
|
60 /** |
|
61 * Destructor |
|
62 */ |
|
63 ~CGlxPreviewThumbnailBinding(); |
|
64 |
|
65 /** |
|
66 * HasFirstThumbnail |
|
67 */ |
|
68 TBool HasFirstThumbnail( const RArray< TMPXAttribute >& aAttributes ); |
|
69 |
|
70 private: |
|
71 |
|
72 /** |
|
73 * Constructor |
|
74 */ |
|
75 CGlxPreviewThumbnailBinding(); |
|
76 |
|
77 /** |
|
78 * Two phase construction |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 |
|
83 public: |
|
84 //From CGlxBinding |
|
85 void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, |
|
86 TBool aIsFocused, TInt aTextureId = KErrNotFound) const; |
|
87 CGlxBinding::TResponse HandleFocusChanged( TBool aIsGained ); |
|
88 void HandleItemChangedL(const CMPXCollectionPath& aPath ); |
|
89 |
|
90 // From MGlxMediaListObserver |
|
91 void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); |
|
92 void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); |
|
93 void HandleAttributesAvailableL( TInt aItemIndex, |
|
94 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList ); |
|
95 void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, |
|
96 TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); |
|
97 void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); |
|
98 void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); |
|
99 void HandleError( TInt aError ); |
|
100 void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, |
|
101 MGlxMediaList* aList ); |
|
102 void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); |
|
103 void HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList ); |
|
104 |
|
105 |
|
106 private: |
|
107 |
|
108 /** |
|
109 * CreateThumbnail |
|
110 */ |
|
111 |
|
112 std::auto_ptr< GlxThumbnailVariantType > CreateThumbnailL( TInt aIndex )const; |
|
113 |
|
114 /** |
|
115 * MediaIndexBySlotIndex |
|
116 */ |
|
117 TInt MediaIndexBySlotIndex( TInt aProgressIndex, TInt aSlotIndex ) const; |
|
118 |
|
119 /** |
|
120 * IsTime |
|
121 */ |
|
122 static TInt IsTime( TAny* aSelf ); |
|
123 |
|
124 /** |
|
125 * TimerTicked |
|
126 */ |
|
127 void TimerTicked(); |
|
128 |
|
129 /** |
|
130 * Sets initial thumbnail to visual item depending upon slot |
|
131 */ |
|
132 void SetInitialThumbnailAttributeL(Alf::MulVisualItem& aItem, TInt aSlot ) const; |
|
133 |
|
134 /** |
|
135 * Sets initial thumbnail to visual item simultaneously |
|
136 */ |
|
137 void SetThumbnailAttributeL(Alf::MulVisualItem& aItem ) const; |
|
138 |
|
139 /** |
|
140 * changes the next slot that has to be filled |
|
141 */ |
|
142 void PreviewSlotIndex( TInt aSlot, TInt aSlotIndex ) const; |
|
143 |
|
144 private: |
|
145 |
|
146 // Timer that checks for the time expiration |
|
147 CPeriodic* iTimer; |
|
148 |
|
149 //Medialist that holds the thumbnail information |
|
150 MGlxMediaList* iMediaList; |
|
151 |
|
152 // Thumbnail context |
|
153 CGlxThumbnailContext* iThumbnailContext; |
|
154 |
|
155 // for thumbnail context |
|
156 TGlxSequentialIterator iThumbnailIterator; |
|
157 |
|
158 // Preview thumbnail index |
|
159 TInt iProgressIndex; |
|
160 |
|
161 // keeps track of which index to fill with thumbnail |
|
162 mutable TInt iSlotIndex; |
|
163 |
|
164 // Flag that has information whether thumbnail is available |
|
165 TBool iStartedShowingThumbnails; |
|
166 |
|
167 // flag that says whether timer has expired |
|
168 TBool iTimerTicked; |
|
169 |
|
170 // whether current orientation is landscape or potrait |
|
171 TBool iCurrentOrientationLandscape; |
|
172 |
|
173 //it holds the initial number of thumbnail to be displayed |
|
174 RArray<TInt> iPreviewItemCount; |
|
175 |
|
176 // holds how many thumbnail to be shown initially |
|
177 TInt iSlots; |
|
178 |
|
179 CGlxUiUtility* iUiUtility; |
|
180 |
|
181 }; |
|
182 |
|
183 |
|
184 #endif //_GLXPREVIEWTHUMBNAILBINDING_H_ |