mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Use 'Space' in voice chat as push-to-talk key.
This commit is contained in:
parent
d732a35904
commit
29e7ea9b36
4 changed files with 31 additions and 13 deletions
|
@ -828,21 +828,26 @@ void GroupCall::applyGlobalShortcutChanges() {
|
|||
}
|
||||
_pushToTalk = shortcut;
|
||||
_shortcutManager->startWatching(_pushToTalk, [=](bool pressed) {
|
||||
const auto delay = Core::App().settings().groupCallPushToTalkDelay();
|
||||
if (muted() == MuteState::ForceMuted
|
||||
|| muted() == MuteState::Active) {
|
||||
return;
|
||||
} else if (pressed) {
|
||||
_pushToTalkCancelTimer.cancel();
|
||||
setMuted(MuteState::PushToTalk);
|
||||
} else if (delay) {
|
||||
_pushToTalkCancelTimer.callOnce(delay);
|
||||
} else {
|
||||
pushToTalkCancel();
|
||||
}
|
||||
pushToTalk(
|
||||
pressed,
|
||||
Core::App().settings().groupCallPushToTalkDelay());
|
||||
});
|
||||
}
|
||||
|
||||
void GroupCall::pushToTalk(bool pressed, crl::time delay) {
|
||||
if (muted() == MuteState::ForceMuted
|
||||
|| muted() == MuteState::Active) {
|
||||
return;
|
||||
} else if (pressed) {
|
||||
_pushToTalkCancelTimer.cancel();
|
||||
setMuted(MuteState::PushToTalk);
|
||||
} else if (delay) {
|
||||
_pushToTalkCancelTimer.callOnce(delay);
|
||||
} else {
|
||||
pushToTalkCancel();
|
||||
}
|
||||
}
|
||||
|
||||
void GroupCall::pushToTalkCancel() {
|
||||
_pushToTalkCancelTimer.cancel();
|
||||
if (muted() == MuteState::PushToTalk) {
|
||||
|
|
|
@ -126,6 +126,8 @@ public:
|
|||
std::shared_ptr<GlobalShortcutManager> ensureGlobalShortcutManager();
|
||||
void applyGlobalShortcutChanges();
|
||||
|
||||
void pushToTalk(bool pressed, crl::time delay);
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime() {
|
||||
return _lifetime;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Calls {
|
||||
namespace {
|
||||
|
||||
constexpr auto kSpacePushToTalkDelay = crl::time(250);
|
||||
|
||||
class InviteController final : public ParticipantsBoxController {
|
||||
public:
|
||||
InviteController(
|
||||
|
@ -280,6 +282,15 @@ void GroupPanel::initWindow() {
|
|||
if (e->type() == QEvent::Close && handleClose()) {
|
||||
e->ignore();
|
||||
return base::EventFilterResult::Cancel;
|
||||
} else if (e->type() == QEvent::KeyPress
|
||||
|| e->type() == QEvent::KeyRelease) {
|
||||
if (static_cast<QKeyEvent*>(e.get())->key() == Qt::Key_Space) {
|
||||
if (_call) {
|
||||
_call->pushToTalk(
|
||||
e->type() == QEvent::KeyPress,
|
||||
kSpacePushToTalkDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
return base::EventFilterResult::Continue;
|
||||
});
|
||||
|
|
2
Telegram/ThirdParty/tgcalls
vendored
2
Telegram/ThirdParty/tgcalls
vendored
|
@ -1 +1 @@
|
|||
Subproject commit b892eb58bc941a4a1a67303439df8ffd379d6051
|
||||
Subproject commit 905ed863c19bc39b04b3b1c070b39195fedfef1e
|
Loading…
Add table
Reference in a new issue