|
1 /* |
|
2 * Copyright (c) 2006 - 2008 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: Video UI states class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <cvtengmodel.h> |
|
20 #include <mvtengcamerapreferences.h> |
|
21 #include <cvtlogger.h> |
|
22 |
|
23 #include "tvtuistates.h" |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // TVtUiStates::TVtUiStates |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 TVtUiStates::TVtUiStates( CVtEngModel& aModel ) |
|
30 : iMediaState( aModel.Media(), aModel.CommandHandler() ), iAudioState( aModel ), |
|
31 iModel( aModel ), iExecState( EExecStateStarting), |
|
32 iCommandActivatingRefCount( 0 ) |
|
33 { |
|
34 // get camera preferences |
|
35 iCameraPref = static_cast<MVtEngCameraPreferences*> |
|
36 ( iModel.Extension( KVtEngExtensionCameraPreferences ) ); |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // TVtUiStates::Update |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 void TVtUiStates::Update() |
|
44 { |
|
45 iMediaState.Update(); |
|
46 iAudioState.Update(); |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // TVtUiStates::IsColorToneSettingAvailable |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 TBool TVtUiStates::IsColorToneSettingAvailable() const |
|
54 { |
|
55 __VTPRINTENTER( "TVtUiStates.IsColorToneSettingAvailable" ) |
|
56 TUint32 supportedModes; |
|
57 // Get supported whitebalance modes |
|
58 if ( iCameraPref ) |
|
59 { |
|
60 if ( iCameraPref->GetSupportedColorTones( supportedModes ) ) |
|
61 { |
|
62 // error occured |
|
63 __VTPRINTEXIT( "TVtUiStates.IsColorToneSettingAvailableErr" ) |
|
64 return EFalse; |
|
65 } |
|
66 } |
|
67 |
|
68 // Clean the flag, flags that are possible are |
|
69 // A bitfield of suported colortones |
|
70 // ENormal = 0x00, |
|
71 // ESepia = 0x01, |
|
72 // EGrayscale = 0x02, |
|
73 // ENegative = 0x04 |
|
74 supportedModes &= 0x07; |
|
75 |
|
76 // If supported modes is 0 automatic,then return EFalse |
|
77 return supportedModes; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // TVtUiStates::IsWhiteBalanceSettingAvailable |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 TBool TVtUiStates::IsWhiteBalanceSettingAvailable() const |
|
85 { |
|
86 __VTPRINTENTER( "TVtUiStates.IsWhiteBalanceSettingAvailable" ) |
|
87 TUint32 supportedModes; |
|
88 // Get supported whitebalance modes |
|
89 if ( iCameraPref ) |
|
90 { |
|
91 if ( iCameraPref->GetSupportedWhiteBalanceModes( supportedModes ) ) |
|
92 { |
|
93 // error occured |
|
94 __VTPRINTEXIT( "TVtUiStates.IsWhiteBalanceSettingAvailableErr" ) |
|
95 return EFalse; |
|
96 } |
|
97 } |
|
98 __VTPRINT2( DEBUG_GEN, "IsWhiteBalanceSettingAvailable=%d", supportedModes ) |
|
99 // If supported modes is 0 ,then return EFalse |
|
100 __VTPRINTEXIT( "TVtUiStates.IsWhiteBalanceSettingAvailable2" ) |
|
101 return supportedModes; |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // TVtUiStates::IsContrastSettingAvailable |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 TBool TVtUiStates::IsContrastSettingAvailable() const |
|
109 { |
|
110 __VTPRINTENTER( "TVtUiStates.IsContrastSettingAvailable" ) |
|
111 TBool ret( ETrue ); |
|
112 if ( iCameraPref ) |
|
113 { |
|
114 TInt temp; |
|
115 ret = !iCameraPref->GetBrightness( temp ); |
|
116 } |
|
117 return ret; |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // TVtUiStates::IsBrightnessSettingAvailable |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 TBool TVtUiStates::IsBrightnessSettingAvailable() const |
|
125 { |
|
126 __VTPRINTENTER( "TVtUiStates.IsBrightnessSettingAvailable" ) |
|
127 TBool ret( ETrue ); |
|
128 if ( iCameraPref ) |
|
129 { |
|
130 TInt temp; |
|
131 ret = !iCameraPref->GetBrightness( temp ); |
|
132 } |
|
133 return ret; |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // TVtUiStates::SetExecState |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void TVtUiStates::SetExecState( const TVtUiExecState aState ) |
|
141 { |
|
142 iExecState = aState; |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // TVtUiStates::SetIsCommandActivating |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 void TVtUiStates::SetIsCommandActivating( TBool aSet ) |
|
150 { |
|
151 if ( aSet ) |
|
152 { |
|
153 iCommandActivatingRefCount++; |
|
154 } |
|
155 else if ( iCommandActivatingRefCount > 0 ) |
|
156 { |
|
157 iCommandActivatingRefCount--; |
|
158 } |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // TVtUiStates::ExecState |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 TVtUiStates::TVtUiExecState TVtUiStates::ExecState() const |
|
166 { |
|
167 return iExecState; |
|
168 } |