radioapp/radioenginewrapper/src/radioenginewrapper.cpp
changeset 28 075425b8d9a4
parent 24 6df133bd92e1
child 32 189d20c34778
child 34 bc10a61bd7d3
--- a/radioapp/radioenginewrapper/src/radioenginewrapper.cpp	Fri Jun 04 10:21:36 2010 +0100
+++ b/radioapp/radioenginewrapper/src/radioenginewrapper.cpp	Fri Jun 11 13:38:32 2010 +0300
@@ -26,8 +26,6 @@
 RadioEngineWrapper::RadioEngineWrapper( RadioStationHandlerIf& stationHandler ) :
     d_ptr( new RadioEngineWrapperPrivate( this, stationHandler ) )
 {
-    Q_D( RadioEngineWrapper );
-    d->init();
 }
 
 /*!
@@ -41,6 +39,15 @@
 /*!
  *
  */
+bool RadioEngineWrapper::init()
+{
+    Q_D( RadioEngineWrapper );
+    return d->init();
+}
+
+/*!
+ *
+ */
 void RadioEngineWrapper::addObserver( RadioEngineWrapperObserver* observer )
 {
     Q_D( RadioEngineWrapper );
@@ -57,15 +64,6 @@
 }
 
 /*!
- * Checks if the radio engine has been constructed properly
- */
-bool RadioEngineWrapper::isEngineConstructed()
-{
-    Q_D( RadioEngineWrapper );
-    return d->isEngineConstructed();
-}
-
-/*!
  * Returns the settings handler owned by the engine
  */
 RadioSettingsIf& RadioEngineWrapper::settings()
@@ -113,10 +111,9 @@
 /*!
  * Returns the frequency step size from the selected region
  */
-bool RadioEngineWrapper::isFrequencyValid( uint frequency )
+bool RadioEngineWrapper::isFrequencyValid( uint frequency ) const
 {
-    Q_D( const RadioEngineWrapper );
-    return d->mEngineHandler->IsFrequencyValid( frequency );
+    return frequency >= minFrequency() && frequency <= maxFrequency() && frequency % frequencyStepSize() == 0;
 }
 
 /*!
@@ -134,7 +131,7 @@
 uint RadioEngineWrapper::currentFrequency() const
 {
     Q_D( const RadioEngineWrapper );
-    return d->mEngineHandler->TunedFrequency();
+    return d->mEngineHandler->CurrentFrequency();
 }
 
 /*!
@@ -165,21 +162,57 @@
 }
 
 /*!
- * Tunes to the given frequency
+ * Sets or unsets the engine to manual seek mode
  */
-void RadioEngineWrapper::tuneFrequency( uint frequency, const int reason )
+void RadioEngineWrapper::setManualSeekMode( bool manualSeek )
 {
     Q_D( RadioEngineWrapper );
-    d->tuneFrequency( frequency, reason );
+    d->mEngineHandler->SetManualSeekMode( manualSeek );
+}
+
+/*!
+ * Checks if the engine is in manual seek mode
+ */
+bool RadioEngineWrapper::isInManualSeekMode() const
+{
+    Q_D( const RadioEngineWrapper );
+    return d->mEngineHandler->IsInManualSeekMode();
 }
 
 /*!
- * Tunes to the given frequency after a delay
+ *
  */
-void RadioEngineWrapper::tuneWithDelay( uint frequency, const int reason )
+void RadioEngineWrapper::setRdsEnabled( bool rdsEnabled )
+{
+    Q_D( RadioEngineWrapper );
+    d->mEngineHandler->SetRdsEnabled( rdsEnabled );
+}
+
+/*!
+ * Tunes to the given frequency
+ */
+void RadioEngineWrapper::setFrequency( uint frequency, const int reason )
 {
     Q_D( RadioEngineWrapper );
-    d->tuneWithDelay( frequency, reason );
+    d->setFrequency( frequency, reason );
+}
+
+/*!
+ * volume increase command for the engine
+ */
+void RadioEngineWrapper::increaseVolume()
+{
+    Q_D( RadioEngineWrapper );
+    d->mEngineHandler->IncreaseVolume();
+}
+
+/*!
+ * volume decrease command for the engine
+ */
+void RadioEngineWrapper::decreaseVolume()
+{
+    Q_D( RadioEngineWrapper );
+    d->mEngineHandler->DecreaseVolume();
 }
 
 /*!
@@ -194,10 +227,10 @@
 /*!
  *
  */
-void RadioEngineWrapper::setMute( bool muted )
+void RadioEngineWrapper::setMute( bool muted, bool updateSettings )
 {
     Q_D( RadioEngineWrapper );
-    d->mEngineHandler->SetMuted( muted );
+    d->mEngineHandler->SetMuted( muted, updateSettings );
 }
 
 /*!
@@ -213,7 +246,7 @@
 /*!
  *
  */
-void RadioEngineWrapper::startSeeking( Seeking::Direction direction, const int reason )
+void RadioEngineWrapper::startSeeking( Seek::Direction direction, const int reason )
 {
     Q_D( RadioEngineWrapper );
     d->startSeeking( direction, reason );