1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef ATCONSOLE_VIEWS_H |
|
19 #define ATCONSOLE_VIEWS_H |
|
20 |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 |
|
26 // CONSTANTS |
|
27 const TInt KViewOverhead = 4; |
|
28 |
|
29 // Numeric key ascii code values for ATConsoleUI's menu |
|
30 const TInt KMyKeyDownAsciiCode = 56; // Ascii code for number '8' |
|
31 const TInt KMyKeyLeftAsciiCode = 52; // Ascii code for number '4' |
|
32 const TInt KMyKeyRightAsciiCode = 54; // Ascii code for number '6' |
|
33 const TInt KMyKeyUpAsciiCode = 50; // Ascii code for number '2' |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CView; |
|
37 class CConsoleMain; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * @class CView atconsoleviews.h |
|
43 * @brief The CView is used for making views needed in the console |
|
44 * application. |
|
45 */ |
|
46 class CView |
|
47 :public CBase |
|
48 { |
|
49 public: // Enumerations |
|
50 enum TUpdateType |
|
51 { |
|
52 EViewPrint, |
|
53 EViewRefresh, |
|
54 }; |
|
55 |
|
56 public: // Constructors and destructor |
|
57 // None |
|
58 |
|
59 /** |
|
60 * NewL is first phase of two-phased constructor. |
|
61 */ |
|
62 static CView* NewL( CConsoleMain* aConsole, |
|
63 CView* aParent, |
|
64 const TDesC& aName, TInt64 aProcessId ); |
|
65 |
|
66 /** |
|
67 * Destructor of CConsoleMain. |
|
68 */ |
|
69 virtual ~CView(); |
|
70 |
|
71 public: // New functions |
|
72 |
|
73 /** |
|
74 * Return menu name |
|
75 */ |
|
76 virtual const TDesC& Name() const; |
|
77 |
|
78 /** |
|
79 * Return item texts. |
|
80 */ |
|
81 virtual TInt ItemTexts( RArray<TDesC>& aArray ); |
|
82 |
|
83 /** |
|
84 * Prints the view |
|
85 */ |
|
86 virtual void PrintViewL( TUpdateType aType ); |
|
87 |
|
88 /** |
|
89 * Process keypresses on this menu |
|
90 */ |
|
91 virtual CView* SelectL( TKeyCode aSelection, TBool& aContinue ); |
|
92 |
|
93 /** |
|
94 * Set parent menu |
|
95 */ |
|
96 virtual void SetParent ( CView* aMenu ); |
|
97 |
|
98 /** |
|
99 * Print line |
|
100 */ |
|
101 virtual void Print( const TDesC& aPrint ); |
|
102 |
|
103 /** |
|
104 * Add item to menu |
|
105 */ |
|
106 virtual void AddItemL ( CView* aItem ); |
|
107 |
|
108 /** |
|
109 * Resets the item list |
|
110 */ |
|
111 virtual void ResetItems(); |
|
112 |
|
113 /** |
|
114 * Update display from timer |
|
115 */ |
|
116 virtual void TimerUpdate(); |
|
117 |
|
118 /** |
|
119 * Append text before original text. |
|
120 */ |
|
121 virtual void AppendBefore( TInt aLineNum, TDes& aLine ); |
|
122 |
|
123 /** |
|
124 * Get menu type. |
|
125 */ |
|
126 inline TInt Type(){ return iType; }; |
|
127 |
|
128 /** |
|
129 * Map KeyCode |
|
130 */ |
|
131 void MapKeyCode( TKeyCode &aSelection ); |
|
132 |
|
133 protected: // Functions from base classes |
|
134 // None |
|
135 |
|
136 /** |
|
137 * C++ default constructor. |
|
138 */ |
|
139 CView(); |
|
140 |
|
141 /** |
|
142 * By default Symbian OS constructor is private. |
|
143 */ |
|
144 void ConstructL( CConsoleMain* aConsole, |
|
145 CView* aParent, |
|
146 const TDesC& aName, TInt64 aProcessId ); |
|
147 |
|
148 protected: // Data |
|
149 |
|
150 CConsoleBase* iConsole; // Pointer to console |
|
151 CConsoleMain* iMain; // Pointer to main console |
|
152 CView* iParent; // Pointer to parent menu |
|
153 TName iViewName; // Menu name |
|
154 TInt64 iProcessId; // Process id of the menu |
|
155 |
|
156 RPointerArray<CView> iItems; // Menu items |
|
157 |
|
158 TInt iPositionOnScreen; // Position on display |
|
159 TInt iFirstItem; // First displayed item |
|
160 TInt iLastItem; // Last displayed item |
|
161 TInt iItemCount; // Last Item |
|
162 TSize iSize; // Display size |
|
163 TInt iScreenSize; // "Work area" size |
|
164 TInt iDirection; // Scrolling direction |
|
165 TInt iStart; // Scrolling position |
|
166 TInt iPrevPos; // Previous position in scrolling |
|
167 // Menu type (which updates must cause console update) |
|
168 TInt iType; |
|
169 TUpdateType iUpdateType; |
|
170 // Determines if libraries are to be shown |
|
171 TBool iShowLibraries; |
|
172 // Determines if set logging mode query is to be shown |
|
173 TBool iSetLoggingMode; |
|
174 }; |
|
175 |
|
176 /** |
|
177 * @class CProcessInfoView atconsoleviews.h |
|
178 * @brief The CProcessInfoView is used for showing information about |
|
179 * some process and starting/stopping subtests. |
|
180 */ |
|
181 class CProcessInfoView |
|
182 :public CView |
|
183 |
|
184 { |
|
185 |
|
186 private: // Enumerations |
|
187 enum TProcessInfoView |
|
188 { |
|
189 EStartSubtestTxtItem, |
|
190 EStopSubtestTxtItem, |
|
191 EViewLibrariesTxtItem, |
|
192 EEndProcessTxtItem, |
|
193 EKillProcessTxtItem, |
|
194 ECancelLoggingTxtItem |
|
195 }; |
|
196 |
|
197 enum TProcessEnds |
|
198 { |
|
199 ETryToEnd, |
|
200 ETryToKill |
|
201 }; |
|
202 |
|
203 public: // Constructors and destructor |
|
204 |
|
205 /** |
|
206 * NewL is first phase of two-phased constructor. |
|
207 */ |
|
208 static CProcessInfoView* NewL( CConsoleMain* aConsole, |
|
209 CView* aParent, |
|
210 const TDesC& aName, TInt64 aProcessId ); |
|
211 |
|
212 /** |
|
213 * Destructor |
|
214 */ |
|
215 ~CProcessInfoView(); |
|
216 |
|
217 public: // Functions from base classes |
|
218 |
|
219 /** |
|
220 * Return item texts. |
|
221 */ |
|
222 virtual TInt ItemTexts( RArray<TDesC>& aArray ); |
|
223 |
|
224 /** |
|
225 * Process keypresses on this menu |
|
226 */ |
|
227 virtual CView* SelectL( TKeyCode aSelectLion, |
|
228 TBool& aContinue ); |
|
229 |
|
230 /** |
|
231 * Prints the view |
|
232 */ |
|
233 virtual void PrintViewL( TUpdateType aType ); |
|
234 |
|
235 /** |
|
236 * Prints libraries |
|
237 */ |
|
238 void ViewLibrariesL(); |
|
239 |
|
240 /** |
|
241 * Prints logging modes |
|
242 */ |
|
243 void SetLoggingModeL(); |
|
244 |
|
245 /** |
|
246 * Ends a process with a certain method. |
|
247 * @param aCommand command id |
|
248 */ |
|
249 void EndProcessL( TInt aCommand ); |
|
250 |
|
251 protected: // New functions |
|
252 // None |
|
253 |
|
254 protected: // Functions from base classes |
|
255 // None |
|
256 |
|
257 /** |
|
258 * By default Symbian OS constructor is private. |
|
259 */ |
|
260 void ConstructL( CConsoleMain* aConsole, |
|
261 CView* aParent, |
|
262 const TDesC& aName, TInt64 aProcessId ); |
|
263 |
|
264 private: // Data |
|
265 // Current opened process's info |
|
266 TATProcessInfo iCurrentProcessInfo; |
|
267 |
|
268 }; |
|
269 |
|
270 // CONSTANTS |
|
271 _LIT( KExitTxt, "Exit" ); |
|
272 |
|
273 /** |
|
274 * @class CMainView atconsoleviews.h |
|
275 * @brief The CMainView is used for showing all the processes |
|
276 * currently under testing. |
|
277 */ |
|
278 class CMainView |
|
279 :public CView |
|
280 |
|
281 { |
|
282 public: // Constructors and destructor |
|
283 |
|
284 /** |
|
285 * NewL is first phase of two-phased constructor. |
|
286 */ |
|
287 static CMainView* NewL( CConsoleMain* aConsole, |
|
288 CView* aParent, |
|
289 const TDesC& aName ); |
|
290 |
|
291 public: // Functions from base classes |
|
292 |
|
293 /** |
|
294 * Return item texts. |
|
295 */ |
|
296 virtual TInt ItemTexts( RArray<TDesC>& aArray ); |
|
297 |
|
298 /** |
|
299 * Process keypresses on this menu |
|
300 */ |
|
301 virtual CView* SelectL( TKeyCode aSelectLion, TBool& aContinue ); |
|
302 |
|
303 protected: // Functions from base classes |
|
304 |
|
305 /** |
|
306 * By default Symbian OS constructor is private. |
|
307 */ |
|
308 void ConstructL( CConsoleMain* aConsole, |
|
309 CView* aParent, |
|
310 const TDesC& aName ); |
|
311 |
|
312 }; |
|
313 |
|
314 #endif // ATCONSOLE_VIEWS_H |
|
315 |
|
316 // End of File |
|