Commit 86e91689 authored by Stepan Salenikovich's avatar Stepan Salenikovich

incomingcallview: show the peer's uri

In the case that the peer has a display name or is a contact, we
show the uri below so the user is aware of the number or ringId
being used for the call.

Change-Id: I3a59a34452110d1cebc8decde28599926d676d7a
Tuleap: #645
parent bbfa4407
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <person.h> #include <person.h>
#include <globalinstances.h> #include <globalinstances.h>
#include "native/pixbufmanipulator.h" #include "native/pixbufmanipulator.h"
#include <itemdataroles.h>
#include <numbercategory.h>
struct _IncomingCallView struct _IncomingCallView
{ {
...@@ -43,7 +45,8 @@ typedef struct _IncomingCallViewPrivate IncomingCallViewPrivate; ...@@ -43,7 +45,8 @@ typedef struct _IncomingCallViewPrivate IncomingCallViewPrivate;
struct _IncomingCallViewPrivate struct _IncomingCallViewPrivate
{ {
GtkWidget *image_incoming; GtkWidget *image_incoming;
GtkWidget *label_identity; GtkWidget *label_name;
GtkWidget *label_uri;
GtkWidget *spinner_status; GtkWidget *spinner_status;
GtkWidget *placeholder; GtkWidget *placeholder;
GtkWidget *label_status; GtkWidget *label_status;
...@@ -88,7 +91,8 @@ incoming_call_view_class_init(IncomingCallViewClass *klass) ...@@ -88,7 +91,8 @@ incoming_call_view_class_init(IncomingCallViewClass *klass)
"/cx/ring/RingGnome/incomingcallview.ui"); "/cx/ring/RingGnome/incomingcallview.ui");
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, image_incoming); gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, image_incoming);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, label_identity); gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, label_name);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, label_uri);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, spinner_status); gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, spinner_status);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, placeholder); gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, placeholder);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, label_status); gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, label_status);
...@@ -168,9 +172,19 @@ incoming_call_view_set_call_info(IncomingCallView *view, const QModelIndex& idx) ...@@ -168,9 +172,19 @@ incoming_call_view_set_call_info(IncomingCallView *view, const QModelIndex& idx)
gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_incoming), image.get()); gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_incoming), image.get());
/* get name */ /* get name */
QVariant var = idx.model()->data(idx, static_cast<int>(Call::Role::Name)); auto name = idx.model()->data(idx, static_cast<int>(Ring::Role::Name));
QByteArray ba_name = var.toString().toLocal8Bit(); gtk_label_set_text(GTK_LABEL(priv->label_name), name.toString().toUtf8().constData());
gtk_label_set_text(GTK_LABEL(priv->label_identity), ba_name.constData());
/* get uri, if different from name */
auto uri = idx.model()->data(idx, static_cast<int>(Ring::Role::Number));
if (name.toString() != uri.toString()) {
auto cat_uri = g_strdup_printf("(%s) %s"
,call->peerContactMethod()->category()->name().toUtf8().constData()
,uri.toString().toUtf8().constData());
gtk_label_set_text(GTK_LABEL(priv->label_uri), cat_uri);
g_free(cat_uri);
gtk_widget_show(priv->label_uri);
}
/* change some things depending on call state */ /* change some things depending on call state */
update_state(view, call); update_state(view, call);
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<!-- <property name="min-content-height">250</property> -->
<!-- for now, disable scrolling, display everything --> <!-- for now, disable scrolling, display everything -->
<property name="vscrollbar_policy">never</property> <property name="vscrollbar_policy">never</property>
<property name="hscrollbar_policy">never</property> <property name="hscrollbar_policy">never</property>
...@@ -47,7 +46,7 @@ ...@@ -47,7 +46,7 @@
<!-- end image of contact --> <!-- end image of contact -->
<!-- name or other identity of contact --> <!-- name or other identity of contact -->
<child> <child>
<object class="GtkLabel" id="label_identity"> <object class="GtkLabel" id="label_name">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="halign">center</property> <property name="halign">center</property>
...@@ -63,6 +62,24 @@ ...@@ -63,6 +62,24 @@
</packing> </packing>
</child> </child>
<!-- end name or other identity of contact --> <!-- end name or other identity of contact -->
<!-- uri of contact -->
<child>
<object class="GtkLabel" id="label_uri">
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
<property name="selectable">True</property>
<property name="ellipsize">end</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<!-- end uri of contact -->
<!-- call initialization progress --> <!-- call initialization progress -->
<child> <child>
<object class="GtkSpinner" id="spinner_status"> <object class="GtkSpinner" id="spinner_status">
...@@ -87,9 +104,9 @@ ...@@ -87,9 +104,9 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Incoming...</property> <property name="label" translatable="yes">Incoming...</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
<attributes> <style>
<attribute name="foreground" value="#88888a8a8585"/> <class name="dim-label"/>
</attributes> </style>
</object> </object>
</child> </child>
</object> </object>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment