|
1 /* |
|
2 * Name : AppUi.cpp |
|
3 * Description : |
|
4 * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser |
|
5 * Website : http://OpenMAR.org |
|
6 * |
|
7 * Copyright (c) 2010 David Caabeiro |
|
8 * |
|
9 * All rights reserved. This program and the accompanying materials are made available |
|
10 * under the terms of the Eclipse Public License v1.0 which accompanies this |
|
11 * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html |
|
12 * |
|
13 */ |
|
14 |
|
15 #include "AppUi.h" |
|
16 |
|
17 #include <avkon.hrh> |
|
18 #include <AknMessageQueryDialog.h> |
|
19 #include <AknNoteWrappers.h> |
|
20 #include <stringloader.h> |
|
21 #include <hlplch.h> |
|
22 |
|
23 #include <OpenMAR_0x2002E1AB.rsg> |
|
24 |
|
25 #include "Application.hrh" |
|
26 #include "Application.pan" |
|
27 #include "Application.h" |
|
28 |
|
29 #include "SettingManager.h" |
|
30 |
|
31 #include "SplashView.h" |
|
32 #include "ARView.h" |
|
33 |
|
34 #include "Logger.h" |
|
35 |
|
36 void CAppUi::ConstructL() |
|
37 { |
|
38 LOGTXT("Creating AppUi"); |
|
39 |
|
40 BaseConstructL(EAknEnableSkin | EAppOrientationLandscape); |
|
41 // BaseConstructL(EAknEnableSkin); |
|
42 |
|
43 iSetting = CSettingManager::NewL(); |
|
44 |
|
45 // Set up splash view and make it default |
|
46 CAknView* splashView = CSplashView::NewL(*iSetting); |
|
47 CleanupStack::PushL(splashView); |
|
48 AddViewL(splashView); |
|
49 CleanupStack::Pop(splashView); |
|
50 |
|
51 SetDefaultViewL(*splashView); |
|
52 |
|
53 CAknView* arView = CARView::NewL(); |
|
54 CleanupStack::PushL(arView); |
|
55 AddViewL(arView); |
|
56 CleanupStack::Pop(arView); |
|
57 } |
|
58 |
|
59 CAppUi::~CAppUi() |
|
60 { |
|
61 delete iSetting; |
|
62 |
|
63 REComSession::FinalClose(); |
|
64 } |
|
65 |
|
66 void CAppUi::HandleCommandL(TInt aCommand) |
|
67 { |
|
68 switch (aCommand) |
|
69 { |
|
70 case EEikCmdExit: |
|
71 case EAknSoftkeyExit: |
|
72 Exit(); |
|
73 break; |
|
74 /* |
|
75 case EHelp: |
|
76 { |
|
77 CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL(); |
|
78 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf); |
|
79 } |
|
80 break; |
|
81 */ |
|
82 case EAbout: |
|
83 { |
|
84 CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(); |
|
85 dlg->PrepareLC(R_ABOUT_QUERY_DIALOG); |
|
86 HBufC* title = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TITLE); |
|
87 dlg->QueryHeading()->SetTextL(*title); |
|
88 CleanupStack::PopAndDestroy(title); |
|
89 HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT); |
|
90 dlg->SetMessageTextL(*msg); |
|
91 CleanupStack::PopAndDestroy(msg); |
|
92 dlg->RunLD(); |
|
93 } |
|
94 break; |
|
95 |
|
96 default: |
|
97 // Panic(); |
|
98 break; |
|
99 } |
|
100 } |
|
101 |
|
102 CArrayFix<TCoeHelpContext>* CAppUi::HelpContextL() const |
|
103 { |
|
104 #warning "Please see comment about help and UID3..." |
|
105 // Note: Help will not work if the application uid3 is not in the |
|
106 // protected range. The default uid3 range for projects created |
|
107 // from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they |
|
108 // can be self signed and installed on the device during testing. |
|
109 // Once you get your official uid3 from Symbian Ltd. and find/replace |
|
110 // all occurrences of uid3 in your project, the context help will |
|
111 // work. |
|
112 /* |
|
113 CArrayFixFlat<TCoeHelpContext>* array = new(ELeave) CArrayFixFlat<TCoeHelpContext>(1); |
|
114 CleanupStack::PushL(array); |
|
115 array->AppendL(TCoeHelpContext(KUidApplication, KGeneral_Information)); |
|
116 CleanupStack::Pop(array); |
|
117 return array; |
|
118 */ |
|
119 return 0; |
|
120 } |