|
1 // Copyright (c) 2005-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 TIMAGEDISPLAY_H |
|
17 #define TIMAGEDISPLAY_H |
|
18 |
|
19 #include <eikappui.h> |
|
20 #include <eikapp.h> |
|
21 |
|
22 #include <eikdoc.h> |
|
23 |
|
24 #include <imageconversion.h> |
|
25 #include <imagedisplay.h> |
|
26 #include "app_uid.h" |
|
27 |
|
28 const TUid KUidTVideo={ APPUID }; |
|
29 |
|
30 // class CImgDisplayAppView |
|
31 class CImageDisplay; |
|
32 class CDisplayModeDialog; |
|
33 class CImgDisplayAppView; |
|
34 |
|
35 class CVideoWalker; |
|
36 |
|
37 // CImgDisplAppUi |
|
38 |
|
39 class CImgDisplAppUi : public CEikAppUi, public MIclImageDisplayObserver |
|
40 { |
|
41 friend class CVideoWalker; |
|
42 private: |
|
43 enum TFileType |
|
44 { |
|
45 EFileTypeUnknown, |
|
46 EFileTypeWbmp, |
|
47 EFileTypeOta |
|
48 }; |
|
49 enum TState |
|
50 { |
|
51 EIdle, |
|
52 ELoading, |
|
53 EPlaying, |
|
54 EPlayPaused, |
|
55 EPlayingWait, |
|
56 ESaving, |
|
57 EFolderWait |
|
58 }; |
|
59 public: |
|
60 void ConstructL(); |
|
61 CImgDisplAppUi(); |
|
62 ~CImgDisplAppUi(); |
|
63 protected: |
|
64 virtual void MiidoImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError) ; |
|
65 private: |
|
66 // From CCoeAppUi |
|
67 virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
68 // From CEikAppUi |
|
69 virtual void HandleCommandL(TInt aCommand); |
|
70 virtual TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName,const TDesC8& aTail); |
|
71 void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); |
|
72 TBool CheckHotKeyNotDimmedL(TInt aCommandId); |
|
73 TUint ImageOptions() const; |
|
74 |
|
75 void OpenFileL(TFileType aFileType); |
|
76 void LoadFileL(); |
|
77 void SaveAsL(); |
|
78 void DisplayModeL(); |
|
79 void ScalingQualityL(); |
|
80 void ClipRectParamsL(); |
|
81 void DrmParamsL(); |
|
82 void BackgroundColorL(); |
|
83 void ExtractFrameL(); |
|
84 void Pause(); |
|
85 void PlayClipL(); |
|
86 void NextFrameL(); |
|
87 void StreamPlayL(TFileType aFileType = EFileTypeUnknown, TBool aMultiFrameStreaming=EFalse); |
|
88 void FrameInfoL(); |
|
89 void FrameRotateL(TBool aClockwise); |
|
90 void FrameFlipL(TBool aVertical); |
|
91 void AutoRotateL(); |
|
92 void MaxReductionL(); |
|
93 |
|
94 void RunL(CVideoWalker* aWalker, TInt aStatus); |
|
95 void DoCancel(CVideoWalker* aWalker); |
|
96 void Cancel(); |
|
97 |
|
98 void HandleNewlyOpenedImageL(); |
|
99 void HandleConvertCompleteL(); |
|
100 void DrawConvertedFrame(); |
|
101 void ResizeBitmapsToSuitL(); |
|
102 void StartFrameOpen(TState aNextState); |
|
103 void StartFrameSave(); |
|
104 |
|
105 void HandleRunError(CVideoWalker* aWalker, TInt aError); |
|
106 |
|
107 void OpenFolderL(); |
|
108 void LoadFolderWait(); |
|
109 void LoadFolderL(const TDesC& aFolderName); |
|
110 void OpenNextFolderEntry(); |
|
111 |
|
112 void MakeName(const TDesC& aDir, TBool aIsMask, TDes& aFileName) const; |
|
113 |
|
114 static void ReplaceNewlinesWithLineBreaks(TDes& aDes); |
|
115 |
|
116 private: |
|
117 CImageDisplay* iImageDisplay; |
|
118 const CFbsBitmap* iFrame; // not owned |
|
119 const CFbsBitmap* iMask; // not owned |
|
120 TSize iImageDisplaySize; |
|
121 TPoint iOffset; |
|
122 TInt iFrameNumber; |
|
123 TInt iPrevFrameNumber; |
|
124 TInt iRotationAngle; |
|
125 TUint iLatestStatus; |
|
126 TInt iLatestError; |
|
127 TBool iUseThumbnail; |
|
128 TBool iPauseAfterEachFrame; |
|
129 TFileName iDrmContentId; |
|
130 ContentAccess::TIntent iDrmIntent; |
|
131 TBool iClippingSet; |
|
132 TRect iClipRect; |
|
133 TInt iScalingQuality; |
|
134 CImgDisplayAppView* iAppView; |
|
135 TInt iZoomFactor; |
|
136 TFileName iLoadFileName; |
|
137 TFileName iSaveFileName; |
|
138 TFileSaveInfo iSaveInfo; |
|
139 TTime iTime; |
|
140 TInt iBackgroundColor; |
|
141 TBool iOverrideBackgroundColor; |
|
142 TSize iOverallSize; |
|
143 TFileType iLastFileType; |
|
144 TUint32 iLastFrameFlags; |
|
145 TSize iScaleSize; |
|
146 TBool iViewResized; |
|
147 TBool iDisableMask; |
|
148 TBool iDumpFrames; |
|
149 TInt iMaxReduction; |
|
150 |
|
151 CImageEncoder* iSaveUtil; |
|
152 CFrameImageData* iFrameImageData; |
|
153 TState iState; |
|
154 CVideoWalker* iWalker; |
|
155 RTimer iTimer; |
|
156 |
|
157 // for folder opens |
|
158 TFileName iDirName; |
|
159 CDir* iDir; |
|
160 TInt iDirIndex; |
|
161 TBool iOpeningFolder; |
|
162 }; |
|
163 |
|
164 // CImgDisplDocument |
|
165 |
|
166 class CImgDisplDocument : public CEikDocument |
|
167 { |
|
168 public: |
|
169 CImgDisplDocument(CEikApplication& aApp); |
|
170 private: |
|
171 // from CEikDocument |
|
172 CEikAppUi* CreateAppUiL(); |
|
173 }; |
|
174 |
|
175 // CImgDisplApp |
|
176 |
|
177 class CImgDisplApp : public CEikApplication |
|
178 { |
|
179 private: |
|
180 // from CApaApplication |
|
181 CApaDocument* CreateDocumentL(); |
|
182 TUid AppDllUid() const; |
|
183 }; |
|
184 |
|
185 #endif |
|
186 |