|
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: CaudioclientstubAppUi implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <avkon.hrh> |
|
21 #include <aknmessagequerydialog.h> |
|
22 #include <aknnotewrappers.h> |
|
23 #include <stringloader.h> |
|
24 #include <audioclientstub.rsg> |
|
25 #include <tspclientmapper.h> |
|
26 |
|
27 #include "audioclientstub.hrh" |
|
28 #include "audioclientstub.pan" |
|
29 #include "audioclientstubApplication.h" |
|
30 #include "audioclientstubAppUi.h" |
|
31 #include "audioclientstubAppView.h" |
|
32 #include "audioclientstubremconobserver.h" |
|
33 |
|
34 _LIT(KText, "Hello World!"); |
|
35 |
|
36 // ============================ MEMBER FUNCTIONS =============================== |
|
37 |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CaudioclientstubAppUi::ConstructL() |
|
41 // Symbian 2nd phase constructor can leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void CaudioclientstubAppUi::ConstructL() |
|
45 { |
|
46 RDebug::Print( _L("CaudioclientstubAppUi::ConstructL") ) ; |
|
47 // Initialise app UI with standard value. |
|
48 BaseConstructL(CAknAppUi::EAknEnableSkin); |
|
49 |
|
50 // Create view object |
|
51 iAppView = CaudioclientstubAppView::NewL(ClientRect() ); |
|
52 |
|
53 iTspClientMapper = CTspClientMapper::NewL(); |
|
54 iTspClientMapper->SetTspTargetClient( CTspClientMapper::EPlayingClients, RProcess().Id() ); |
|
55 |
|
56 iRemConObserver = CAudioClientStubRemConObserver::NewL(); |
|
57 } |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CaudioclientstubAppUi::CaudioclientstubAppUi() |
|
60 // C++ default constructor can NOT contain any code, that might leave. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 CaudioclientstubAppUi::CaudioclientstubAppUi() |
|
64 { |
|
65 RDebug::Print( _L("CaudioclientstubAppUi::CaudioclientstubAppUi") ) ; |
|
66 // No implementation required |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CaudioclientstubAppUi::~CaudioclientstubAppUi() |
|
71 // Destructor. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CaudioclientstubAppUi::~CaudioclientstubAppUi() |
|
75 { |
|
76 RDebug::Print( _L("CaudioclientstubAppUi::~CaudioclientstubAppUi") ) ; |
|
77 if (iAppView) |
|
78 { |
|
79 delete iAppView; |
|
80 iAppView = NULL; |
|
81 } |
|
82 |
|
83 if ( iTspClientMapper ) |
|
84 { |
|
85 iTspClientMapper->RemoveTspTargetClient( CTspClientMapper::EPlayingClients, RProcess().Id() ); |
|
86 } |
|
87 |
|
88 delete iTspClientMapper; |
|
89 |
|
90 delete iRemConObserver; |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CaudioclientstubAppUi::HandleCommandL() |
|
95 // Takes care of command handling. |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void CaudioclientstubAppUi::HandleCommandL(TInt aCommand) |
|
99 { |
|
100 RDebug::Print( _L("CaudioclientstubAppUi::HandleCommandL: aCommand=%d"), aCommand ) ; |
|
101 switch (aCommand) |
|
102 { |
|
103 case EEikCmdExit: |
|
104 case EAknSoftkeyExit: |
|
105 Exit(); |
|
106 break; |
|
107 |
|
108 case ECommand1: |
|
109 { |
|
110 |
|
111 // Load a string from the resource file and display it |
|
112 HBufC* textResource = StringLoader::LoadLC(R_COMMAND1_TEXT); |
|
113 CAknInformationNote* informationNote; |
|
114 |
|
115 informationNote = new ( ELeave ) CAknInformationNote; |
|
116 |
|
117 // Show the information Note with |
|
118 // textResource loaded with StringLoader. |
|
119 informationNote->ExecuteLD( *textResource); |
|
120 |
|
121 // Pop HBuf from CleanUpStack and Destroy it. |
|
122 CleanupStack::PopAndDestroy(textResource); |
|
123 } |
|
124 break; |
|
125 case ECommand2: |
|
126 { |
|
127 |
|
128 } |
|
129 break; |
|
130 case EHelp: |
|
131 { |
|
132 |
|
133 } |
|
134 break; |
|
135 case EAbout: |
|
136 { |
|
137 |
|
138 CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(); |
|
139 dlg->PrepareLC(R_ABOUT_QUERY_DIALOG); |
|
140 HBufC* title = |
|
141 iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TITLE); |
|
142 dlg->QueryHeading()->SetTextL(*title); |
|
143 CleanupStack::PopAndDestroy(); //title |
|
144 HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT); |
|
145 dlg->SetMessageTextL(*msg); |
|
146 CleanupStack::PopAndDestroy(); //msg |
|
147 dlg->RunLD(); |
|
148 } |
|
149 break; |
|
150 default: |
|
151 Panic(EaudioclientstubUi); |
|
152 break; |
|
153 } |
|
154 } |
|
155 // ----------------------------------------------------------------------------- |
|
156 // Called by the framework when the application status pane |
|
157 // size is changed. Passes the new client rectangle to the |
|
158 // AppView |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CaudioclientstubAppUi::HandleStatusPaneSizeChange() |
|
162 { |
|
163 RDebug::Print( _L("CaudioclientstubAppUi::HandleStatusPaneSizeChange") ) ; |
|
164 iAppView->SetRect(ClientRect() ); |
|
165 } |
|
166 |
|
167 |
|
168 // End of File |