diff options
author | Jonas Rabbe <jonas.rabbe@nokia.com> | 2011-09-01 07:44:46 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-01 02:42:57 +0200 |
commit | a6e2cbb83ce78940a9cdbac44d6080a8e9cad21f (patch) | |
tree | d868d28172a62d901ec4e34b1d7f2cc20feccae7 | |
parent | 6781063df647fcba3dd5ca6fdff8631579acb495 (diff) |
Added tune up and down methods, and changed name of scan methods.
Instead of requiring developers using the radio API to read the
frequency step, adding it to the current frequency and setting the
new frequency, there has been added tuneUp and tuneDown methods.
Also, the searchBackward and searchForward methods have been renamed
to scanDown and scanUp which seem more logical. And cancelSearch
has become cancelScan.
Change-Id: Ib9ff61c0f58163039f41f045037cb9a11b37a59e
Reviewed-on: http://codereview.qt.nokia.com/4013
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Reviewed-by: derick hawcroft <derick.hawcroft@nokia.com>
-rw-r--r-- | examples/declarative-radio/view.qml | 16 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativeradio.cpp | 20 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativeradio_p.h | 8 |
3 files changed, 26 insertions, 18 deletions
diff --git a/examples/declarative-radio/view.qml b/examples/declarative-radio/view.qml index cb7623497..4e2882d45 100644 --- a/examples/declarative-radio/view.qml +++ b/examples/declarative-radio/view.qml @@ -120,7 +120,7 @@ Rectangle { MouseArea { anchors.fill: parent - onClicked: radio.searchBackward(); + onClicked: radio.scanDown(); } } Rectangle { @@ -141,11 +141,7 @@ Rectangle { MouseArea { anchors.fill: parent - onClicked: { - var f = radio.frequency; - f = f - radio.frequencyStep; - radio.setFrequency(f); - } + onClicked: radio.tuneDown(); } } Rectangle { @@ -166,11 +162,7 @@ Rectangle { MouseArea { anchors.fill: parent - onClicked: { - var f = radio.frequency; - f = f + radio.frequencyStep; - radio.setFrequency(f); - } + onClicked: radio.tuneUp(); } } Rectangle { @@ -191,7 +183,7 @@ Rectangle { MouseArea { anchors.fill: parent - onClicked: radio.searchForward(); + onClicked: radio.scanUp(); } } } diff --git a/src/imports/multimedia/qdeclarativeradio.cpp b/src/imports/multimedia/qdeclarativeradio.cpp index 5debda7ba..5cac32e6f 100644 --- a/src/imports/multimedia/qdeclarativeradio.cpp +++ b/src/imports/multimedia/qdeclarativeradio.cpp @@ -156,21 +156,35 @@ void QDeclarativeRadio::setMuted(bool muted) m_radioTuner->setMuted(muted); } -void QDeclarativeRadio::cancelSearch() +void QDeclarativeRadio::cancelScan() { m_radioTuner->cancelSearch(); } -void QDeclarativeRadio::searchBackward() +void QDeclarativeRadio::scanDown() { m_radioTuner->searchBackward(); } -void QDeclarativeRadio::searchForward() +void QDeclarativeRadio::scanUp() { m_radioTuner->searchForward(); } +void QDeclarativeRadio::tuneDown() +{ + int f = frequency(); + f = f - frequencyStep(); + setFrequency(f); +} + +void QDeclarativeRadio::tuneUp() +{ + int f = frequency(); + f = f + frequencyStep(); + setFrequency(f); +} + void QDeclarativeRadio::start() { m_radioTuner->start(); diff --git a/src/imports/multimedia/qdeclarativeradio_p.h b/src/imports/multimedia/qdeclarativeradio_p.h index 498e60fe3..eddf93bfc 100644 --- a/src/imports/multimedia/qdeclarativeradio_p.h +++ b/src/imports/multimedia/qdeclarativeradio_p.h @@ -134,9 +134,11 @@ public Q_SLOTS: void setVolume(int volume); void setMuted(bool muted); - void cancelSearch(); - void searchBackward(); - void searchForward(); + void cancelScan(); + void scanDown(); + void scanUp(); + void tuneUp(); + void tuneDown(); void start(); void stop(); |