1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-03 14:25:38 +02:00

video-split: use lrc const QStrings

Change-Id: I4e2196668829c28074d28eaf99386dc15b524c2d
This commit is contained in:
Aline Gondim Santos 2022-04-01 16:12:06 -04:00 committed by Sébastien Blin
parent 0e53a71d33
commit 21af116ad2
2 changed files with 45 additions and 29 deletions

View file

@ -514,17 +514,18 @@ CallAdapter::updateCall(const QString& convUid, const QString& accountId, bool f
void
CallAdapter::fillParticipantData(QJsonObject& participant) const
{
participant["bestName"] = participant["uri"];
participant[lrc::api::ParticipantsInfosStrings::BESTNAME]
= participant[lrc::api::ParticipantsInfosStrings::URI];
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId_);
participant["isLocal"] = false;
if (participant["bestName"] == accInfo.profileInfo.uri) {
participant["bestName"] = tr("me");
participant["isLocal"] = true;
participant[lrc::api::ParticipantsInfosStrings::ISLOCAL] = false;
if (participant[lrc::api::ParticipantsInfosStrings::BESTNAME] == accInfo.profileInfo.uri) {
participant[lrc::api::ParticipantsInfosStrings::BESTNAME] = tr("me");
participant[lrc::api::ParticipantsInfosStrings::ISLOCAL] = true;
} else {
try {
participant["bestName"] = lrcInstance_->getCurrentAccountInfo()
.contactModel->bestNameForContact(
participant["uri"].toString());
participant[lrc::api::ParticipantsInfosStrings::BESTNAME]
= lrcInstance_->getCurrentAccountInfo().contactModel->bestNameForContact(
participant[lrc::api::ParticipantsInfosStrings::URI].toString());
} catch (...) {
}
}
@ -741,8 +742,8 @@ CallAdapter::maximizeParticipant(const QString& uri)
auto participants = getConferencesInfos();
for (auto part : participants) {
auto participant = part.toJsonObject();
if (participant["uri"].toString() == uri) {
auto active = participant["active"].toBool();
if (participant[lrc::api::ParticipantsInfosStrings::URI].toString() == uri) {
auto active = participant[lrc::api::ParticipantsInfosStrings::ACTIVE].toBool();
// Else, continue.
if (!active) {
callModel->setActiveParticipant(confId, uri);
@ -772,8 +773,8 @@ CallAdapter::minimizeParticipant(const QString& uri)
auto participants = getConferencesInfos();
for (auto& part : participants) {
auto participant = part.toJsonObject();
if (participant["uri"].toString() == uri) {
auto active = participant["active"].toBool();
if (participant[lrc::api::ParticipantsInfosStrings::URI].toString() == uri) {
auto active = participant[lrc::api::ParticipantsInfosStrings::ACTIVE].toBool();
if (active) {
if (call.layout == lrc::api::call::Layout::ONE) {
callModel->setConferenceLayout(confId,

View file

@ -27,6 +27,8 @@
#include <QSortFilterProxyModel>
#include <QQuickItem>
#include <api/callparticipantsmodel.h>
CallParticipantsModel::CallParticipantsModel(LRCInstance* instance, QObject* parent)
: QAbstractListModel(parent)
, lrcInstance_(instance)
@ -53,33 +55,46 @@ CallParticipantsModel::data(const QModelIndex& index, int role) const
switch (role) {
case Role::Uri:
return QVariant::fromValue(participant.item.value("uri"));
return QVariant::fromValue(participant.item.value(lrc::api::ParticipantsInfosStrings::URI));
case Role::BestName:
return QVariant::fromValue(participant.item.value("bestName"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::BESTNAME));
case Role::Active:
return QVariant::fromValue(participant.item.value("active"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::ACTIVE));
case Role::AudioLocalMuted:
return QVariant::fromValue(participant.item.value("audioLocalMuted"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::AUDIOLOCALMUTED));
case Role::AudioModeratorMuted:
return QVariant::fromValue(participant.item.value("audioModeratorMuted"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::AUDIOMODERATORMUTED));
case Role::VideoMuted:
return QVariant::fromValue(participant.item.value("videoMuted"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::VIDEOMUTED));
case Role::IsModerator:
return QVariant::fromValue(participant.item.value("isModerator"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::ISMODERATOR));
case Role::IsLocal:
return QVariant::fromValue(participant.item.value("isLocal"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::ISLOCAL));
case Role::IsContact:
return QVariant::fromValue(participant.item.value("isContact"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::ISCONTACT));
case Role::Avatar:
return QVariant::fromValue(participant.item.value("avatar"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::AVATAR));
case Role::SinkId:
return QVariant::fromValue(participant.item.value("sinkId"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::SINKID));
case Role::Height:
return QVariant::fromValue(participant.item.value("height"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::HEIGHT));
case Role::Width:
return QVariant::fromValue(participant.item.value("width"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::WIDTH));
case Role::HandRaised:
return QVariant::fromValue(participant.item.value("handRaised"));
return QVariant::fromValue(
participant.item.value(lrc::api::ParticipantsInfosStrings::HANDRAISED));
}
return QVariant();
}
@ -108,7 +123,7 @@ CallParticipantsModel::addParticipant(int index, const QVariant& infos)
endInsertRows();
callId_ = participants_[index].item["callId"].toString();
callId_ = participants_[index].item[lrc::api::ParticipantsInfosStrings::CALLID].toString();
}
void
@ -121,7 +136,7 @@ CallParticipantsModel::updateParticipant(int index, const QVariant& infos)
auto it = participants_.begin() + index;
(*it) = CallParticipant::Item {infos.toJsonObject()};
callId_ = participants_[index].item["callId"].toString();
callId_ = participants_[index].item[lrc::api::ParticipantsInfosStrings::CALLID].toString();
}
Q_EMIT dataChanged(createIndex(index, 0), createIndex(index, 0));
}
@ -132,7 +147,7 @@ CallParticipantsModel::removeParticipant(int index)
std::lock_guard<std::mutex> lk(participantsMtx_);
if (participants_.size() <= index)
return;
callId_ = participants_[index].item["callId"].toString();
callId_ = participants_[index].item[lrc::api::ParticipantsInfosStrings::CALLID].toString();
beginRemoveRows(QModelIndex(), index, index);