viewer: show error message when failed to load the image 12/55812/1
authorMinkyu Kang <mk7.kang@samsung.com>
Tue, 29 Dec 2015 11:17:01 +0000 (20:17 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Tue, 29 Dec 2015 11:17:01 +0000 (20:17 +0900)
Change-Id: I368b8c30eb5a3a8b17890e4ef69014d89aef8da5
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
include/define.h
include/view/viewer.h
res/edc/view/viewer.edc
src/view/viewer.c

index f55eaec..a5c6890 100644 (file)
@@ -49,6 +49,7 @@
 #define COLOR_TEXT_SELECTED 64 136 211 255
 #define COLOR_TEXT_DISABLED 87 87 87 128
 #define COLOR_TEXT_BG 113 128 147 255
+#define COLOR_TEXT_ERR 218 51 51 255
 #define COLOR_ITEM_BG 255 255 255 255
 #define COLOR_ITEM_DEFAULT 119 169 202 255
 #define COLOR_ITEM_FOCUS 0 119 246 255
index beb81a8..3c590fa 100644 (file)
@@ -29,6 +29,7 @@
 /* part */
 #define PART_VIEWER_BG "part.viewer_bg"
 #define PART_VIEWER_CONTENT "part.viewer_content"
+#define PART_VIEWER_CONTENT_ERR "part.viewer_content_err"
 #define PART_VIEWER_TITLE "part.viewer_title"
 #define PART_VIEWER_DATE "part.viewer_date"
 #define PART_VIEWER_PAGE "part.viewer_page"
index 0810c18..4792b91 100644 (file)
@@ -671,6 +671,24 @@ group {
                                visible: 0;
                        }
                }
+
+               /* ERR */
+               part {
+                       name: PART_VIEWER_CONTENT_ERR;
+                       type: TEXT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1.to: "bg";
+                               rel2.to: "bg";
+                               text {
+                                       font: FONT_LIGHT;
+                                       size: 36;
+                                       align: 0.5 0.5;
+                               }
+                               color: COLOR_TEXT_ERR;
+                       }
+               }
        }
 
        programs {
index ec5cab7..428291f 100644 (file)
@@ -293,6 +293,9 @@ static void _image_loaded_detail(void *data, Evas_Object *obj, void *ev)
 static void _draw_contents(struct _priv *priv, int id, app_media_info *mi)
 {
        Evas_Object *obj;
+       Evas_Load_Error err;
+
+       elm_object_part_text_set(priv->base, PART_VIEWER_CONTENT_ERR, "");
 
        if (id == VIEWER_MOVIE) {
                _image_unload(priv);
@@ -343,7 +346,19 @@ static void _draw_contents(struct _priv *priv, int id, app_media_info *mi)
 
        _set_bg_color(priv, 0, 0, 0, 255);
 
-       elm_photocam_file_set(obj, mi->file_path);
+       err = elm_photocam_file_set(obj, mi->file_path);
+       if (err != EVAS_LOAD_ERROR_NONE) {
+               _ERR("photocam file load failed (%d): %s", err, mi->file_path);
+
+               _image_unload(priv);
+
+               _set_bg_color(priv, 244, 244, 244, 255);
+               elm_object_part_text_set(priv->base, PART_VIEWER_CONTENT_ERR,
+                               "Failed to load the image.");
+
+               return;
+       }
+
        elm_photocam_zoom_mode_set(obj, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
        elm_photocam_image_orient_set(obj,
                        util_get_orient(mi->image->orientation));