Added tune up and down methods, and changed name of scan methods.
authorJonas Rabbe <jonas.rabbe@nokia.com>
Wed, 31 Aug 2011 21:44:46 +0000 (07:44 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 1 Sep 2011 00:42:57 +0000 (02:42 +0200)
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>
examples/declarative-radio/view.qml
src/imports/multimedia/qdeclarativeradio.cpp
src/imports/multimedia/qdeclarativeradio_p.h

index cb7623497fc5400b1d1237cb5cc2f77437fdcef0..4e2882d45355f3593c215b4be011dce99624e229 100644 (file)
@@ -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();
                 }
             }
         }
index 5debda7ba0f0b07be1ce0701074d16710b01ae4c..5cac32e6f0b3acec8f6cae4a5ad0d5ebce26c9a4 100644 (file)
@@ -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();
index 498e60fe3323455d5fd708e619ac43dc3840bfb8..eddf93bfc36753c9d92725c11e7e6358f5a5f4ad 100644 (file)
@@ -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();