|
1 /* |
|
2 * Copyright (c) 2005-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: Common NativeUi definitions and utilities |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ainativeuimodel.h" |
|
20 #include "aidevicestatuscontentmodel.h" |
|
21 |
|
22 namespace AiNativeUiController |
|
23 { |
|
24 |
|
25 namespace AiNativeUiModel |
|
26 { |
|
27 |
|
28 struct TRenderingPriorityItem |
|
29 { |
|
30 TInt iContentId; |
|
31 TInt iRenderingPriority; |
|
32 }; |
|
33 |
|
34 const TInt KHighestRenderingPriority = 20; |
|
35 |
|
36 const TInt KPriorityOffset1 = 1; |
|
37 const TInt KPriorityOffset2 = 2; |
|
38 const TInt KPriorityOffset3 = 3; |
|
39 const TInt KPriorityOffset4 = 4; |
|
40 const TInt KPriorityOffset5 = 5; |
|
41 const TInt KPriorityOffset6 = 6; |
|
42 |
|
43 |
|
44 const TRenderingPriorityItem KNaviPaneRenderingPriorities[] = |
|
45 { |
|
46 { EAiDeviceStatusContentProfileName, KHighestRenderingPriority }, |
|
47 { EAiDeviceStatusContentSilentIndicator, KHighestRenderingPriority }, |
|
48 { EAiDeviceStatusContentTimedProfileIndicator, KHighestRenderingPriority }, |
|
49 { EAiDeviceStatusContentDate, KHighestRenderingPriority - KPriorityOffset1 }, |
|
50 { EAiDeviceStatusContentGeneralProfileName, KHighestRenderingPriority - KPriorityOffset2 }, |
|
51 { EAiDeviceStatusContentVHZIndicator, KHighestRenderingPriority - KPriorityOffset3 }, |
|
52 { EAiDeviceStatusContentCUGIndicator, KHighestRenderingPriority - KPriorityOffset4 }, |
|
53 { EAiDeviceStatusContentMCNIndicator, KHighestRenderingPriority - KPriorityOffset5 }, |
|
54 { EAiDeviceStatusContentGeneralIndicator, KHighestRenderingPriority - KPriorityOffset6 } |
|
55 }; |
|
56 |
|
57 |
|
58 TRenderingPriorities RenderingPriorities( const TDesC8& aUiElementId ) |
|
59 { |
|
60 if( aUiElementId == KNaviPaneId ) |
|
61 { |
|
62 return TRenderingPriorities( KNaviPaneRenderingPriorities, |
|
63 sizeof(KNaviPaneRenderingPriorities) / sizeof(KNaviPaneRenderingPriorities[0]) ); |
|
64 } |
|
65 else |
|
66 { |
|
67 return TRenderingPriorities( NULL, 0 ); |
|
68 } |
|
69 } |
|
70 |
|
71 |
|
72 TRenderingPriorities::TRenderingPriorities |
|
73 (const TRenderingPriorityItem* aRenderingPriorities, TInt aCount) |
|
74 : iRenderingPriorities(aRenderingPriorities), iCount(aCount) |
|
75 { |
|
76 } |
|
77 |
|
78 |
|
79 TInt TRenderingPriorities::RenderingPriority( TInt aContentId ) |
|
80 { |
|
81 if( !iRenderingPriorities ) |
|
82 { |
|
83 return KErrNotFound; |
|
84 } |
|
85 for( TInt i = 0; i < iCount; ++i ) |
|
86 { |
|
87 if( iRenderingPriorities[i].iContentId == aContentId ) |
|
88 { |
|
89 return iRenderingPriorities[i].iRenderingPriority; |
|
90 } |
|
91 } |
|
92 return KErrNotFound; |
|
93 } |
|
94 |
|
95 |
|
96 TBool TRenderingPriorities::GetNextContentId( TInt& aContentId, TInt& aNextPriority ) |
|
97 { |
|
98 if( !iRenderingPriorities ) |
|
99 { |
|
100 return EFalse; |
|
101 } |
|
102 for( TInt i = 0; i < iCount; ++i ) |
|
103 { |
|
104 if( iRenderingPriorities[i].iRenderingPriority < aNextPriority ) |
|
105 { |
|
106 aContentId = iRenderingPriorities[i].iContentId; |
|
107 aNextPriority = iRenderingPriorities[i].iRenderingPriority; |
|
108 return ETrue; |
|
109 } |
|
110 } |
|
111 return EFalse; |
|
112 } |
|
113 |
|
114 } // namespace AiNativeUi |
|
115 |
|
116 } |