mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improved conflict handle between IV shortcuts and Shortcuts.
This commit is contained in:
parent
d6ba6ac41e
commit
cf1fa718a8
4 changed files with 18 additions and 1 deletions
|
@ -1214,6 +1214,7 @@ void Widget::setupShortcuts() {
|
||||||
});
|
});
|
||||||
request->check(Command::ShowChatMenu, 1) && request->handle([=] {
|
request->check(Command::ShowChatMenu, 1) && request->handle([=] {
|
||||||
if (_inner) {
|
if (_inner) {
|
||||||
|
Window::ActivateWindow(controller());
|
||||||
_inner->showPeerMenu();
|
_inner->showPeerMenu();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2010,6 +2010,7 @@ void HistoryWidget::setupShortcuts() {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
request->check(Command::ShowChatMenu, 1) && request->handle([=] {
|
request->check(Command::ShowChatMenu, 1) && request->handle([=] {
|
||||||
|
Window::ActivateWindow(controller());
|
||||||
_topBar->showPeerMenu();
|
_topBar->showPeerMenu();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -502,6 +502,7 @@ void WrapWidget::addTopBarMenuButton() {
|
||||||
using Command = Shortcuts::Command;
|
using Command = Shortcuts::Command;
|
||||||
|
|
||||||
request->check(Command::ShowChatMenu, 1) && request->handle([=] {
|
request->check(Command::ShowChatMenu, 1) && request->handle([=] {
|
||||||
|
Window::ActivateWindow(_controller->parentController());
|
||||||
showTopBarMenu(false);
|
showTopBarMenu(false);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "iv/iv_controller.h"
|
#include "iv/iv_controller.h"
|
||||||
|
|
||||||
|
#include "base/event_filter.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/qt/qt_key_modifiers.h"
|
#include "base/qt/qt_key_modifiers.h"
|
||||||
#include "base/invoke_queued.h"
|
#include "base/invoke_queued.h"
|
||||||
|
@ -679,18 +680,31 @@ void Controller::createWebview(const Webview::StorageId &storageId) {
|
||||||
if (event->key() == Qt::Key_Escape) {
|
if (event->key() == Qt::Key_Escape) {
|
||||||
escape();
|
escape();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}, window->lifetime());
|
||||||
|
|
||||||
|
base::install_event_filter(window, qApp, [=](not_null<QEvent*> e) {
|
||||||
|
if (e->type() == QEvent::ShortcutOverride) {
|
||||||
|
if (!window->isActiveWindow()) {
|
||||||
|
return base::EventFilterResult::Continue;
|
||||||
|
}
|
||||||
|
const auto event = static_cast<QKeyEvent*>(e.get());
|
||||||
if (event->modifiers() & Qt::ControlModifier) {
|
if (event->modifiers() & Qt::ControlModifier) {
|
||||||
if (event->key() == Qt::Key_Plus
|
if (event->key() == Qt::Key_Plus
|
||||||
|| event->key() == Qt::Key_Equal) {
|
|| event->key() == Qt::Key_Equal) {
|
||||||
_delegate->ivSetZoom(_delegate->ivZoom() + kZoomStep);
|
_delegate->ivSetZoom(_delegate->ivZoom() + kZoomStep);
|
||||||
|
return base::EventFilterResult::Cancel;
|
||||||
} else if (event->key() == Qt::Key_Minus) {
|
} else if (event->key() == Qt::Key_Minus) {
|
||||||
_delegate->ivSetZoom(_delegate->ivZoom() - kZoomStep);
|
_delegate->ivSetZoom(_delegate->ivZoom() - kZoomStep);
|
||||||
|
return base::EventFilterResult::Cancel;
|
||||||
} else if (event->key() == Qt::Key_0) {
|
} else if (event->key() == Qt::Key_0) {
|
||||||
_delegate->ivSetZoom(kDefaultZoom);
|
_delegate->ivSetZoom(kDefaultZoom);
|
||||||
|
return base::EventFilterResult::Cancel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, window->lifetime());
|
return base::EventFilterResult::Continue;
|
||||||
|
});
|
||||||
|
|
||||||
const auto widget = raw->widget();
|
const auto widget = raw->widget();
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue