Call screen now shows contact's photo
authorIscaro <iscaro@profusion.mobi>
Thu, 6 Sep 2012 19:44:26 +0000 (16:44 -0300)
committerIscaro <iscaro@profusion.mobi>
Mon, 10 Sep 2012 19:58:34 +0000 (16:58 -0300)
data/themes/default-hd.edc
data/themes/default-sd.edc
data/themes/images/ico_multiparty.png
data/themes/includes/answer_screen.edc
data/themes/includes/call.edc
data/themes/includes/contacts.edc
dialer/callscreen.c
tizen/answer_daemon.c
utils/util.c

index 2f48667..4b22f68 100644 (file)
@@ -26,7 +26,6 @@
 #define SIZE_TINY 16
 
 #define CONTACT_PHOTO_SIZE 128
-#define CONTACT_HALF_PHOTO 64
 #define LIST_CONTACT_HEIGHT 170
 
 #define GROUP_HEIGHT 30
@@ -39,4 +38,7 @@
 #define NOTIFICATION_BAR_HEIGHT 0
 #endif
 
+#define CALL_TEXT_OFFSET 32
+#define CALL_PHOTO_SIZE 180
+
 #include "default.edc"
index 8ed28a6..bf229b7 100644 (file)
@@ -26,7 +26,6 @@
 #define SIZE_TINY 8
 
 #define CONTACT_PHOTO_SIZE 64
-#define CONTACT_HALF_PHOTO 32
 #define LIST_CONTACT_HEIGHT 90
 
 #define GROUP_HEIGHT 20
@@ -39,4 +38,7 @@
 #define NOTIFICATION_BAR_HEIGHT 0
 #endif
 
+#define CALL_TEXT_OFFSET 16
+#define CALL_PHOTO_SIZE 90
+
 #include "default.edc"
