cooldown popup : changes string and add image for wearable 85/110785/2 accepted/tizen/3.0/common/20170119.105855 accepted/tizen/3.0/mobile/20170118.230722 accepted/tizen/3.0/tv/20170118.230738 accepted/tizen/3.0/wearable/20170118.230758 submit/tizen_3.0/20170118.072533
authorlokilee73 <changjoo.lee@samsung.com>
Wed, 18 Jan 2017 05:17:33 +0000 (14:17 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Wed, 18 Jan 2017 07:21:20 +0000 (16:21 +0900)
Change-Id: I59dacee19f48a991f4ca410d7e2d19b8beb3f00c
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
data/overheat.png [new file with mode: 0755]
packaging/system-servant.spec
src/CMakeLists.txt
src/cooldown/cooldown-popup.edc [new file with mode: 0755]
src/cooldown/cooldown-wearable.c

diff --git a/data/overheat.png b/data/overheat.png
new file mode 100755 (executable)
index 0000000..d1a937c
Binary files /dev/null and b/data/overheat.png differ
index bc4bfe0..46c36a6 100755 (executable)
@@ -343,6 +343,10 @@ rm -rf %{buildroot}
 %if "%{?profile}" == "mobile"
 %{TZ_SYS_RO_APP}/org.tizen.system-syspopup/shared/res/usb-popup.edj
 %endif
+%if "%{?profile}" == "wearable"
+%{TZ_SYS_RO_APP}/org.tizen.system-syspopup/shared/res/cooldown-popup.edj
+%{TZ_SYS_RO_APP}/org.tizen.system-syspopup/res/overheat.png
+%endif
 %{TZ_SYS_RO_SHARE}/packages/org.tizen.system-syspopup.xml
 %endif
 
index 5e99c6d..e257cc1 100755 (executable)
@@ -72,11 +72,7 @@ SET(PREFIX "${CMAKE_INSTALL_PREFIX}/apps/${PKGNAME}")
 SET(BINDIR "${PREFIX}/bin")
 SET(RESDIR "${PREFIX}/res")
 SET(MANIFESTDIR "${CMAKE_INSTALL_PREFIX}/share/packages")
-IF(USB_POPUP STREQUAL on)
-       IF(PROFILE_MOBILE)
-               SET(SYSTEM_RES "${TZ_SYS_RO_APP}/${PKGNAME}/shared/res")
-       ENDIF()
-ENDIF(USB_POPUP STREQUAL on)
+SET(SYSTEM_RES "${TZ_SYS_RO_APP}/${PKGNAME}/shared/res")
 
 SET(PKG_MODULES
                appcore-efl
@@ -116,6 +112,12 @@ IF(USB_POPUP STREQUAL on)
        ENDIF()
 ENDIF(USB_POPUP STREQUAL on)
 
+IF(COOLDOWN_POPUP STREQUAL on)
+       IF(PROFILE_WEARABLE)
+               ADD_DEFINITIONS("-DELM_COOLDOWN_EDC=\"${SYSTEM_RES}/cooldown-popup.edj\"")
+       ENDIF()
+ENDIF(COOLDOWN_POPUP STREQUAL on)
+
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
 
 ADD_EXECUTABLE(${PACKAGE} ${SRCS})
@@ -136,6 +138,22 @@ IF(USB_POPUP STREQUAL on)
        ENDIF()
 ENDIF(USB_POPUP STREQUAL on)
 
+IF(COOLDOWN_POPUP STREQUAL on)
+       IF(PROFILE_WEARABLE)
+               ADD_CUSTOM_TARGET(cooldown-popup.edj
+                       COMMAND edje_cc -no-save ${CMAKE_SOURCE_DIR}/src/cooldown/cooldown-popup.edc ${CMAKE_BINARY_DIR}/cooldown-popup.edj
+                       DEPENDS ${CMAKE_SOURCE_DIR}/src/cooldown/cooldown-popup.edc
+                       COMMENT "making cooldown popup edj file"
+               )
+               ADD_DEPENDENCIES(${PACKAGE} cooldown-popup.edj)
+               INSTALL(FILES ${CMAKE_BINARY_DIR}/cooldown-popup.edj DESTINATION ${SYSTEM_RES})
+       ENDIF()
+ENDIF(COOLDOWN_POPUP STREQUAL on)
+
+IF(PROFILE STREQUAL wearable)
+       INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/overheat.png DESTINATION ${RESDIR})
+ENDIF()
+
 # install manifest file
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PKGNAME}.xml DESTINATION ${MANIFESTDIR})
 ############## END ##############
