Added ability to customize shortcut for full screen in media viewer.

This commit is contained in:
23rd 2023-10-12 04:14:05 +03:00
parent bee0534052
commit 6cae088d1f
3 changed files with 20 additions and 3 deletions

View File

@ -94,9 +94,10 @@ const auto CommandByName = base::flat_map<QString, Command>{
{ u"read_chat"_q , Command::ReadChat },
// Shortcuts that have no default values.
{ u"message"_q , Command::JustSendMessage },
{ u"message_silently"_q , Command::SendSilentMessage },
{ u"message_scheduled"_q , Command::ScheduleMessage },
{ u"message"_q , Command::JustSendMessage },
{ u"message_silently"_q , Command::SendSilentMessage },
{ u"message_scheduled"_q , Command::ScheduleMessage },
{ u"mevia_viewer_video_fullscreen"_q , Command::MediaViewerFullscreen },
//
};

View File

@ -59,6 +59,8 @@ enum class Command {
ReadChat,
MediaViewerFullscreen,
SupportReloadTemplates,
SupportToggleMuted,
SupportScrollToCurrent,

View File

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/ui_integration.h"
#include "core/crash_reports.h"
#include "core/sandbox.h"
#include "core/shortcuts.h"
#include "ui/widgets/popup_menu.h"
#include "ui/widgets/buttons.h"
#include "ui/image/image.h"
@ -458,6 +459,19 @@ OverlayWidget::OverlayWidget()
QImage::Format_ARGB32_Premultiplied);
_docRectImage.setDevicePixelRatio(cIntRetinaFactor());
Shortcuts::Requests(
) | rpl::start_with_next([=](not_null<Shortcuts::Request*> request) {
request->check(
Shortcuts::Command::MediaViewerFullscreen
) && request->handle([=] {
if (_streamed) {
playbackToggleFullScreen();
return true;
}
return false;
});
}, lifetime());
setupWindow();
const auto mousePosition = [](not_null<QEvent*> e) {