From f49616889ae0725cff7e5963399afde1c6bba62a Mon Sep 17 00:00:00 2001 From: Taeyoung Kim Date: Tue, 29 Mar 2016 10:12:29 +0900 Subject: [PATCH] circle: add popup for wearable circle device - Popup for circle device needs to use theme for circle. Change-Id: I41b94f245811cc1ad354ac363711ad5365d2aa05 Signed-off-by: Taeyoung Kim --- CMakeLists.txt | 11 +++- circle_btn_check.png | Bin 0 -> 1392 bytes circle_btn_delete.png | Bin 0 -> 1184 bytes packaging/system-servant.spec | 17 +++-- src/common/popup-ui-circle.c | 148 ++++++++++++++++++++++++++++++++++++++++++ src/po/en_US.po | 2 +- src/poweroff/CMakeLists.txt | 4 ++ 7 files changed, 176 insertions(+), 6 deletions(-) create mode 100644 circle_btn_check.png create mode 100644 circle_btn_delete.png create mode 100755 src/common/popup-ui-circle.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 19c1f86..062c067 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,15 +11,24 @@ ADD_DEFINITIONS("-DPKGNAME=\"${PKGNAME}\"") ADD_DEFINITIONS("-DLOCALE_DIR=\"${LOCALE_DIR}\"") ADD_DEFINITIONS("-DLANG_DOMAIN=\"${LANG_DOMAIN}\"") ADD_DEFINITIONS("-DPROFILE=\"${PROFILE}\"") +ADD_DEFINITIONS("-DFORMFACTOR=\"${FORMFACTOR}\"") SET(COMMON_DIR "${CMAKE_SOURCE_DIR}/src/common") SET(COMMON_SRCS ${COMMON_DIR}/core.c ${COMMON_DIR}/popup-common.c ${COMMON_DIR}/popup-ui.c - ${COMMON_DIR}/popup-ui-normal.c ) +IF("${FORMFACTOR}" STREQUAL "circle") + SET(COMMON_SRCS ${COMMON_SRCS} + ${COMMON_DIR}/popup-ui-circle.c) +ELSE() + SET(COMMON_SRCS ${COMMON_SRCS} + ${COMMON_DIR}/popup-ui-normal.c) +ENDIF() + + # DPMS IF("${DPMS}" STREQUAL "x") SET(COMMON_SRCS ${COMMON_SRCS} diff --git a/circle_btn_check.png b/circle_btn_check.png new file mode 100644 index 0000000000000000000000000000000000000000..f20f62e7f8872c282aa2bb8135b3393de9dff42f GIT binary patch literal 1392 zcmbVMZA=?=7(aoHm&u?Sw6bZ=gJp@*-b=49cT(WEYgr@ZrEMH8e&BjN=%rk*-W|47 zRE8#2Hg)oWWeI}Gf*NCR(?pCirpdBpya;A7OSX)ez@~F!#QK6{!+3?3`GM?%m%ID_ z|IauP*+$`S^xk*p=%%G(N-k&>K;vw^M`&-0Z4kR23!EozIqp5!Fa$fk6RF)^Z{0id!v7Gb#%uY!KQT?pHu z9@WLdNXSx?NJ+ zr^GM>uB)gaJG2p0i@OP=C7B1!M#R7&78JDLMifT~oTvaX1VvyJgAuC%MM$%iL{Kn& zL7F!?&_;R~XWEx`vO_^tjgT-LjYf@8lTnh}VU!>U7{Oo+GiVwHr7NtmF+*4>%UED| zg_DJdDo9~4Ws&tuovIzuBHc(qjJVyKhQmslD2*~W#ztV&h`^$l%4=O)Q9b;Wt1L)sT(KnRcyim^Bd z6vs_w+<~KLt%ETW6y~&=EDVKPv5bwau!zZILl84X*lZMvI&h-4*6F}4gsIj{5EjIi z!MehV%7!^U<5$r9rm@6*u_P_?tSZSqN$SXSKvPgsB_$|DK-z0IqM)1Qgm6ldD$qv0 z3@-~W@d2kSiQqcJq_9N_qpW*XZ5V1@X1lADu`AD0dAh}}M|uZ~aw9?&_$2XCLa>wFa}!}))X_kMCsSu3^`RQAZz zr}l1NJ@8Q1W#Ij9UpbtZXj|UZ;(kinb)xJK6UOWg{Wbpj*N3|My}^scXwJy7g?ArJ zhDMXFtc0CDGc%l^XHf5n+jNxxoRkt@0rr_oxxv5tqxs;@H?AD%zVOj_sOJXWe15EZ z>P{YVs`>b84qKX>$f_Uyz5Hs!v-9mezaDyL@fl(A&Q7pl-1~?6_N0c#kZNwP|r;n;w|WU0S;JTJg=)KhWi9U`A_Od;bN2{Oh;? literal 0 HcmV?d00001 diff --git a/circle_btn_delete.png b/circle_btn_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..5f346cb1623ffc78d757ca3d0e4528043ca5e42a GIT binary patch literal 1184 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8hm3bwJ6}oxF$}kgLQj3#|G7CyF^YauyCMG83 zmzLNn0bL65LT&-v*t}wBFaZNhzap_f-%!s00+w{G(#^lGsVin%-qt%z{teX!qLRg(AC7!$;r*t#LUvz z$<)%)%)kPs*Cju>G&eP`1g19ysMpZa)X?0>&;qE}6sulPV#qB3+U$~Alv$RV;#QQO zs{r=2RVHq?7~yscL~jZfw?O@2j8m^Z&@uX;s6~oum=G}ifSB-v3*^9)erg^ty%zx! zHjl2}Yz78KAx{^_kcwMxW?tkyWWeJRe9CIg5t%fmO&)4Vaw1J4oi!p!le@LT(@)w@ zO}g(byJMU8Im?Q^-~u@o1qMbA2L`5yB;A=_r&x4@vez#Q&DUOdW^2l+`2vS;#d!sr zUyWO}b(-4R3YC_eE55hBP7|!kiP_EHH~EUxthmFBVXkcJbIMDY|D1o7y=j{QPUmrh$$_!6eKbLh* G2~7Z}D~yo< literal 0 HcmV?d00001 diff --git a/packaging/system-servant.spec b/packaging/system-servant.spec index bdc3270..d82bb9a 100755 --- a/packaging/system-servant.spec +++ b/packaging/system-servant.spec @@ -3,23 +3,29 @@ %bcond_with emulator %define PROFILE common +%define FORMFACTOR none #Main applications %define poweroff_popup on -%if "%{?tizen_profile_name}" == "mobile" +%if "%{?profile}" == "mobile" %define PROFILE mobile #Main applicaitons %define poweroff_popup on %endif -%if "%{?tizen_profile_name}" == "wearable" +%if "%{?profile}" == "wearable" %define PROFILE wearable +%if "%_repository" == "target-circle" || "%_repository" == "emulator-circle" + %define FORMFACTOR circle +%else + %define FORMFACTOR rectangle +%endif #Main applicaitons %define poweroff_popup on %endif -%if "%{?tizen_profile_name}" == "tv" +%if "%{?profile}" == "tv" %define PROFILE tv %endif @@ -89,6 +95,7 @@ cp %{SOURCE1001} . -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DPKGNAME=%{name} \ -DPROFILE=%{PROFILE} \ + -DFORMFACTOR=%{FORMFACTOR} \ -DDPMS=%{DPMS} \ -DTZ_SYS_RO_APP=%{TZ_SYS_RO_APP} \ -DTZ_SYS_RO_PACKAGES=%{TZ_SYS_RO_PACKAGES} \ @@ -96,7 +103,7 @@ cp %{SOURCE1001} . -DTZ_SYS_SHARE=%{TZ_SYS_SHARE} \ -DTZ_SYS_RO_SHARE=%{TZ_SYS_RO_SHARE} \ -DTZ_SYS_RO_APP=%{TZ_SYS_RO_APP} \ - -DPOWEROFF_POPUP=%{poweroff_popup} \ + -DPOWEROFF_POPUP=%{poweroff_popup} make %{?jobs:-j%jobs} @@ -182,4 +189,6 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %{TZ_SYS_RO_APP}/org.tizen.poweroff-syspopup/bin/poweroff-popup %{TZ_SYS_RO_SHARE}/packages/org.tizen.poweroff-syspopup.xml +%{TZ_SYS_RO_APP}/org.tizen.poweroff-syspopup/res/circle_btn_check.png +%{TZ_SYS_RO_APP}/org.tizen.poweroff-syspopup/res/circle_btn_delete.png %endif diff --git a/src/common/popup-ui-circle.c b/src/common/popup-ui-circle.c new file mode 100755 index 0000000..74f5df2 --- /dev/null +++ b/src/common/popup-ui-circle.c @@ -0,0 +1,148 @@ +/* + * system-popup + * + * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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 "popup-ui.h" + +#define BUF_MAX 512 + +int load_normal_popup(const struct popup_ops *ops) +{ + Evas_Object *btn; + Evas_Object *popup; + Evas_Object *layout; + Evas_Object *icon; + Evas_Object *win; + Evas_Smart_Cb clicked; + char *text; + char content[BUF_MAX]; + struct object_ops *obj; + int ret; + + if (!ops) + return -EINVAL; + + ret = get_object_by_ops(ops, &obj); + if (ret < 0) { + _E("Failed to get object (%d)", ret); + return -EINVAL; + } + + win = get_window(); + if (!win) + return -ENOMEM; + + evas_object_show(win); + + popup = elm_popup_add(win); + if (!popup) + return -ENOMEM; + + elm_object_style_set(popup, "circle"); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + layout = elm_layout_add(popup); + if (!layout) + return -ENOMEM; + + if (!ops->left_text && !ops->right_text) + return -ENOENT; + if (ops->left_text && ops->right_text) + elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons2"); + else + elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons1"); + if (ops->title) + elm_object_part_text_set(layout, "elm.text.title", _(ops->title)); + + if (ops->content) + snprintf(content, sizeof(content), "%s", _(ops->content)); + else if (ops->get_content) { + ret = ops->get_content(ops, content, sizeof(content)); + if (ret < 0) { + _E("Failed to get popup content"); + return ret; + } + } else + return -ENOENT; + + text = elm_entry_utf8_to_markup(content); + if (!text) + return -ENOMEM; + elm_object_part_text_set(layout, "elm.text", text); + elm_object_content_set(popup, layout); + free(text); + + if (ops->left_text && ops->right_text) { /* Two buttons */ + /* Left button */ + btn = elm_button_add(popup); + if (btn) { + elm_object_style_set(btn, "popup/circle/left"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button1", btn); + evas_object_smart_callback_add(btn, "clicked", left_clicked, ops); + + icon = elm_image_add(btn); + if (icon) { + elm_image_file_set(icon, RESDIR"/circle_btn_delete.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn, "elm.swallow.content", icon); + evas_object_show(icon); + } + } + + /* Right button */ + btn = elm_button_add(popup); + if (btn) { + elm_object_style_set(btn, "popup/circle/right"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button2", btn); + evas_object_smart_callback_add(btn, "clicked", right_clicked, ops); + + icon = elm_image_add(btn); + if (icon) { + elm_image_file_set(icon, RESDIR"/circle_btn_check.png", NULL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(btn, "elm.swallow.content", icon); + evas_object_show(icon); + } + } + } else { /* One button */ + if (ops->left_text) { + text = ops->left_text; + clicked = left_clicked; + } else { + text = ops->right_text; + clicked = right_clicked; + } + + btn = elm_button_add(popup); + if (btn) { + elm_object_style_set(btn, "bottom"); + elm_object_text_set(btn, _(text)); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_content_set(popup, "button1", btn); + evas_object_smart_callback_add(btn, "clicked", clicked, ops); + } + } + + evas_object_show(popup); + + obj->popup = popup; + + return 0; +} diff --git a/src/po/en_US.po b/src/po/en_US.po index 8faf794..554b34c 100755 --- a/src/po/en_US.po +++ b/src/po/en_US.po @@ -206,7 +206,7 @@ msgid "IDS_SYNCML_POP_DM_REMOVE_CHARGER" msgstr "Remove charger." msgid "IDS_TPLATFORM_BODY_POWER_OFF_THE_DEVICE_Q" -msgstr "Turn off the phone?" +msgstr "Turn off the device?" msgid "IDS_USB_BODY_BROWSE_CAMERA_CONNECTED_VIA_USB_Q" msgstr "Browse camera connected via USB?" diff --git a/src/poweroff/CMakeLists.txt b/src/poweroff/CMakeLists.txt index f7cec3e..12b9aa8 100755 --- a/src/poweroff/CMakeLists.txt +++ b/src/poweroff/CMakeLists.txt @@ -54,6 +54,7 @@ SET(CMAKE_C_FLAGS_RELEASE "-O2 -fpie") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") +ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") @@ -62,3 +63,6 @@ TARGET_LINK_LIBRARIES(${EXECNAME} ${poweroff_pkgs_LDFLAGS}) INSTALL(TARGETS ${EXECNAME} DESTINATION ${TZ_SYS_RO_APP}/${PKGNAME}/bin) INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/poweroff/${PKGNAME}.xml DESTINATION ${MANIFESTDIR}) + +INSTALL(FILES ${CMAKE_SOURCE_DIR}/circle_btn_check.png DESTINATION ${RESDIR}) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/circle_btn_delete.png DESTINATION ${RESDIR}) -- 2.7.4