Commit 55bff9dd authored by Sébastien Blin's avatar Sébastien Blin

link client to LRC new models

- change all components of the client to use new models from the lrc.
- remove dead code.

Change-Id: Idb705df6f63fd90de7fdded6c38288dab6ffe31e
Reviewed-by: Adrien Béraud's avatarAdrien Béraud <adrien.beraud@savoirfairelinux.com>
parent fad674f5
......@@ -337,6 +337,9 @@ create_ring_account(AccountCreationWizard *view,
case NameDirectory::RegisterNameStatus::NETWORK_ERROR:
{
could_not_register_username_dialog(view);
// Reload so that the username is displayed in the settings
account << Account::EditAction::RELOAD;
break;
}
case NameDirectory::RegisterNameStatus::SUCCESS:
{
......
......@@ -122,7 +122,6 @@ choose_export_location(AccountImportExportView *self)
gtk_label_set_text(GTK_LABEL(priv->label_export_location), filename);
// if accounts and password are set then we're ready for export
auto password = gtk_entry_get_text(GTK_ENTRY(priv->entry_password));
if (priv->export_accounts_list && priv->export_accounts_list->data) {
gtk_widget_set_sensitive(priv->button_export, TRUE);
}
......
......@@ -172,8 +172,6 @@ password_entry_changed(G_GNUC_UNUSED GtkEntry* entry, AccountMigrationView *view
AccountMigrationViewPrivate *priv = ACCOUNT_MIGRATION_VIEW_GET_PRIVATE(view);
gtk_widget_hide(priv->label_migration_error);
const gchar *password = gtk_entry_get_text(GTK_ENTRY(priv->entry_password));
gtk_widget_set_sensitive(priv->button_migrate_account, TRUE);
}
......
This diff is collapsed.
/*
* Copyright (C) 2016-2017 Savoir-faire Linux Inc.
* Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
* Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -19,12 +21,23 @@
#pragma once
// Gtk
#include <gtk/gtk.h>
// Client related
#include "accountcontainer.h"
#include "webkitchatcontainer.h"
class Call;
class ContactMethod;
class Person;
namespace lrc
{
namespace api
{
namespace conversation
{
struct Info;
}
}
}
G_BEGIN_DECLS
......@@ -37,14 +50,13 @@ G_BEGIN_DECLS
typedef struct _ChatView ChatView;
typedef struct _ChatViewClass ChatViewClass;
GType chat_view_get_type (void) G_GNUC_CONST;
GtkWidget *chat_view_new_call (WebKitChatContainer* view, Call* call);
GtkWidget *chat_view_new_cm (WebKitChatContainer* view, ContactMethod* cm);
GtkWidget *chat_view_new_person (WebKitChatContainer* view, Person* p);
Call *chat_view_get_call (ChatView*);
ContactMethod *chat_view_get_cm (ChatView*);
Person *chat_view_get_person (ChatView*);
void chat_view_set_header_visible(ChatView*, gboolean);
GtkWidget *chat_view_new (WebKitChatContainer* view,
AccountContainer* accountContainer,
lrc::api::conversation::Info* conversation);
lrc::api::conversation::Info chat_view_get_conversation(ChatView*);
bool chat_view_get_temporary(ChatView*);
void chat_view_update_temporary(ChatView*, bool);
void chat_view_set_header_visible(ChatView*, gboolean);
G_END_DECLS
......@@ -52,7 +52,7 @@ G_DEFINE_TYPE_WITH_PRIVATE(ConversationPopupMenu, conversation_popup_menu, GTK_T
#define CONVERSATION_POPUP_MENU_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CONVERSATION_POPUP_MENU_TYPE, ConversationPopupMenuPrivate))
static void
remove_history_conversation(GtkWidget *menu, ConversationPopupMenuPrivate* priv)
remove_history_conversation(G_GNUC_UNUSED GtkWidget *menu, ConversationPopupMenuPrivate* priv)
{
try
{
......@@ -150,7 +150,7 @@ update(GtkTreeSelection *selection, ConversationPopupMenu *self)
if (contactInfo.profileInfo.type == lrc::api::profile::Type::TEMPORARY ||
contactInfo.profileInfo.type == lrc::api::profile::Type::PENDING) {
// If we can add this conversation
auto add_conversation_conversation = gtk_menu_item_new_with_mnemonic(_("_Add conversation"));
auto add_conversation_conversation = gtk_menu_item_new_with_mnemonic(_("_Add to conversations"));
gtk_menu_shell_append(GTK_MENU_SHELL(self), add_conversation_conversation);
g_signal_connect(add_conversation_conversation, "activate", G_CALLBACK(add_conversation), priv);
if (contactInfo.profileInfo.type == lrc::api::profile::Type::PENDING) {
......
......@@ -129,14 +129,6 @@ render_name_and_last_interaction(G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
4 /* col# */, &lastInteraction /* data */,
-1);
// Limit the size of lastInteraction to 20 chars and add '…' at the end
const auto maxSize = 20;
const auto size = g_utf8_strlen (lastInteraction, maxSize + 1);
if (size > maxSize) {
g_utf8_strncpy (lastInteraction, lastInteraction, 20);
lastInteraction = g_markup_printf_escaped("%s…", lastInteraction);
}
if (std::string(alias).empty()) {
// For conversations with contacts with no alias
text = g_markup_printf_escaped(
......@@ -183,7 +175,8 @@ render_time(G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
auto priv = CONVERSATIONS_VIEW_GET_PRIVATE(treeview);
if (!priv) return;
gchar *text;
char empty[] = {'\0'};
gchar *text = empty;
try
{
......@@ -195,11 +188,9 @@ render_time(G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
lrc::api::call::to_string(call.status).c_str()
);
} else if (conversation.interactions.empty()) {
text = "";
} else {
auto lastUid = conversation.lastMessageUid;
if (conversation.interactions.find(lastUid) == conversation.interactions.end()) {
text = "";
} else {
std::time_t lastInteractionTimestamp = conversation.interactions[lastUid].timestamp;
std::time_t now = std::time(nullptr);
......@@ -212,13 +203,9 @@ render_time(G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
if (std::string(interactionDay) == std::string(nowDay)) {
char interactionTime[100];
std::strftime(interactionTime, sizeof(interactionTime), "%R", std::localtime(&lastInteractionTimestamp));
text = g_markup_printf_escaped("<span size=\"smaller\" color=\"#666\">%s</span>",
&interactionTime
);
text = g_markup_printf_escaped("<span size=\"smaller\" color=\"#666\">%s</span>", &interactionTime[0]);
} else {
text = g_markup_printf_escaped("<span size=\"smaller\" color=\"#666\">%s</span>",
&interactionDay
);
text = g_markup_printf_escaped("<span size=\"smaller\" color=\"#666\">%s</span>", &interactionDay[0]);
}
}
}
......@@ -312,7 +299,7 @@ select_conversation(GtkTreeSelection *selection, ConversationsView *self)
}
static void
conversations_view_init(ConversationsView *self)
conversations_view_init(G_GNUC_UNUSED ConversationsView *self)
{
// Nothing to do
}
......@@ -609,7 +596,8 @@ conversations_view_new(AccountContainer* accountContainer)
priv->accountContainer_ = accountContainer;
build_conversations_view(self);
if (priv->accountContainer_)
build_conversations_view(self);
return (GtkWidget *)self;
}
......
This diff is collapsed.
/*
* Copyright (C) 2015-2017 Savoir-faire Linux Inc.
* Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
* Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -17,13 +19,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _CURRENTCALLVIEW_H
#define _CURRENTCALLVIEW_H
#pragma once
#include <gtk/gtk.h>
#include "accountcontainer.h"
#include "webkitchatcontainer.h"
class Call;
namespace lrc
{
namespace api
{
namespace conversation
{
struct Info;
}
}
}
G_BEGIN_DECLS
......@@ -38,9 +49,9 @@ typedef struct _CurrentCallViewClass CurrentCallViewClass;
GType current_call_view_get_type (void) G_GNUC_CONST;
GtkWidget *current_call_view_new (Call*, WebKitChatContainer*);
Call *current_call_view_get_call (CurrentCallView*);
GtkWidget *current_call_view_new (WebKitChatContainer* view,
AccountContainer* accountContainer,
lrc::api::conversation::Info* conversation);
lrc::api::conversation::Info current_call_view_get_conversation(CurrentCallView*);
G_END_DECLS
#endif /* _CURRENTCALLVIEW_H */
/*
* Copyright (C) 2015-2017 Savoir-faire Linux Inc.
* Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
* Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -19,17 +21,21 @@
#include "incomingcallview.h"
// Gtk
#include <gtk/gtk.h>
#include <call.h>
#include "utils/drawing.h"
#include <callmodel.h>
#include <contactmethod.h>
#include <person.h>
#include <QSize>
// Lrc
#include <api/newcallmodel.h>
#include <api/contactmodel.h>
#include <api/conversationmodel.h>
#include <api/contact.h>
#include <globalinstances.h>
#include "native/pixbufmanipulator.h"
#include <itemdataroles.h>
#include <numbercategory.h>
// Client
#include "chatview.h"
#include "native/pixbufmanipulator.h"
#include "utils/drawing.h"
#include "utils/files.h"
struct _IncomingCallView
......@@ -51,23 +57,18 @@ struct _IncomingCallViewPrivate
GtkWidget *label_name;
GtkWidget *label_bestId;
GtkWidget *spinner_status;
GtkWidget *placeholder;
GtkWidget *label_status;
GtkWidget *button_accept_incoming;
GtkWidget *button_reject_incoming;
GtkWidget *button_end_call;
GtkWidget *frame_chat;
/* The webkit_chat_container is created once, then reused for all chat
* views */
// The webkit_chat_container is created once, then reused for all chat views
GtkWidget *webkit_chat_container;
Call *call;
lrc::api::conversation::Info* conversation_;
AccountContainer* accountContainer_;
QMetaObject::Connection state_change_connection;
QMetaObject::Connection cm_changed_connection;
QMetaObject::Connection person_changed_connection;
QMetaObject::Connection cm_person_changed_connection;
GSettings *settings;
};
......@@ -86,9 +87,6 @@ incoming_call_view_dispose(GObject *object)
priv = INCOMING_CALL_VIEW_GET_PRIVATE(view);
QObject::disconnect(priv->state_change_connection);
QObject::disconnect(priv->cm_changed_connection);
QObject::disconnect(priv->person_changed_connection);
QObject::disconnect(priv->cm_person_changed_connection);
g_clear_object(&priv->settings);
......@@ -111,11 +109,30 @@ map_boolean_to_orientation(GValue *value, GVariant *variant, G_GNUC_UNUSED gpoin
return FALSE;
}
static void
reject_incoming_call(G_GNUC_UNUSED GtkWidget *widget, ChatView *self)
{
auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(self);
priv->accountContainer_->info.callModel->hangUp(priv->conversation_->callId);
}
static void
accept_incoming_call(G_GNUC_UNUSED GtkWidget *widget, ChatView *self)
{
auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(self);
auto contactUri = priv->conversation_->participants[0];
auto contact = priv->accountContainer_->info.contactModel->getContact(contactUri);
// If the contact is pending, we should accept its request
if (contact.profileInfo.type == lrc::api::profile::Type::PENDING)
priv->accountContainer_->info.conversationModel->makePermanent(contactUri);
// Accept call
priv->accountContainer_->info.callModel->accept(priv->conversation_->callId);
}
static void
incoming_call_view_init(IncomingCallView *view)
{
gtk_widget_init_template(GTK_WIDGET(view));
// gtk_widget_add_events(GTK_WIDGET(view), GDK_KEY_PRESS_MASK);
auto provider = gtk_css_provider_new();
gtk_css_provider_load_from_data(provider,
......@@ -139,6 +156,9 @@ incoming_call_view_init(IncomingCallView *view)
G_SETTINGS_BIND_GET,
map_boolean_to_orientation,
nullptr, nullptr, nullptr);
g_signal_connect(priv->button_reject_incoming, "clicked", G_CALLBACK(reject_incoming_call), view);
g_signal_connect(priv->button_accept_incoming, "clicked", G_CALLBACK(accept_incoming_call), view);
}
static void
......@@ -154,65 +174,33 @@ incoming_call_view_class_init(IncomingCallViewClass *klass)
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_bestId);
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, label_status);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, button_accept_incoming);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, button_reject_incoming);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, button_end_call);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, frame_chat);
}
static void
update_state(IncomingCallView *view, Call *call)
update_state(IncomingCallView *view)
{
IncomingCallViewPrivate *priv = INCOMING_CALL_VIEW_GET_PRIVATE(view);
/* change state label */
Call::State state = call->state();
// change state label
auto callId = priv->conversation_->callId;
if (!priv->accountContainer_->info.callModel->hasCall(callId)) return;
auto call = priv->accountContainer_->info.callModel->getCall(callId);
gchar *status = g_strdup_printf("%s", call->toHumanStateName().toUtf8().constData());
gchar *status = g_strdup_printf("%s", lrc::api::call::to_string(call.status).c_str());
gtk_label_set_text(GTK_LABEL(priv->label_status), status);
g_free(status);
/* change button(s) displayed */
gtk_widget_hide(priv->button_accept_incoming);
gtk_widget_hide(priv->button_reject_incoming);
gtk_widget_hide(priv->button_end_call);
switch(state) {
case Call::State::INCOMING:
gtk_widget_show(priv->button_accept_incoming);
gtk_widget_show(priv->button_reject_incoming);
break;
case Call::State::NEW:
case Call::State::ABORTED:
case Call::State::RINGING:
case Call::State::CURRENT:
case Call::State::DIALING:
case Call::State::HOLD:
case Call::State::FAILURE:
case Call::State::BUSY:
case Call::State::TRANSFERRED:
case Call::State::TRANSF_HOLD:
case Call::State::OVER:
case Call::State::ERROR:
case Call::State::CONFERENCE:
case Call::State::CONFERENCE_HOLD:
case Call::State::INITIALIZATION:
case Call::State::CONNECTED:
gtk_widget_show(priv->button_end_call);
break;
case Call::State::COUNT__:
break;
}
if (call.status == lrc::api::call::Status::INCOMING_RINGING)
gtk_widget_show(priv->button_accept_incoming);
else
gtk_widget_hide(priv->button_accept_incoming);
gtk_widget_show(priv->button_reject_incoming);
if (call->lifeCycleState() == Call::LifeCycleState::INITIALIZATION) {
gtk_widget_show(priv->spinner_status);
gtk_widget_hide(priv->placeholder);
} else {
gtk_widget_show(priv->placeholder);
gtk_widget_hide(priv->spinner_status);
}
gtk_widget_show(priv->spinner_status);
}
static void
......@@ -220,93 +208,75 @@ update_name_and_photo(IncomingCallView *view)
{
auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(view);
/* get call image */
QVariant var_i = GlobalInstances::pixmapManipulator().callPhoto(priv->call, QSize(110, 110), false);
QVariant var_i = GlobalInstances::pixmapManipulator().conversationPhoto(
*priv->conversation_,
priv->accountContainer_->info,
QSize(110, 110),
false
);
std::shared_ptr<GdkPixbuf> image = var_i.value<std::shared_ptr<GdkPixbuf>>();
gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_incoming), image.get());
/* get name */
auto name = priv->call->formattedName();
gtk_label_set_text(GTK_LABEL(priv->label_name), name.toUtf8().constData());
auto contactInfo = priv->accountContainer_->info.contactModel->getContact(priv->conversation_->participants.front());
auto name = contactInfo.profileInfo.alias;
gtk_label_set_text(GTK_LABEL(priv->label_name), name.c_str());
/* get uri, if different from name */
auto bestId = priv->call->peerContactMethod()->bestId();
auto bestId = contactInfo.registeredName;
if (name != bestId) {
gtk_label_set_text(GTK_LABEL(priv->label_bestId), bestId.toUtf8().constData());
gtk_label_set_text(GTK_LABEL(priv->label_bestId), bestId.c_str());
gtk_widget_show(priv->label_bestId);
}
}
static void
update_person(IncomingCallView *view, Person *new_person)
{
auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(view);
update_name_and_photo(view);
QObject::disconnect(priv->person_changed_connection);
if (new_person) {
priv->person_changed_connection = QObject::connect(
new_person,
&Person::changed,
[view]() { update_name_and_photo(view); }
);
}
}
static void
set_call_info(IncomingCallView *view, Call *call) {
set_call_info(IncomingCallView *view) {
IncomingCallViewPrivate *priv = INCOMING_CALL_VIEW_GET_PRIVATE(view);
priv->call = call;
/* change some things depending on call state */
update_state(view, call);
update_person(view, priv->call->peerContactMethod()->contact());
update_state(view);
update_name_and_photo(view);
// Update view if call state changes
priv->state_change_connection = QObject::connect(
call,
&Call::stateChanged,
[=]() { update_state(view, call); }
);
priv->cm_changed_connection = QObject::connect(
priv->call->peerContactMethod(),
&ContactMethod::changed,
[view]() { update_name_and_photo(view); }
);
priv->cm_person_changed_connection = QObject::connect(
priv->call->peerContactMethod(),
&ContactMethod::contactChanged,
[view] (Person* newPerson, Person*) { update_person(view, newPerson); }
);
&*priv->accountContainer_->info.callModel,
&lrc::api::NewCallModel::callStatusChanged,
[view, priv] (const std::string& callId) {
if (callId == priv->conversation_->callId) {
update_state(view);
update_name_and_photo(view);
}
});
/* show chat */
auto chat_view = chat_view_new_cm(WEBKIT_CHAT_CONTAINER(priv->webkit_chat_container), priv->call->peerContactMethod());
auto chat_view = chat_view_new(WEBKIT_CHAT_CONTAINER(priv->webkit_chat_container),
priv->accountContainer_,
priv->conversation_);
gtk_widget_show(chat_view);
chat_view_set_header_visible(CHAT_VIEW(chat_view), FALSE);
gtk_container_add(GTK_CONTAINER(priv->frame_chat), chat_view);
}
GtkWidget *
incoming_call_view_new(Call *call, WebKitChatContainer *webkit_chat_container)
incoming_call_view_new(WebKitChatContainer* view,
AccountContainer* accountContainer,
lrc::api::conversation::Info* conversation)
{
auto self = g_object_new(INCOMING_CALL_VIEW_TYPE, NULL);
IncomingCallViewPrivate *priv = INCOMING_CALL_VIEW_GET_PRIVATE(self);
priv->webkit_chat_container = GTK_WIDGET(webkit_chat_container);
priv->webkit_chat_container = GTK_WIDGET(view);
priv->conversation_ = conversation;
priv->accountContainer_ = accountContainer;
set_call_info(INCOMING_CALL_VIEW(self), call);
set_call_info(INCOMING_CALL_VIEW(self));
return GTK_WIDGET(self);
}
Call*
incoming_call_view_get_call(IncomingCallView *self)
lrc::api::conversation::Info
incoming_call_view_get_conversation(IncomingCallView *self)
{
g_return_val_if_fail(IS_INCOMING_CALL_VIEW(self), nullptr);
g_return_val_if_fail(IS_INCOMING_CALL_VIEW(self), lrc::api::conversation::Info());
auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(self);
return priv->call;
return *priv->conversation_;
}
/*
* Copyright (C) 2015-2017 Savoir-faire Linux Inc.
* Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
* Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -17,13 +19,25 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _INCOMINGCALLVIEW_H
#define _INCOMINGCALLVIEW_H
#pragma once
// Gtk
#include <gtk/gtk.h>
// client
#include "accountcontainer.h"
#include "webkitchatcontainer.h"
class Call;
namespace lrc
{
namespace api
{
namespace conversation
{
struct Info;
}
}
}
G_BEGIN_DECLS
......@@ -37,10 +51,10 @@ typedef struct _IncomingCallView IncomingCallView;
typedef struct _IncomingCallViewClass IncomingCallViewClass;
GType incoming_call_view_get_type (void) G_GNUC_CONST;
GtkWidget *incoming_call_view_new (Call*, WebKitChatContainer*);
Call *incoming_call_view_get_call (IncomingCallView*);
GType incoming_call_view_get_type (void) G_GNUC_CONST;
GtkWidget *incoming_call_view_new (WebKitChatContainer* view,
AccountContainer* accountContainer,
lrc::api::conversation::Info* conversation);
lrc::api::conversation::Info incoming_call_view_get_conversation (IncomingCallView*);
G_END_DECLS
#endif /* _INCOMINGCALLVIEW_H */
......@@ -183,7 +183,7 @@ connect_combo_box_qmodel(GtkComboBox *box, QAbstractItemModel *qmodel, QItemSele
}
static void
hardware_decoding_toggled(GtkToggleButton *toggle_button, MediaSettingsView *self)
hardware_decoding_toggled(GtkToggleButton *toggle_button, G_GNUC_UNUSED MediaSettingsView *self)
{
gboolean hardware_decoding = gtk_toggle_button_get_active(toggle_button);
Video::ConfigurationProxy::setDecodingAccelerated(hardware_decoding);
......
......@@ -247,17 +247,17 @@ PixbufManipulator::conversationPhoto(const lrc::api::conversation::Info& convers
auto contactPhoto = contactInfo.profileInfo.avatar;
auto bestName = contactInfo.profileInfo.alias.empty()? contactInfo.registeredName : contactInfo.profileInfo.alias;
if (contactInfo.profileInfo.type == lrc::api::profile::Type::SIP) {
return QVariant::fromValue(scaleAndFrame(generateAvatar(bestName, "").get(), size, displayPresence, true));
return QVariant::fromValue(scaleAndFrame(generateAvatar(bestName, "").get(), size, displayPresence, contactInfo.isPresent));
} else if (!contactPhoto.empty()) {
QByteArray byteArray(contactPhoto.c_str(), contactPhoto.length());
QVariant photo = personPhoto(byteArray);
return QVariant::fromValue(scaleAndFrame(photo.value<std::shared_ptr<GdkPixbuf>>().get(), size, displayPresence, true));
return QVariant::fromValue(scaleAndFrame(photo.value<std::shared_ptr<GdkPixbuf>>().get(), size, displayPresence, contactInfo.isPresent));
} else {
return QVariant::fromValue(scaleAndFrame(generateAvatar(bestName, contactInfo.profileInfo.uri).get(), size, displayPresence, true));
return QVariant::fromValue(scaleAndFrame(generateAvatar(bestName, contactInfo.profileInfo.uri).get(), size, displayPresence, contactInfo.isPresent));