|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: |
|
15 * Helper class to put animation and progress indicator to contextPane. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef BROWSERPROGRESSINDICATOR_H |
|
22 #define BROWSERPROGRESSINDICATOR_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <E32BASE.H> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 //class CBrowserAnimation; |
|
29 class MApiProvider; |
|
30 |
|
31 // DATA TYPES |
|
32 |
|
33 // Progressbar data struct. |
|
34 struct TProgressData |
|
35 { |
|
36 TUint16 iId; // Id of the transaction |
|
37 TUint32 iRecvdData; // Amount of received data |
|
38 TUint32 iMaxData; // Max amount of data |
|
39 TBool iComplete; // True if TransAct Id downloaded otherwise False. |
|
40 }; |
|
41 |
|
42 |
|
43 // CLASS DECLARATION |
|
44 /** |
|
45 * Encapsulates the animation feature of the browser. |
|
46 * |
|
47 * @lib Browser.app |
|
48 * @since Series60 1.2 |
|
49 */ |
|
50 class CBrowserProgressIndicator : public CBase |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * @param aApiProvider Reference to API provider |
|
57 * @return Pointer to instance of CBrowserAnimation |
|
58 */ |
|
59 static CBrowserProgressIndicator* CBrowserProgressIndicator::NewL( MApiProvider& aApiProvider ); |
|
60 /** |
|
61 * Constructor. |
|
62 * @param aApiProvider Reference to API provider |
|
63 */ |
|
64 CBrowserProgressIndicator( MApiProvider& aApiProvider ); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~CBrowserProgressIndicator(); |
|
70 |
|
71 public: // New functions |
|
72 |
|
73 /** |
|
74 * Starts animation and progress bar. |
|
75 * @since Series60 1.2 |
|
76 * @param aBearerType |
|
77 */ |
|
78 void StartL(); |
|
79 |
|
80 /** |
|
81 * Stops animation and progress bar. |
|
82 * @since Series60 1.2 |
|
83 */ |
|
84 void StopL(); |
|
85 |
|
86 /** |
|
87 * Adds transaction id to array. |
|
88 * @since Series60 1.2 |
|
89 * @param aId Id of the transaction |
|
90 */ |
|
91 void AddTransActIdL( TUint16 aId ); |
|
92 |
|
93 /** |
|
94 * Notify that new data has arrived to the loaders. |
|
95 * @since Series60_version 2.5 |
|
96 * @return none |
|
97 */ |
|
98 void NotifyProgress(); |
|
99 |
|
100 /** |
|
101 * Saves maximum and received data with a transction id. |
|
102 * @since Series60 1.2 |
|
103 * @param aId Id of the transaction |
|
104 * @param aRecvdData Amount of data we have received with current transaction Id |
|
105 * @param aMaxData Max size of the transaction |
|
106 */ |
|
107 void AddProgressDataL( TUint16 aId, TUint32 aRecvdData, TUint32 aMaxData ); |
|
108 |
|
109 /** |
|
110 * Marks particular transaction id to complete status |
|
111 * @since Series60 2.0 |
|
112 * @param aId Id of the transaction |
|
113 */ |
|
114 void TransActIdCompleteL( TUint16 aId ); |
|
115 |
|
116 /** |
|
117 * Gives amount of transaction ids. |
|
118 * @since Series60 1.2 |
|
119 * @return Amount of transaction ids |
|
120 */ |
|
121 TInt TransActIdAmount() const; |
|
122 |
|
123 /** |
|
124 * Gives amount of completed transaction ids. |
|
125 * @since Series60 1.2 |
|
126 * @return Amount of transaction ids |
|
127 */ |
|
128 TInt TransActIdAmountCompleted() const; |
|
129 |
|
130 protected: |
|
131 /** |
|
132 * Two-phase constructor. |
|
133 */ |
|
134 void ConstructL(); |
|
135 |
|
136 private: |
|
137 /** |
|
138 * Enquires transaction statuses. Calculates and generates progress |
|
139 * text and progress bar. |
|
140 * @since Series60 1.2 |
|
141 * @return None. |
|
142 */ |
|
143 void EnquireStatusL(); |
|
144 |
|
145 /** |
|
146 * Deletes progress data item according to aId . |
|
147 * @since Series60 1.2 |
|
148 * @param aId Transaction id |
|
149 */ |
|
150 void DeleteProgressDataItem( TUint16 aId ); |
|
151 |
|
152 /** |
|
153 * Resets all saved transaction ids, maximum data and received data. |
|
154 * @since Series60 1.2 |
|
155 */ |
|
156 void ResetValues(); |
|
157 |
|
158 /** |
|
159 * Returns total amount of received data. |
|
160 * @since Series60 1.2 |
|
161 * @return Number of received data |
|
162 */ |
|
163 TUint32 ReceivedData(); |
|
164 |
|
165 /** |
|
166 * All transaction ids won't give max data info at the same time. |
|
167 * Calculation is needed to get estimated maxData of page. |
|
168 * @since Series60 1.2 |
|
169 * @return Number of maximum data |
|
170 */ |
|
171 TUint32 EstimateMaxData(); |
|
172 |
|
173 /** |
|
174 * Returns transaction id of current index from array. |
|
175 * @since Series60 1.2 |
|
176 * @param aIndex Index of array |
|
177 * @return Transaction id |
|
178 */ |
|
179 TUint16 TransActId( TInt aIndex ); |
|
180 |
|
181 private: // Data |
|
182 |
|
183 TBool iIsRunning; // Animation is running |
|
184 MApiProvider& iApiProvider; // Api provider |
|
185 |
|
186 CArrayFixFlat<TProgressData>* iProgressData; |
|
187 TBool iInitialDownloadIndicatorState; // initial download (globe) animation in Full Screen pane |
|
188 TReal iProgressEstimate; |
|
189 |
|
190 /** |
|
191 * Temporary storage for strings. Each must be reseted at |
|
192 * the beginning of EnquireStatusL! |
|
193 */ |
|
194 TBuf<20> iPercentText; |
|
195 TBuf<15> iDataText; |
|
196 TBuf<5> iMBvalue; |
|
197 |
|
198 const TDesC* iMyKb; |
|
199 const TDesC* iMyMb; |
|
200 |
|
201 TInt iLastMaxEstimate; |
|
202 TInt iLastReceivedData; |
|
203 }; |
|
204 |
|
205 #endif |
|
206 |
|
207 // End of File |