index 4db977e..fade23b 100644 (file)
Binary files a/data/themes/images/ico_multiparty.png and b/data/themes/images/ico_multiparty.png differ
index d9f3eb6..4d37d21 100644 (file)
@@ -25,6 +25,66 @@ group {
       }
 
       part {
+         name: "img.border";
+         type: RECT;
+         scale: 1;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            color_class: "action";
+            rel1 {
+               to: "elm.swallow.photo";
+               relative: 0.0 0.0;
+               offset: -1 -1;
+            }
+            rel2 {
+               to: "elm.swallow.photo";
+               relative: 1.0 1.0;
+               offset: 0 0;
+            }
+         }
+      }
+
+      part {
+         name: "img.bg";
+         type: RECT;
+         scale: 1;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            color_class: "dark";
+            rel1 {
+               to: "elm.swallow.photo";
+               relative: 0.0 0.0;
+               offset: 0 0;
+            }
+            rel2 {
+               to: "elm.swallow.photo";
+               relative: 1.0 1.0;
+               offset: -1 -1;
+            }
+         }
+      }
+
+      part {
+         name: "elm.swallow.photo";
+         type: SWALLOW;
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            min: CALL_PHOTO_SIZE CALL_PHOTO_SIZE;
+            max: CALL_PHOTO_SIZE CALL_PHOTO_SIZE;
+            rel1.offset: BORDER_PADDING SEPARATOR_HEIGHT;
+            rel2 {
+               relative: 0.0 0.0;
+               offset: (CALL_PHOTO_SIZE + BORDER_PADDING) (SEPARATOR_HEIGHT + CALL_PHOTO_SIZE);
+            }
+         }
+      }
+
+      part {
          name: "elm.text.name";
          type: TEXT;
          mouse_events: 0;
@@ -32,10 +92,14 @@ group {
             state: "default" 0.0;
             color: 255 255 255 255;
             color_class: "action";
-            rel1.offset: BORDER_PADDING SEPARATOR_HEIGHT;
+            rel1 {
+               to: "elm.swallow.photo";
+               relative: 1.0 0.0;
+               offset: ITEM_PADDING 0;
+            }
             rel2 {
                relative: 1.0 0.0;
-               offset:  -BORDER_PADDING ACTION_HEIGHT;
+               offset: 0 (SEPARATOR_HEIGHT + CONTACT_PHOTO_SIZE);
             }
             text {
                text: "Gustavo Barbieri";
index fb0c043..3cd8319 100644 (file)
@@ -64,7 +64,7 @@ group {
       image: "ico_merge.png" COMP;
       image: "ico_swap.png" COMP;
       image: "ico_contacts.png" COMP;
-      image: "ico_multiparty.png" COMP;
+      image: "ico_arrow_right.png" COMP;
    }
 
    parts {
@@ -197,19 +197,19 @@ group {
             state: "default" 0.0;                                       \
             color: 255 255 255 255;                                     \
             color_class: "action";                                      \
-            min: 80 80;                                                 \
-            max: 80 80;                                                 \
+            min: LIST_ICON_SIZE LIST_ICON_SIZE;                                \
+            max: LIST_ICON_SIZE LIST_ICON_SIZE;                         \
             rel1 {                                                      \
                to: "call."##id;                                         \
                relative: 1.0 0.0;                                       \
-               offset: -80 (BORDER_PADDING - 1);                        \
+               offset: (-LIST_ICON_SIZE - BORDER_PADDING) 0;            \
             }                                                           \
             rel2 {                                                      \
                to: "call."##id;                                         \
-               relative: 1.0 0.0;                                       \
-               offset: -1 141;                                          \
+               relative: 1.0 1.0;                                       \
+               offset: (-BORDER_PADDING -1) -1;                         \
             }                                                           \
-            image.normal: "ico_multiparty.png";                         \
+            image.normal: "ico_arrow_right.png";                        \
          }                                                              \
          description {                                                  \
             state: "pressed" 0.0;                                       \
@@ -296,7 +296,7 @@ group {
          description {                                                  \
             state: "multiparty" 0.0;                                    \
             inherit: "default" 0.0;                                     \
-            rel2.offset: (-80 - ITEM_PADDING) (ACTION_HEIGHT - 1);      \
+            rel2.offset: (-BORDER_PADDING - ITEM_PADDING -LIST_ICON_SIZE - 1) (ACTION_HEIGHT - 1); \
          }                                                              \
       }                                                                 \
       part {                                                            \
@@ -310,15 +310,24 @@ group {
             state: "default" 0.0;                                       \
             color: 255 255 255 255;                                     \
             color_class: "action";                                      \
-            rel1.to: "area."##id".name";                                \
-            rel2.to: "area."##id".name";                                \
+            rel1 {                                                      \
+               to: "elm.swallow.img."##id;                              \
+               relative: 1.0 0.0;                                       \
+               offset: ITEM_PADDING 0;                                  \
+            }                                                           \
+            rel2 {                                                      \
+               to: "area."##id".name";                                  \
+               relative: 1.0 1.0;                                       \
+               offset: -1 -CALL_TEXT_OFFSET;                            \
+            }                                                           \
             text {                                                      \
                text: "Gustavo Barbieri";                                \
                font: FONT_NORMAL;                                       \
                size: SIZE_HUGE;                                         \
-               size_range: SIZE_TINY SIZE_HUGE;                         \
+               size_range: SIZE_MEDIUM SIZE_HUGE;                       \
                fit: 1 1;                                                \
-               align: 0.0 0.5;                                          \
+               max: 0 1;                                                \
+               align: 0.0 1.0;                                          \
                ellipsis: 0.0;                                           \
             }                                                           \
          }                                                              \
@@ -343,14 +352,15 @@ group {
             fixed: 1 1;                                                 \
             align: 0.0 0.0;                                             \
             rel1 {                                                      \
-               to: "area."##id".name";                                  \
-               relative: 0.0 1.0;                                       \
-               offset: 0 -20;                                           \
+               to_x: "elm.swallow.img."##id;                            \
+               to_y: "elm.text."##id".name";                            \
+               relative: 1.0 1.0;                                       \
+               offset: ITEM_PADDING -SEPARATOR_HEIGHT;                  \
             }                                                           \
             rel2 {                                                      \
-               to: "area."##id".name";                                  \
-               relative: 0.0 1.0;                                       \
-               offset: 0 -1;                                            \
+               to: "elm.swallow.img."##id;                              \
+               relative: 1.0 1.0;                                       \
+               offset: ITEM_PADDING -1;                                 \
             }                                                           \
             text {                                                      \
                text: "calling...";                                      \
@@ -395,6 +405,78 @@ group {
          }                                                              \
       }                                                                 \
                                                                         \
+      part {                                                            \
+         name: "elm.swallow.border."##id;                               \
+         type: RECT;                                                    \
+         scale: 1;                                                      \
+         mouse_events: 0;                                               \
+         clip_to: "call."##id;                                          \
+         description {                                                  \
+            state: "default" 0.0;                                       \
+            color: 255 255 255 255;                                     \
+            color_class: "action";                                      \
+            rel1 {                                                      \
+               to: "elm.swallow.img."##id;                              \
+               relative: 0.0 0.0;                                       \
+               offset: -1 -1;                                           \
+            }                                                           \
+            rel2 {                                                      \
+               to: "elm.swallow.img."##id;                              \
+               relative: 1.0 1.0;                                       \
+               offset: 0 0;                                             \
+            }                                                           \
+         }                                                              \
+      }                                                                 \
+                                                                        \
+      part {                                                            \
+         name: "elm.swallow.img.bg".#id;                                \
+         type: RECT;                                                    \
+         scale: 1;                                                      \
+         mouse_events: 0;                                               \
+         clip_to: "call."##id;                                          \
+         description {                                                  \
+            state: "default" 0.0;                                       \
+            color: 255 255 255 255;                                     \
+            color_class: "dark";                                        \
+            rel1 {                                                      \
+               to: "elm.swallow.img."##id;                              \
+               relative: 0.0 0.0;                                       \
+               offset: 0 0;                                             \
+            }                                                           \
+            rel2 {                                                      \
+               to: "elm.swallow.img."##id;                              \
+               relative: 1.0 1.0;                                       \
+               offset: -1 -1;                                           \
+            }                                                           \
+         }                                                              \
+      }                                                                 \
+                                                                        \
+      part {                                                            \
+         name: "elm.swallow.img."##id;                                  \
+         type: SWALLOW;                                                 \
+         scale: 1;                                                      \
+         clip_to: "call."##id;                                          \
+         mouse_events: 0;                                               \
+         description {                                                  \
+            state: "default" 0.0;                                       \
+            visible: 1;                                                 \
+            min: CALL_PHOTO_SIZE CALL_PHOTO_SIZE;                       \
+            max: CALL_PHOTO_SIZE CALL_PHOTO_SIZE;                       \
+            rel1 {                                                      \
+               to: "area."##id."name";                                  \
+               relative: 0.0 0.0;                                       \
+               offset: 0 ITEM_PADDING;                                  \
+            }                                                           \
+            rel2 {                                                      \
+               to: "area."##id."name";                                  \
+               relative: 0.0 0.0;                                       \
+               offset: CALL_PHOTO_SIZE (CALL_PHOTO_SIZE + ITEM_PADDING); \
+            }                                                           \
+         }                                                             \
+                                                                       \
+      }                                                                 \
+                                                                       \
+                                                                        \
       programs {                                                        \
          program {                                                      \
             signal: "mouse,clicked,1";                                  \
@@ -415,6 +497,7 @@ group {
             transition: ACCELERATE 0.1;                                 \
             target: "elm.text."##id".name";                             \
          }                                                              \
+                                                                        \
       }
 
       CALL("1", 0);
@@ -2037,11 +2120,15 @@ group {
             state: "default" 0.0;
             color: 255 255 255 255;
             color_class: "action";
-            align: 0.0 0.5;
-            rel1.offset: BORDER_PADDING 0;
-            rel2 {
+            rel1 {
+               to: "elm.swallow.waiting.photo";
                relative: 1.0 0.0;
-               offset: (-BORDER_PADDING - 1) (ACTION_HEIGHT - 1);
+               offset: ITEM_PADDING 0;
+            }
+            rel2 {
+               to: "notification.bar";
+               relative: 1.0 1.0;
+               offset: -BORDER_PADDING ACTION_HEIGHT;
             }
             text {
                text: "Someone";
@@ -2056,6 +2143,75 @@ group {
       }
 
       part {
+         name: "waiting.img.border";
+         type: RECT;
+         scale: 1;
+         mouse_events: 0;
+         clip_to: "clipper.waiting-visible";
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            color_class: "action";
+            rel1 {
+               to: "elm.swallow.waiting.photo";
+               relative: 0.0 0.0;
+               offset: -1 -1;
+            }
+            rel2 {
+               to: "elm.swallow.waiting.photo";
+               relative: 1.0 1.0;
+               offset: 0 0;
+            }
+         }
+      }
+
+      part {
+         name: "waiting.img.bg";
+         type: RECT;
+         scale: 1;
+         mouse_events: 0;
+         clip_to: "clipper.waiting-visible";
+         description {
+            state: "default" 0.0;
+            color: 255 255 255 255;
+            color_class: "dark";
+            rel1 {
+               to: "elm.swallow.waiting.photo";
+               relative: 0.0 0.0;
+               offset: 0 0;
+            }
+            rel2 {
+               to: "elm.swallow.waiting.photo";
+               relative: 1.0 1.0;
+               offset: -1 -1;
+            }
+         }
+      }
+
+      part {
+         name: "elm.swallow.waiting.photo";
+         type: SWALLOW;
+         scale: 1;
+         clip_to: "clipper.waiting-visible";
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            min: CALL_PHOTO_SIZE CALL_PHOTO_SIZE;
+            max: CALL_PHOTO_SIZE CALL_PHOTO_SIZE;
+            rel1 {
+               to: "notification.bar";
+               relative: 0.0 1.0;
+               offset: BORDER_PADDING ITEM_PADDING;
+            }
+            rel2 {
+               to: "notification.bar";
+               relative: 0.0 1.0;
+               offset: (CALL_PHOTO_SIZE + BORDER_PADDING) (CALL_PHOTO_SIZE + ITEM_PADDING);
+            }
+         }
+      }
+
+      part {
          name: "label.waiting";
          type: TEXT;
          mouse_events: 0;
@@ -2259,3 +2415,26 @@ group {
       }
    }
 }
+
+group {
+
+   name: "elm/icon/multiparty/default";
+
+   images{
+      image: "ico_multiparty.png" COMP;
+   }
+
+   parts {
+      part {
+         name : "base";
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            aspect: 1.0 1.0;
+            color_class: "action";
+            aspect_preference: BOTH;
+            image.normal: "ico_multiparty.png";
+         }
+      }
+   }
+}
index 330a2be..714ddb0 100644 (file)
@@ -522,6 +522,7 @@ group {
          description {
             state: "default" 0.0;
             aspect: 1.0 1.0;
+            color_class: "action";
             aspect_preference: BOTH;
             image.normal: "ico_person.png";
          }
index cc2d838..b447c95 100644 (file)
@@ -62,7 +62,7 @@ static char *_call_name_or_id(const OFono_Call *call)
        Contact_Info *info;
 
        if (!s)
-               return NULL;;
+               return NULL;
 
        info = gui_contact_search(s, NULL);
        if (info)
@@ -71,6 +71,20 @@ static char *_call_name_or_id(const OFono_Call *call)
        return phone_format(s);
 }
 
+static Evas_Object *_call_photo_get(const OFono_Call *call, Evas_Object *parent)
+{
+       const char *s = ofono_call_line_id_get(call);
+       Contact_Info *info;
+
+       if (!s)
+               return NULL;
+
+       info = gui_contact_search(s, NULL);
+       if (info)
+               return picture_icon_get(parent, contact_info_picture_get(info));
+       return NULL;
+}
+
 static char *_call_name_get(const Callscreen *ctx __UNUSED__,
                                const OFono_Call *call)
 {
@@ -277,17 +291,38 @@ static const char *_call_state_id(OFono_Call_State state)
        }
 }
 
+static void _call_photo_set(Callscreen *ctx, unsigned int id,
+                               Evas_Object *photo)
+{
+       char buf[128];
+
+       if (!photo) {
+               photo = elm_icon_add(ctx->self);
+               elm_icon_standard_set(photo, "no-picture");
+       }
+
+       snprintf(buf, sizeof(buf), "elm.swallow.img.%u", id);
+       elm_object_part_content_set(ctx->self, buf, photo);
+}
+
 static void _call_show(Callscreen *ctx, unsigned int id, const OFono_Call *c)
 {
        char *contact = _call_name_get(ctx, c);
        const char *type = _call_type_get(c);
        const char *status = _call_state_str(ofono_call_state_get(c));
+       Evas_Object *photo;
+
+       if (ofono_call_multiparty_get(c)) {
+               photo = elm_icon_add(ctx->self);
+               elm_icon_standard_set(photo, "multiparty");
+       } else
+               photo = _call_photo_get(c, ctx->self);
 
        _call_text_set(ctx, id, "name", contact);
        _call_text_set(ctx, id, "phone.type", type);
        _call_text_set(ctx, id, "status", status);
        _call_text_set(ctx, id, "elapsed", "");
-
+       _call_photo_set(ctx, id, photo);
        free(contact);
 }
 
@@ -478,6 +513,13 @@ static void _call_waiting_set(Callscreen *ctx, OFono_Call *c)
                elm_object_signal_emit(o, "hide,waiting", "call");
        } else {
                char *name = _call_name_get(ctx, c);
+               Evas_Object *photo = _call_photo_get(c, o);
+               if (!photo) {
+                       photo = elm_icon_add(o);
+                       elm_icon_standard_set(photo, "no-picture");
+               }
+               elm_object_part_content_set(o, "elm.swallow.waiting.photo",
+                                               photo);
                elm_object_part_text_set(o, "elm.text.waiting", name);
                elm_object_signal_emit(o, "show,waiting", "call");
                free(name);
index ef364e1..f35ce2a 100644 (file)
@@ -122,6 +122,7 @@ static void _call_destroy(Call *c)
 static void _call_screen_show(Call_Screen *cs)
 {
        Call *c = cs->call;
+       Evas_Object *icon = NULL;
 
        INF("Show line_id=%s, name=%s, type=%s",
                c->line_id, c->name, c->type);
@@ -137,9 +138,20 @@ static void _call_screen_show(Call_Screen *cs)
        else
                elm_object_part_text_set(cs->layout, "elm.text.name",
                                                c->name);
+       icon = elm_icon_add(cs->layout);
+
+       if (strcmp("", c->img) != 0) {
+#ifdef HAVE_TIZEN
+               elm_icon_file_set(icon, c->img, NULL);
+#else
+               elm_image_file_set(icon, c->img, NULL);
+#endif
+       } else
+               elm_icon_standard_set(icon, "no-picture");
 
        elm_object_part_text_set(cs->layout, "elm.text.state", "Incoming...");
        elm_object_part_text_set(cs->layout, "elm.text.phone.type", c->type);
+       elm_object_part_content_set(cs->layout, "elm.swallow.photo", icon);
        elm_object_signal_emit(cs->layout, "show,activecall", "gui");
        evas_object_show(cs->win);
 #ifdef HAVE_TIZEN
index 39344ff..92d15b6 100644 (file)
@@ -113,12 +113,16 @@ Evas_Object *picture_icon_get(Evas_Object *parent, const char *picture)
        if (!picture || *picture == '\0')
                elm_icon_standard_set(icon, "no-picture");
        else {
+#ifdef HAVE_TIZEN
+               elm_icon_file_set(icon, picture, NULL);
+#else
                char path[PATH_MAX];
                const char *prefix;
                prefix = efreet_config_home_get();
                snprintf(path, sizeof(path), "%s/%s/%s", prefix, PACKAGE_NAME,
                                picture);
                elm_image_file_set(icon, path, NULL);
+#endif
        }
        return icon;
 }