mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-05 23:35:50 +02:00
utils: improve error logs
Change-Id: I2fd8650cf106f6f0ececd3d4ce2b021061224b04
This commit is contained in:
parent
42a2465080
commit
3b973aa5b3
1 changed files with 14 additions and 6 deletions
|
@ -359,10 +359,14 @@ Utils::accountPhoto(LRCInstance* instance, const QString& accountId, const QSize
|
||||||
try {
|
try {
|
||||||
auto& accInfo = instance->accountModel().getAccountInfo(
|
auto& accInfo = instance->accountModel().getAccountInfo(
|
||||||
accountId.isEmpty() ? instance->get_currentAccountId() : accountId);
|
accountId.isEmpty() ? instance->get_currentAccountId() : accountId);
|
||||||
|
auto bestName = instance->accountModel().bestNameForAccount(accInfo.id);
|
||||||
if (!accInfo.profileInfo.avatar.isEmpty()) {
|
if (!accInfo.profileInfo.avatar.isEmpty()) {
|
||||||
photo = imageFromBase64String(accInfo.profileInfo.avatar);
|
photo = imageFromBase64String(accInfo.profileInfo.avatar);
|
||||||
} else {
|
if (photo.isNull()) {
|
||||||
auto bestName = instance->accountModel().bestNameForAccount(accInfo.id);
|
qWarning() << "Invalid image for account " << bestName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (photo.isNull()) {
|
||||||
QString name = bestName == accInfo.profileInfo.uri ? QString() : bestName;
|
QString name = bestName == accInfo.profileInfo.uri ? QString() : bestName;
|
||||||
QString prefix = accInfo.profileInfo.type == profile::Type::JAMI ? "jami:" : "sip:";
|
QString prefix = accInfo.profileInfo.type == profile::Type::JAMI ? "jami:" : "sip:";
|
||||||
photo = fallbackAvatar(prefix + accInfo.profileInfo.uri, name, size);
|
photo = fallbackAvatar(prefix + accInfo.profileInfo.uri, name, size);
|
||||||
|
@ -424,8 +428,14 @@ Utils::conversationAvatar(LRCInstance* instance,
|
||||||
accountId.isEmpty() ? instance->get_currentAccountId() : accountId);
|
accountId.isEmpty() ? instance->get_currentAccountId() : accountId);
|
||||||
auto* convModel = accInfo.conversationModel.get();
|
auto* convModel = accInfo.conversationModel.get();
|
||||||
auto avatarb64 = convModel->avatar(convId);
|
auto avatarb64 = convModel->avatar(convId);
|
||||||
if (!avatarb64.isEmpty())
|
if (!avatarb64.isEmpty()) {
|
||||||
return scaleAndFrame(imageFromBase64String(avatarb64, true), size);
|
auto photo = imageFromBase64String(avatarb64, true);
|
||||||
|
if (photo.isNull()) {
|
||||||
|
qWarning() << "Invalid image for conversation " << convId;
|
||||||
|
return photo;
|
||||||
|
}
|
||||||
|
return scaleAndFrame(photo, size);
|
||||||
|
}
|
||||||
// Else, generate an avatar
|
// Else, generate an avatar
|
||||||
auto members = convModel->peersForConversation(convId);
|
auto members = convModel->peersForConversation(convId);
|
||||||
if (members.size() < 1)
|
if (members.size() < 1)
|
||||||
|
@ -479,8 +489,6 @@ Utils::imageFromBase64Data(const QByteArray& data, bool circleCrop)
|
||||||
}
|
}
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
qWarning() << Q_FUNC_INFO << "Image loading failed";
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue