From: Awadhesh Singh Date: Mon, 23 Jul 2018 07:47:06 +0000 (+0530) Subject: [TBT][dali-adaptor][ACR-1124][Add widget application apis] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c4060a2a6fa7d7d2a735b1da0dd0e635042fef4;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][dali-adaptor][ACR-1124][Add widget application apis] Change-Id: Ieffb7f35674e009aae2f0ae890659266d9f2e04d Signed-off-by: Awadhesh Singh --- diff --git a/coretbtwidgetapp-dali/.cproject b/coretbtwidgetapp-dali/.cproject new file mode 100644 index 0000000..09054c6 --- /dev/null +++ b/coretbtwidgetapp-dali/.cproject @@ -0,0 +1,619 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/coretbtwidgetapp-dali/.exportMap b/coretbtwidgetapp-dali/.exportMap new file mode 100644 index 0000000..43e310e --- /dev/null +++ b/coretbtwidgetapp-dali/.exportMap @@ -0,0 +1,4 @@ +{ + global: main; + local: *; +}; diff --git a/coretbtwidgetapp-dali/.gbs.conf b/coretbtwidgetapp-dali/.gbs.conf new file mode 100644 index 0000000..5a50939 --- /dev/null +++ b/coretbtwidgetapp-dali/.gbs.conf @@ -0,0 +1,30 @@ +[general] +buildroot=~/GBS-ROOT-TBT-MOBILE +profile = profile.device + +[profile.device] # Profile for Device +obs = obs.device +repos = repo.device + +[profile.sdk] # Profile for SDK +obs = obs.sdk +repos = repo.sdk + +[obs.device] # obs for SDK.Ref_Target +#OBS API URL pointing to a remote OBS. +url = https://168.219.209.58/ + +[obs.sdk] # obs for SDK.Emulator +#OBS API URL pointing to a remote OBS. +url = https://168.219.209.58/ + + +#device +[repo.device] # Repository for Tizen 2.4 SDK Target snapshot +url = http://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm64-wayland/packages/ + +#SDK +[repo.sdk] # Repository for Tizen 2.4 SDK Emulator snapshot +url = http://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm64-wayland/packages/ + + diff --git a/coretbtwidgetapp-dali/.gitignore b/coretbtwidgetapp-dali/.gitignore new file mode 100644 index 0000000..9cd49f2 --- /dev/null +++ b/coretbtwidgetapp-dali/.gitignore @@ -0,0 +1,3 @@ +/Debug +/SA_Report +/res diff --git a/coretbtwidgetapp-dali/.package-stamp b/coretbtwidgetapp-dali/.package-stamp new file mode 100644 index 0000000..40cbe59 --- /dev/null +++ b/coretbtwidgetapp-dali/.package-stamp @@ -0,0 +1 @@ +TPK \ No newline at end of file diff --git a/coretbtwidgetapp-dali/.project b/coretbtwidgetapp-dali/.project new file mode 100644 index 0000000..7cf1b46 --- /dev/null +++ b/coretbtwidgetapp-dali/.project @@ -0,0 +1,32 @@ + + + coretbtwidgetapp + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + org.tizen.nativecore.apichecker.core.builder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.tizen.nativecore.apichecker.core.tizenCppNature + + diff --git a/coretbtwidgetapp-dali/.rds_delta b/coretbtwidgetapp-dali/.rds_delta new file mode 100644 index 0000000..b923a0e --- /dev/null +++ b/coretbtwidgetapp-dali/.rds_delta @@ -0,0 +1,9 @@ +#delete +#add +#modify +author-signature.xml +signature1.xml +bin/coretbtwidgetapp +shared/res/icon.png +shared/res/preview.png +tizen-manifest.xml diff --git a/coretbtwidgetapp-dali/.sdk_delta.info b/coretbtwidgetapp-dali/.sdk_delta.info new file mode 100644 index 0000000..ef32173 Binary files /dev/null and b/coretbtwidgetapp-dali/.sdk_delta.info differ diff --git a/coretbtwidgetapp-dali/.tproject b/coretbtwidgetapp-dali/.tproject new file mode 100644 index 0000000..658e81b --- /dev/null +++ b/coretbtwidgetapp-dali/.tproject @@ -0,0 +1,12 @@ + + + + + mobile-5.0 + + + + + + + diff --git a/coretbtwidgetapp-dali/CMakeLists_not.txt b/coretbtwidgetapp-dali/CMakeLists_not.txt new file mode 100755 index 0000000..a3be864 --- /dev/null +++ b/coretbtwidgetapp-dali/CMakeLists_not.txt @@ -0,0 +1,64 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(${NAME} CXX) + +SET(project_name ${NAME}) +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) + + +SET(PKG_MODULES + appcore-efl + aul + bundle + capi-appfw-application + capi-appfw-widget-application + capi-system-info + dlog + dlog + ecore + ecore-evas + edje + efl-extension + eina + elementary + evas + glib-2.0 +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(${project_name} REQUIRED ${PKG_MODULES}) + +INCLUDE_DIRECTORIES( + ${${project_name}_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/inc +) + +FILE(GLOB_RECURSE SRCS ${CMAKE_SOURCE_DIR}/src/*.cpp) +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} + capi-appfw-app-common + capi-appfw-app-control + capi-appfw-application + capi-appfw-widget-application + capi-system-info + dlog + ecore + edje + efl-extension + eina + elementary + evas +) + + +CONFIGURE_FILE(tizen-manifest.xml ${PACKAGE_NAME}.xml) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) +install(FILES ${CMAKE_SOURCE_DIR}/${PACKAGE_NAME}.xml DESTINATION /opt/share/packages) +install(FILES ${CMAKE_SOURCE_DIR}/shared/res/${DESKTOP_ICON} DESTINATION /opt/share/icons/default/small) +install(FILES ${CMAKE_SOURCE_DIR}/shared/res/${DESKTOP_ICON} DESTINATION /opt/usr/apps/${PACKAGE_NAME}/shared/res) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -Wall -fPIC -pipe -Wl,--allow-shlib-undefined -D__DEBUG_MSG__") +#SET(CMAKE_C_FLAGS " -fPIE -Wall -lstdc++") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie") + + diff --git a/coretbtwidgetapp-dali/packaging/org.tizen.coretbtwidgetapp-dali.spec b/coretbtwidgetapp-dali/packaging/org.tizen.coretbtwidgetapp-dali.spec new file mode 100755 index 0000000..694a46e --- /dev/null +++ b/coretbtwidgetapp-dali/packaging/org.tizen.coretbtwidgetapp-dali.spec @@ -0,0 +1,98 @@ +Name: org.tizen.coretbtwidgetapp-dali +Version: 0.0.1 +Release: 1 +License: To be filled +Summary: TBT GBS +Group: System/Libraries +Source0: %{name}-%{version}.tar.gz + +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: cmake +BuildRequires: edje-tools +BuildRequires: efl-assist-devel +BuildRequires: gettext-tools +BuildRequires: hash-signer +BuildRequires: pkgconfig(accounts-svc) +BuildRequires: pkgconfig(appcore-common) +BuildRequires: pkgconfig(appcore-efl) +BuildRequires: pkgconfig(appsvc) +BuildRequires: pkgconfig(badge) +BuildRequires: pkgconfig(bundle) +BuildRequires: pkgconfig(capi-appfw-app-control) +BuildRequires: pkgconfig(capi-appfw-package-manager) +BuildRequires: pkgconfig(capi-appfw-widget-application) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(capi-message-port) +BuildRequires: pkgconfig(capi-messaging-messages) +BuildRequires: pkgconfig(db-util) +BuildRequires: pkgconfig(dbus-glib-1) +BuildRequires: pkgconfig(deviced) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(ecore-evas) +BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(edje) +BuildRequires: pkgconfig(efl-extension) +BuildRequires: pkgconfig(embryo) +BuildRequires: pkgconfig(evas) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(gobject-2.0) + + +%description +Platform Project + +%define _shortname coretbtwidgetapp-dali +%define _optdir /opt +%define _usrdir /opt/usr +%define _appdir /opt/usr/apps +%define _pkgdir %{_appdir}/%{name} +%define _bindir %{_pkgdir}/bin +%define _libdir %{_pkgdir}/lib +%define _resdir %{_pkgdir}/res +%define _shareddir %{_pkgdir}/shared +%define _sharedreddir %{_pkgdir}/shared/res +%define _manifestdir /opt/share/packages +%define _desktopicondir /opt/share/icons/default/small +%define _desktopicon %{_shortname}.png + +%prep +%setup -q + +%build +cmake \ + -DCMAKE_INSTALL_PREFIX=%{_pkgdir} \ + -DPACKAGE_NAME=%{name} \ + -DBINDIR=%{_bindir} \ + -DLIBDIR=%{_libdir} \ + -DRESDIR=%{_resdir} \ + -DMANIFESTDIR=%{_manifestdir} \ + -DSHAREDDIR=%{_sharedreddir} \ + -DDESKTOP_ICONDIR=%{_desktopicondir} \ + -DDESKTOP_ICON=%{_desktopicon} \ + -DNAME=%{_shortname} \ + -DVERSION=%{version} \ + -DCMAKE_BUILD_TYPE=%{BUILD_TYPE} \ + +make %{?jobs:-j%jobs} + +%install +%make_install +mkdir -p %{buildroot}%{_appdir}/%{name} +%clean +rm -rf %{buildroot} + +%post +chown -R 5000:5000 %{_resdir} +chsmack -a %{name} %{_resdir} +%postun + +%files +%{_manifestdir}/%{name}.xml +%{_desktopicondir}/%{_desktopicon} +%{_sharedreddir}/%{_desktopicon} +%{_bindir}/%{_shortname} + + + + diff --git a/coretbtwidgetapp-dali/shared/res/coretbtwidgetapp.png b/coretbtwidgetapp-dali/shared/res/coretbtwidgetapp.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/coretbtwidgetapp-dali/shared/res/coretbtwidgetapp.png differ diff --git a/coretbtwidgetapp-dali/shared/res/icon.png b/coretbtwidgetapp-dali/shared/res/icon.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/coretbtwidgetapp-dali/shared/res/icon.png differ diff --git a/coretbtwidgetapp-dali/shared/res/preview.png b/coretbtwidgetapp-dali/shared/res/preview.png new file mode 100644 index 0000000..acf5670 Binary files /dev/null and b/coretbtwidgetapp-dali/shared/res/preview.png differ diff --git a/coretbtwidgetapp-dali/src/hello-world-example.cpp b/coretbtwidgetapp-dali/src/hello-world-example.cpp new file mode 100644 index 0000000..39fa54c --- /dev/null +++ b/coretbtwidgetapp-dali/src/hello-world-example.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017 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. + * + */ + +#include + +using namespace Dali; +using Dali::Toolkit::TextLabel; + +// This example shows how to create and display Hello World! using a simple TextActor +// +class HelloWorldController : public ConnectionTracker +{ +public: + + HelloWorldController( Application& application ) + : mApplication( application ) + { + // Connect to the Application's Init signal + mApplication.InitSignal().Connect( this, &HelloWorldController::Create ); + } + + ~HelloWorldController() + { + // Nothing to do here; + } + + // The Init signal is received once (only) during the Application lifetime + void Create( Application& application ) + { + // Get a handle to the stage + Stage stage = Stage::GetCurrent(); + stage.SetBackgroundColor( Color::WHITE ); + + TextLabel textLabel = TextLabel::New( "Hello World" ); + textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + textLabel.SetName( "helloWorldLabel" ); + stage.Add( textLabel ); + + // Respond to a click anywhere on the stage + stage.GetRootLayer().TouchSignal().Connect( this, &HelloWorldController::OnTouch ); + } + + bool OnTouch( Actor actor, const TouchData& touch ) + { + // quit the application + mApplication.Quit(); + return true; + } + +private: + Application& mApplication; +}; + +int DALI_EXPORT_API main( int argc, char **argv ) +{ + Application application = Application::New( &argc, &argv ); + HelloWorldController test( application ); + application.MainLoop(); + return 0; +} diff --git a/coretbtwidgetapp-dali/tizen-manifest.xml b/coretbtwidgetapp-dali/tizen-manifest.xml new file mode 100644 index 0000000..8403fe6 --- /dev/null +++ b/coretbtwidgetapp-dali/tizen-manifest.xml @@ -0,0 +1,10 @@ + + + + + + icon.png + 2x2 + + true + diff --git a/release/binary-armv7l/org.tizen.coretbtwidgetapp-dali-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.coretbtwidgetapp-dali-1.0.0-arm.tpk new file mode 100755 index 0000000..be79ac8 Binary files /dev/null and b/release/binary-armv7l/org.tizen.coretbtwidgetapp-dali-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk index b2ec598..a708561 100755 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk old mode 100644 new mode 100755 index 26cf797..2a40472 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-dali-1.0.0-arm.tpk differ diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-widget-new-dali-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-widget-new-dali-1.0.0-arm.tpk new file mode 100755 index 0000000..3f19d8b Binary files /dev/null and b/release/binary-armv7l/org.tizen.tbtcoreapp-widget-new-dali-1.0.0-arm.tpk differ diff --git a/release/binary-x86/org.tizen.coretbtwidgetapp-dali-1.0.0-x86.tpk b/release/binary-x86/org.tizen.coretbtwidgetapp-dali-1.0.0-x86.tpk new file mode 100755 index 0000000..1d1e801 Binary files /dev/null and b/release/binary-x86/org.tizen.coretbtwidgetapp-dali-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk index e8c198c..f39eeeb 100755 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-x86.tpk b/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-x86.tpk old mode 100644 new mode 100755 index 8726f16..d9aeacc Binary files a/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-dali-1.0.0-x86.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-widget-new-dali-1.0.0-x86.tpk b/release/binary-x86/org.tizen.tbtcoreapp-widget-new-dali-1.0.0-x86.tpk new file mode 100755 index 0000000..04dd62e Binary files /dev/null and b/release/binary-x86/org.tizen.tbtcoreapp-widget-new-dali-1.0.0-x86.tpk differ diff --git a/scripts_tpk/tpkbuild.sh b/scripts_tpk/tpkbuild.sh index aaa51c3..de5d98c 100755 --- a/scripts_tpk/tpkbuild.sh +++ b/scripts_tpk/tpkbuild.sh @@ -130,7 +130,7 @@ elif [ "$ARCH_TYPE" == "aarch64" ]; then elif [ "$ARCH_TYPE" == "x86_64" ]; then ARCH="x86_64" fi -modulearray=(org.tizen.coretbt_dataprovider org.tizen.coretbt_serviceapp org.tizen.coretbt_uiapp org.tizen.operationpickviewapp org.tizen.coretbtwidgetapp org.tizen.tbtcoreapp org.tizen.tbt-ime org.tizen.tbtcoreapp-dali org.tizen.tbt_pushtestapp org.tizen.tbt_ui_viewmgr org.example.multiclass) +modulearray=(org.tizen.coretbt_dataprovider org.tizen.coretbt_serviceapp org.tizen.coretbt_uiapp org.tizen.operationpickviewapp org.tizen.coretbtwidgetapp org.tizen.tbtcoreapp org.tizen.tbt-ime org.tizen.tbtcoreapp-dali org.tizen.tbt_pushtestapp org.tizen.tbt_ui_viewmgr org.example.multiclass org.tizen.coretbtwidgetapp-dali org.tizen.tbtcoreapp-widget-new-dali) echo $TC_TYPE echo $MOD_NAME sdb root on diff --git a/tbtcoreapp-dali/inc/view/tbt-dali-widget-custom-view.h b/tbtcoreapp-dali/inc/view/tbt-dali-widget-custom-view.h new file mode 100644 index 0000000..42ef0b4 --- /dev/null +++ b/tbtcoreapp-dali/inc/view/tbt-dali-widget-custom-view.h @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ +/** + * @file tbt-dali-widget-custom-view.h + * @brief To test functionality of dali widget + * + * @author Awadhesh Singh (awadhesh1.s@samsung.com) + * @date July, 2018 + * @credit + * + */ + +#ifndef __TBT_MODULE_APP_DALI_CUSTOM_WIDGET +#define __TBT_MODULE_APP_DALI_CUSTOM_WIDGET +#include "utils/logger.h" +#include "utils/config.h" +#include "utils/ui-utils.h" +#include "utils/dali-ui-utils.h" + +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +class WidgetApplicationController : public ConnectionTracker +{ +public: + WidgetApplicationController(WidgetApplication& application); + void Create(Application& application); + bool OnWidgetAdded(Toolkit::Button button ); + bool OnWidgetDeleted(Toolkit::Button button ); + PushButton btnAdd; + PushButton btnRemove; + TableView mTableView; + bool OnButtonClicked_add( Button button ); + bool OnButtonClicked_remove( Button button ); + + private: + void OnKeyEvent(const KeyEvent& event); + WidgetApplication & mApplication; + WidgetView::WidgetViewManager mWidgetViewManager; + WidgetView::WidgetView mWidgetView; +}; +#endif diff --git a/tbtcoreapp-dali/src/view/tbt-dali-widget-custom-view.cpp b/tbtcoreapp-dali/src/view/tbt-dali-widget-custom-view.cpp new file mode 100644 index 0000000..347e480 --- /dev/null +++ b/tbtcoreapp-dali/src/view/tbt-dali-widget-custom-view.cpp @@ -0,0 +1,104 @@ + +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ +/** + * @file tbt-dali-widget-custom-view.cpp + * @brief To test functionality of dali widget + * + * @author Awadhesh Singh (awadhesh1.s@samsung.com) + * @date December, 2016 + * @credit + * + */ + +#include "view/tbt-dali-widget-custom-view.h" +WidgetApplicationController::WidgetApplicationController(WidgetApplication& application):mApplication(application) +{ + DBG(">>>>>>WidgetApplicationController "); + mApplication.InitSignal().Connect(this,&WidgetApplicationController::Create); +} +static Dali::Widget CreatingWidgetFunction(const std::string& widgetName) +{ + DBG(">>>>>>CreateWidgetFunction "); + Dali::Widget widget = Dali::Widget::New(); + return widget; +} +void WidgetApplicationController::Create(Application& application) +{ + DBG(">>>>Create called "); + Stage stage = Stage::GetCurrent(); + stage.SetBackgroundColor( Color::BLACK ); + stage.KeyEventSignal().Connect( this, &WidgetApplicationController::OnKeyEvent ); + + + mWidgetViewManager = WidgetView::WidgetViewManager::New( mApplication, "org.tizen.tbtcoreapp-dali" ); + + PushButton button = PushButton::New(); + button.ClickedSignal().Connect( this, &WidgetApplicationController::OnWidgetDeleted ); + button.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); + button.SetAnchorPoint( ParentOrigin::BOTTOM_LEFT ); + button.SetProperty(Button::Property::LABEL, "Delete Widget"); + button.SetPosition( 0, 0 ); + button.SetSize(300,100); + stage.Add( button ); + + PushButton button2 = PushButton::New(); + button2.ClickedSignal().Connect( this, &WidgetApplicationController::OnWidgetAdded ); + button2.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); + button2.SetAnchorPoint( ParentOrigin::BOTTOM_RIGHT ); + button2.SetProperty(Button::Property::LABEL, "Add Widget"); + button2.SetPosition( 0, 0 ); + button2.SetSize(300,100); + stage.Add( button2 ); + mApplication.RegisterWidgetCreatingFunction("org.tizen.coretbtwidgetapp-dali",CreatingWidgetFunction); + +} +bool WidgetApplicationController::OnWidgetAdded(Toolkit::Button button ) +{ + DBG("TBTDaliWidgetView::OnWidgetAdded"); + if(!mWidgetView) + { + mWidgetView = mWidgetViewManager.AddWidget("org.tizen.coretbtwidgetapp-dali","",480,680,-1); + mWidgetView.SetParentOrigin( ParentOrigin::CENTER ); + mWidgetView.SetAnchorPoint( AnchorPoint::CENTER ); + mWidgetView.SetBackgroundColor( Vector4(0.0f, 0.0f, 0.0f, 0.0f) ); + Stage::GetCurrent().Add( mWidgetView ); + } + +} + +bool WidgetApplicationController::OnWidgetDeleted(Toolkit::Button button ) +{ + DBG("TBTDaliWidgetView::OnWidgetDeleted"); + if(mWidgetView) + { + mWidgetView.TerminateWidget(); + Stage::GetCurrent().Remove( mWidgetView ); + mWidgetView.Reset(); + } +} + +void WidgetApplicationController::OnKeyEvent(const KeyEvent& event) +{ + if(event.state == KeyEvent::Down) + { + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) + { + mApplication.Quit(); + } + } +} + diff --git a/tbtcoreapp-widget-new-dali/.cproject b/tbtcoreapp-widget-new-dali/.cproject new file mode 100644 index 0000000..0dd8080 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/.cproject @@ -0,0 +1,618 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tbtcoreapp-widget-new-dali/.exportMap b/tbtcoreapp-widget-new-dali/.exportMap new file mode 100644 index 0000000..43e310e --- /dev/null +++ b/tbtcoreapp-widget-new-dali/.exportMap @@ -0,0 +1,4 @@ +{ + global: main; + local: *; +}; diff --git a/tbtcoreapp-widget-new-dali/.gitignore b/tbtcoreapp-widget-new-dali/.gitignore new file mode 100644 index 0000000..65fa71e --- /dev/null +++ b/tbtcoreapp-widget-new-dali/.gitignore @@ -0,0 +1,2 @@ +/Debug +/SA_Report diff --git a/tbtcoreapp-widget-new-dali/.package-stamp b/tbtcoreapp-widget-new-dali/.package-stamp new file mode 100644 index 0000000..40cbe59 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/.package-stamp @@ -0,0 +1 @@ +TPK \ No newline at end of file diff --git a/tbtcoreapp-widget-new-dali/.project b/tbtcoreapp-widget-new-dali/.project new file mode 100644 index 0000000..679ac4a --- /dev/null +++ b/tbtcoreapp-widget-new-dali/.project @@ -0,0 +1,26 @@ + + + tbtcoreapp-widget-new-dali + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/tbtcoreapp-widget-new-dali/.rds_delta b/tbtcoreapp-widget-new-dali/.rds_delta new file mode 100644 index 0000000..63a4f78 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/.rds_delta @@ -0,0 +1,29 @@ +#delete +#add +#modify +author-signature.xml +signature1.xml +bin/tbtcoreapp-widget-new-dali +res/dali-toolkit-test-theme_720x1280.json +res/images/Default_home.png +res/images/customTextFieldBgImage.jpg +res/images/gallery-medium-1.jpg +res/images/gallery-medium-10.jpg +res/images/gallery-medium-11.jpg +res/images/gallery-medium-12.jpg +res/images/gallery-medium-13.jpg +res/images/gallery-medium-14.jpg +res/images/gallery-medium-2.jpg +res/images/gallery-medium-3.jpg +res/images/gallery-medium-4.jpg +res/images/gallery-medium-5.jpg +res/images/gallery-medium-6.jpg +res/images/gallery-medium-7.jpg +res/images/gallery-medium-8.jpg +res/images/gallery-medium-9.jpg +res/images/innerButtonSelected.png +res/images/innerButtonUnselected.png +res/images/text-field-bg.9.png +res/images/top-bar.png +shared/res/tbtcoreapp-dali.png +tizen-manifest.xml diff --git a/tbtcoreapp-widget-new-dali/.sdk_delta.info b/tbtcoreapp-widget-new-dali/.sdk_delta.info new file mode 100644 index 0000000..23e34c5 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/.sdk_delta.info differ diff --git a/tbtcoreapp-widget-new-dali/.tproject b/tbtcoreapp-widget-new-dali/.tproject new file mode 100644 index 0000000..658e81b --- /dev/null +++ b/tbtcoreapp-widget-new-dali/.tproject @@ -0,0 +1,12 @@ + + + + + mobile-5.0 + + + + + + + diff --git a/tbtcoreapp-widget-new-dali/inc/model/tbt-info.h b/tbtcoreapp-widget-new-dali/inc/model/tbt-info.h new file mode 100644 index 0000000..a2ad01c --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/model/tbt-info.h @@ -0,0 +1,395 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + +/** + * @file tbt-info.h + * @brief This file provides the basic structure of all modules. + * @since_tizen 2.3 + * @author Amlan Chowdhury (amlan.c@samsung.com) + * @date October, 2014 + * @bug + * @credit + */ +#ifndef __TBT_INFO_H__ +#define __TBT_INFO_H__ + +#include +#include + +typedef struct _tbt_info tbt_info; + +typedef enum{ + TBT_INFO_RESULT_NOT_TESTED=0, + TBT_INFO_RESULT_PASS=1, + TBT_INFO_RESULT_FAIL=2, + TBT_INFO_RESULT_NOT_SUPPORTED=3 +} tbt_info_result; + +/** + * @brief main Item for tbt list + * @since_tizen 2.3 + */ +typedef enum { + TBT_APP_CAMERA_CAPTURE = 0, + TBT_APP_CAMERA_RECORD, + TBT_APP_CAMERA_FACE_DETECT, + TBT_APP_CAMERA_HDR_CAPTURE, + + TBT_APP_SOUND_AUDIO, + TBT_APP_SOUND_VOLUME, + + TBT_APP_GPS_GPS, + + TBT_APP_BT_CLIENT_PAIRED, + TBT_APP_BT_SERVER_PAIRED, + TBT_APP_BT_AUDIO_CONNECT, + TBT_APP_BT_AUDIO_CONNECT_HANDSFREE, + TBT_APP_BT_AUTHORIZATION, + TBT_APP_BT_OPP_CLIENT, + TBT_APP_BT_OPP_SERVER, + TBT_APP_BT_PROFILES, + TBT_APP_BT_SDP, + TBT_APP_BT_SERVER_SOCKET, + TBT_APP_BT_CLIENT_SOCKET, + TBT_APP_BT_HID_CONNECT, + TBT_APP_BT_OOB_PERIPHERAL, + TBT_APP_BT_OOB_DEVICE, + TBT_APP_BT_AVRCP, + TBT_APP_BT_AG, + TBT_APP_BT_HDP, + + TBT_APP_BLE_GATT_CLIENT, + + TBT_APP_BT_CALLBACK_CREATE_BOND_TEST, + TBT_APP_BT_CALLBACK_DESTROY_BOND_TEST, + TBT_APP_BT_CALLBACK_DISCOVER_DEVICES_TEST, + TBT_APP_BT_CALLBACK_GET_DEVICE_TEST, + TBT_APP_BT_CALLBACK_SET_NAME_TEST, + TBT_APP_BT_CALLBACK_ADD_ADVERTISING_SERVICE_UUID_TEST, + + + TBT_APP_WIFIDIRECT, + TBT_APP_WIFIDIRECT_CONNECTION_CANCEL, + + TBT_APP_WIFI_WIFI, + + TBT_APP_NFC_P2P, + TBT_APP_NFC_TAG, + + TBT_APP_DISPLAY_DISPLAY, + + TBT_APP_GRAPHICS_GRAPHICS, + + TBT_APP_IDEV_NUM_KEYPAD, + TBT_APP_IDEV_PH_NUM_KEYPAD, + TBT_APP_IDEV_IP_KEYPAD, + + TBT_APP_LOCAL_MPEG4, + TBT_APP_LOCAL_H263, + TBT_APP_LOCAL_H264, + + TBT_APP_IMAGEVIEW_JPEG, + TBT_APP_IMAGEVIEW_BMP, + TBT_APP_IMAGEVIEW_GIF, + TBT_APP_IMAGEVIEW_PNG, + + TBT_APP_DC_INSERT, + TBT_APP_DC_DELETE, + TBT_APP_DC_UPDATE, + TBT_APP_DC_SELECT, + TBT_APP_DC_CURSOR, + TBT_APP_DC_MAP, + + TBT_APP_PICK_VIEW_APP, + TBT_APP_PICK_PICK_APP, + + TBT_APP_PICK_VIEW_BR0WSER_APP, + TBT_APP_PICK_VIEW_IMAGE_APP, + TBT_APP_PICK_VIEW_SOUND_APP, + TBT_APP_PICK_VIEW_VIDEO_APP, + TBT_APP_PICK_PICK_ALL_APP, + TBT_APP_PICK_PICK_IMAGE_APP, + TBT_APP_PICK_PICK_VIDEO_APP, + TBT_APP_PICK_PICK_AUDIO_APP, + + TBT_APP_SENSOR_ACCELEROMETER, + TBT_APP_SENSOR_GYROSCOPE, + TBT_APP_SENSOR_PROXIMITY, + TBT_APP_SENSOR_LIGHT, + TBT_APP_SENSOR_ULTRA_VIOLET, + TBT_APP_SENSOR_MAGNATOMETER, + TBT_APP_SENSOR_PRESSURE, + + + TBT_APP_ANIMATION_FADE, + TBT_APP_ANIMATION_POINT, + TBT_APP_ANIMATION_DIMENSION, + TBT_APP_ANIMATION_RECT, + TBT_APP_ANIMATION_ROTATE, + + TBT_APP_UI_RESIZE, + TBT_APP_UI_SHAPE, + TBT_APP_UI_ROTATE, + TBT_APP_UI_FONT, + TBT_APP_UI_LINE, + TBT_APP_UI_ALPHA, + + TBT_APP_SL_SCREENLOCK, + + TBT_APP_TOUCH_TOUCH, + + TBT_APP_MOCK, + TBT_APP_EVENT_VIEW, + + TBT_APP_FEATURE_SUMMARY, + + TBT_APP_RUNTIME_INFO, + + TBT_APP_SCREEN_MIRROR_SINK, + + TBT_APP_ATTACH_PANEL, + + TBT_APP_OAUTH2, + + TBT_APP_PUSH_SERVICE, + + TBT_APP_MAX, + + TBT_APP_EFL_CALLBACK, + + TBT_APP_SHORTCUT, + + TBT_APP_IME_ALPHABATIC, + + TBT_APP_IME_NUMERIC, + + TBT_APP_IME_EVENT, + + TBT_APP_IME_CONTEXT_GET, + + TBT_APP_WIDGET, + + TBT_APP_MTP, + + TBT_APP_NSD_DNS_SD_LOCAL, + + TBT_APP_NSD_DNS_SD_REMOTE, + + TBT_APP_NSD_SSDP_LOCAL, + + TBT_APP_NSD_SSDP_REMOTE, + + TBT_APP_STORAGE, + + TBT_APP_RADIO, + + TBT_APP_SOUND_MANAGER, + + TBT_APP_SOUND_MANAGER_DEVICE, + + TBT_APP_MEDIA_KEY, + + TBT_APP_PACKAGE_MANAGER, + + TBT_APP_NOTIFICATION_TEXT, + + TBT_APP_NOTIFICATION_TIME, + + TBT_APP_NOTIFICATION_TITLE, + + TBT_APP_NOTIFICATION_IMAGE, + + TBT_APP_CONNECTION, + + TBT_APP_SYSTEM_SETTINGS, + + TBT_APP_CONTACTS, + + TBT_APP_DALI_DALI + +} tbt_app_type_e; + + +/** + * @brief Measurement units for sensors + * @since_tizen 2.3 + */ +typedef enum { + SENSOR_UNIT_METRE_PER_SECOND_SQUARED, + SENSOR_UNIT_MICRO_TESLA, + SENSOR_UNIT_DEGREE, + SENSOR_UNIT_LUX, + SENSOR_UNIT_CENTIMETER, + SENSOR_UNIT_DEGREE_PER_SECOND, + SENSOR_UNIT_HECTOPASCAL, + SENSOR_UNIT_MAX +} sensor_unit_e; + + + +/** + * @brief Extra value getter function + * @since_tizen 2.3 + * @param[in] info Sensor info + * @param[in] values Values received from the sensor + * @return Calculated value + */ +typedef float (*sensor_extra_value_get_cb)(const tbt_info *info, const float *values); + +/** + * @brief Extra value associated with the sensor + * @since_tizen 2.3 + * @details Allows to add value which is not received from the sensor, + * but instead calculated based on sensor values + */ +typedef struct _sensor_extra_value +{ + const char *name; /**< Value name */ + const char *format; /**< Value printf() format for text representation */ + sensor_extra_value_get_cb value_get; /**< Value getter function */ +} sensor_extra_value; + +/** + * @brief Module metadata + * @since_tizen 2.3 + */ +struct _tbt_info +{ + + const char *name; //tbt display name + const char *parent; //tbt display name + tbt_app_type_e apptype; //Values measurement units + tbt_info_result result; //app status: pass or fail + const char *info; //Values measurement units string representation + const char *icon_name; //Values measurement units string representation + const char *file_name; //Values measurement units string representation + const char *extra_file_name; + const char *layout_file; //Values measurement units string representation + const char *layout_group; //Values measurement units string representation + sensor_h sensor; /**< Sensor handle */ + sensor_type_e sensortype; /**< Sensor type, @see sensor_type_e */ + sensor_unit_e units; /**< Values measurement units */ + int sensor_response_interval; + const char **value_names; /**< Value names array of value_count size */ + int value_count; /**< Values count */ + float value_min; /**< Minimal value */ + float value_max; /**< Maximal value */ + float value_range; /**< Values range */ + const char *units_str; /**< Values measurement units string representation */ + const char *value_format; /**< Values printf() format for text representation */ + int axes[3]; /**< Sensor axes directions relative to screen coordinate system */ + sensor_extra_value *extra_values; /**< Sensor variable to retrieve the sensor extra values */ + int extra_value_count; /**< The count of the extra values */ + bool is_push_from_outside; /**< Checks if push data is received or not */ + char* push_operation_id; /**< Operation id of push data */ + app_control_h push_app_control; /**< App conrol handler*/ + int required_features_count; /**< Number of features required */ + int features_required[16]; /**< Index/indexs of features required */ + +}; + +/** + * @brief Feature List + * @since_tizen 2.3 + */ +static char *feature_list[1024] = +{ + "tizen.org/feature/camera", + "tizen.org/feature/camera.back", + "tizen.org/feature/camera.back.flash", + "tizen.org/feature/camera.front", + "tizen.org/feature/camera.front.flash", + "tizen.org/feature/database.encryption", + "tizen.org/feature/fmradio", + "tizen.org/feature/graphics.acceleration", + "tizen.org/feature/input.keyboard", + "tizen.org/feature/input.keyboard.layout", + "tizen.org/feature/location", + "tizen.org/feature/location.gps", + "tizen.org/feature/location.wps", + "tizen.org/feature/microphone", + "tizen.org/feature/multi_point_touch.point_count", + "tizen.org/feature/multi_point_touch.pinch_zoom", + "tizen.org/feature/network.bluetooth", + "tizen.org/feature/network.nfc", + "tizen.org/feature/network.nfc.reserved_push", + "tizen.org/feature/network.push", + "tizen.org/feature/network.secure_element", + "tizen.org/feature/network.telephony", + "tizen.org/feature/network.telephony.mms", + "tizen.org/feature/network.telephony.sms.cbs", + "tizen.org/feature/network.wifi", + "tizen.org/feature/network.wifi.direct", + "tizen.org/feature/opengles.texture_format.3dc", + "tizen.org/feature/opengles.texture_format.atc", + "tizen.org/feature/opengles.texture_format.etc", + "tizen.org/feature/opengles.texture_format.ptc", + "tizen.org/feature/opengles.texture_format.pvrtc", + "tizen.org/feature/opengles.texture_format.utc", + "tizen.org/feature/opengles.version.1_1", + "tizen.org/feature/opengles.version.2_0", + "tizen.org/feature/platform.core.cpu.arch.armv7", + "tizen.org/feature/platform.core.fpu.arch.sse2", + "tizen.org/feature/platform.core.fpu.arch.sse3", + "tizen.org/feature/platform.core.fpu.arch.ssse3", + "tizen.org/feature/platform.core.fpu.arch.vfpv3", + "tizen.org/feature/platform.core.cpu.arch.x86", + "tizen.org/feature/platform.native.osp_compatible", + "tizen.org/feature/screen.auto_rotation", + "tizen.org/feature/sensor.accelerometer", + "tizen.org/feature/sensor.accelerometer.wakeup", + "tizen.org/feature/sensor.gyroscope", + "tizen.org/feature/sensor.gyroscope.wakeup", + "tizen.org/feature/sensor.magnetometer", + "tizen.org/feature/sensor.magnetometer.wakeup", + "tizen.org/feature/sensor.proximity", + "tizen.org/feature/sensor.proximity.wakeup", + "tizen.org/feature/sensor.tiltmeter", + "tizen.org/feature/sensor.tiltmeter.wakeup", + "tizen.org/feature/shell.appwidget", + "tizen.org/feature/network.bluetooth", + "tizen.org/feature/sip.voip", + "tizen.org/feature/speech.recognition", + "tizen.org/feature/speech.synthesis", + "tizen.org/feature/usb.accessory", + "tizen.org/feature/usb.host", + "tizen.org/feature/vision.face_recognition", + "tizen.org/feature/vision.image_recognition", + "tizen.org/feature/vision.qrcode_generation", + "tizen.org/feature/vision.qrcode_recognition", + "tizen.org/feature/bluetooth", + "tizen.org/feature/bluetooth.le", + "tizen.org/feature/network.bluetooth.le", + "tizen.org/feature/bluetooth.audio.media", + "tizen.org/feature/network.bluetooth.audio.media", + "tizen.org/feature/bluetooth.audio.call", + "tizen.org/feature/network.bluetooth.audio.call", + "tizen.org/feature/bluetooth.hdp", + "tizen.org/feature/network.bluetooth.hdp" + "tizen.org/feature/bluetooth.hid", + "tizen.org/feature/network.bluetooth.hid", + "tizen.org/feature/bluetooth.opp", + "tizen.org/feature/network.bluetooth.opp", + "tizen.org/feature/bluetooth.spp", + "tizen.org/feature/network.nfc.p2p", + "tizen.org/feature/network.nfc.tag", + "tizen.org/feature/network.wifi.direct.display", + "tizen.org/feature/network.internet", + "tizen.org/feature/notification" +}; + +#endif /* __TBT_INFO_H__ */ diff --git a/tbtcoreapp-widget-new-dali/inc/model/tbt-list.h b/tbtcoreapp-widget-new-dali/inc/model/tbt-list.h new file mode 100644 index 0000000..655f63b --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/model/tbt-list.h @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + +/** + * @file tbt-list.h + * @brief This file Handles main List of Application. + * @since_tizen 2.3 + * @author Amlan Chowdhury (amlan.c@samsung.com) + * @date October, 2014 + * @bug + * @credit + */ + +#ifndef __TBT_LIST_H__ +#define __TBT_LIST_H__ + +#include "tbt-info.h" + +/** + * @brief Initialize sensor info list + * @since_tizen 2.3 + */ +void tbt_list_init(); + +/** + * Save xml report file for future use + * @since_tizen 2.3 + */ +void tbt_save_report(); + +/** + * @brief Get list of tbt list supported by application + * @since_tizen 2.3 + * @param[out] count tbts list count + * @return Sensor list + */ +const tbt_info *tbt_list_get(unsigned *count); + +/** + * Returns total count of tbt_info; + * @since_tizen 2.3 + */ +const int tbt_info_count(); + +/** + * @brief Get list of tbt list supported by application + * @since_tizen 2.3 + * @param[out] count tbts list count + * @return Sensor list + */ +tbt_info *tbt_list_item_get(int index); + +/** + * @brief Get list item index of tbt list supported by application + * @since_tizen 2.3 + * @param[out] count tbts list count + * @return Sensor list + */ +const int tbt_list_item_index_get_by_app_type(int app_type); +/** + * @brief Get list item count tbt list supported by application + * @since_tizen 2.3 + * @param[out] count tbts list count + * @return Sensor list + */ +const int tbt_list_item_count(int index); + +#endif /* __TBT_LIST_H__ */ diff --git a/tbtcoreapp-widget-new-dali/inc/utils/app_module_config.h b/tbtcoreapp-widget-new-dali/inc/utils/app_module_config.h new file mode 100644 index 0000000..3e06a29 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/utils/app_module_config.h @@ -0,0 +1,14 @@ +#ifndef _EXCLUDE_LIST_H +#define _EXCLUDE_LIST_H + +//#define TIZEN_2_3_1 +//#define TIZEN_2_4 +#define TIZEN_3_0 + +#define DEVICE_TYPE_MOBILE +//#define DEVICE_TYPE_WEARABLE + +#define TBT_MODULE_DALI +#define TBT_MODULE_APP_DALI_TTS + +#endif diff --git a/tbtcoreapp-widget-new-dali/inc/utils/config.h b/tbtcoreapp-widget-new-dali/inc/utils/config.h new file mode 100644 index 0000000..5d3dd1d --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/utils/config.h @@ -0,0 +1,375 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + +/** + * @file config.h + * @brief This file Configures the Application. + * @since_tizen 2.3 + * @author Kallol Kumar Pal(kallol.kumar@samsung.com) and Amlan Chowdhury(amlan.c@samsung.com) + * @date October, 2014 + * @bug + * @credit + */ +#ifndef CONFIG_H_ +#define CONFIG_H_ + +#include "utils/app_module_config.h" +#include +#include +#include +#include +#include +#include +#include "utils/logger.h" +#include +#include + +#define MAX_LENGTH_CONFIG 1024 + +#define EDJPATH "edje" +#define AUDIOPATH "sounds" +#define VIDEOPATH "video" +#define IMAGEPATH "images" + +extern bool __is_efl_test_running; + +//Push: +#define PUSH_APP_ID "da58f09b7dcd898f" +#define PUSH_APP_SECRET "E55A746761233098DDD1114F652AFE51" + + +// *_X_POS, *_Y_POS, *_WIDTH, *_HEIGHT are virtual (relative) coords of grid widget +#define MAX_WIDTH 100 +#define MAX_HEIGHT 100 + +#define IMAGE_X_POS 0 +#define IMAGE_Y_POS 0 +#define IMAGE_WIDTH MAX_WIDTH +#define IMAGE_HEIGHT 40 + +#define LABEL_X_POS 0 +#define LABEL_Y_POS IMAGE_HEIGHT +#define LABEL_WIDTH MAX_WIDTH +#define LABEL_HEIGHT MAX_WIDTH-IMAGE_HEIGHT + +#define LABEL_MAX_LEN 500 + +#define IMAGES_REL_FOLDER "images" +#define IMAGE_REL_PATH_TEMPLATE "%s/%s" + +#define TOOLBAR_BUTTON_DATA_KEY "button_id" + +#define LABEL_REL_PATH "res/IMAGES_REL_FOLDER/" +#define LABEL_TEMPLATE "%s%s
Dimension = %u x %u
Result:E_SUCCESS" + +#define TABLE_PADDING_VERTICAL 20 +#define TABLE_PADDING_HORIZONTAL 20 + +#define NAVI_TOOLBAR_HEIGHT 150 + +#ifdef TIZEN_2_3_1 + #define WINDOW_PREFERED_ENGINE "opengl_x11" +#else + #define WINDOW_PREFERED_ENGINE "3d" +#endif + + +#define PICK_VIEW_APP_PACKAGE_NAME "org.tizen.coretbt_uiapp"; +#define PICK_VIEW_SERVICEAPP_PACKAGE_NAME "org.tizen.coretbt_serviceapp"; + + +#define PICK_VIEW_URL_HTTP "http://www.tizen.org" +#define PICK_VIEW_URL_HTTPS "https://www.tizen.org/" + +#define PICK_VIEW_IMAGE_BMP "images/zebra_1024_680.bmp" +#define PICK_VIEW_IMAGE_JPG "images/giraffe_800_1179.jpg" +#define PICK_VIEW_IMAGE_GIF "images/squee.gif" +#define PICK_VIEW_IMAGE_PNG "images/plane_1024_768.png" + +#define PICK_VIEW_SOUND_AAC "sounds/SampleAAC.aac" +#define PICK_VIEW_SOUND_AMR "sounds/SampleAMR.amr" +#define PICK_VIEW_SOUND_MP3 "sounds/SampleMP3.mp3" +#define PICK_VIEW_SOUND_WAV "sounds/SampleWAV.wav" + +#define PICK_VIEW_VIDEO_3GP "video/sampleH263.3gp" +#define PICK_VIEW_VIDEO_MP4 "video/sampleMPEG4.mp4" + + + + +#define WIDGET_VIEW_APPID "org.tizen.coretbtwidgetapp"; +#define VIEWER_VIEW_APP_PACKAGE_NAME "org.tizen.widget_viewer_sdk"; + +#define DATA_CONTROL_PROVIDER_MAP_ID "MapRepository"; +#define DATA_CONTROL_PROVIDER_DATA_ID "provider"; + +#define DATA_CONTROL_PROVIDER_ID "http://coretbt_dataprovider.com/datacontrol/provider/coretbt_dataprovider"; +#define DATA_CONTROL_MAP_PROVIDER_ID "http://coretbt_dataprovider.com/datacontrol/provider/coretbt_dataprovider_map"; + + +#define BLUETOOTH_SOCKET_UUID "00001101-0000-1000-8000-00805F9B34FB" + +#define DEFINED_WIDTH 480 +#define DEFINED_HEIGHT 800 + +//char *TBT_LOGGING_DIR; +//char *TBT_MEDIA_DIR; +//char XML_REPORT_FILE_PATH[128]; +//char MEDIA_FILE_PATH[128]; + + +static inline const char *get_data_path(const char * file_path); +static inline const char *get_resource_path(const char * file_path); +static inline const char *get_shared_resource_path(const char *file_path); + + +typedef enum { + DEVICE_WEARABLE, + DEVICE_MOBILE, + DEVICE_WEARABLE_360_X_480, + DEVICE_WEARABLE_320_X_320, + DEVICE_WEARABLE_CIRCLE, + + DEVICE_NONE, + DEVICE_MAX +}device_type_e; + +static inline device_type_e get_device_type(); + +typedef enum +{ + CURSOR_NONE_PRESSED = -1, + CURSOR_START_PRESSED , + CURSOR_FIRST_PRESSED , + CURSOR_NEXT_PRESSED , + CURSOR_PREVIOUS_PRESSED , + CURSOR_LAST_PRESSED +}_Data_Control_Cursor_State; + +static int _supportedStorageID; +static bool _storage_device_supported_cb(int storage_id, storage_type_e type, storage_state_e state, const char *path, void *user_data) +{ + if(type == STORAGE_TYPE_INTERNAL) + { + // save storage id + _supportedStorageID=storage_id; + return false; + } + return true; +} + +static void +app_get_resource(const char *edj_file_in, char *edj_path_out, int edj_path_max) +{ + char *res_path = app_get_resource_path(); + if (res_path) { + snprintf(edj_path_out, edj_path_max, "%s%s", res_path, edj_file_in); + } +} + +static void +app_get_shared_resource(const char *edj_file_in, char *edj_path_out, int edj_path_max) +{ + char *res_path = app_get_shared_resource_path(); + if (res_path) { + snprintf(edj_path_out, edj_path_max, "%s%s", res_path, edj_file_in); + } +} + +static inline const char *get_edje_path(const char *file_name) +{ +char absolute_path[MAX_LENGTH_CONFIG] = {'\0'}; +char file_path[MAX_LENGTH_CONFIG] = {'\0'}; +#ifdef TIZEN_2_3_1 + #ifdef DEVICE_TYPE_MOBILE + strncat(file_path, "edje/2.3.1/mobile/", sizeof("edje/2.3.1/mobile/")); + #endif + #ifdef DEVICE_TYPE_WEARABLE + if(get_device_type() == DEVICE_WEARABLE) + { + strncat(file_path, "edje/2.3.1/wearable/", sizeof("edje/2.3.1/wearable/")); + } + else if(get_device_type() == DEVICE_WEARABLE_360_X_480) + { + strncat(file_path, "edje/2.3.1/wearable_360_x_480/", sizeof("edje/2.3.1/wearable_360_x_480/")); + } + else if(get_device_type() == DEVICE_WEARABLE_320_X_320) + { + strncat(file_path, "edje/2.3.1/wearable_320_x_320/", sizeof("edje/2.3.1/wearable_320_x_320/")); + } + else if(get_device_type() == DEVICE_WEARABLE_CIRCLE) + { + strncat(file_path, "edje/2.3.1/wearable_circle/", sizeof("edje/2.3.1/wearable_circle/")); + } + #endif +#endif + + + +#ifdef TIZEN_2_4 + #ifdef DEVICE_TYPE_MOBILE + strncat(file_path, "edje/2.4/mobile/", sizeof("edje/2.4/mobile/")); + #endif + #ifdef DEVICE_TYPE_WEARABLE + if(get_device_type() == DEVICE_WEARABLE) + { + strncat(file_path, "edje/2.4/wearable/", sizeof("edje/2.4/wearable/")); + } + else if(get_device_type() == DEVICE_WEARABLE_360_X_480) + { + strncat(file_path, "edje/2.4/wearable_360_x_480/", sizeof("edje/2.4/wearable_360_x_480/")); + } + else if(get_device_type() == DEVICE_WEARABLE_320_X_320) + { + strncat(file_path, "edje/2.4/wearable_320_x_320/", sizeof("edje/2.4/wearable_320_x_320/")); + } + else if(get_device_type() == DEVICE_WEARABLE_CIRCLE) + { + strncat(file_path, "edje/2.4/wearable_circle/", sizeof("edje/2.4/wearable_circle/")); + } + #endif +#endif + + + +#ifdef TIZEN_3_0 + #ifdef DEVICE_TYPE_MOBILE + strncat(file_path, "edje/3.0/mobile/", sizeof("edje/3.0/mobile/")); + #endif + #ifdef DEVICE_TYPE_WEARABLE + if(get_device_type() == DEVICE_WEARABLE) + { + strncat(file_path, "edje/2.4/wearable/", sizeof("edje/2.4/wearable/")); + } + else if(get_device_type() == DEVICE_WEARABLE_360_X_480) + { + strncat(file_path, "edje/2.4/wearable_360_x_480/", sizeof("edje/2.4/wearable_360_x_480/")); + } + else if(get_device_type() == DEVICE_WEARABLE_320_X_320) + { + strncat(file_path, "edje/2.4/wearable_320_x_320/", sizeof("edje/2.4/wearable_320_x_320/")); + } + else if(get_device_type() == DEVICE_WEARABLE_CIRCLE) + { + strncat(file_path, "edje/2.4/wearable_circle/", sizeof("edje/2.4/wearable_circle/")); + } + #endif +#endif + + int num = strlen(file_name); + if(strlen(file_path)+strlen(file_name) <= MAX_LENGTH_CONFIG) + { + num = strlen(file_name); + } + else + { + num = MAX_LENGTH_CONFIG-strlen(file_path); + } + + strncat(file_path,file_name, num); + app_get_resource(file_path, absolute_path, (int)MAX_LENGTH_CONFIG); + return strdup(absolute_path); + +} +static inline const char *get_resource_path(const char *file_path) +{ + static char absolute_path[MAX_LENGTH_CONFIG] = {'\0'}; + app_get_resource(file_path, absolute_path, (int)MAX_LENGTH_CONFIG); + return strdup(absolute_path); +} + +static inline const char *get_shared_resource_path(const char *file_path) +{ + static char absolute_path[MAX_LENGTH_CONFIG] = {'\0'}; + app_get_shared_resource(file_path, absolute_path, (int)MAX_LENGTH_CONFIG); + return strdup(absolute_path); +} + +static inline const char *get_storage_image_dir_path() +{ + static char *absolute_path; + // lets set storage devices + storage_foreach_device_supported(_storage_device_supported_cb,NULL); + storage_get_directory(_supportedStorageID,STORAGE_DIRECTORY_IMAGES,&absolute_path); + DBG("Logging_Dir set = %s",absolute_path); + + return strdup(absolute_path); +} + +static inline const char *get_data_path(const char *file_path) +{ + static char* absolute_path = NULL; + static char result[MAX_LENGTH_CONFIG]; + absolute_path = strdup(app_get_data_path()); + strcpy(result, absolute_path); + strcat(result, "/"); + strcat(result, file_path); + DBG("Data Path is %s", result); + return result; +} + +static inline char *gen_data_path(const char *file_path) +{ + char path[128]; + snprintf(path, sizeof(path), "%s%s",app_get_data_path(),file_path); + + return strdup(path); +} + +static inline char *format_string(const char *format, ...) +{ + va_list arg; + char* chTemp; + chTemp= (char*)malloc(1024 * sizeof(char)); + RETVM_IF(!chTemp, NULL,"malloc failed."); + va_start(arg,format); + vsnprintf(chTemp,1024,format,arg); + va_end(arg); + return chTemp; +} + +static inline device_type_e get_device_type() +{ + int width, height; + device_type_e device_type = DEVICE_NONE; + system_info_get_platform_int("tizen.org/feature/screen.width", &width); + system_info_get_platform_int("tizen.org/feature/screen.height", &height); + + if(width == 360 && height == 360) + { + //circle + device_type = DEVICE_WEARABLE_CIRCLE; + } + else if(width == 360 && height == 480) + { + device_type = DEVICE_WEARABLE_360_X_480; + } + else if(width == 320 && height == 320) + { + device_type = DEVICE_WEARABLE_320_X_320; + } + else + { + device_type = DEVICE_MOBILE; + } + +return device_type; + +} + + +#endif /* CONFIG_H_ */ diff --git a/tbtcoreapp-widget-new-dali/inc/utils/constrants.h b/tbtcoreapp-widget-new-dali/inc/utils/constrants.h new file mode 100644 index 0000000..cc94b07 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/utils/constrants.h @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ +/** + * @file constraints.h + * @brief constant values + * + * @author Jahangir Alam(ja.alam@samsung.com) + * @date July, 2016 + * @credit + * + */ + +#ifndef CONSTRANTS_H_ +#define CONSTRANTS_H_ +#include +using namespace Dali; + +#define TEXTLABEL_HEIGHT 0.0625f // assume full screen width 1 and height 1. 0.0625 is 1/16 +#define TEXTFIELD_HEIGHT 0.0625f // assume full screen width 1 and height 1. 0.0625 is 1/16 +#define TEXTEDITOR_HEIGHT 0.08333f // assume full screen width 1 and height 1. 0.0625 is 1/12 +#define BUTTON_HEIGHT 0.125f // assume full screen width 1 and height 1. 0.125 is 1/8 +#define VERTICAL_SPACE 0.00781f // assume full screen width 1 and height 1. 0.125 is 1/128 +#define HORIZONTAL_SPACE 0.00781f // assume full screen width 1 and height 1. 0.125 is 1/128 + +const Vector4 selectedColor=Vector4(0.55f, 0.8f, 0.9f, 1.0f); +const Vector4 unSelectedColor=Vector4(0.8f, 0.9f, 0.9f, 1.0f); + + +#endif /* CONSTRANTS_H_ */ diff --git a/tbtcoreapp-widget-new-dali/inc/utils/dali-ui-utils.h b/tbtcoreapp-widget-new-dali/inc/utils/dali-ui-utils.h new file mode 100644 index 0000000..e81a65f --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/utils/dali-ui-utils.h @@ -0,0 +1,119 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ +/** + * @file dali-ui-utils.h + * @brief UI Utils + * + * @author Jahangir Alam(ja.alam@samsung.com) + * @date July, 2016 + * @credit + * + */ + +#ifndef DALI_UI_UTILS_H_ +#define DALI_UI_UTILS_H_ + +#include +#include +#include +#include +#include +#include "logger.h" +#include +#include "utils/constrants.h" +#include "utils/type-cast.h" + + +//global function +void get_screen_height_width(const char *key, int *value); + +using namespace Dali; +using namespace Dali::Toolkit; +using namespace std; + + +class UiUtils : public ConnectionTracker +{ + +public: + UiUtils(Application& application, app_control_h app_control); +public: + + Vector2 headerSize; + Vector2 bodySize; + Vector2 footerSize; + + TextLabel lblTitle; + //TextLabel lblInfoTitle; + + Control ctlRoot; + Control ctlHeader; + Control ctlBody; + Control ctlFooter; + Control ctlInfo; + + PushButton btnPassButton; + PushButton btnFailButton; + PushButton btnInfoButton; + + TableView tblVerdict; + + Application& mApplication; + app_control_h _control; + + bool bflag; + std::string mAppResourcePath; + std::string mImageDirectory; + std::string mInfoText; + +public: + void Init(std::string title); + + template + PushButton CreateVerdictButton(TableView parent, TableView::CellPosition cellPosition, + Vector3 anchorPoint, Vector2 position, std::string label, X* obj, + Ret (X::*onClickedCallback)(Arg0 arg0), + Vector4 selectedColor, Vector4 unselectedColor, Vector2 size); + + //template + PushButton CreateButton(Vector3 anchorPoint, Vector2 position, std::string label,/* X* obj, + Ret (X::*onClickedCallback)(Arg0 arg0),*/ Vector4 selectedColor, + Vector4 unselectedColor, Vector2 size); + + TextLabel CreateTextLabel(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size ); + + //template + Control CreateTextField(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size/*, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0)*/ ); + + //template + Control CreateTextEditor(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size/*, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0)*/ ); + + void CreateLabelList(Property::Map keyMap, Property::Map sizeMap); + void AddLabelToTable(TableView table,Property::Map keyMap, Property::Map sizeMap); + + void FillInfoPage(std::string content); + + bool OnPassButtonClick(Button button); + bool OnFailButtonClick(Button button); + bool OnInfoButtonClick(Button button); + void OnKeyEvent( const KeyEvent& event ); +}; + + +#endif /* DALI_UI_UTILS_H_ */ diff --git a/tbtcoreapp-widget-new-dali/inc/utils/logger.h b/tbtcoreapp-widget-new-dali/inc/utils/logger.h new file mode 100644 index 0000000..b6049e6 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/utils/logger.h @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ + +/** + * @file logger.h + * @brief This file provide necessary macro for logging information. + * @since_tizen 2.3 + * @author Amlan Chowdhury (amlan.c@samsung.com) + * @date October, 2014 + * @bug + * @credit + */ +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#include + +#define LOG_TAG_CORE "[TBT_DALI_CORE]_" + +#define DLOG(prio, fmt, arg...) dlog_print(prio, LOG_TAG_CORE, "%s (Line: %d) > " fmt, __func__, __LINE__, ##arg) +#define DBG(fmt, arg...) DLOG(DLOG_DEBUG, fmt, ##arg) +#define ERR(fmt, arg...) DLOG(DLOG_ERROR, fmt, ##arg) + +#define RETM_IF(expr, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return; \ + } \ +} + +#define RETVM_IF(expr, val, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return (val); \ + } \ +} + +#define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL; + +#endif /* __LOGGER_H__ */ diff --git a/tbtcoreapp-widget-new-dali/inc/utils/type-cast.h b/tbtcoreapp-widget-new-dali/inc/utils/type-cast.h new file mode 100644 index 0000000..d58724b --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/utils/type-cast.h @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ + +/** + * @file type-cast.h + * @brief This file provide necessary Util functions UI. + * @since_tizen 3.0 + * @author Jahangir Alam (ja.alam@samsung.com) + * @date July, 2016 + * @bug + * @credit + */ + +#ifndef __TYPE_CASE_H__ +#define __TYPE_CASE_H__ +#include +#include +#include + +std::string IntToString ( int number ); +std::string FloatToString ( float number ); +std::string LongToString ( long number ); + +#endif /* __TYPE_CASE_H__ */ diff --git a/tbtcoreapp-widget-new-dali/inc/utils/ui-utils.h b/tbtcoreapp-widget-new-dali/inc/utils/ui-utils.h new file mode 100644 index 0000000..b2c7d7b --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/utils/ui-utils.h @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ + +/** + * @file ui-utils.h + * @brief This file provide necessary Util functions UI. + * @since_tizen 2.3 + * @author kallol kumar pal (kallol.kumar@samsung.com) + * @date October, 2014 + * @bug + * @credit + */ + + +#ifndef __UI_UTILS_H__ +#define __UI_UTILS_H__ + +#include "utils/app_module_config.h" + +#include + +#ifdef TIZEN_3_0 + #include +#endif +#ifdef TIZEN_2_4 + #include +#endif +#ifdef TIZEN_2_3_1 + #include "efl_extension_events.h" +#endif +#include + + +enum +{ + TOOLBAR_ITEM_INDEX_PASS = 0, + TOOLBAR_ITEM_INDEX_FAIL, + TOOLBAR_ITEM_INDEX_INFO, + TOOLBAR_ITEM_INDEX_COUNT_MAX +} TOOLBAR_ITEM_INDEXS; + +static const char *caption_ok = "OK"; + +static const char *toolbar_item_names[TOOLBAR_ITEM_INDEX_COUNT_MAX] = { "Pass", + "Fail", + "Info" +}; + +static const int toolbar_item_ids[TOOLBAR_ITEM_INDEX_COUNT_MAX] = { TOOLBAR_ITEM_INDEX_PASS, + TOOLBAR_ITEM_INDEX_FAIL, + TOOLBAR_ITEM_INDEX_INFO +}; + + +#endif /* __UI_UTILS_H__ */ diff --git a/tbtcoreapp-widget-new-dali/inc/view/tbt-dali-widget-custom-view.h b/tbtcoreapp-widget-new-dali/inc/view/tbt-dali-widget-custom-view.h new file mode 100644 index 0000000..3cc9d9b --- /dev/null +++ b/tbtcoreapp-widget-new-dali/inc/view/tbt-dali-widget-custom-view.h @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2017 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. + *******************************************************************************/ +/** + * @file tbt-dali-widget-custom-view.h + * @brief To test functionality of dali widget + * + * @author Awadhesh Singh (awadhesh1.s@samsung.com) + * @date July, 2018 + * @credit + * + */ +#ifndef __TBT_MODULE_APP_DALI_CUSTOM_WIDGET +#define __TBT_MODULE_APP_DALI_CUSTOM_WIDGET +#include +#include +#include +#include +#include "utils/logger.h" +#include "utils/config.h" +#include "utils/ui-utils.h" +#include "utils/dali-ui-utils.h" +using namespace Dali; +using namespace Dali::Toolkit; + +class WidgetApplicationController : public ConnectionTracker +{ +public: + WidgetApplicationController(WidgetApplication& application); + void Create(Application& application); + bool OnWidgetAdded(Toolkit::Button button ); + bool OnWidgetDeleted(Toolkit::Button button ); + + private: + void OnKeyEvent(const KeyEvent& event); + WidgetApplication & mApplication; + WidgetView::WidgetViewManager mWidgetViewManager; + WidgetView::WidgetView mWidgetView; +}; +#endif diff --git a/tbtcoreapp-widget-new-dali/res/dali-toolkit-test-theme_720x1280.json b/tbtcoreapp-widget-new-dali/res/dali-toolkit-test-theme_720x1280.json new file mode 100644 index 0000000..d3645a5 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/res/dali-toolkit-test-theme_720x1280.json @@ -0,0 +1,15 @@ +{ + "styles": + { + "textlabel": + { + "fontStyle":"italic", + "pointSize":12 + }, + "testbutton": + { + "backgroundColor":[1.0,0.0,0.0,1.0], + "foregroundColor":[0.0,1.0,1.0,1.0] + } + } +} diff --git a/tbtcoreapp-widget-new-dali/res/images/Default_home.png b/tbtcoreapp-widget-new-dali/res/images/Default_home.png new file mode 100644 index 0000000..4487cab Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/Default_home.png differ diff --git a/tbtcoreapp-widget-new-dali/res/images/customTextFieldBgImage.jpg b/tbtcoreapp-widget-new-dali/res/images/customTextFieldBgImage.jpg new file mode 100644 index 0000000..85776e3 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/customTextFieldBgImage.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-1.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-1.jpg new file mode 100644 index 0000000..ce9620f Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-1.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-10.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-10.jpg new file mode 100644 index 0000000..dcf6188 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-10.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-11.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-11.jpg new file mode 100644 index 0000000..7f98989 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-11.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-12.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-12.jpg new file mode 100644 index 0000000..c0e72ce Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-12.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-13.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-13.jpg new file mode 100644 index 0000000..c96a2d6 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-13.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-14.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-14.jpg new file mode 100644 index 0000000..093adba Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-14.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-2.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-2.jpg new file mode 100644 index 0000000..75bcf3a Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-2.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-3.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-3.jpg new file mode 100644 index 0000000..c0e72ce Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-3.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-4.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-4.jpg new file mode 100644 index 0000000..24f7ccd Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-4.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-5.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-5.jpg new file mode 100644 index 0000000..c4a2414 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-5.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-6.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-6.jpg new file mode 100644 index 0000000..b87e092 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-6.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-7.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-7.jpg new file mode 100644 index 0000000..cf71867 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-7.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-8.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-8.jpg new file mode 100644 index 0000000..42b971e Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-8.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/gallery-medium-9.jpg b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-9.jpg new file mode 100644 index 0000000..b2edbe4 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/gallery-medium-9.jpg differ diff --git a/tbtcoreapp-widget-new-dali/res/images/innerButtonSelected.png b/tbtcoreapp-widget-new-dali/res/images/innerButtonSelected.png new file mode 100644 index 0000000..eae282c Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/innerButtonSelected.png differ diff --git a/tbtcoreapp-widget-new-dali/res/images/innerButtonUnselected.png b/tbtcoreapp-widget-new-dali/res/images/innerButtonUnselected.png new file mode 100644 index 0000000..657da96 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/innerButtonUnselected.png differ diff --git a/tbtcoreapp-widget-new-dali/res/images/text-field-bg.9.png b/tbtcoreapp-widget-new-dali/res/images/text-field-bg.9.png new file mode 100644 index 0000000..60d6173 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/text-field-bg.9.png differ diff --git a/tbtcoreapp-widget-new-dali/res/images/top-bar.png b/tbtcoreapp-widget-new-dali/res/images/top-bar.png new file mode 100644 index 0000000..0a31d0e Binary files /dev/null and b/tbtcoreapp-widget-new-dali/res/images/top-bar.png differ diff --git a/tbtcoreapp-widget-new-dali/shared/res/tbtcoreapp-dali.png b/tbtcoreapp-widget-new-dali/shared/res/tbtcoreapp-dali.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/tbtcoreapp-widget-new-dali/shared/res/tbtcoreapp-dali.png differ diff --git a/tbtcoreapp-widget-new-dali/src/tbtcoreapp-dali-new.cpp b/tbtcoreapp-widget-new-dali/src/tbtcoreapp-dali-new.cpp new file mode 100644 index 0000000..74ae24f --- /dev/null +++ b/tbtcoreapp-widget-new-dali/src/tbtcoreapp-dali-new.cpp @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ +/** + * @file tbtcoreapp-dali-new.cpp + * @brief tbt dali entry file + * + * @author Awadhesh singh (awadhesh1.s@samsung.com) + * @date July, 2018 + * @credit + * + */ + +#include +#include +#include +#include +#include "utils/logger.h" +#include +#include +#include +#include +#include "view/tbt-dali-widget-custom-view.h" +using namespace Dali; +using namespace Dali::Toolkit; +int main( int argc, char **argv ) +{ + WidgetApplication application = WidgetApplication::New( &argc, &argv, ""); + WidgetApplicationController test( application ); + application.MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS); + return 0; +} diff --git a/tbtcoreapp-widget-new-dali/src/utils/dali-ui-utils.cpp b/tbtcoreapp-widget-new-dali/src/utils/dali-ui-utils.cpp new file mode 100644 index 0000000..94c7263 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/src/utils/dali-ui-utils.cpp @@ -0,0 +1,372 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ +/** + * @file dali-ui-utils.cpp + * @brief UI Utils + * + * @author Jahangir Alam(ja.alam@samsung.com) + * @date July, 2016 + * @credit + * + */ + +#include "utils/dali-ui-utils.h" +const Vector4 CUSTOM_BLUE_COLOR = Vector4( 66.0f/255.0f, 180.0f/255.0f, 198.0f/255.0f, 1.0f ); +const Vector4 EDITOR_COLOR = Vector4( 214.0f, 234.0f, 248.0f, 1.0f); + +UiUtils::UiUtils(Application& application, app_control_h app_control) : mApplication(application) +{ + DBG("UiUtils::UiUtils...."); + this->bflag=false; + this->mAppResourcePath= app_get_resource_path(); + this->mImageDirectory = this->mAppResourcePath + "images/"; + //this->mApplication=application; + this->_control=app_control; +} +void UiUtils::Init(std::string title) +{ + DBG("UiUtils::Init....Begin"); + Stage stage = Stage::GetCurrent(); + Vector2 stageSize=stage.GetSize(); + stage.SetBackgroundColor( Color::WHITE ); + + this->ctlRoot=Control::New(); + this->ctlRoot.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlRoot.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlRoot.SetSize(stageSize); + this->ctlRoot.SetPosition(0.0f, 0.0f); + this->ctlRoot.SetBackgroundColor(Color::WHITE); + stage.Add(this->ctlRoot); + + this->headerSize=Vector2(stageSize.width, stageSize.height*0.0781); + this->footerSize=Vector2(stageSize.width, stageSize.height*0.125); + this->bodySize=Vector2(stageSize.width, stageSize.height - (this->headerSize.y+footerSize.y)); + + this->lblTitle=TextLabel::New(title); + this->lblTitle.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->lblTitle.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->lblTitle.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER"); + this->lblTitle.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER"); + + this->ctlHeader=Control::New(); + this->ctlHeader.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlHeader.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlHeader.SetSize(this->headerSize); + this->ctlHeader.SetPosition(0.0f, 0.0f); + this->ctlHeader.SetBackgroundColor(CUSTOM_BLUE_COLOR); + this->ctlHeader.Add(this->lblTitle); + this->ctlRoot.Add(this->ctlHeader); + + this->ctlBody=Control::New(); + this->ctlBody.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlBody.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlBody.SetSize(this->bodySize); + this->ctlBody.SetPosition(0.0f,this->headerSize.y); + //this->ctlBody.SetBackgroundColor(CUSTOM_BLUE_COLOR); + this->ctlRoot.Add(this->ctlBody); + //DBG("X=%d Y=%d",bodySize.x,bodySize.y); + + this->ctlFooter=Control::New(); + this->ctlFooter.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlFooter.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlFooter.SetSize(this->footerSize); + this->ctlFooter.SetPosition(0.0f,this->headerSize.y+this->bodySize.y); + this->ctlFooter.SetBackgroundColor(CUSTOM_BLUE_COLOR); + this->ctlRoot.Add(this->ctlFooter); + + this->ctlInfo=Control::New(); + this->ctlInfo.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->ctlInfo.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->ctlInfo.SetSize(this->bodySize+this->footerSize); + this->ctlInfo.SetPosition(0.0f,this->headerSize.y); + this->ctlInfo.SetBackgroundColor(Color::WHITE); + + this->tblVerdict=TableView::New(1,3); + this->tblVerdict.SetAnchorPoint(AnchorPoint::TOP_LEFT); + this->tblVerdict.SetParentOrigin(ParentOrigin::TOP_LEFT); + this->tblVerdict.SetSize(this->footerSize); + this->tblVerdict.SetPosition(0.0f, 0.0f); + this->ctlFooter.Add(this->tblVerdict); + + Vector2 size(this->footerSize.x/3,this->footerSize.y); + this->btnPassButton = this->CreateVerdictButton(this->tblVerdict, TableView::CellPosition(0, 0), AnchorPoint::TOP_LEFT, Vector2(0.0f, 0.0f), "Pass", this, &UiUtils::OnPassButtonClick, Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); + this->btnFailButton = this->CreateVerdictButton(this->tblVerdict, TableView::CellPosition(0, 1), AnchorPoint::TOP_LEFT, Vector2(0.0f, 0.0f), "Fail", this, &UiUtils::OnFailButtonClick, Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); + this->btnInfoButton = this->CreateVerdictButton(this->tblVerdict, TableView::CellPosition(0, 2), AnchorPoint::TOP_LEFT, Vector2(0.0f, 0.0f), "Info", this, &UiUtils::OnInfoButtonClick, Vector4(0.55f, 0.8f, 0.9f, 1.0f), Vector4(0.8f, 0.9f, 0.9f, 1.0f),size); + + Stage::GetCurrent().KeyEventSignal().Connect( this, &UiUtils::OnKeyEvent ); + DBG("UiUtils::Init.... End"); +} + +template +PushButton UiUtils::CreateVerdictButton(TableView parent, TableView::CellPosition cellPosition, + Vector3 anchorPoint, Vector2 position, std::string label, X* obj, + Ret (X::*onClickedCallback)(Arg0 arg0), + Vector4 selectedColor, Vector4 unselectedColor, Vector2 size) +{ + PushButton button = PushButton::New(); + button.SetAnchorPoint(anchorPoint); + button.SetPosition(position.x,position.y); + //button.SetSize(size); + button.SetProperty( Button::Property::LABEL, label ); + button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); + button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); + parent.AddChild(button, cellPosition); + + button.ClickedSignal().Connect(obj, onClickedCallback); + return button; +} + +//template +PushButton UiUtils::CreateButton(Vector3 anchorPoint, Vector2 position, std::string label,/* X* obj, + Ret (X::*onClickedCallback)(Arg0 arg0), */Vector4 selectedColor, + Vector4 unselectedColor, Vector2 size) +{ + PushButton button = PushButton::New(); + button.SetAnchorPoint(anchorPoint); + //button.SetParentOrigin(parentOrigin); + button.SetPosition(position.x,position.y); + //button.SetSize(size); + button.SetProperty( Button::Property::LABEL, label ); + button.SetProperty(Button::Property::UNSELECTED_COLOR, selectedColor); + button.SetProperty(Button::Property::SELECTED_COLOR, unselectedColor); + + //button.ClickedSignal().Connect(obj, onClickedCallback); + return button; +} +TextLabel UiUtils::CreateTextLabel(Vector3 anchorPoint,Vector3 parentOrigin, Vector2 position, std::string txt, Vector2 size ) +{ + DBG("UiUtils::CreateTextLabel Begin"); + TextLabel label=TextLabel::New(" "+txt); + label.SetAnchorPoint(anchorPoint); + label.SetParentOrigin(parentOrigin); + label.SetPosition(position.x,position.y); + DBG("X=%f Y=%f Width=%f Height=%f",size.x,size.y,size.width,size.height); + label.SetSize(size); + label.SetProperty(TextLabel::Property::MULTI_LINE,true); + DBG("UiUtils::CreateTextLabel End"); + return label; +} +//template +Control UiUtils::CreateTextField(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size/*, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0)*/ ) +{ + Control customTextField = Control::New(); + customTextField.SetAnchorPoint( anchorPoint ); + customTextField.SetParentOrigin(parentOrigin); + customTextField.SetSize( size); + customTextField.SetPosition( position.x,position.y ); + Image customTextFieldBgImage = ResourceImage::New( this->mImageDirectory+"customTextFieldBgImage.jpg" ); + customTextField.SetBackgroundImage(customTextFieldBgImage); + + TextField field=TextField::New(); + field.SetAnchorPoint(anchorPoint); + field.SetParentOrigin(parentOrigin); + //field.SetPosition(position.x,position.y); + field.SetSize(size); + field.SetProperty( TextField::Property::POINT_SIZE, 10.0f ); + field.SetProperty( TextField::Property::TEXT_COLOR, CUSTOM_BLUE_COLOR); + field.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, "CENTER" ); + field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN" ); + field.SetProperty( TextField::Property::PLACEHOLDER_TEXT,"Edit here"); + //field.SetBackgroundColor(Color::YELLOW); + customTextField.Add(field); + + PushButton btnCross = PushButton::New(); + btnCross.SetAnchorPoint( anchorPoint ); + btnCross.SetParentOrigin(parentOrigin); + btnCross.SetSize( size.width/10, size.height ); + btnCross.SetPosition( size.width - size.width/10, 0.0f ); + btnCross.SetUnselectedImage( this->mImageDirectory + "innerButtonUnselected.png" ); + btnCross.SetSelectedImage( this->mImageDirectory + "innerButtonSelected.png" ); + //btnCross.ClickedSignal().Connect( obj, onClickedCallback ); + customTextField.Add(btnCross); + + return customTextField; +} +//template +Control UiUtils::CreateTextEditor(Vector3 anchorPoint, Vector3 parentOrigin, Vector2 position, + std::string txt, Vector2 size/*, X* obj, Ret (X::*onClickedCallback)(Arg0 arg0)*/ ) +{ + Control customTextEditor = Control::New(); + customTextEditor.SetAnchorPoint( anchorPoint ); + customTextEditor.SetParentOrigin(parentOrigin); + customTextEditor.SetSize( size); + customTextEditor.SetPosition( position.x,position.y ); + + TextEditor editor=TextEditor::New(); + editor.SetAnchorPoint(anchorPoint); + editor.SetParentOrigin(parentOrigin); + //editor.SetPosition(position.x,position.y); + editor.SetSize(size); + editor.SetBackgroundColor(CUSTOM_BLUE_COLOR); + editor.SetProperty( TextEditor::Property::POINT_SIZE, 10); + editor.SetProperty( TextEditor::Property::TEXT_COLOR, Color::BLACK); + editor.SetProperty( TextEditor::Property::TEXT, "Text edit here"); + editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "BEGIN" ); + customTextEditor.Add(editor); + + PushButton btnCross = PushButton::New(); + btnCross.SetAnchorPoint( anchorPoint ); + btnCross.SetParentOrigin(parentOrigin); + btnCross.SetSize( bodySize.width*TEXTEDITOR_HEIGHT, bodySize.height*TEXTEDITOR_HEIGHT ); + btnCross.SetPosition( size.width - size.width/10, 0.0f ); + btnCross.SetUnselectedImage( this->mImageDirectory + "innerButtonSelected.png" ); + btnCross.SetSelectedImage( this->mImageDirectory + "innerButtonUnselected.png" ); + //btnCross.ClickedSignal().Connect( obj, onClickedCallback ); + customTextEditor.Add(btnCross); + + return customTextEditor; +} +void UiUtils::CreateLabelList(Property::Map keyMap, Property::Map sizeMap) +{ + DBG("UiUtils::CreateLabelList Begin"); + //Dali::Property::Map textlabelMap; + std::string key; + Property::Value value; + Property::Value size_value; + Vector2 size; + Vector2 position; + int count=keyMap.Count(); + float next=Stage::GetCurrent().GetSize().height*0.039; + TextLabel lbl; + for(int i=0;i(); + position=Vector2(0.0f, next); + lbl=this->CreateTextLabel(AnchorPoint::TOP_LEFT, ParentOrigin::TOP_LEFT,position,value.Get(),size); + lbl.SetProperty( TextLabel::Property::POINT_SIZE, 8); + lbl.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED); + lbl.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "TOP"); + lbl.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "BEGIN"); + lbl.SetName(value.Get()); + //textlabelMap.Insert(key,lbl); + this->ctlBody.Add(lbl); + next=next+size.y; + } + DBG("UiUtils::CreateLabelList End"); + //return textlabelMap; +} + +void UiUtils::AddLabelToTable(TableView table,Property::Map keyMap, Property::Map sizeMap) +{ + DBG("UiUtils::AddLabelToTable Begin"); + //Dali::Property::Map textlabelMap; + std::string key; + Property::Value value; + Property::Value size_value; + Vector2 size; + Vector2 position; + int count=keyMap.Count(); + float next=Stage::GetCurrent().GetSize().height*0.039; + TextLabel lbl; + for(int i=0;i(); + position=Vector2(0.0f, next); + lbl=this->CreateTextLabel(AnchorPoint::TOP_LEFT, ParentOrigin::TOP_LEFT,position,value.Get(),size); + lbl.SetProperty( TextLabel::Property::POINT_SIZE, 8); + lbl.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED); + lbl.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "TOP"); + lbl.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "BEGIN"); + lbl.SetName(value.Get()); + + table.AddChild(lbl,TableView::CellPosition(i,0)); + + next=next+size.y; + } + DBG("UiUtils::AddLabelToTable End"); + //return textlabelMap; +} + +bool UiUtils::OnPassButtonClick(Button button) +{ + DBG("UiUtils::OnPassButtonClick"); + app_control_h reply; + int nStatus = app_control_create(&reply); + + app_control_result_e res = APP_CONTROL_RESULT_SUCCEEDED; + nStatus = app_control_reply_to_launch_request(reply, _control, res); + DBG("app_control_reply_to_launch_request=%s", nStatus); + + this->mApplication.Quit(); + return true; +} +bool UiUtils::OnFailButtonClick(Button button) +{ + DBG("UiUtils::OnFailButtonClick"); + app_control_h reply; + int nStatus = app_control_create(&reply); + + app_control_result_e res = APP_CONTROL_RESULT_FAILED; + nStatus = app_control_reply_to_launch_request(reply, _control, res); + DBG("app_control_reply_to_launch_request=%s", nStatus); + this->mApplication.Quit(); + return true; +} +bool UiUtils::OnInfoButtonClick(Button button) +{ + DBG("UiUtils::OnInfoButtonClick"); + + DBG("ho ho i m in info page"); + this->bflag=true; + //Stage::GetCurrent().Remove(ctlRoot); + //ctlRoot.Add(ctlHeader); + ctlRoot.Remove(ctlBody); + ctlRoot.Add(ctlInfo); + + FillInfoPage(mInfoText); + return true; +} +void UiUtils::OnKeyEvent( const KeyEvent& event ) +{ + DBG("UiUtils::OnKeyEvent"); + + if( event.state == KeyEvent::Down ) + { + if( IsKey( event, DALI_KEY_ESCAPE ) || IsKey( event, DALI_KEY_BACK ) ) + { + //mApplication.Quit(); + if(this->bflag != true) + mApplication.Quit(); + DBG("ho ho i m in content page"); + ctlRoot.Remove(ctlInfo); + ctlRoot.Add(ctlBody); + this->bflag=false; + } + } +} +void UiUtils::FillInfoPage(std::string content) +{ + DBG("UiUtils::FillInfoPage"); + TextLabel lblText=TextLabel::New(); + lblText.SetProperty(TextLabel::Property::ENABLE_MARKUP, true); + lblText.SetProperty(TextLabel::Property::MULTI_LINE, true); + lblText.SetProperty( TextLabel::Property::TEXT, content); + lblText.SetAnchorPoint(AnchorPoint::TOP_LEFT); + lblText.SetParentOrigin(ParentOrigin::TOP_LEFT); + lblText.SetSize(bodySize); + lblText.SetProperty(TextLabel::Property::POINT_SIZE,7.0f); + lblText.SetProperty(TextLabel::Property::TEXT_COLOR,Color::BLACK); + lblText.SetPosition(0.0f, 0.0f); + + this->ctlInfo.Add(lblText); +} diff --git a/tbtcoreapp-widget-new-dali/src/utils/type-cast.cpp b/tbtcoreapp-widget-new-dali/src/utils/type-cast.cpp new file mode 100644 index 0000000..0a53dc4 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/src/utils/type-cast.cpp @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + *******************************************************************************/ +/** + * @file type-cast.cpp + * @brief Type casting + * + * @author Jahangir Alam(ja.alam@samsung.com) + * @date July, 2016 + * @credit + * + */ + +#include "utils/type-cast.h" + + +std::string IntToString ( int number ) +{ + std::ostringstream oss; + // Works just like cout + oss<< number; + // Return the underlying string + return oss.str(); +} +std::string FloatToString ( float number ) +{ + std::ostringstream oss; + // Works just like cout + oss<< number; + // Return the underlying string + return oss.str(); +} +std::string LongToString ( long number ) +{ + std::ostringstream oss; + // Works just like cout + oss<< number; + // Return the underlying string + return oss.str(); +} diff --git a/tbtcoreapp-widget-new-dali/src/view/.tbt-dali-widget-view.cpp.swp b/tbtcoreapp-widget-new-dali/src/view/.tbt-dali-widget-view.cpp.swp new file mode 100644 index 0000000..2a2fd43 Binary files /dev/null and b/tbtcoreapp-widget-new-dali/src/view/.tbt-dali-widget-view.cpp.swp differ diff --git a/tbtcoreapp-widget-new-dali/src/view/tbt-dali-widget-custom-view.cpp b/tbtcoreapp-widget-new-dali/src/view/tbt-dali-widget-custom-view.cpp new file mode 100644 index 0000000..7f017ec --- /dev/null +++ b/tbtcoreapp-widget-new-dali/src/view/tbt-dali-widget-custom-view.cpp @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2017 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. + *******************************************************************************/ +/** + * @file tbt-dali-widget-custom-view.cpp + * @brief To test functionality of dali widget + * + * @author Awadhesh Singh (awadhesh1.s@samsung.com) + * @date July, 2018 + * @credit + * + */ +#include "view/tbt-dali-widget-custom-view.h" + +WidgetApplicationController::WidgetApplicationController(WidgetApplication& application):mApplication(application) +{ + DBG(">>>>>>WidgetApplicationController "); + mApplication.InitSignal().Connect(this,&WidgetApplicationController::Create); +} + +static Dali::Widget CreatingWidgetFunction(const std::string& widgetName) +{ + DBG(">>>>>>CreateWidgetFunction "); + Dali::Widget widget = Dali::Widget::New(); + return widget; +} +void WidgetApplicationController::Create(Application& application) +{ + DBG(">>>>Create called "); + + Stage stage = Stage::GetCurrent(); + stage.SetBackgroundColor( Color::BLACK ); + stage.KeyEventSignal().Connect( this, &WidgetApplicationController::OnKeyEvent ); + + mWidgetViewManager = WidgetView::WidgetViewManager::New( mApplication, "org.tizen.tbtcoreapp-widget-new-dali" ); + + PushButton button = PushButton::New(); + button.ClickedSignal().Connect( this, &WidgetApplicationController::OnWidgetDeleted ); + button.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); + button.SetAnchorPoint( ParentOrigin::BOTTOM_LEFT ); + button.SetProperty(Button::Property::LABEL, "Delete Widget"); + button.SetPosition( 0, 0 ); + button.SetSize(300,100); + stage.Add( button ); + + PushButton button2 = PushButton::New(); + button2.ClickedSignal().Connect( this, &WidgetApplicationController::OnWidgetAdded ); + button2.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); + button2.SetAnchorPoint( ParentOrigin::BOTTOM_RIGHT ); + button2.SetProperty(Button::Property::LABEL, "Add Widget"); + button2.SetPosition( 0, 0 ); + button2.SetSize(300,100); + stage.Add( button2 ); + mApplication.RegisterWidgetCreatingFunction("org.tizen.coretbtwidgetapp-dali",CreatingWidgetFunction); + +} +bool WidgetApplicationController::OnWidgetAdded(Toolkit::Button button ) +{ + DBG("WidgetApplicationController::OnWidgetAdded"); + if(!mWidgetView) + { + mWidgetView = mWidgetViewManager.AddWidget("org.tizen.coretbtwidgetapp-dali","",480,680,-1); + mWidgetView.SetParentOrigin( ParentOrigin::CENTER ); + mWidgetView.SetAnchorPoint( AnchorPoint::CENTER ); + mWidgetView.SetBackgroundColor( Vector4(0.0f, 0.0f, 0.0f, 0.0f) ); + Stage::GetCurrent().Add( mWidgetView ); + } + +} + +bool WidgetApplicationController::OnWidgetDeleted(Toolkit::Button button ) +{ + DBG("WidgetApplicationController::OnWidgetDeleted"); + if(mWidgetView) + { + mWidgetView.TerminateWidget(); + Stage::GetCurrent().Remove( mWidgetView ); + mWidgetView.Reset(); + } +} + +void WidgetApplicationController::OnKeyEvent(const KeyEvent& event) +{ + if(event.state == KeyEvent::Down) + { + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) + { + mApplication.Quit(); + } + } +} + diff --git a/tbtcoreapp-widget-new-dali/tizen-manifest.xml b/tbtcoreapp-widget-new-dali/tizen-manifest.xml new file mode 100644 index 0000000..a983590 --- /dev/null +++ b/tbtcoreapp-widget-new-dali/tizen-manifest.xml @@ -0,0 +1,103 @@ + + + + + + tbtcoreapp-dali.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://tizen.org/privilege/mediastorage + http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/externalstorage + http://tizen.org/privilege/widget.viewer + + true + diff --git a/tbtcoreapp/inc/model/tbt-info.h b/tbtcoreapp/inc/model/tbt-info.h index d0f197b..3e7dcc2 100755 --- a/tbtcoreapp/inc/model/tbt-info.h +++ b/tbtcoreapp/inc/model/tbt-info.h @@ -302,7 +302,7 @@ typedef enum { TBT_APP_DALI_SCROLL, TBT_APP_DALI_WIDGET, - + TBT_APP_DALI_CUSTOM_WIDGET, TBT_APP_MULTICLASS, TBT_APP_USBHOST, diff --git a/tbtcoreapp/inc/utils/app_module_config.h b/tbtcoreapp/inc/utils/app_module_config.h index 0460c7a..0e57268 100755 --- a/tbtcoreapp/inc/utils/app_module_config.h +++ b/tbtcoreapp/inc/utils/app_module_config.h @@ -277,6 +277,7 @@ #define TBT_MODULE_APP_DALI_TTS #define TBT_MODULE_APP_DALI_SCROLL #define TBT_MODULE_APP_DALI_WIDGET +#define TBT_MODULE_APP_DALI_CUSTOM_WIDGET //#define TBT_MODULE_APP_DALI_SCROLL_BAR //#define TBT_MODULE_APP_DALI_HOVER_EVENT //#define TBT_MODULE_APP_DALI_KEY_EVENT diff --git a/tbtcoreapp/inc/view/tbt-dali-custom-view.h b/tbtcoreapp/inc/view/tbt-dali-custom-view.h new file mode 100755 index 0000000..5a27cca --- /dev/null +++ b/tbtcoreapp/inc/view/tbt-dali-custom-view.h @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2017 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. + *******************************************************************************/ +/** + * @file tbt-dali-custom-view.h + * @brief This view provide the Apps tested the dali widget functionality. + * @since_tizen 4.0 + * @author Awadhesh Singh (awadhesh1.s@samsung.com) + * @date July, 2018 + * @bug No known bug. + * @credit Tizen Application framework Example + * + */ + +#ifndef __TBT_DALI_CUSTOM_VIEW_H__ +#define __TBT_DALI_CUSTOM_VIEW_H__ + +#include "utils/app_module_config.h" +#ifdef TBT_MODULE_DALI + +#include +#include "model/tbt-list.h" + +/** + * @typedef _dali_custom_view + * @since_tizen 4.0 + * @brief A dali custom viewer view handle. + */ +typedef struct _dali_custom_view dali_custom_view; + +/** + * @brief Create dali_custom_view_add + * @since_tizen 4.0 + * @param[in] navi Parent naviframe + * @param[in] tbt_info Custom struct contains all the necessary information of the moduales + * @param[in] item Is the selected item of the Application home genlist + * @return Pointer of dali_custom_view on success, otherwise NULL + */ +dali_custom_view *dali_custom_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item); + +#endif +#endif // __TBT_DALI_CUSTOM_VIEW_H__ diff --git a/tbtcoreapp/src/model/tbt-list.c b/tbtcoreapp/src/model/tbt-list.c index e8d81f8..8f8c7ab 100755 --- a/tbtcoreapp/src/model/tbt-list.c +++ b/tbtcoreapp/src/model/tbt-list.c @@ -1861,9 +1861,8 @@ static tbt_info tbtapps[] = .parent = "Runtime Info", .apptype = TBT_APP_USB_CONNECTED, .icon_name = "dummy", - .info = "1. Initially Callback not hit message will be shown.
" - "2. In sdb shell run command devicectl usb-host-test start or devicectl usb-host-test stop.
" - "3. Callback hit message will be shown.", + .info = "1.Insert and Remove usb cable [eg: mobile charger]
" + "2.Usb Connected or Usb Disconnected will be shown", .result = 0 }, #endif @@ -2806,7 +2805,23 @@ static tbt_info tbtapps[] = .result = 0, .required_features_count = 0 }, - #endif + + #endif + #ifdef TBT_MODULE_APP_DALI_CUSTOM_WIDGET + + //DALi Test + { + .name = "DALi Custom Widget", + .parent = "DALi", + .apptype = TBT_APP_DALI_CUSTOM_WIDGET, + .icon_name = "dummy", + .info = "1. Please install org.tizen.tbtcoreapp-widget-new-dali tpk file
2. Click View Widget UI button
3. Dali Widget app gets launched.
4. click on add button, hello world widget should launch
5. click on remove button, widget should be removed
6. If hello world widget is added/remove then press Pass. " + "Otherwise, press Fail", + .result = 0, + .required_features_count = 0 + }, + #endif + #endif #ifdef TBT_MODULE_MULTICLASS #ifdef TBT_MODULE_APP_MULTICLASS diff --git a/tbtcoreapp/src/view/tbt-dali-custom-view.c b/tbtcoreapp/src/view/tbt-dali-custom-view.c new file mode 100644 index 0000000..404d76f --- /dev/null +++ b/tbtcoreapp/src/view/tbt-dali-custom-view.c @@ -0,0 +1,201 @@ +/******************************************************************************* + * Copyright (c) 2017 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. + *******************************************************************************/ +/** + * @file tbt-dali-custom-view.cpp + * @brief This view provide the Apps tested the dali widget functionality. + * @author Awadhesh Singh (awadhesh1.s@samsung.com) + * @date July, 2018 + * @bug No known bug. + * @credit Tizen Application framework Example + * + */ + +#include "utils/app_module_config.h" +#ifdef TBT_MODULE_DALI + +#include "utils/logger.h" +#include "utils/config.h" +#include "utils/ui-utils.h" +#include "view/tbt-dali-custom-view.h" +#include "view/tbt-common-view.h" + +struct _dali_custom_view +{ + common_view* view; + Evas_Object *label; + Evas_Object* btn_dali_widget_app; + app_control_h service; +}; + + +static Evas_Object *add_control_layout(dali_custom_view *this, Evas_Object *parent); +static void _app_destroy_cb(void* this); +static void dali_widget_app_launch_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); +static void app_control_view_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data); + +static char* get_app_control_error(int ret) +{ + char* error = NULL; + + switch (ret) { + case APP_CONTROL_ERROR_NONE: + error = "APP_CONTROL_ERROR_NONE"; + break; + case APP_CONTROL_ERROR_INVALID_PARAMETER: + error = "APP_CONTROL_ERROR_INVALID_PARAMETER"; + break; + case APP_CONTROL_ERROR_OUT_OF_MEMORY: + error = "APP_CONTROL_ERROR_OUT_OF_MEMORY"; + break; + case APP_CONTROL_ERROR_APP_NOT_FOUND: + error = "APP_CONTROL_ERROR_APP_NOT_FOUND"; + break; + case APP_CONTROL_ERROR_KEY_NOT_FOUND: + error = "APP_CONTROL_ERROR_KEY_NOT_FOUND"; + break; + case APP_CONTROL_ERROR_KEY_REJECTED: + error = "APP_CONTROL_ERROR_KEY_REJECTED"; + break; + case APP_CONTROL_ERROR_INVALID_DATA_TYPE: + error = "APP_CONTROL_ERROR_INVALID_DATA_TYPE"; + break; + case APP_CONTROL_ERROR_LAUNCH_REJECTED: + error = "APP_CONTROL_ERROR_LAUNCH_REJECTED"; + break; + case APP_CONTROL_ERROR_PERMISSION_DENIED: + error = "APP_CONTROL_ERROR_PERMISSION_DENIED"; + break; + case APP_CONTROL_ERROR_LAUNCH_FAILED: + error = "APP_CONTROL_ERROR_LAUNCH_FAILED"; + break; + case APP_CONTROL_ERROR_TIMED_OUT: + error = "APP_CONTROL_ERROR_TIMED_OUT"; + break; +#ifdef TIZEN_3_0 + case APP_CONTROL_ERROR_IO_ERROR: + error = "APP_CONTROL_ERROR_IO_ERROR"; + break; +#endif +#ifdef TIZEN_2_4 + case APP_CONTROL_ERROR_IO_ERROR: + error = "APP_CONTROL_ERROR_IO_ERROR"; + break; +#endif + default: + error = "Unknown Error"; + break; + } + return error; +} + +dali_custom_view *dali_custom_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item) +{ + RETVM_IF(NULL == navi, NULL, "navi is null"); + + dali_custom_view *this = NULL; + this = calloc(1, sizeof(dali_custom_view)); + RETVM_IF(!this, NULL, "calloc failed"); + + this->view = calloc(1, sizeof(common_view)); + RETVM_IF(!this->view, NULL, "calloc failed"); + + + tbt_info->layout_group = "multiclass_viewer"; + tbt_info->layout_file = get_edje_path("multiclass_viewer.edj"); + + common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this); + RETVM_IF(NULL == this->view, NULL, "navi is null"); + + this->label = ui_utils_label_add(this->view->layout, ""); + RETVM_IF(!this->label, NULL, "ui_utils_label_add failed"); + ui_utils_label_set_text(this->label, "press button to launch app", "left"); + elm_object_part_content_set(this->view->layout, "multiclass_text", this->label); + + Evas_Object *control = add_control_layout(this, this->view->layout); + elm_object_part_content_set(this->view->layout, "controlr_part", control); + + return this; +} + +static Evas_Object *add_control_layout(dali_custom_view *this, Evas_Object *parent) +{ + RETVM_IF(NULL == this, NULL, "view is NULL"); + this->btn_dali_widget_app = ui_utils_push_button_add(this, parent, "View Widget UI", dali_widget_app_launch_button_pressed_cb); + + return this->btn_dali_widget_app ; +} + +static void dali_widget_app_launch_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +{ + RETM_IF(NULL == data, "data is NULL"); + char *key = "widget_id"; + dali_custom_view *view = NULL; + view = (dali_custom_view*)data; + RETM_IF(NULL == view, "view is NULL"); + + DBG("dali_widget_app_launch_button_pressed_cb"); + + char *appid = VIEWER_VIEW_APP_PACKAGE_NAME; + int nStatus = app_control_create(&view->service); + RETM_IF(nStatus != APP_CONTROL_ERROR_NONE, "app_control_create error : %s", get_app_control_error(nStatus)); + DBG("app_control_create nStatus=%d",nStatus); + + nStatus = app_control_set_app_id(view->service, "org.tizen.tbtcoreapp-widget-new-dali"); + RETM_IF(nStatus != APP_CONTROL_ERROR_NONE, "app_control_set_app_id error : %s", get_app_control_error(nStatus)); + DBG("app_control_set_app_id nStatus=%d",nStatus); + + nStatus = app_control_send_launch_request(view-> service, app_control_view_reply_cb, view); + RETM_IF(APP_CONTROL_ERROR_NONE != nStatus, "app_control_send_launch_request failed :%s", get_app_control_error(nStatus)); + ui_utils_label_set_text(view->label, "App launch requested.", "left"); +} + +static void app_control_view_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data) +{ + RETM_IF(NULL == data, "data is NULL"); + + dali_custom_view *view = NULL; + view = (dali_custom_view*)data; + RETM_IF(NULL == view, "view is NULL"); + + if(result == APP_CONTROL_RESULT_SUCCEEDED) + { + int result; + char *app_id; + + if(reply != NULL) + { + result = app_control_get_app_id(reply, &app_id); + RETM_IF(APP_CONTROL_ERROR_NONE != result, "app_control_create failed :%s", get_app_control_error(result)); + DBG("app_id is %s", app_id); + + ui_utils_label_set_text(view->label, "App launched successfully.", "left"); + } + } +} + +static void _app_destroy_cb(void* this) +{ + RETM_IF(NULL == this, "data is NULL"); + + dali_custom_view *view = NULL; + view = (dali_custom_view*)this; + RETM_IF(NULL == view, "view is NULL"); + app_control_destroy(view->service); + SAFE_DELETE(view->view); + SAFE_DELETE(view); +} + +#endif diff --git a/tbtcoreapp/src/view/tbt-dali-view.c b/tbtcoreapp/src/view/tbt-dali-view.c index 22b2d5d..ccbca84 100644 --- a/tbtcoreapp/src/view/tbt-dali-view.c +++ b/tbtcoreapp/src/view/tbt-dali-view.c @@ -179,10 +179,20 @@ dali_view *dali_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item ret = app_control_set_mime(this->service, this->dali->mime); RETVM_IF(APP_CONTROL_ERROR_NONE != ret, NULL,"app_control_set_mime failed :%s", get_app_control_error(ret)); + if(strcmp(module_name, "TBT_APP_DALI_CUSTOM_WIDGET") == 0) + { - ret = app_control_add_extra_data(this->service, "module_name", this->module_name); - RETVM_IF(APP_CONTROL_ERROR_NONE != ret, NULL,"app_control_set_mime failed :%s", get_app_control_error(ret)); + ret = app_control_set_app_id(this->service, "org.tizen.tbtcoreapp-widget-new-dali"); + } + else + { + ret = app_control_set_app_id(this->service, "org.tizen.tbtcoreapp-dali"); + + + ret = app_control_add_extra_data(this->service, "module_name", this->module_name); + RETVM_IF(APP_CONTROL_ERROR_NONE != ret, NULL,"app_control_set_mime failed :%s", get_app_control_error(ret)); + } ret = app_control_send_launch_request(this->service , app_control_view_cb, this); RETVM_IF(APP_CONTROL_ERROR_NONE != ret, NULL, "app_control_send_launch_request failed :%s", get_app_control_error(ret)); diff --git a/tbtcoreapp/src/view/tbt-genlist-view.c b/tbtcoreapp/src/view/tbt-genlist-view.c index 9a0a92d..bfe1140 100755 --- a/tbtcoreapp/src/view/tbt-genlist-view.c +++ b/tbtcoreapp/src/view/tbt-genlist-view.c @@ -103,7 +103,7 @@ #include "view/tbt-usb-host-view.h" #include "view/tbt-motion-detection-view.h" #include "view/tbt-cbhm-view.h" - +#include "view/tbt-dali-custom-view.h" typedef struct { Evas_Object *win; @@ -1243,6 +1243,11 @@ static void _gl_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void case TBT_APP_DALI_WIDGET: dali_view_add(view->navi, info, it, "TBT_APP_DALI_WIDGET"); break; + case TBT_APP_DALI_CUSTOM_WIDGET: + dali_custom_view_add(view->navi, info, it); + break; + + #endif #ifdef TBT_MODULE_MULTICLASS case TBT_APP_MULTICLASS: