Added QML API for getting the limits for a specific radio band.

Using properties for the frequency step, minimum and maximum
frequency of the currently selected band.
Also updated the declarative-radio example to use the minimum
and maximum frequencies to show a tuner band for the radio.

Change-Id: I9f28f10e98e008c14b10bdc12b0727086cd45f0b
Reviewed-on: http://codereview.qt.nokia.com/3829
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
Jonas Rabbe
2011-08-30 10:46:19 +10:00
committed by Qt by Nokia
parent 7535629ecb
commit 8e954ee246
3 changed files with 49 additions and 9 deletions

View File

@@ -46,11 +46,13 @@ Rectangle {
Radio {
id: radio
band: Radio.FM
}
Column {
anchors.fill: parent
anchors.margins: 5
spacing: 5
Row {
@@ -61,7 +63,7 @@ Rectangle {
height: 200
verticalAlignment: Text.AlignVCenter
text: "" + radio.frequency / 1000 + " kHz";
text: "" + radio.frequency / 1000 + " kHz"
}
Text {
id: sig
@@ -74,6 +76,28 @@ Rectangle {
}
}
Row {
spacing: 5
Rectangle {
width: 350
height: 10
color: "black"
Rectangle {
width: 5
height: 10
color: "red"
y: 0
x: (parent.width - 5) * ((radio.frequency - radio.minimumFrequency) / (radio.maximumFrequency -
radio.minimumFrequency))
}
}
}
Row {
spacing: 5
@@ -119,7 +143,7 @@ Rectangle {
anchors.fill: parent
onClicked: {
var f = radio.frequency;
f = f - radio.frequencyStep(Radio.FM);
f = f - radio.frequencyStep;
radio.setFrequency(f);
}
}
@@ -144,7 +168,7 @@ Rectangle {
anchors.fill: parent
onClicked: {
var f = radio.frequency;
f = f + radio.frequencyStep(Radio.FM);
f = f + radio.frequencyStep;
radio.setFrequency(f);
}
}