|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: CAknSettingItemList compliant setting item class for slider settings.* |
|
15 */ |
|
16 |
|
17 |
|
18 // Version : %version: 6 % |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <aknslider.h> |
|
25 #include <StringLoader.h> |
|
26 #include <aknslidersettingpage.h> |
|
27 #include <MediaSettings.rsg> |
|
28 #include <barsread.h> |
|
29 |
|
30 #include "MPSettingsSliderSettingItem.h" |
|
31 #include "mpxlog.h" |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CMPSettingsSliderSettingItem::CMPSettingsSliderSettingItem |
|
37 // C++ default constructor can NOT contain any code, that |
|
38 // might leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CMPSettingsSliderSettingItem::CMPSettingsSliderSettingItem(TInt aIdentifier, |
|
42 TInt& aExternalSliderValue, TInt aResource, TBool aBareFigure) : |
|
43 CAknSliderSettingItem(aIdentifier, aExternalSliderValue), |
|
44 iResource(aResource), |
|
45 iBareFigure(aBareFigure) |
|
46 { |
|
47 MPX_FUNC("#MS# CMPSettingsSliderSettingItem::CMPSettingsSliderSettingItem()"); |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CMPSettingsSliderSettingItem::~CMPSettingsSliderSettingItem |
|
52 // Destructor |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 CMPSettingsSliderSettingItem::~CMPSettingsSliderSettingItem() |
|
56 { |
|
57 MPX_FUNC("#MS# CMPSettingsSliderSettingItem::~CMPSettingsSliderSettingItem()"); |
|
58 if (iSettingText) |
|
59 { |
|
60 delete iSettingText; |
|
61 } |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CMPSettingsSliderSettingItem::SettingTextL |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 const TDesC& CMPSettingsSliderSettingItem::SettingTextL() |
|
69 { |
|
70 delete iSettingText; |
|
71 iSettingText = NULL; |
|
72 |
|
73 if (iBareFigure) |
|
74 { |
|
75 iSettingText = CAknSlider::CreateValueTextInHBufCL(InternalSliderValue(), |
|
76 iResource); |
|
77 } |
|
78 else |
|
79 { |
|
80 iSettingText = StringLoader::LoadL(iResource, InternalSliderValue()); |
|
81 } |
|
82 |
|
83 TPtr text = iSettingText->Des(); |
|
84 AknTextUtils::LanguageSpecificNumberConversion(text); |
|
85 MPX_DEBUG2(_L("#MS# CMPSettingsSliderSettingItem::SettingTextL(%S)"),&text); |
|
86 return *iSettingText; |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CMPSettingsSliderSettingItem::CreateSettingPageL |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 CAknSettingPage* CMPSettingsSliderSettingItem::CreateSettingPageL() |
|
94 { |
|
95 MPX_FUNC("#MS# CMPSettingsSliderSettingItem::CreateSettingPageL()"); |
|
96 CAknSliderSettingPage* settingPage = |
|
97 static_cast<CAknSliderSettingPage*>(CAknSliderSettingItem::CreateSettingPageL()); |
|
98 CleanupStack::PushL(settingPage); |
|
99 |
|
100 if (iBareFigure && AknTextUtils::DigitModeQuery()) |
|
101 { |
|
102 settingPage->ConstructL(); |
|
103 CAknSlider* slider = settingPage->SliderControl(); |
|
104 |
|
105 // Read unnecessary SLIDER resource struct members |
|
106 TResourceReader reader; |
|
107 CCoeEnv::Static()->CreateResourceReaderLC(reader, iResource); |
|
108 |
|
109 for (TInt ii = 0; ii < 6; ++ii) |
|
110 { |
|
111 reader.ReadInt16(); // layout, minvalue, maxvalue, step, valuetype, decimalplaces |
|
112 } |
|
113 |
|
114 HBufC* buf = reader.ReadHBufCL(); // singular_valuelabel |
|
115 delete buf; |
|
116 buf = NULL; |
|
117 |
|
118 // Read minlabel from resource file |
|
119 buf = reader.ReadHBufCL(); // minlabel |
|
120 CleanupStack::PushL(buf); |
|
121 TPtr ptr = buf->Des(); |
|
122 AknTextUtils::DisplayTextLanguageSpecificNumberConversion(ptr); |
|
123 MPX_DEBUG2(_L("#MS# CMPSettingsSliderSettingItem::CreateSettingPageL() min(%S)"),&ptr); |
|
124 slider->SetMinimumTextL(*buf); |
|
125 CleanupStack::PopAndDestroy(); // buf |
|
126 buf = NULL; |
|
127 |
|
128 // Read maxlabel from resource file |
|
129 buf = reader.ReadHBufCL(); // maxlabel |
|
130 CleanupStack::PushL(buf); |
|
131 ptr.Set(buf->Des()); |
|
132 AknTextUtils::DisplayTextLanguageSpecificNumberConversion(ptr); |
|
133 MPX_DEBUG2(_L("#MS# CMPSettingsSliderSettingItem::CreateSettingPageL() max(%S)"),&ptr); |
|
134 slider->SetMaximumTextL(*buf); |
|
135 CleanupStack::PopAndDestroy(2); // buf & reader |
|
136 } |
|
137 |
|
138 CleanupStack::Pop(); // settingPage |
|
139 return settingPage; |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CMPSettingsSliderSettingItem::CreateBitmapL |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 CFbsBitmap* CMPSettingsSliderSettingItem::CreateBitmapL() |
|
147 { |
|
148 MPX_FUNC("#MS# CMPSettingsSliderSettingItem::CreateBitmapL()"); |
|
149 return NULL; |
|
150 } |
|
151 |
|
152 // End of File |