qml interop: refactor and remove utilsadapter from clientwrapper

- Separate utilsadapter into files and expose it to Qml so it can
  be used without passing through clientwrapper.

Change-Id: I7c351d7191cd166521b6e0a685ea9d4a9731f165
Gitlab: #66
This commit is contained in:
Andreas Traczyk
2020-09-04 14:51:39 -04:00
parent a364b6195b
commit 88816940fb
55 changed files with 865 additions and 831 deletions

View File

@@ -106,26 +106,22 @@ PixbufManipulator::decorationRole(const lrc::api::conversation::Info &conversati
auto bestId = Utils::bestIdForContact(contactInfo);
if (accountInfo.profileInfo.type == lrc::api::profile::Type::SIP
&& contactInfo.profileInfo.type == lrc::api::profile::Type::TEMPORARY) {
photo = Utils::fallbackAvatar(IMAGE_SIZE, QString(), QString());
photo = Utils::fallbackAvatar(QString(), QString());
} else if (contactInfo.profileInfo.type == lrc::api::profile::Type::TEMPORARY
&& contactInfo.profileInfo.uri.isEmpty()) {
photo = Utils::fallbackAvatar(IMAGE_SIZE, QString(), QString());
photo = Utils::fallbackAvatar(QString(), QString());
} else if (!contactPhoto.isEmpty()) {
QByteArray byteArray = contactPhoto.toLocal8Bit();
photo = personPhoto(byteArray, nullptr).value<QImage>();
if (photo.isNull()) {
auto avatarName = contactInfo.profileInfo.uri == bestName ? QString() : bestName;
photo = Utils::fallbackAvatar(IMAGE_SIZE,
"ring:" + contactInfo.profileInfo.uri,
avatarName);
photo = Utils::fallbackAvatar("ring:" + contactInfo.profileInfo.uri, avatarName);
}
} else {
auto avatarName = contactInfo.profileInfo.uri == bestName ? QString() : bestName;
photo = Utils::fallbackAvatar(IMAGE_SIZE,
"ring:" + contactInfo.profileInfo.uri,
avatarName);
photo = Utils::fallbackAvatar("ring:" + contactInfo.profileInfo.uri, avatarName);
}
} catch (...) {
}
return QVariant::fromValue(Utils::scaleAndFrame(photo, IMAGE_SIZE));
}
return QVariant::fromValue(Utils::scaleAndFrame(photo));
}