|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __LOGVIEWWINDOW_H__ |
|
17 #define __LOGVIEWWINDOW_H__ |
|
18 |
|
19 // System includes |
|
20 #include <e32base.h> |
|
21 |
|
22 // User includes |
|
23 #include <logwrap.h> |
|
24 #include "LogServShared.h" |
|
25 #include "LogViewWindowFetcher.h" |
|
26 #include "LogViewWindowLockObserver.h" |
|
27 #include "LogViewChangeObserverInternal.h" |
|
28 |
|
29 // Classes referenced |
|
30 class CLogClient; |
|
31 class CLogPackage; |
|
32 class CLogChangeDefinition; |
|
33 class CLogFilterList; |
|
34 class MLogViewChangeObserver; |
|
35 class CLogViewSetupClientOp; |
|
36 class CLogViewWindowFetcher; |
|
37 class CLogViewWindowLockObserver; |
|
38 class CLogViewWindowChangeObserver; |
|
39 |
|
40 |
|
41 ///////////////////////////////////////////////////////////////////////////////////////// |
|
42 // -----> CLogViewWindow (header) |
|
43 ///////////////////////////////////////////////////////////////////////////////////////// |
|
44 NONSHARABLE_CLASS(CLogViewWindow) : public CLogActive, public MLogViewChangeObserverInternal, public MLogViewWindowFetcherObserver, public MLogViewWindowLockObserver |
|
45 /** |
|
46 @internalComponent |
|
47 */ |
|
48 { |
|
49 public: |
|
50 CLogViewWindow(RLogSession& aSession, TLogViewId aViewId, TInt aWindowSize, MLogViewChangeObserver* aCascadeObserver, TInt aPriority); |
|
51 ~CLogViewWindow(); |
|
52 void ConstructL(CLogPackage& aPackage); |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Prepare the view |
|
58 */ |
|
59 TInt Setup(const CLogFilterList& aFilterList, TInt aParam, TLogFilterConstructionType aFilterConstructionType); |
|
60 |
|
61 /** |
|
62 * Move the view position |
|
63 */ |
|
64 TBool NavigateL(TLogNavigation aNavigate, TRequestStatus& aStatus); |
|
65 |
|
66 /** |
|
67 * Remove the specified log event from the window if its present |
|
68 */ |
|
69 void RemoveFromWindowIfPresentL(TLogId aId); |
|
70 |
|
71 /** |
|
72 * Access the change observer (needed to construct the view) |
|
73 */ |
|
74 MLogViewChangeObserverInternal& ChangeObserver(); |
|
75 |
|
76 /** |
|
77 * Access the event at the current position |
|
78 */ |
|
79 const CLogEvent& CurrsorEvent() const; |
|
80 |
|
81 /** gets iViewRecordCount */ |
|
82 inline TInt ViewRecordCount() const; |
|
83 |
|
84 private: // FROM MLogViewWindowLockObserver |
|
85 void HandleWindowLockStatusChangeL(TLogViewLockStatus aStatus); |
|
86 |
|
87 private: // FROM MLogViewWindowFetcherObserver |
|
88 void HandleFetchedWindowItemL(TInt aItemIndex, CLogEvent* aEvent); |
|
89 |
|
90 public: // FROM MLogViewChangeObserver |
|
91 void HandleLogViewChangeEventAddedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount); |
|
92 void HandleLogViewChangeEventChangedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount); |
|
93 void HandleLogViewChangeEventDeletedL(TLogId aId, TInt aViewIndex, TInt aChangeIndex, TInt aTotalChangeCount); |
|
94 |
|
95 private: // FROM MLogViewChangeObserverInternal |
|
96 void HandleLogViewChangeEventLogClearedL(); |
|
97 |
|
98 private: // FROM CLogActive |
|
99 void DoRunL(); |
|
100 void DoCancel(); |
|
101 void DoComplete(TInt& aComplete); |
|
102 |
|
103 private: |
|
104 enum TWindowState |
|
105 { |
|
106 EStateIdle = 0, |
|
107 EStateFetchingWindow, |
|
108 EStateProcessingWindow, |
|
109 EStateNavigateWithinWindow, |
|
110 EStateLocked |
|
111 }; |
|
112 |
|
113 private: |
|
114 void StateHandleWindowFetchStarting(); |
|
115 void StateHandleWindowFetchedL(); |
|
116 void StateHandleNavigation(); |
|
117 |
|
118 private: |
|
119 void CompleteRequest(TInt aCompletionCode = KErrNone); |
|
120 void CalculateWindowForCursorPosition(TInt aCursorPosition, TLogWindow& aWindow) const; |
|
121 void Reset(); |
|
122 void SilentCancel(); |
|
123 void RefetchL(const TLogWindow& aWindow, TInt aCursor); |
|
124 void ChangeState(TWindowState aNewState); |
|
125 void RemoveEvent(TInt aIndex); |
|
126 TInt CalculateCursorPosition(TLogNavigation aNavigate) const; |
|
127 TInt FindEvent(TLogId aId); |
|
128 TInt FindAndRemoveEvent(TLogId aId); |
|
129 |
|
130 private: |
|
131 RLogSession& iSession; |
|
132 const TLogViewId iViewId; |
|
133 const TInt iWindowSize; |
|
134 MLogViewChangeObserver* iCascadeObserver; |
|
135 RPointerArray<CLogEvent> iEvents; |
|
136 |
|
137 TWindowState iState; |
|
138 TLogWindowAndCursor iWindow; |
|
139 TInt iViewRecordCount; |
|
140 |
|
141 CLogViewSetupClientOp* iWindowPreparer; |
|
142 CLogViewWindowFetcher* iWindowFetcher; |
|
143 CLogViewWindowLockObserver* iWindowLockObserver; |
|
144 CLogViewWindowChangeObserver* iWindowChangeObserver; |
|
145 }; |
|
146 |
|
147 |
|
148 inline |
|
149 TInt CLogViewWindow::ViewRecordCount() const |
|
150 { |
|
151 return iViewRecordCount; |
|
152 } |
|
153 |
|
154 #endif |