X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fapplication-impl.cpp;h=f7286579cbc239080c1b3dc8b899dafa5cfa2b92;hb=263ec21432f3d7c9f9be5b463748fdce8f6942e4;hp=47c42d5aec45d9e1f4210cf8ea3720a903f7799e;hpb=126df2d0eaeae2c65f2935ec334dfa2414498996;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp old mode 100644 new mode 100755 index 47c42d5..f728657 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -27,8 +27,11 @@ #include #include #include +#include #include +#undef Status + namespace Dali { @@ -48,6 +51,13 @@ namespace Internal namespace Adaptor { +namespace +{ + +const float DEFAULT_STEREO_BASE( 65.0f ); + +} // unnamed namespace + ApplicationPtr Application::gPreInitializedApplication( NULL ); ApplicationPtr Application::New( @@ -101,7 +111,9 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee mEnvironmentOptions(), mWindowPositionSize( positionSize ), mLaunchpadState( Launchpad::NONE ), - mSlotDelegate( this ) + mSlotDelegate( this ), + mViewMode( MONO ), + mStereoBase( DEFAULT_STEREO_BASE ) { // Get mName from environment options mMainWindowName = mEnvironmentOptions.GetWindowName(); @@ -148,12 +160,6 @@ void Application::CreateWindow() const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName(); mMainWindow = Dali::Window::New( mWindowPositionSize, mMainWindowName, windowClassName, mMainWindowMode == Dali::Application::TRANSPARENT ); - int indicatorVisibleMode = mEnvironmentOptions.GetIndicatorVisibleMode(); - if( indicatorVisibleMode >= Dali::Window::INVISIBLE && indicatorVisibleMode <= Dali::Window::AUTO ) - { - GetImplementation( mMainWindow ).SetIndicatorVisibleMode( static_cast< Dali::Window::IndicatorVisibleMode >( indicatorVisibleMode ) ); - } - // Quit the application when the window is closed GetImplementation( mMainWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit ); } @@ -205,8 +211,10 @@ void Application::QuitFromMainLoop() // This will trigger OnTerminate(), below, after the main loop has completed. } -void Application::DoInit() +void Application::OnInit() { + mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) ); + CreateAdaptorBuilder(); // If an application was pre-initialized, a window was made in advance @@ -226,59 +234,10 @@ void Application::DoInit() mAdaptor->SetUseHardwareVSync(false); } - Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetStereoBase( mCommandLineOptions->stereoBase ); - if( mCommandLineOptions->viewMode != 0 ) - { - ViewMode viewMode = MONO; - if( mCommandLineOptions->viewMode <= STEREO_INTERLACED ) - { - viewMode = static_cast( mCommandLineOptions->viewMode ); - } - Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetViewMode( viewMode ); - } - if( ! mStylesheet.empty() ) { Dali::StyleMonitor::Get().SetTheme( mStylesheet ); } -} - -void Application::DoStart() -{ - mAdaptor->NotifySceneCreated(); -} - -void Application::DoTerminate() -{ - if( mAdaptor ) - { - // Ensure that the render-thread is not using the surface(window) after we delete it - mAdaptor->Stop(); - } - - mMainWindow.Reset(); // This only resets (clears) the default Window -} - -void Application::DoPause() -{ - mAdaptor->Pause(); -} - -void Application::DoResume() -{ - mAdaptor->Resume(); -} - -void Application::DoLanguageChange() -{ - mAdaptor->NotifyLanguageChanged(); -} - -void Application::OnInit() -{ - mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) ); - - DoInit(); // Wire up the LifecycleController Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get(); @@ -294,7 +253,7 @@ void Application::OnInit() Dali::Application application(this); mInitSignal.Emit( application ); - DoStart(); + mAdaptor->NotifySceneCreated(); } void Application::OnTerminate() @@ -305,7 +264,13 @@ void Application::OnTerminate() Dali::Application application(this); mTerminateSignal.Emit( application ); - DoTerminate(); + if( mAdaptor ) + { + // Ensure that the render-thread is not using the surface(window) after we delete it + mAdaptor->Stop(); + } + + mMainWindow.Reset(); // This only resets (clears) the default Window } void Application::OnPause() @@ -350,7 +315,7 @@ void Application::OnAppControl(void *data) void Application::OnLanguageChanged() { - DoLanguageChange(); + mAdaptor->NotifyLanguageChanged(); Dali::Application application(this); mLanguageChangedSignal.Emit( application ); } @@ -411,22 +376,22 @@ Dali::Window Application::GetWindow() void Application::SetViewMode( ViewMode viewMode ) { - Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetViewMode( viewMode ); + mViewMode = viewMode; } ViewMode Application::GetViewMode() const { - return Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).GetViewMode(); + return mViewMode; } void Application::SetStereoBase( float stereoBase ) { - Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetStereoBase( stereoBase ); + mStereoBase = stereoBase; } float Application::GetStereoBase() const { - return Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).GetStereoBase(); + return mStereoBase; } void Application::ReplaceWindow( const PositionSize& positionSize, const std::string& name ) @@ -435,13 +400,7 @@ void Application::ReplaceWindow( const PositionSize& positionSize, const std::st Window& windowImpl = GetImplementation(newWindow); windowImpl.SetAdaptor(*mAdaptor); - int indicatorVisibleMode = mEnvironmentOptions.GetIndicatorVisibleMode(); - if( indicatorVisibleMode >= Dali::Window::INVISIBLE && indicatorVisibleMode <= Dali::Window::AUTO ) - { - GetImplementation( newWindow ).SetIndicatorVisibleMode( static_cast< Dali::Window::IndicatorVisibleMode >( indicatorVisibleMode ) ); - } - - Dali::RenderSurface* renderSurface = windowImpl.GetSurface(); + Internal::Adaptor::WindowRenderSurface* renderSurface = windowImpl.GetSurface(); Any nativeWindow = newWindow.GetNativeHandle(); Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(nativeWindow, *renderSurface); @@ -454,6 +413,11 @@ std::string Application::GetResourcePath() return Internal::Adaptor::Framework::GetResourcePath(); } +std::string Application::GetDataPath() +{ + return Internal::Adaptor::Framework::GetDataPath(); +} + void Application::SetStyleSheet( const std::string& stylesheet ) { mStylesheet = stylesheet;