1 /* |
|
2 * Copyright (c) 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: The MUS application's UI class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "musuiclipsharingviewcontainer.h" |
|
20 #include "musuisendview.h" |
|
21 #include "musuilevelindicator.h" |
|
22 #include "musuidialogutil.h" |
|
23 #include "musuidefinitions.h" |
|
24 #include "musuisendcontroller.h" |
|
25 #include "muslogger.h" // debug logging |
|
26 #include <musui.rsg> |
|
27 |
|
28 #include <AknWaitDialog.h> |
|
29 #include <AknsBasicBackgroundControlContext.h> |
|
30 #include <AknsUtils.h> |
|
31 #include <AknsDrawUtils.h> |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CMusUiSendViewContainer::CMusUiSendViewContainer() |
|
38 { |
|
39 // NOP |
|
40 } |
|
41 |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 void CMusUiSendViewContainer::ConstructL( CMusUiGeneralView* aView, |
|
48 const TRect& aRect, |
|
49 TAknOrientation aIndicatorLayout ) |
|
50 { |
|
51 MUS_LOG( "mus: [MUSUI ] -> CMusUiSendViewContainer::ConstructL" ); |
|
52 |
|
53 CreateWindowL(); |
|
54 iView = aView; |
|
55 iBackGround = CAknsBasicBackgroundControlContext::NewL( |
|
56 KAknsIIDQsnBgAreaMain, |
|
57 aRect, |
|
58 EFalse ); |
|
59 |
|
60 iIndicator = CMusUiLevelIndicator::NewL( aIndicatorLayout, |
|
61 0, |
|
62 100, |
|
63 this, |
|
64 aRect, |
|
65 this ); |
|
66 iIndicator->SetContainerWindowL( *this ); |
|
67 |
|
68 iVideoRect = aRect; |
|
69 |
|
70 SetRect( aRect ); |
|
71 |
|
72 iIndicator->SetRect( Rect() ); |
|
73 |
|
74 MakeVisible( EFalse ); |
|
75 ActivateL(); |
|
76 |
|
77 MUS_LOG( "mus: [MUSUI ] <- CMusUiSendViewContainer::ConstructL" ); |
|
78 } |
|
79 |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 CMusUiSendViewContainer::~CMusUiSendViewContainer() |
|
86 { |
|
87 MUS_LOG( "mus: [MUSUI ] -> CMusUiSendViewContainer::~CMusUiSendViewContainer" ); |
|
88 |
|
89 delete iIndicator; |
|
90 delete iBackGround; |
|
91 |
|
92 MUS_LOG( "mus: [MUSUI ] <- CMusUiSendViewContainer::~CMusUiSendViewContainer" ); |
|
93 } |
|
94 |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // Fetches a pointer to the view that owns this container. |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 CMusUiGeneralView* CMusUiSendViewContainer::MusUiView() const |
|
101 { |
|
102 MUS_LOG( "mus: [MUSUI ] -> CMusUiSendViewContainer::MusUiView" ); |
|
103 MUS_LOG( "mus: [MUSUI ] <- CMusUiSendViewContainer::MusUiView" ); |
|
104 return iView; |
|
105 } |
|
106 |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void CMusUiSendViewContainer::SetController( CMusUiSendController* aController ) |
|
113 { |
|
114 iSendController = aController; |
|
115 } |
|
116 |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // Called by framework to redraw the screen area. |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void CMusUiSendViewContainer::Draw( const TRect& aRect ) const |
|
123 { |
|
124 MUS_LOG( "mus: [MUSUI ] -> CMusUiSendViewContainer::Draw" ); |
|
125 CWindowGc& gc = SystemGc(); |
|
126 |
|
127 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
128 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
129 if(!AknsDrawUtils::Background( skin, |
|
130 cc, |
|
131 this, |
|
132 gc, |
|
133 iVideoRect, |
|
134 KAknsDrawParamDefault )) |
|
135 { |
|
136 MUS_LOG( "mus: [MUSUI ] Skin not valid or not found" ); |
|
137 gc.SetBrushColor( iEikonEnv->ControlColor( EColorWindowBackground, *this ) ); |
|
138 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
139 gc.Clear( aRect ); |
|
140 } |
|
141 |
|
142 MUS_LOG( "mus: [MUSUI ] <- CMusUiSendViewContainer::Draw" ); |
|
143 } |
|
144 |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // Called by framework when the view size is changed |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 void CMusUiSendViewContainer::SizeChanged() |
|
151 { |
|
152 if (iBackGround) |
|
153 { |
|
154 static_cast<CAknsBasicBackgroundControlContext*> |
|
155 ( iBackGround )->SetRect( Rect() ); |
|
156 } |
|
157 iIndicator->SetRect( Rect() ); |
|
158 } |
|
159 |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // Supply the Mob Object for background skin drawing |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 TTypeUid::Ptr CMusUiSendViewContainer::MopSupplyObject( TTypeUid aId ) |
|
166 { |
|
167 if (aId.iUid == MAknsControlContext::ETypeId && iBackGround ) |
|
168 { |
|
169 return MAknsControlContext::SupplyMopObject( aId, iBackGround ); |
|
170 } |
|
171 return CCoeControl::MopSupplyObject( aId ); |
|
172 } |
|
173 |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 void CMusUiSendViewContainer::SetLevelIndicatorVisibility( TBool aVisible) |
|
180 { |
|
181 MUS_LOG1( "mus: [MUSUI ] -> CMusUiSendViewContainer::SetLevelIndicatorVisibility( %d )", |
|
182 aVisible ) |
|
183 |
|
184 MakeVisible( aVisible ); |
|
185 |
|
186 if ( !aVisible ) |
|
187 { |
|
188 iView->LevelIndicatorDismissed(); |
|
189 } |
|
190 MUS_LOG( "mus: [MUSUI ] <- CMusUiSendViewContainer::SetLevelIndicatorVisibility" ) |
|
191 } |
|
192 |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 void CMusUiSendViewContainer::IndicatorLevelChanged( TInt aNewLevel ) |
|
199 { |
|
200 if ( iSendController ) |
|
201 { |
|
202 TRAPD( error, iSendController->HandleSliderValueChangeL( aNewLevel ) ) |
|
203 |
|
204 if ( error != KErrNone ) |
|
205 { |
|
206 MUS_LOG1( "mus: [MUSUI ] Error during handling of slider value change( %d )", |
|
207 error ) |
|
208 |
|
209 iSendController->HandleError( error ); |
|
210 } |
|
211 } |
|
212 } |
|
213 |
|
214 |
|
215 |
|
216 // end of file |
|