diff --git a/src/cooldown/cooldown-popup.edc b/src/cooldown/cooldown-popup.edc
new file mode 100755 (executable)
index 0000000..62ccd61
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2017 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.
+ *
+ */
+collections {
+       base_scale: 2.6;
+
+       #define POPUP_PROGRESSBAR_VIEW_LAYOUT_BASE_COOLDOWN_MIN_INC 360 360
+       #define POPUP_PROGRESSBAR_VIEW_LAYOUT_BASE_COOLDOWN_MAX_INC 360 360
+       #define POPUP_PROGRESSBAR_VIEW_LAYOUT_TOP_PAD_MIN_INC 224 76
+       #define POPUP_PROGRESSBAR_VIEW_LAYOUT_TOP_PAD_MAX_INC 224 76
+       #define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC 224 100
+       #define POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC 224 100
+
+       group { name: "cooldown_warning_layout";
+          parts {
+             part { name: "elm.swallow.content";
+                type: SWALLOW;
+                scale: 1;
+                description { state: "default" 0.0;
+                   min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC;
+                   max: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC;
+                   fixed: 1 1;
+                   align: 0.5 0.0;
+                   rel2.relative: 1.0 0.0;
+                }
+             }
+             part { name: "before_text_pad";
+                type: SPACER;
+                scale: 1;
+                description { state: "default" 0.0;
+                   min: 0 5;
+                   align: 0.5 0.0;
+                   fixed: 0 1;
+                   rel1 {
+                      relative: 0.0 1.0;
+                      to_y: "elm.swallow.content";
+                   }
+                   rel2 {
+                      relative: 1.0 1.0;
+                      to_y: "elm.swallow.content";
+                   }
+                }
+             }
+             part { name: "label";
+                type: SWALLOW;
+                scale: 1;
+                description { state: "default" 0.0;
+                   align: 0.5 0.0;
+                   fixed: 1 0;
+                   rel1 {
+                      relative: 0.0 1.0;
+                      to_y: "before_text_pad";
+                   }
+                   rel2 {
+                      relative: 1.0 1.0;
+                   }
+                }
+             }
+          }
+       }
+
+       group { name: "cooldown_poweroff_layout";
+          parts {
+             part { name: "base";
+                type: SPACER;
+                scale: 1;
+                description { state: "default" 0.0;
+                   min: POPUP_PROGRESSBAR_VIEW_LAYOUT_BASE_COOLDOWN_MIN_INC;
+                   max: POPUP_PROGRESSBAR_VIEW_LAYOUT_BASE_COOLDOWN_MAX_INC;
+                }
+             }
+             part { name: "top_pad";
+                type: SPACER;
+                scale: 1;
+                description { state: "default" 0.0;
+                    min: POPUP_PROGRESSBAR_VIEW_LAYOUT_TOP_PAD_MIN_INC;
+                    max: POPUP_PROGRESSBAR_VIEW_LAYOUT_TOP_PAD_MAX_INC;
+                   rel1.relative: 0.0 0.0;
+                   rel1.to: "base";
+                   rel2.relative: 1.0 0.0;
+                   rel2.to: "base";
+                   align: 0.5 0.0;
+                   fixed: 0 1;
+                }
+             }
+             part { name: "elm.swallow.content";
+                type: SWALLOW;
+                scale: 1;
+                description { state: "default" 0.0;
+                   min: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MIN_INC;
+                   max: POPUP_PROCESSING_SWALLOW_VIEW_LAYOUT_MAX_INC;
+                   fixed: 1 1;
+                   align: 0.5 0.0;
+                   rel2.relative: 1.0 0.0;
+                }
+             }
+             part { name: "before_text_pad";
+                type: SPACER;
+                scale: 1;
+                description { state: "default" 0.0;
+                   min: 0 5;
+                   align: 0.5 0.0;
+                   fixed: 0 1;
+                   rel1 {
+                      relative: 0.0 1.0;
+                      to_y: "elm.swallow.content";
+                   }
+                   rel2 {
+                      relative: 1.0 1.0;
+                      to_y: "elm.swallow.content";
+                   }
+                }
+             }
+             part { name: "label";
+                type: SWALLOW;
+                scale: 1;
+                description { state: "default" 0.0;
+                   align: 0.5 0.0;
+                   fixed: 1 0;
+                   rel1 {
+                      relative: 0.0 1.0;
+                      to_y: "before_text_pad";
+                   }
+                   rel2 {
+                      relative: 1.0 1.0;
+                   }
+                }
+             }
+          }
+       }
+}
index 98018d0..0d5b3e6 100755 (executable)
@@ -41,6 +41,8 @@
 #define TIMEOUT_BEEP_1   1 /* seconds */
 #define TIMEOUT_BEEP_0_5 (0.5) /* seconds */
 
