49 |
49 |
50 // scale value is needed because slider doesn't show all ticks and |
50 // scale value is needed because slider doesn't show all ticks and |
51 // labels correctly if step is something else than 1 |
51 // labels correctly if step is something else than 1 |
52 int step = 1; |
52 int step = 1; |
53 mSliderScaleValue = 1; |
53 mSliderScaleValue = 1; |
54 if (data->mStep != 0) { |
54 if (data->mMinorStep != 0) { |
55 mSliderScaleValue = step / data->mStep; |
55 mSliderScaleValue = step / data->mMinorStep; |
56 } |
56 } |
57 |
57 |
58 // scale min and max values as step has been set to 1 |
58 // scale min and max values as step has been set to 1 |
59 int minvalue = data->mRange.first * mSliderScaleValue; |
59 int minvalue = data->mRange.first * mSliderScaleValue; |
60 int maxvalue = data->mRange.second * mSliderScaleValue; |
60 int maxvalue = data->mRange.second * mSliderScaleValue; |
61 CX_DEBUG(("Setting slider range [%d..%d]", minvalue, maxvalue)); |
61 CX_DEBUG(("Setting slider range [%d..%d]", minvalue, maxvalue)); |
62 setRange(minvalue,maxvalue); |
62 setRange(minvalue,maxvalue); |
63 setSingleStep(step); |
63 setSingleStep(step); |
|
64 |
|
65 setSnappingMode(HbSlider::MinorTickSnapping); |
64 |
66 |
65 setSnappingMode(HbSlider::MajorTickSnapping); |
67 setMajorTickLabels(data->mSettingStrings); |
66 |
68 setMajorTickInterval(mSliderScaleValue * data->mMajorStep); |
67 // don't show labels and tickmarks if there are no strings to be shown |
69 setMinorTickInterval(mSliderScaleValue * data->mMinorStep); |
68 if (!data->mSettingStrings.isEmpty()) { |
70 setTickPosition(Hb::SliderTicksAbove); |
69 setMajorTickLabels(data->mSettingStrings); |
|
70 setMajorTickInterval(step); |
|
71 setTickPosition(Hb::SliderTicksLeft); |
|
72 } else { |
|
73 setTickPosition(Hb::NoSliderTicks); |
|
74 } |
|
75 |
71 |
76 setSettingId(data->mSettingId); |
72 setSettingId(data->mSettingId); |
77 |
73 |
78 } |
74 } |
79 CX_DEBUG_EXIT_FUNCTION(); |
75 CX_DEBUG_EXIT_FUNCTION(); |