mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Allow changing my own volume in voice chat.
This commit is contained in:
parent
2559c5d6f4
commit
5d4e5ed527
1 changed files with 33 additions and 26 deletions
|
@ -1275,10 +1275,11 @@ base::unique_qptr<Ui::PopupMenu> MembersController::createRowContextMenu(
|
||||||
not_null<PeerListRow*> row) {
|
not_null<PeerListRow*> row) {
|
||||||
Expects(row->peer()->isUser());
|
Expects(row->peer()->isUser());
|
||||||
|
|
||||||
if (row->peer()->isSelf()) {
|
const auto real = static_cast<Row*>(row.get());
|
||||||
|
if (row->peer()->isSelf()
|
||||||
|
&& (!_peer->canManageGroupCall() || !real->ssrc())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const auto real = static_cast<Row*>(row.get());
|
|
||||||
const auto user = row->peer()->asUser();
|
const auto user = row->peer()->asUser();
|
||||||
auto result = base::make_unique_q<Ui::PopupMenu>(
|
auto result = base::make_unique_q<Ui::PopupMenu>(
|
||||||
parent,
|
parent,
|
||||||
|
@ -1358,6 +1359,7 @@ base::unique_qptr<Ui::PopupMenu> MembersController::createRowContextMenu(
|
||||||
addMuteActionsToContextMenu(result, user, real);
|
addMuteActionsToContextMenu(result, user, real);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!user->isSelf()) {
|
||||||
result->addAction(
|
result->addAction(
|
||||||
tr::lng_context_view_profile(tr::now),
|
tr::lng_context_view_profile(tr::now),
|
||||||
showProfile);
|
showProfile);
|
||||||
|
@ -1380,6 +1382,7 @@ base::unique_qptr<Ui::PopupMenu> MembersController::createRowContextMenu(
|
||||||
tr::lng_context_remove_from_group(tr::now),
|
tr::lng_context_remove_from_group(tr::now),
|
||||||
removeFromGroup);
|
removeFromGroup);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1422,7 +1425,7 @@ void MembersController::addMuteActionsToContextMenu(
|
||||||
|
|
||||||
auto mutesFromVolume = rpl::never<bool>() | rpl::type_erased();
|
auto mutesFromVolume = rpl::never<bool>() | rpl::type_erased();
|
||||||
|
|
||||||
if (!isMuted) {
|
if (!isMuted || user->isSelf()) {
|
||||||
const auto call = _call.get();
|
const auto call = _call.get();
|
||||||
auto otherParticipantStateValue = call
|
auto otherParticipantStateValue = call
|
||||||
? call->otherParticipantStateValue(
|
? call->otherParticipantStateValue(
|
||||||
|
@ -1448,7 +1451,9 @@ void MembersController::addMuteActionsToContextMenu(
|
||||||
|
|
||||||
volumeItem->toggleMuteLocallyRequests(
|
volumeItem->toggleMuteLocallyRequests(
|
||||||
) | rpl::start_with_next([=](bool muted) {
|
) | rpl::start_with_next([=](bool muted) {
|
||||||
|
if (!user->isSelf()) {
|
||||||
toggleMute(muted, true);
|
toggleMute(muted, true);
|
||||||
|
}
|
||||||
}, volumeItem->lifetime());
|
}, volumeItem->lifetime());
|
||||||
|
|
||||||
volumeItem->changeVolumeRequests(
|
volumeItem->changeVolumeRequests(
|
||||||
|
@ -1458,14 +1463,16 @@ void MembersController::addMuteActionsToContextMenu(
|
||||||
|
|
||||||
volumeItem->changeVolumeLocallyRequests(
|
volumeItem->changeVolumeLocallyRequests(
|
||||||
) | rpl::start_with_next([=](int volume) {
|
) | rpl::start_with_next([=](int volume) {
|
||||||
|
if (!user->isSelf()) {
|
||||||
changeVolume(volume, true);
|
changeVolume(volume, true);
|
||||||
|
}
|
||||||
}, volumeItem->lifetime());
|
}, volumeItem->lifetime());
|
||||||
|
|
||||||
menu->addAction(std::move(volumeItem));
|
menu->addAction(std::move(volumeItem));
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto muteAction = [&]() -> QAction* {
|
const auto muteAction = [&]() -> QAction* {
|
||||||
if (muteState == Row::State::Invited) {
|
if (muteState == Row::State::Invited || user->isSelf()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto callback = [=] {
|
auto callback = [=] {
|
||||||
|
|
Loading…
Add table
Reference in a new issue