ui and group call shenanigans

This commit is contained in:
TheK0tYaRa 2026-03-11 12:58:07 +02:00
parent 586c3e3e3a
commit 7775068bf5
4 changed files with 21 additions and 16 deletions

View file

@ -183,7 +183,7 @@ Menu {
height: stickerDim
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: Settings.emojiFont != "" ? Settings.emojiFont : undefined
/* font.family: Settings.emojiFont != "" ? Settings.emojiFont : undefined */
font.pixelSize: 36
text: del.modelData.unicode.replace('\ufe0f', '')
}

View file

@ -218,7 +218,7 @@ Rectangle {
Layout.preferredWidth: 24
Layout.preferredHeight: 24
buttonTextColor: "#000000"
image: CallManager.isMicMuted ? ":/icons/icons/ui/microphone-unmute.svg" : ":/icons/icons/ui/microphone-mute.svg"
image: CallManager.isMicMuted ? ":/icons/icons/ui/microphone-mute.svg" : ":/icons/icons/ui/microphone-unmute.svg"
hoverEnabled: true
ToolTip.visible: hovered
ToolTip.text: CallManager.isMicMuted ? qsTr("Unmute Mic") : qsTr("Mute Mic")

View file

@ -36,7 +36,7 @@ Popup {
Layout.leftMargin: 8
Label {
text: qsTr("Place a call to %1?").arg(room.roomName)
text: qsTr("Place a call in %1?").arg(room.roomName)
color: palette.windowText
}

View file

@ -342,19 +342,15 @@ CallManager::sendInvite(const QString &roomid, CallType callType, unsigned int w
return;
}
const bool isRoomCall = roomInfo.member_count > 2;
const RoomMember *callee = nullptr;
if (roomInfo.member_count == 1)
callee = &members.front();
else if (roomInfo.member_count == 2)
callee =
members.front().user_id == utils::localUser() ? &members.back() : &members.front();
else {
emit ChatPage::instance()->showNotification(
QStringLiteral("Calls are limited to rooms with less than two members"));
clear();
return;
}
if (!callee) {
if (!isRoomCall && !callee) {
nhlog::ui()->warn("WebRTC: failed to resolve callee for outbound invite in room {}",
roomid.toStdString());
emit ChatPage::instance()->showNotification(QStringLiteral("Problem setting up call."));
@ -384,7 +380,7 @@ CallManager::sendInvite(const QString &roomid, CallType callType, unsigned int w
if (haveCallInvite_) {
nhlog::ui()->debug("WebRTC: discarding outbound call for inbound call; localUser is polite party");
if (callParty_ == callee->user_id) {
if ((isRoomCall && roomid_ == roomid) || (!isRoomCall && callParty_ == callee->user_id)) {
if (callType == callType_)
acceptInvite();
else {
@ -409,12 +405,21 @@ CallManager::sendInvite(const QString &roomid, CallType callType, unsigned int w
? "voice"
: (callType_ == CallType::VIDEO ? "video" : "screen");
nhlog::ui()->debug("WebRTC: call id: {} - creating {} invite", callid_, strCallType);
callParty_ = callee->user_id;
callPartyDisplayName_ =
callee->display_name.isEmpty() ? callee->user_id : callee->display_name;
nhlog::ui()->debug("WebRTC: call id: {} - creating {} {}invite",
callid_,
strCallType,
isRoomCall ? "room-wide " : "");
if (isRoomCall) {
callParty_ = utils::localUser();
callPartyDisplayName_ =
roomInfo.name.empty() ? roomid : QString::fromStdString(roomInfo.name);
} else {
callParty_ = callee->user_id;
callPartyDisplayName_ =
callee->display_name.isEmpty() ? callee->user_id : callee->display_name;
}
callPartyAvatarUrl_ = QString::fromStdString(roomInfo.avatar_url);
invitee_ = callParty_.toStdString();
invitee_ = isRoomCall ? std::string{} : callParty_.toStdString();
emit newInviteState();
playRingtone(QUrl(QStringLiteral("qrc:/media/media/ringback.ogg")), true);