From: huiyu.eun Date: Mon, 25 Nov 2019 08:58:43 +0000 (+0900) Subject: Add Component Application Structure X-Git-Tag: dali_1.5.18~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=589ec1d7fa9d28ddd347b86bef3a730cecebc047;p=platform%2Fcore%2Fuifw%2Fdali-adaptor-legacy.git Add Component Application Structure Add Component Application Structure Change-Id: I6d37796b495db417f81d0cd14dd66818c0d69ba4 Signed-off-by: huiyu.eun --- diff --git a/build/tizen/deps-check.cmake b/build/tizen/deps-check.cmake index b496dd9..ac5382a 100644 --- a/build/tizen/deps-check.cmake +++ b/build/tizen/deps-check.cmake @@ -89,6 +89,7 @@ CHECK_MODULE_AND_SET( CAPI_SYSTEM_INFO capi-system-info [] ) CHECK_MODULE_AND_SET( CAPI_SYSTEM_SENSOR capi-system-sensor capi_system_sensor_support ) CHECK_MODULE_AND_SET( CAPI_SYSTEM_SYSTEM_SETTINGS capi-system-system-settings [] ) CHECK_MODULE_AND_SET( CAPI_APPFW_APPLICATION capi-appfw-application [] ) +CHECK_MODULE_AND_SET( COMPONENT_BASED_CORE_BASE component-based-core-base [] ) CHECK_MODULE_AND_SET( ELEMENTARY elementary [] ) CHECK_MODULE_AND_SET( BUNDLE bundle [] ) @@ -211,6 +212,10 @@ ELSE() SET( cachePath /home/owner ) ENDIF() +IF( enable_appfw ) + ADD_DEFINITIONS( -DUSE_APPFW -DCOMPONENT_APPLICATION_SUPPORT) +ENDIF() + ####################################################### ADD_DEFINITIONS( -DDALI_PROFILE_${enable_profile}) @@ -330,6 +335,7 @@ IF( enable_appfw ) ${CAPI_APPFW_WIDGET_BASE_CFLAGS} ${ECORE_IMF_CFLAGS} ${FRIBIDI_CFLAGS} + ${COMPONENT_BASED_CORE_BASE_CFLAGS} ) SET( DALI_LDFLAGS ${DALI_LDFLAGS} @@ -344,6 +350,7 @@ IF( enable_appfw ) ${CAPI_APPFW_WIDGET_BASE_LDFLAGS} ${ECORE_IMF_LDFLAGS} ${FRIBIDI_LDFLAGS} + ${COMPONENT_BASED_CORE_BASE_LDFLAGS} ) ELSE() SET( DALI_CFLAGS ${DALI_CFLAGS} diff --git a/build/tizen/profiles/common-profile.cmake b/build/tizen/profiles/common-profile.cmake index 2c18ce0..bdc26ff 100644 --- a/build/tizen/profiles/common-profile.cmake +++ b/build/tizen/profiles/common-profile.cmake @@ -65,3 +65,10 @@ IF( ENABLE_TRACE ) ${adaptor_trace_tizen_src_files} ) ENDIF() + +IF( COMPONENT_APPLICATION_SUPPORT ) + SET( SOURCES ${SOURCES} + ${adaptor_adaptor_component_application_src_files} + ) +ENDIF() + diff --git a/build/tizen/profiles/ivi-profile.cmake b/build/tizen/profiles/ivi-profile.cmake index 765a1ea..77d540c 100644 --- a/build/tizen/profiles/ivi-profile.cmake +++ b/build/tizen/profiles/ivi-profile.cmake @@ -66,3 +66,10 @@ IF( ENABLE_TRACE ) ${adaptor_trace_tizen_src_files} ) ENDIF() + +IF( COMPONENT_APPLICATION_SUPPORT ) + SET( SOURCES ${SOURCES} + ${adaptor_adaptor_component_application_src_files} + ) +ENDIF() + diff --git a/build/tizen/profiles/mobile-profile.cmake b/build/tizen/profiles/mobile-profile.cmake index 38cc849..0ba3e35 100644 --- a/build/tizen/profiles/mobile-profile.cmake +++ b/build/tizen/profiles/mobile-profile.cmake @@ -66,3 +66,9 @@ IF( ENABLE_TRACE ) ) ENDIF() +IF( COMPONENT_APPLICATION_SUPPORT ) + SET( SOURCES ${SOURCES} + ${adaptor_adaptor_component_application_src_files} + ) +ENDIF() + diff --git a/build/tizen/profiles/tv-profile.cmake b/build/tizen/profiles/tv-profile.cmake index fbaa533..ff4b008 100644 --- a/build/tizen/profiles/tv-profile.cmake +++ b/build/tizen/profiles/tv-profile.cmake @@ -65,3 +65,10 @@ IF( ENABLE_TRACE ) ${adaptor_trace_tizen_src_files} ) ENDIF() + +IF( COMPONENT_APPLICATION_SUPPORT ) + SET( SOURCES ${SOURCES} + ${adaptor_adaptor_component_application_src_files} + ) +ENDIF() + diff --git a/build/tizen/profiles/wearable-profile.cmake b/build/tizen/profiles/wearable-profile.cmake index 3682664..7d5b1b4 100644 --- a/build/tizen/profiles/wearable-profile.cmake +++ b/build/tizen/profiles/wearable-profile.cmake @@ -67,3 +67,10 @@ IF( ENABLE_TRACE ) ${adaptor_trace_tizen_src_files} ) ENDIF() + +IF( COMPONENT_APPLICATION_SUPPORT ) + SET( SOURCES ${SOURCES} + ${adaptor_adaptor_component_application_src_files} + ) +ENDIF() + diff --git a/dali/devel-api/adaptor-framework/component-application.h b/dali/devel-api/adaptor-framework/component-application.h new file mode 100644 index 0000000..1f23b2f --- /dev/null +++ b/dali/devel-api/adaptor-framework/component-application.h @@ -0,0 +1,127 @@ +#ifndef DALI_COMPONENT_APPLICATION_H +#define DALI_COMPONENT_APPLICATION_H + +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include + +namespace Dali +{ +namespace Internal DALI_INTERNAL +{ + +namespace Adaptor +{ +class ComponentApplication; +} + +} + +/** + * @brief An ComponentApplication class object should be created by every component-based application + * that wishes to use Dali. + * + * Component application draw multiple UI applications based on frame components. + * component application can draw multiple UIs in one process. + * + * It provides a means for initializing the + * resources required by the Dali::Core. + * + * The ComponentApplication class emits several signals which the user can + * connect to. The user should not create any Dali objects in the main + * function and instead should connect to the Init signal of the + * ComponentApplication and create the Dali Widget object in the connected callback. + * + */ +class DALI_ADAPTOR_API ComponentApplication : public Application +{ +public: + typedef Signal< Any () > CreateSignalType; + +public: + /** + * @brief This is the constructor for component applications without an argument list. + * @return A handle to the ComponentApplication + */ + static ComponentApplication New( ); + + /** + * @brief This is the constructor for component applications. + * + * @param[in,out] argc A pointer to the number of arguments + * @param[in,out] argv A pointer to the argument list + * @return A handle to the ComponentApplication + */ + static ComponentApplication New( int* argc, char **argv[] ); + + /** + * @brief This is the constructor for component applications with a stylesheet + * + * @param[in,out] argc A pointer to the number of arguments + * @param[in,out] argv A pointer to the argument list + * @param[in] stylesheet The path to user defined theme file + * @return A handle to the ComponentApplication + */ + static ComponentApplication New( int* argc, char **argv[], const std::string& stylesheet ); + + /** + * @brief The default constructor. + */ + ComponentApplication() = default; + + /** + * @brief Copy Constructor. + * + * @param[in] componentApplication Handle to an object + */ + ComponentApplication( const ComponentApplication& componentApplication ) = default; + + /** + * @brief Assignment operator. + * + * @param[in] componentApplication Handle to an object + * @return A reference to this + */ + ComponentApplication& operator=( const ComponentApplication& componentApplication ) = default; + + /** + * @brief Destructor + */ + ~ComponentApplication() = default; + + /** + * @brief The user should connect to this signal to determine when they should initialize + * their application. + * The callback function is called before the main loop of the application starts. + * @return The signal to connect to + */ + CreateSignalType& CreateSignal(); + +public: + /// @cond internal + /** + * @brief Internal constructor. + */ + explicit DALI_INTERNAL ComponentApplication(Internal::Adaptor::ComponentApplication* componentApplication); + /// @endcond +}; +} // namespace Dali + +#endif // DALI_COMPONENT_APPLICATION_H + diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index 33c3ab3..b7e8f1f 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -84,6 +84,7 @@ SET( devel_api_adaptor_framework_header_files ${adaptor_devel_api_dir}/adaptor-framework/key-devel.h ${adaptor_devel_api_dir}/adaptor-framework/thread-settings.h ${adaptor_devel_api_dir}/adaptor-framework/window-devel.h + ${adaptor_devel_api_dir}/adaptor-framework/component-application.h ) @@ -117,4 +118,3 @@ SET( text_abstraction_header_files ${adaptor_devel_api_dir}/text-abstraction/text-renderer.h ${adaptor_devel_api_dir}/text-abstraction/text-renderer-layout-helper.h ) - diff --git a/dali/internal/adaptor/common/framework.h b/dali/internal/adaptor/common/framework.h index d95388c..e4b172b 100644 --- a/dali/internal/adaptor/common/framework.h +++ b/dali/internal/adaptor/common/framework.h @@ -28,6 +28,9 @@ // INTERNAL INCLUDES #include #include +#ifdef COMPONENT_APPLICATION_SUPPORT +#include +#endif namespace Dali { @@ -54,7 +57,8 @@ public: { NORMAL, ///< normal appFramework WATCH, ///< watch appFramework - WIDGET ///< widget appFramework + WIDGET, ///< widget appFramework + COMPONENT ///< component appFramework }; /** @@ -141,6 +145,13 @@ public: * Invoked when the platform surface is destroyed. */ virtual void OnSurfaceDestroyed( Any newSurface ) {} + +#ifdef COMPONENT_APPLICATION_SUPPORT + /** + * Invoked when the component application is created. + */ + virtual Any OnCreate() { return nullptr; } +#endif }; public: diff --git a/dali/internal/adaptor/file.list b/dali/internal/adaptor/file.list index defd518..cf5b02c 100644 --- a/dali/internal/adaptor/file.list +++ b/dali/internal/adaptor/file.list @@ -48,4 +48,7 @@ SET( adaptor_adaptor_windows_src_files ${adaptor_adaptor_dir}/windows/framework-win.cpp ) - +SET( adaptor_adaptor_component_application_src_files + ${adaptor_adaptor_dir}/tizen-wayland/component-application.cpp + ${adaptor_adaptor_dir}/tizen-wayland/component-application-impl.cpp +) diff --git a/dali/internal/adaptor/tizen-wayland/component-application-impl.cpp b/dali/internal/adaptor/tizen-wayland/component-application-impl.cpp new file mode 100644 index 0000000..bf3855c --- /dev/null +++ b/dali/internal/adaptor/tizen-wayland/component-application-impl.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ +ComponentApplicationPtr ComponentApplication::New( + int* argc, + char **argv[], + const std::string& stylesheet, + Dali::Application::WINDOW_MODE windowMode) +{ + ComponentApplicationPtr application ( new ComponentApplication (argc, argv, stylesheet, windowMode ) ); + return application; +} + +ComponentApplication::ComponentApplication( int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode ) +: Application(argc, argv, stylesheet, windowMode, PositionSize(), Framework::COMPONENT) +{ +} + +Any ComponentApplication::OnCreate() +{ + return mCreateSignal.Emit(); +} + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali diff --git a/dali/internal/adaptor/tizen-wayland/component-application-impl.h b/dali/internal/adaptor/tizen-wayland/component-application-impl.h new file mode 100644 index 0000000..cd7e6c2 --- /dev/null +++ b/dali/internal/adaptor/tizen-wayland/component-application-impl.h @@ -0,0 +1,111 @@ +#ifndef DALI_INTERNAL_COMPONENT_APPLICATION_H +#define DALI_INTERNAL_COMPONENT_APPLICATION_H + +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ +class Adaptor; + +namespace Internal +{ + +namespace Adaptor +{ + +class ComponentApplication; +typedef IntrusivePtr ComponentApplicationPtr; + +/** + * Implementation of the ComponentApplication class. + */ +class ComponentApplication : public Application +{ +public: + typedef Dali::ComponentApplication::CreateSignalType CreateSignal; + +public: + /** + * Create a new component application + * @param[in] argc A pointer to the number of arguments + * @param[in] argv A pointer to the argument list + * @param[in] stylesheet The path to user defined theme file + * @param[in] windowMode A member of WINDOW_MODE + * @return A handle to the ComponentApplication + */ + static ComponentApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode ); + + /** + * @brief The default constructor. + */ + ComponentApplication( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode ); + + /** + * @brief Undefined copy constructor. + */ + ComponentApplication( const ComponentApplication& ) = default; + + /** + * @brief Destructor + */ + virtual ~ComponentApplication() = default; + + /** + *@brief Undefined assignment operator. + */ + ComponentApplication& operator=( const ComponentApplication& ) = delete; + +public: // From Framework::Observer + /** + * Called when the framework is Component Application Created. + */ + virtual Any OnCreate(); + +public: + CreateSignal mCreateSignal; +}; + +inline ComponentApplication& GetImplementation(Dali::ComponentApplication& application) +{ + DALI_ASSERT_ALWAYS(application && "application handle is empty"); + + BaseObject& handle = application.GetBaseObject(); + + return static_cast(handle); +} + +inline const ComponentApplication& GetImplementation(const Dali::ComponentApplication& application) +{ + DALI_ASSERT_ALWAYS(application && "application handle is empty"); + + const BaseObject& handle = application.GetBaseObject(); + + return static_cast(handle); +} + + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali +#endif diff --git a/dali/internal/adaptor/tizen-wayland/component-application.cpp b/dali/internal/adaptor/tizen-wayland/component-application.cpp new file mode 100644 index 0000000..c1e0761 --- /dev/null +++ b/dali/internal/adaptor/tizen-wayland/component-application.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +ComponentApplication ComponentApplication::New() +{ + return New( NULL, NULL ); +} + +ComponentApplication ComponentApplication::New( int* argc, char **argv[] ) +{ + return New( argc, argv, "" ); +} + +ComponentApplication ComponentApplication::New( int* argc, char **argv[], const std::string& stylesheet ) +{ + Internal::Adaptor::ComponentApplicationPtr internal = Internal::Adaptor::ComponentApplication::New( argc, argv, stylesheet, TRANSPARENT ); + return ComponentApplication(internal.Get()); +} + +ComponentApplication::CreateSignalType& ComponentApplication::CreateSignal() +{ + return Internal::Adaptor::GetImplementation(*this).mCreateSignal; +} + +ComponentApplication::ComponentApplication(Internal::Adaptor::ComponentApplication* implementation) +: Application(implementation) +{ +} + +} // namespace Dali diff --git a/dali/internal/adaptor/tizen-wayland/framework-tizen.cpp b/dali/internal/adaptor/tizen-wayland/framework-tizen.cpp index 1a05da1..d4236cf 100644 --- a/dali/internal/adaptor/tizen-wayland/framework-tizen.cpp +++ b/dali/internal/adaptor/tizen-wayland/framework-tizen.cpp @@ -41,6 +41,10 @@ #include #endif // TIZEN_PLATFORM_CONFIG_SUPPORTED +#ifdef COMPONENT_APPLICATION_SUPPORT +#include +#endif + #include // INTERNAL INCLUDES @@ -222,35 +226,60 @@ struct Framework::Impl int AppMain() { int ret; - - if (mApplicationType == NORMAL) - { - ret = AppNormalMain(); - } - else if(mApplicationType == WIDGET) + switch ( mApplicationType ) { - ret = AppWidgetMain(); - } - else - { - ret = AppWatchMain(); + case NORMAL: + { + ret = AppNormalMain(); + break; + } + case WIDGET: + { + ret = AppWidgetMain(); + break; + } + case WATCH: + { + ret = AppWatchMain(); + break; + } +#ifdef COMPONENT_APPLICATION_SUPPORT + case COMPONENT: + { + ret = AppComponentMain(); + break; + } +#endif } return ret; } void AppExit() { - if (mApplicationType == NORMAL) - { - AppNormalExit(); - } - else if(mApplicationType == WIDGET) + switch ( mApplicationType ) { - AppWidgetExit(); - } - else - { - AppWatchExit(); + case NORMAL: + { + AppNormalExit(); + break; + } + case WIDGET: + { + AppWidgetExit(); + break; + } + case WATCH: + { + AppWatchExit(); + break; + } +#ifdef COMPONENT_APPLICATION_SUPPORT + case COMPONENT: + { + AppComponentExit(); + break; + } +#endif } } @@ -697,6 +726,56 @@ struct Framework::Impl #endif } +#ifdef COMPONENT_APPLICATION_SUPPORT + int AppComponentMain() + { + int ret; + + /*Crate component_based_app_base_lifecycle_callback*/ + component_based_app_base_lifecycle_callback_s callback; + callback.init = AppInit; + callback.run = AppRun; + callback.exit = AppExit; + callback.create = ComponentAppCreate; + callback.terminate = ComponentAppTerminate; + callback.fini = ComponentAppFinish; + + return component_based_app_base_main(*mFramework->mArgc, *mFramework->mArgv, &callback, mFramework);; + } + + static void* ComponentAppCreate( void *data ) + { + Framework* framework = static_cast(data); + Observer *observer = &framework->mObserver; + observer->OnInit(); + + return Dali::AnyCast( observer->OnCreate() ); + } + + static void ComponentAppTerminate( void *data ) + { + Observer *observer = &static_cast(data)->mObserver; + observer->OnTerminate(); + } + + static void ComponentAppFinish( void *data ) + { + ecore_shutdown(); + + if(getenv("AUL_LOADER_INIT")) + { + setenv("AUL_LOADER_INIT", "0", 1); + ecore_shutdown(); + } + } + + void AppComponentExit() + { + component_based_app_base_exit(); + } + +#endif + private: // Undefined Impl( const Impl& impl ); diff --git a/dali/public-api/file.list b/dali/public-api/file.list index 71866f1..e4d3ac3 100644 --- a/dali/public-api/file.list +++ b/dali/public-api/file.list @@ -54,4 +54,4 @@ SET( adaptor_dali_wearable_header_file SET( public_dali_watch_header_files ${adaptor_public_api_dir}/watch/watch-application.h ${adaptor_public_api_dir}/watch/watch-time.h -) \ No newline at end of file +) diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 6523580..0e7a469 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -103,6 +103,7 @@ BuildRequires: pkgconfig(capi-system-system-settings) # for feedback plugin BuildRequires: pkgconfig(mm-sound) BuildRequires: pkgconfig(feedback) +BuildRequires: pkgconfig(component-based-core-base) # for multiprofile Requires: %{name}-compat = %{version}-%{release} @@ -277,10 +278,6 @@ cmake_flags+=" -DCMAKE_BUILD_TYPE=Debug" cmake_flags+=" -DENABLE_TRACE=ON" %endif -%if 0%{?enable_appfw} -cmake_flags+=" -DUSE_APPFW" -%endif - libtoolize --force cd %{_builddir}/%{name}-%{version}/build/tizen @@ -300,6 +297,7 @@ cmake_flags+=" -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}" cmake_flags+=" -DENABLE_TIZEN_MAJOR_VERSION=%{tizen_version_major}" cmake_flags+=" -DENABLE_FEEDBACK=YES" cmake_flags+=" -DENABLE_APPFW=YES" +cmake_flags+=" -DCOMPONENT_APPLICATION_SUPPORT=YES" # Set up the build via Cmake #######################################################################