Added key filter to calls settings box while shortcut is recording.

This commit is contained in:
23rd 2020-12-04 01:28:52 +03:00
parent d36fad7268
commit 190b1c9872
1 changed files with 12 additions and 0 deletions

View File

@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/slide_wrap.h"
#include "ui/toast/toast.h"
#include "lang/lang_keys.h"
#include "base/event_filter.h"
#include "base/platform/base_platform_global_shortcuts.h"
#include "data/data_channel.h"
#include "data/data_group_call.h"
@ -243,6 +244,17 @@ void GroupCallSettingsBox(
) | rpl::start_with_next([=] {
call->applyGlobalShortcutChanges();
}, box->lifetime());
auto boxKeyFilter = [=](not_null<QEvent*> e) {
if (e->type() != QEvent::KeyPress) {
return base::EventFilterResult::Continue;
}
return (state->recording)
? base::EventFilterResult::Cancel
: base::EventFilterResult::Continue;
};
box->lifetime().make_state<base::unique_qptr<QObject>>(
base::install_event_filter(box, std::move(boxKeyFilter)));
}
AddSkip(layout);