Revert "[Tizen] Added 'make clean' on each profile build."
[platform/core/uifw/dali-adaptor.git] / adaptors / common / sound-player-impl.cpp
index 83654f0..5c3e5a5 100644 (file)
@@ -22,7 +22,7 @@
 #include <dali/public-api/object/type-registry.h>
 
 // INTERNAL INCLUDES
-#include <adaptor-impl.h>
+#include <singleton-service-impl.h>
 
 namespace Dali
 {
@@ -36,15 +36,17 @@ namespace Adaptor
 namespace // unnamed namespace
 {
 
+const char* const SIGNAL_SOUND_PLAY_FINISHED = "soundPlayFinished";
+
 // Type Registration
-Dali::BaseHandle Create()
+Dali::BaseHandle GetInstance()
 {
   return SoundPlayer::Get();
 }
 
-Dali::TypeRegistration SOUND_PLAYER_TYPE( typeid(Dali::SoundPlayer), typeid(Dali::BaseHandle), Create );
+Dali::TypeRegistration SOUND_PLAYER_TYPE( typeid(Dali::SoundPlayer), typeid(Dali::BaseHandle), GetInstance );
 
-Dali::SignalConnectorType SIGNAL_CONNECTOR_1( SOUND_PLAYER_TYPE, Dali::SoundPlayer::SIGNAL_SOUND_PLAY_FINISHED, Dali::Internal::Adaptor::SoundPlayer::DoConnectSignal );
+Dali::SignalConnectorType SIGNAL_CONNECTOR_1( SOUND_PLAYER_TYPE, SIGNAL_SOUND_PLAY_FINISHED, Dali::Internal::Adaptor::SoundPlayer::DoConnectSignal );
 
 } // unnamed namespace
 
@@ -58,10 +60,11 @@ Dali::SoundPlayer SoundPlayer::Get()
 {
   Dali::SoundPlayer player;
 
-  if ( Adaptor::IsAvailable() )
+  Dali::SingletonService service( SingletonService::Get() );
+  if ( service )
   {
     // Check whether the singleton is already created
-    Dali::BaseHandle handle = Adaptor::Get().GetSingleton( typeid( Dali::SoundPlayer ) );
+    Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::SoundPlayer ) );
     if ( handle )
     {
       // If so, downcast the handle
@@ -69,9 +72,8 @@ Dali::SoundPlayer SoundPlayer::Get()
     }
     else
     {
-      Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
       player = Dali::SoundPlayer( New() );
-      adaptorImpl.RegisterSingleton( typeid( player ), player );
+      service.Register( typeid( player ), player );
     }
   }
 
@@ -88,9 +90,9 @@ void SoundPlayer::Stop( int handle )
   mPlugin.StopSound( handle );
 }
 
-SoundPlayer::SoundPlayFinishedSignalV2& SoundPlayer::SoundPlayFinishedSignal()
+SoundPlayer::SoundPlayFinishedSignalType& SoundPlayer::SoundPlayFinishedSignal()
 {
-  return mSoundPlayFinishedSignalV2;
+  return mSoundPlayFinishedSignal;
 }
 
 bool SoundPlayer::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
@@ -98,8 +100,7 @@ bool SoundPlayer::DoConnectSignal( BaseObject* object, ConnectionTrackerInterfac
   bool connected( true );
   SoundPlayer* player = dynamic_cast<SoundPlayer*>( object );
 
-  if( player &&
-      Dali::SoundPlayer::SIGNAL_SOUND_PLAY_FINISHED == signalName )
+  if( player && ( SIGNAL_SOUND_PLAY_FINISHED == signalName ) )
   {
     player->SoundPlayFinishedSignal().Connect( tracker, functor );
   }
@@ -125,10 +126,10 @@ void SoundPlayer::EmitSoundPlayFinishedSignal()
 {
   // Emit SoundPlayFinished signal
 
-  if ( !mSoundPlayFinishedSignalV2.Empty() )
+  if ( !mSoundPlayFinishedSignal.Empty() )
   {
     Dali::SoundPlayer handle( this );
-    mSoundPlayFinishedSignalV2.Emit( handle );
+    mSoundPlayFinishedSignal.Emit( handle );
   }
 }