+#define BUF_MAX 512
+
 enum beep_type {
        BEEP_SINGLE = FEEDBACK_PATTERN_LOWBATT, /* should be changed to FEEDBACK_PATTERN_TEMPERATURE_WARNING */
        BEEP_DOUBLE = FEEDBACK_PATTERN_LOWBATT, /* should be changed to double beep */
@@ -69,6 +71,18 @@ static const struct beep_style {
        { BEEP_DONE             ,   0                                   },
 };
 
+static char *items[] = {
+       "WDS_ST_HEADER_GEAR_COOLING_ABB",
+       "WDS_PN_TPOP_EMERGENCY_CALLS_ONLY_ABB",
+       "IDS_COM_SK_OK",
+       "WDS_PN_TPOP_GEAR_WILL_POWER_OFF_TO_COOL_ABB"
+};
+
+char* gl_text_get(int index)
+{
+       return strdup(_(items[index]));
+}
+
 static const struct popup_ops cooldown_poweroff_ops;
 static const struct popup_ops cooldown_warning_ops;
 static const struct popup_ops cooldown_poweron_ops;
@@ -286,25 +300,172 @@ static int cooldown_poweroff_timer(bundle *b, const struct popup_ops *ops)
        return 0;
 }
 
-static int cooldown_poweroff_content(const struct popup_ops *ops, char *content, unsigned int len)
+static void _clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       const struct popup_ops *ops = data;
+
+       if (ops)
+               unload_simple_popup(ops);
+
+       terminate_if_no_popup();
+}
+
+static void _clicked_poweroff_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       snprintf(content, len, "Device will power off to cool down.");
+       const struct popup_ops *ops = data;
+
+       cooldown_poweroff(ops);
+}
+
+int cooldown_warning_show(bundle *b, const struct popup_ops *ops)
+{
+       Evas_Object *popup;
+       Evas_Object *layout;
+       Evas_Object *layout_inner;
+       Evas_Object *label;
+       Evas_Object *btn;
+       Evas_Object *image;
+       Evas_Object *win;
+       char buf[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 */
+       popup = elm_popup_add(win);
+       elm_object_style_set(popup, "circle");
+
+       /* Layout for one button */
+       layout = elm_layout_add(popup);
+       elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons1");
+
+       /* Popup Title */
+       elm_object_part_text_set(layout, "elm.text.title", gl_text_get(0));
+       elm_object_content_set(popup, layout);
+
+       /* Inner Layout */
+       layout_inner = elm_layout_add(layout);
+       elm_layout_file_set(layout_inner, ELM_COOLDOWN_EDC, "cooldown_warning_layout");
+       elm_object_part_content_set(layout, "elm.swallow.content", layout_inner);
+
+       /* Image */
+       image = elm_image_add(layout_inner);
+       snprintf(buf, sizeof(buf), "%s/overheat.png", RESDIR);
+       elm_image_file_set(image, buf, NULL);
+       elm_object_part_content_set(layout_inner, "elm.swallow.content", image);
+
+       /* Label */
+       label = elm_label_add(layout_inner);
+       elm_object_style_set(label, "popup/default");
+       elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+       elm_object_text_set(label, gl_text_get(1));
+       elm_object_part_content_set(layout_inner, "label", label);
+
+       /* Button */
+       btn = elm_button_add(popup);
+       elm_object_style_set(btn, "popup/circle");
+       elm_object_text_set(btn, gl_text_get(2));
+       elm_object_part_content_set(popup, "button1", btn);
+       evas_object_smart_callback_add(btn, "clicked", _clicked_cb, ops);
+
+       /* Back key */
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
+
+       evas_object_show(popup);
+       obj->popup = popup;
+
        return 0;
 }
 
-static int cooldown_warning_content(const struct popup_ops *ops, char *content, unsigned int len)
+int cooldown_poweroff_show(bundle *b, const struct popup_ops *ops)
 {
-       snprintf(content, len, "Device is overheating. This task will end shortly. You will only be able to make emergency calls until it has cooled down.");
+       Evas_Object *popup;
+       Evas_Object *layout;
+       Evas_Object *layout_inner;
+       Evas_Object *label;
+       Evas_Object *btn;
+       Evas_Object *image;
+       Evas_Object *win;
+       char buf[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 */
+       popup = elm_popup_add(win);
+       elm_object_style_set(popup, "circle");
+
+       /* Layout for one button */
+       layout = elm_layout_add(popup);
+       elm_layout_theme_set(layout, "layout", "popup", "content/circle/buttons1");
+       elm_object_content_set(popup, layout);
+
+       /* Inner Layout */
+       layout_inner = elm_layout_add(layout);
+       elm_layout_file_set(layout_inner, ELM_COOLDOWN_EDC, "cooldown_poweroff_layout");
+       elm_object_part_content_set(layout, "elm.swallow.content", layout_inner);
+
+       /* Image */
+       image = elm_image_add(layout_inner);
+       snprintf(buf, sizeof(buf), "%s/overheat.png", RESDIR);
+       elm_image_file_set(image, buf, NULL);
+       elm_object_part_content_set(layout_inner, "elm.swallow.content", image);
+
+       /* Label */
+       label = elm_label_add(layout_inner);
+       elm_object_style_set(label, "popup/default");
+       elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+       elm_object_text_set(label, gl_text_get(3));
+       elm_object_part_content_set(layout_inner, "label", label);
+
+       /* Button */
+       btn = elm_button_add(popup);
+       elm_object_style_set(btn, "popup/circle");
+       elm_object_text_set(btn, gl_text_get(2));
+       elm_object_part_content_set(popup, "button1", btn);
+       evas_object_smart_callback_add(btn, "clicked", _clicked_poweroff_cb, ops);
+
+       /* Back key */
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops);
+
+       evas_object_show(popup);
+       obj->popup = popup;
+
        return 0;
 }
 
 static const struct popup_ops cooldown_poweroff_ops = {
        .name           = "cooldown_poweroff",
        .pattern        = FEEDBACK_PATTERN_LOWBATT,
-       .show           = load_simple_popup,
-       .get_content = cooldown_poweroff_content,
-       .left_text      = "IDS_COM_SK_OK",
-       .left           = cooldown_poweroff,
+       .show           = cooldown_poweroff_show,
        .pre            = cooldown_poweroff_timer,
        .terminate      = cooldown_poweroff_terminate,
 };
@@ -320,18 +481,25 @@ static const struct popup_ops cooldown_poweron_ops = {
 static const struct popup_ops cooldown_warning_ops = {
        .name           = "cooldown_warning",
        .pattern        = FEEDBACK_PATTERN_LOWBATT,
-       .show           = load_simple_popup,
-       .get_content = cooldown_warning_content,
-       .left_text      = "IDS_COM_SK_OK",
-       .left           = cooldown_warning,
+       .show           = cooldown_warning_show,
        .pre            = cooldown_warning_timer,
        .terminate      = cooldown_warning_terminate,
 };
 
+static const struct popup_ops cooled_down_ops = {
+       .name           = "cooled_down",
+       .pattern        = FEEDBACK_PATTERN_LOWBATT,
+       .show           = load_simple_popup,
+       .title          = "WDS_PN_HEADER_COOLED_ABB",
+       .content        = "WDS_PN_TPOP_YOUR_GEAR_IS_NOW_READY_TO_USE_ABB",
+       .left_text      = "IDS_COM_SK_OK",
+};
+
 /* Constructor to register cooldown button */
 static __attribute__ ((constructor)) void cooldown_register_popup(void)
 {
        register_popup(&cooldown_poweron_ops);
        register_popup(&cooldown_poweroff_ops);
        register_popup(&cooldown_warning_ops);
+       register_popup(&cooled_down_ops);
 }