|
1 /* |
|
2 * Copyright (c) 2006 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: This class is used for global volume |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMMAGLOBALVOLUME_H |
|
20 #define CMMAGLOBALVOLUME_H |
|
21 |
|
22 // INTERNAL INCLUDES |
|
23 #include "cmmavolumecontrol.h" |
|
24 #include "mmmavolumekeyslistener.h" |
|
25 |
|
26 class CMMAPlayer; |
|
27 class CMMAForeground; |
|
28 class CRepository; |
|
29 class CMMAVolumeKeysListener; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * This class is used for global volume setting |
|
34 * @since S60 3.2 |
|
35 */ |
|
36 NONSHARABLE_CLASS(CMMAGlobalVolume) : public CBase, |
|
37 public MMMAVolumeKeysListener |
|
38 { |
|
39 private: // Type definitions |
|
40 |
|
41 // Volume control, index and player holder |
|
42 class TMMAPlayerHolder |
|
43 { |
|
44 public: |
|
45 // Volume index |
|
46 TInt iVolumeIndex; |
|
47 // Player which contains the volume control |
|
48 CMMAPlayer* iPlayer; |
|
49 // Volume control from the player |
|
50 CMMAVolumeControl* iVolumeControl; |
|
51 }; |
|
52 |
|
53 public: // Constructor and destructors |
|
54 |
|
55 /** |
|
56 * NewL |
|
57 * Creates an instance from this class |
|
58 * @param aForeground Foreground listener. The ownership is transferred |
|
59 * to this class |
|
60 * @return New instance from this class. The caller takes ownership |
|
61 * of the returned object |
|
62 */ |
|
63 static CMMAGlobalVolume* NewL(CMMAForeground* aForeground); |
|
64 |
|
65 /** |
|
66 * Destructor |
|
67 */ |
|
68 virtual ~CMMAGlobalVolume(); |
|
69 |
|
70 public: // New methods |
|
71 |
|
72 /** |
|
73 * Adds new player for listening global volume. Players which |
|
74 * do not have volume control are simply ignored |
|
75 * |
|
76 * @param aPlayer Player which receives volume key notifications |
|
77 */ |
|
78 void AddPlayerL(CMMAPlayer* aPlayer); |
|
79 |
|
80 /** |
|
81 * Removes player from listening global volume |
|
82 */ |
|
83 void RemovePlayer(CMMAPlayer* aPlayer); |
|
84 |
|
85 public: // From MMMAVolumeKeysListener |
|
86 |
|
87 /** |
|
88 * Handles volume up event |
|
89 */ |
|
90 void VolumeUp(); |
|
91 |
|
92 /** |
|
93 * Handles volume down event |
|
94 */ |
|
95 void VolumeDown(); |
|
96 |
|
97 private: // New methods |
|
98 |
|
99 /** |
|
100 * Finds volume control from a player |
|
101 * |
|
102 * @param aPlayer Player from which the volume control is searched |
|
103 * @return Volume control instance. NULL is returned if the player |
|
104 * does not support volume control feature |
|
105 */ |
|
106 CMMAVolumeControl* FindVolumeControl(CMMAPlayer* aPlayer); |
|
107 |
|
108 /** |
|
109 * Sets volume level for all registered volume controls |
|
110 * @param aLevel New volume level |
|
111 */ |
|
112 void SetControlVolumeLevels(TInt aLevel); |
|
113 |
|
114 private: // Private constructors |
|
115 |
|
116 /** |
|
117 * C++ constructor |
|
118 * @param aForeground Foreground listener |
|
119 */ |
|
120 CMMAGlobalVolume(CMMAForeground* aForeground); |
|
121 |
|
122 /** |
|
123 * Second phase constructor |
|
124 */ |
|
125 void ConstructL(); |
|
126 |
|
127 protected: // Data |
|
128 |
|
129 // Current global volume level |
|
130 TInt iLevel; |
|
131 // Foreground listener. Owned |
|
132 CMMAForeground* iForeground; |
|
133 // MMA setting repository. Owned |
|
134 CRepository* iSettingsStore; |
|
135 // Volume keys listener. Owned |
|
136 CMMAVolumeKeysListener* iVolumeKeysListener; |
|
137 // Array of volume controls |
|
138 RArray< TMMAPlayerHolder > iControlList; |
|
139 }; |
|
140 |
|
141 #endif // CMMAGLOBALVOLUME_H |
|
142 |
|
143 // End of file |