mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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;
|
_pushToTalk = shortcut;
|
||||||
_shortcutManager->startWatching(_pushToTalk, [=](bool pressed) {
|
_shortcutManager->startWatching(_pushToTalk, [=](bool pressed) {
|
||||||
const auto delay = Core::App().settings().groupCallPushToTalkDelay();
|
pushToTalk(
|
||||||
if (muted() == MuteState::ForceMuted
|
pressed,
|
||||||
|| muted() == MuteState::Active) {
|
Core::App().settings().groupCallPushToTalkDelay());
|
||||||
return;
|
|
||||||
} else if (pressed) {
|
|
||||||
_pushToTalkCancelTimer.cancel();
|
|
||||||
setMuted(MuteState::PushToTalk);
|
|
||||||
} else if (delay) {
|
|
||||||
_pushToTalkCancelTimer.callOnce(delay);
|
|
||||||
} else {
|
|
||||||
pushToTalkCancel();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() {
|
void GroupCall::pushToTalkCancel() {
|
||||||
_pushToTalkCancelTimer.cancel();
|
_pushToTalkCancelTimer.cancel();
|
||||||
if (muted() == MuteState::PushToTalk) {
|
if (muted() == MuteState::PushToTalk) {
|
||||||
|
|
|
@ -126,6 +126,8 @@ public:
|
||||||
std::shared_ptr<GlobalShortcutManager> ensureGlobalShortcutManager();
|
std::shared_ptr<GlobalShortcutManager> ensureGlobalShortcutManager();
|
||||||
void applyGlobalShortcutChanges();
|
void applyGlobalShortcutChanges();
|
||||||
|
|
||||||
|
void pushToTalk(bool pressed, crl::time delay);
|
||||||
|
|
||||||
[[nodiscard]] rpl::lifetime &lifetime() {
|
[[nodiscard]] rpl::lifetime &lifetime() {
|
||||||
return _lifetime;
|
return _lifetime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Calls {
|
namespace Calls {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
constexpr auto kSpacePushToTalkDelay = crl::time(250);
|
||||||
|
|
||||||
class InviteController final : public ParticipantsBoxController {
|
class InviteController final : public ParticipantsBoxController {
|
||||||
public:
|
public:
|
||||||
InviteController(
|
InviteController(
|
||||||
|
@ -280,6 +282,15 @@ void GroupPanel::initWindow() {
|
||||||
if (e->type() == QEvent::Close && handleClose()) {
|
if (e->type() == QEvent::Close && handleClose()) {
|
||||||
e->ignore();
|
e->ignore();
|
||||||
return base::EventFilterResult::Cancel;
|
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;
|
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