|
1 /* |
|
2 * Copyright (c) 2003 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: Loads and stores the bitmap animator settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_CBMPANIMSETTINGS_H |
|
21 #define C_CBMPANIMSETTINGS_H |
|
22 |
|
23 #include <e32std.h> |
|
24 #include "CBmpAnimIniData.h" |
|
25 |
|
26 // Default plugin name |
|
27 _LIT(KPluginName, "BitmapAnimator"); |
|
28 const TInt KMaxPluginNameLength = 30; |
|
29 |
|
30 // BmpAnim settings |
|
31 class CBmpAnimSettings : public CBase |
|
32 { |
|
33 public: |
|
34 // User constructor |
|
35 static CBmpAnimSettings* NewL(); |
|
36 |
|
37 // Construction & destruction |
|
38 private: |
|
39 CBmpAnimSettings(); |
|
40 void ConstructL(); |
|
41 public: |
|
42 virtual ~CBmpAnimSettings(); |
|
43 |
|
44 public: // Access functions |
|
45 // Load the current settings from file (may be used from outside, |
|
46 // hence public). Usually just called from ConstructL(), tho |
|
47 TBool LoadSettingsL(); |
|
48 |
|
49 // Save settings |
|
50 TBool SaveSettingsL(); |
|
51 |
|
52 // Get running time (-1 = not defined) |
|
53 inline TInt RunningTime(); |
|
54 |
|
55 // Get loop count (-1 = not defined) |
|
56 inline TInt LoopCount(); |
|
57 |
|
58 // Get suspend time (-1 = indefinitely) |
|
59 inline TInt SuspendTime(); |
|
60 |
|
61 // Get / set default timing |
|
62 inline TInt Timing(); |
|
63 inline void SetTiming(TInt aTiming); |
|
64 |
|
65 // Get plugin name |
|
66 inline TDesC& PluginName(); |
|
67 |
|
68 // Get bitmap file name |
|
69 inline TDesC& BitmapFilename(); |
|
70 |
|
71 // Get landscape bitmap file name |
|
72 inline TDesC& BitmapFilenameLandscape(); |
|
73 |
|
74 // Get/set lights on time (secs) |
|
75 inline TInt Lights(); |
|
76 inline void SetLights(TInt aSecs); |
|
77 |
|
78 // Landscape used? |
|
79 inline TInt UseLandscape(); |
|
80 |
|
81 // Should bitmaps be scaled to screen |
|
82 inline TInt ScaleBmps(); |
|
83 |
|
84 private: // Utility functions |
|
85 // Opens the settings file (initialises the settings reader) |
|
86 TInt OpenSettings(); |
|
87 |
|
88 // Figures out the bitmap file name |
|
89 void LoadBitmapFileName(TBool aLandscape = EFalse); |
|
90 |
|
91 private: |
|
92 // Settings file handler |
|
93 CBmpAnimIniData* iIniData; |
|
94 |
|
95 // Time to run the animation. Overrides loop count |
|
96 TInt iRunningTime; |
|
97 |
|
98 // Number of loops to be run. Used if run time is undefined |
|
99 TInt iLoopCount; |
|
100 |
|
101 // Time to suspend the animation. -1 = indefinitely |
|
102 TInt iSuspendTime; |
|
103 |
|
104 // Time to display each image. Individual image timing overrides this. |
|
105 TInt iTiming; |
|
106 |
|
107 // Plugin name |
|
108 TBuf<KMaxPluginNameLength> iPluginName; |
|
109 |
|
110 // Bitmap file name |
|
111 TFileName iMbmFileName; |
|
112 |
|
113 // Landscale bitmap file name |
|
114 TFileName iMbmFileNameL; |
|
115 |
|
116 // Lights on time (secs) |
|
117 TInt iLights; |
|
118 |
|
119 // Landscape images used (0 = no) |
|
120 TInt iUseLandscape; |
|
121 |
|
122 // Bitmaps scaled to screen size (0 = no) |
|
123 TInt iScaleBmps; |
|
124 }; |
|
125 |
|
126 |
|
127 // --- inlines --- |
|
128 |
|
129 // Get run time (-1 = not defined) |
|
130 inline TInt CBmpAnimSettings::RunningTime() |
|
131 { return iRunningTime; } |
|
132 |
|
133 |
|
134 // Get loop count (-1 = not defined) |
|
135 inline TInt CBmpAnimSettings::LoopCount() |
|
136 { return iLoopCount; } |
|
137 |
|
138 |
|
139 // Get suspend time (-1 = indefinitely) |
|
140 inline TInt CBmpAnimSettings::SuspendTime() |
|
141 { return iSuspendTime; } |
|
142 |
|
143 |
|
144 // Get default timing |
|
145 inline TInt CBmpAnimSettings::Timing() |
|
146 { return iTiming; } |
|
147 |
|
148 // Set default timing |
|
149 inline void CBmpAnimSettings::SetTiming(TInt aTiming) |
|
150 { iTiming = aTiming; } |
|
151 |
|
152 |
|
153 // Get default bitmap file |
|
154 inline TDesC16& CBmpAnimSettings::PluginName() |
|
155 { return iPluginName; } |
|
156 |
|
157 |
|
158 // Get default bitmap file |
|
159 inline TDesC16& CBmpAnimSettings::BitmapFilename() |
|
160 { return iMbmFileName; } |
|
161 |
|
162 // Get landscape bitmap file |
|
163 inline TDesC16& CBmpAnimSettings::BitmapFilenameLandscape() |
|
164 { return iMbmFileNameL; } |
|
165 |
|
166 // Get lights on time (secs) |
|
167 inline TInt CBmpAnimSettings::Lights() |
|
168 { return iLights; } |
|
169 |
|
170 |
|
171 // Set lights on time (secs) |
|
172 inline void CBmpAnimSettings::SetLights(TInt aSecs) |
|
173 { iLights = aSecs; } |
|
174 |
|
175 // Use landscape? |
|
176 inline TInt CBmpAnimSettings::UseLandscape() |
|
177 { return iUseLandscape; } |
|
178 |
|
179 // Scale bitmaps? |
|
180 inline TInt CBmpAnimSettings::ScaleBmps() |
|
181 { return iScaleBmps; } |
|
182 |
|
183 #endif // C_CBMPANIMSETTINGS_H |