|
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 CPHONERINGINGTONE_H |
|
19 #define CPHONERINGINGTONE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <Profile.hrh> |
|
24 |
|
25 // CONSTANTS |
|
26 |
|
27 // MACROS |
|
28 |
|
29 // DATA TYPES |
|
30 |
|
31 // FUNCTION PROTOTYPES |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * Ringing tone |
|
39 * Wrapper for file name. In addtion, provides methods |
|
40 * for ringing tone type identification. |
|
41 * |
|
42 * @lib Phone.app |
|
43 * @since Series 60 3.1 |
|
44 */ |
|
45 class CPhoneRingingTone : public CBase |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 * @param aFileName Ringing tone file name with path. |
|
52 * @param aDrmInPlayback ETrue to use IsFileDrmProtected(). |
|
53 */ |
|
54 static CPhoneRingingTone* NewL( |
|
55 const TDesC& aFileName, |
|
56 TBool aDrmInPlayback = EFalse ); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 virtual ~CPhoneRingingTone(); |
|
62 |
|
63 public: // New functions |
|
64 |
|
65 |
|
66 /** |
|
67 * Sets the file name including path. |
|
68 * @since Series 60 3.1 |
|
69 * @param aFileName file name plus path. |
|
70 */ |
|
71 void SetFileName( const TDesC& aFileName ); |
|
72 |
|
73 /** |
|
74 * Returns file name including path. |
|
75 * @since Series 60 3.1 |
|
76 * @return File name. |
|
77 */ |
|
78 const TDesC& FileName() const; |
|
79 |
|
80 /** |
|
81 * Returns MIME type. |
|
82 * @since Series 60 3.1 |
|
83 * @return MIME type. |
|
84 */ |
|
85 const TDesC& MimeType() const; |
|
86 |
|
87 /** |
|
88 * Checks if video ringing tone. |
|
89 * @since Series 60 3.1 |
|
90 * @return ETrue if video ringing tone. |
|
91 */ |
|
92 TBool IsVideoRingingTone(); |
|
93 |
|
94 /** |
|
95 * Checks if the file is a DCF file. |
|
96 * @since Series 60 3.1 |
|
97 * @return ETrue if files is DRM protected. |
|
98 */ |
|
99 TBool IsFileDrmProtected() const; |
|
100 |
|
101 /** |
|
102 * Checks if the file is in ROM. |
|
103 * @since Series 60 3.1 |
|
104 */ |
|
105 TBool IsFileInRom() const; |
|
106 |
|
107 /** |
|
108 * Set profile's ringing type |
|
109 * @since Series 60 5.0 |
|
110 */ |
|
111 void SetRingingType( TProfileRingingType aRingingType); |
|
112 |
|
113 /** |
|
114 * Return ringing type of current ringingtone |
|
115 * @since Series 60 5.0 |
|
116 */ |
|
117 TProfileRingingType RingingType() const; |
|
118 |
|
119 /** |
|
120 * Set profile's ringingtone volume |
|
121 * @since Series 60 5.0 |
|
122 */ |
|
123 void SetVolume( const TInt aVolume ); |
|
124 |
|
125 /** |
|
126 * Return volume of current ringingtone |
|
127 * @since Series 60 5.0 |
|
128 */ |
|
129 TInt Volume() const; |
|
130 |
|
131 /** |
|
132 * Set profile's TTS value |
|
133 * @since Series 60 5.0 |
|
134 */ |
|
135 void SetTtsToneToBePlayed( TBool aTtsToneToBePlayed ); |
|
136 |
|
137 /** |
|
138 * Return TTS status of current profile |
|
139 * @since Series 60 5.0 |
|
140 */ |
|
141 TBool TtsToneToBePlayed() const; |
|
142 |
|
143 /** |
|
144 * Checks if ringing tone file's size is larger than the size limit. |
|
145 * If size limit is exceeded, default tone is played instead. |
|
146 * @since 3.1 |
|
147 * @param aRingingTone Tone to check. |
|
148 * @return EFalse if the limit was exceeded and thus default tone played. |
|
149 * ETrue if tone file's size was valid and the checked tone |
|
150 * can be played. |
|
151 */ |
|
152 TBool CheckAndHandleToneSizeLimit(); |
|
153 |
|
154 /** |
|
155 * Checks if ringing tone file's size is larger than the size limit. |
|
156 * @since 3.1 |
|
157 * @param aFile File to check. |
|
158 * aSizeLimitKB the size limit in kB is set to this variable. |
|
159 * @return KErrNone if the file can be used as a ringing tone. |
|
160 * KErrTooBig if the file size limit is exceeded. |
|
161 * Other error value if error happened during size checking. |
|
162 */ |
|
163 TInt CheckToneFileSize( const TDesC& aFile, TInt aSizeLimitKB ); |
|
164 |
|
165 /** |
|
166 * Reads from central repository the file size limit of following tones: |
|
167 * -contact's personal ringing tone |
|
168 * -voice call line1 |
|
169 * -voice call line2 |
|
170 * Value 0 means all sizes are allowed. |
|
171 * @since 3.1 |
|
172 * @return leaves on error. |
|
173 */ |
|
174 void GetMaxToneFileSize(); |
|
175 |
|
176 private: |
|
177 |
|
178 /** |
|
179 * Refresh MIME type. This must be called |
|
180 * before using MimeType(). |
|
181 */ |
|
182 TInt RefreshMime(); |
|
183 |
|
184 /** |
|
185 * Refresh MIME type. |
|
186 */ |
|
187 void RefreshMimeL(); |
|
188 |
|
189 /** |
|
190 * Checks if file is located in video directory. |
|
191 */ |
|
192 TBool IsFileInVideoDirectory() const; |
|
193 |
|
194 private: |
|
195 |
|
196 /** |
|
197 * C++ default constructor. |
|
198 */ |
|
199 CPhoneRingingTone( TBool aDrmInPlayback ); |
|
200 |
|
201 /** |
|
202 * By default Symbian 2nd phase constructor is private. |
|
203 */ |
|
204 void ConstructL( const TDesC& aFileName ); |
|
205 |
|
206 private: // Data |
|
207 |
|
208 // File name with path |
|
209 HBufC* iFileName; |
|
210 |
|
211 // MIME type |
|
212 HBufC* iMimeType; |
|
213 |
|
214 // Extended security |
|
215 TBool iDrmInPlayback; |
|
216 |
|
217 TProfileRingingType iRingingType; |
|
218 |
|
219 TInt iVolume; |
|
220 |
|
221 // Voice call ringing tone file size max value. |
|
222 TInt iToneFileSizeLimitKB; |
|
223 |
|
224 TBool iTtsToneToBePlayed; |
|
225 }; |
|
226 |
|
227 #endif // CPHONERINGINGTONE_H |
|
228 |
|
229 // End of File |