|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Slide set settings model. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_PSLNSLIDESETMODEL_H |
|
20 #define C_PSLNSLIDESETMODEL_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 |
|
25 class CRepository; |
|
26 |
|
27 /** |
|
28 * This is model class for slide set settings. |
|
29 * |
|
30 * It stores and retrieves setting values. |
|
31 * |
|
32 * @lib pslnslidesetsettings.lib |
|
33 * @since S60 v3.2 |
|
34 */ |
|
35 NONSHARABLE_CLASS( CPslnSlideSetModel ): public CBase |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Symbian OS two-phased constructor |
|
41 * @return CPslnSlideSetModel instance. |
|
42 */ |
|
43 static CPslnSlideSetModel* NewL(); |
|
44 |
|
45 /** |
|
46 * Symbian OS two-phased constructor |
|
47 * @return CPslnSlideSetModel instance. |
|
48 */ |
|
49 static CPslnSlideSetModel* NewLC(); |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 virtual ~CPslnSlideSetModel(); |
|
55 |
|
56 /** |
|
57 * Returns current selection for slide set type: random / image set. |
|
58 * |
|
59 * @param aSlideSetType slide set type: wallpaper / screensaver. |
|
60 * @return current value for slide set type. In case of error, |
|
61 * default value is returned. |
|
62 */ |
|
63 TInt GetSlideSetType( const TInt aSlideSetType ) const; |
|
64 |
|
65 /** |
|
66 * Stores new slide set image selection type value to repository |
|
67 * |
|
68 * @param aSlideSetType slide set type: wallpaper / screensaver. |
|
69 * @param aValue new value for slide set image selection type. |
|
70 * @return KErrNone, if operation is successful; otherwise either |
|
71 * repository given error code, or if the aValue is not |
|
72 * valid, KErrArgument. |
|
73 */ |
|
74 TInt SetSlideSetType( const TInt aSlideSetType, const TInt aValue ); |
|
75 |
|
76 /** |
|
77 * Returns current selection for screensaver slide set duration. |
|
78 * |
|
79 * @return current value for slide set type. In case of error, |
|
80 * default value is returned. |
|
81 */ |
|
82 TInt GetSlideSetDuration() const; |
|
83 |
|
84 /** |
|
85 * Stores new slide set duration value to repository. |
|
86 * |
|
87 * @param aValue new value for slide set duration. |
|
88 * @return KErrNone, if operation is successful; otherwise either |
|
89 * repository given error code, or if the aValue is not |
|
90 * valid, KErrArgument. |
|
91 */ |
|
92 TInt SetSlideSetDuration( const TInt aValue ); |
|
93 |
|
94 /** |
|
95 * Returns current selection for screensaver slide set backlight period. |
|
96 * |
|
97 * @return current value for slide set backlight period. In case of error, |
|
98 * default value is returned. |
|
99 */ |
|
100 TInt GetSlideSetBacklight() const; |
|
101 |
|
102 /** |
|
103 * Stores new slide set backlight period value to repository. |
|
104 * |
|
105 * @param aValue new value for slide set backlight period. |
|
106 * @return KErrNone, if operation is successful; otherwise either |
|
107 * repository given error code, or if the aValue is not |
|
108 * valid, KErrArgument. |
|
109 */ |
|
110 TInt SetSlideSetBacklight( const TInt aValue ); |
|
111 |
|
112 /** |
|
113 * Returns current selection for screensaver slide set image interval. |
|
114 * |
|
115 * @return current value for slide set image interval. In case of error, |
|
116 * default value is returned. |
|
117 */ |
|
118 TInt GetSlideSetInterval() const; |
|
119 |
|
120 /** |
|
121 * Stores new slide set image interval value to repository. |
|
122 * |
|
123 * @param aValue new value for slide set image interval. |
|
124 * @return KErrNone, if operation is successful; otherwise either |
|
125 * repository given error code, or if the aValue is not |
|
126 * valid, KErrArgument. |
|
127 */ |
|
128 TInt SetSlideSetInterval( const TInt aValue ); |
|
129 |
|
130 /** |
|
131 * Stores list of image filenames to be used as slide set image set. |
|
132 * |
|
133 * @param aSelectedFiles list of files to set as wallpaper slide set. |
|
134 */ |
|
135 void SetImageListL( |
|
136 const TInt aSlideSetType, |
|
137 CDesCArray& aSelectedFiles, |
|
138 const TInt aLaunchMode ); |
|
139 |
|
140 /** |
|
141 * Checks if the slide set file exists. |
|
142 * |
|
143 * @param aSlideSetType type of slide set (wallpaper/screensaver). |
|
144 * @return ETrue if file exists, otherwise EFalse. |
|
145 */ |
|
146 TBool SlideSetImageFileExistsL( const TInt aSlideSetType ) const; |
|
147 |
|
148 /** |
|
149 * Checks if there has been changes to image list. |
|
150 * |
|
151 * @return ETrue if image list has been changed, EFalse otherwise. |
|
152 */ |
|
153 TBool HasDialogUpdatedValues() const; |
|
154 |
|
155 /** |
|
156 * Count the number of images in the image file. |
|
157 * @param aSlideSetType type of slide set (wallpaper/screensaver). |
|
158 * @return number of images in the file, or zero if no file exists. |
|
159 */ |
|
160 TInt GetImageCountInSlideSetL( const TInt aSlideSetType ) const; |
|
161 |
|
162 /** |
|
163 * Sets feature support - see pslnslidesetconst.h for feature list. |
|
164 * @param aFeatureBitFlags feature support bitflags. |
|
165 */ |
|
166 void GetFeatureSupportL( TBitFlags& aFeatureBitFlags ) const; |
|
167 |
|
168 private: |
|
169 |
|
170 /** |
|
171 * C++ constructor. |
|
172 */ |
|
173 CPslnSlideSetModel(); |
|
174 |
|
175 /** |
|
176 * Symbian 2nd phase constructor. |
|
177 */ |
|
178 void ConstructL(); |
|
179 |
|
180 /** |
|
181 * Stores image list to a file. |
|
182 */ |
|
183 void StoreImageListToFileL( |
|
184 const TInt aSlideSetType, CDesCArray& aSelectedFiles ) const; |
|
185 |
|
186 /** |
|
187 * Opens image list file for operations. |
|
188 */ |
|
189 void OpenImageFileL( RFile& aImageFile, const TInt aSlideSetType ) const; |
|
190 |
|
191 private: // data |
|
192 |
|
193 /** |
|
194 * Central repository object. Used for storing and retrieving data. |
|
195 * Own. |
|
196 */ |
|
197 CRepository* iRepository; |
|
198 |
|
199 /** |
|
200 * Indicates if the slide set image list has been changed. |
|
201 */ |
|
202 TBool iImageListChanged; |
|
203 |
|
204 /** |
|
205 * Coe environment reference. |
|
206 * Own. |
|
207 */ |
|
208 CCoeEnv* iCoeEnv; |
|
209 }; |
|
210 |
|
211 |
|
212 #endif // C_PSLNSLIDESETMODEL_H |