2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Rewrite shortcuts using QAction.

That way they don't depend on the main window.
This commit is contained in:
John Preston
2023-01-18 11:58:57 +04:00
parent 5154fe0044
commit 3e332ad8e7
4 changed files with 49 additions and 41 deletions

View File

@@ -183,9 +183,6 @@ Application::~Application() {
Local::writeSettings();
}
// Depend on primaryWindow() for now :(
Shortcuts::Finish();
_closingAsyncWindows.clear();
_secondaryWindows.clear();
_primaryWindows.clear();
@@ -261,6 +258,7 @@ void Application::run() {
Ui::StartCachedCorners();
Ui::Emoji::Init();
Ui::PreloadTextSpoilerMask();
startShortcuts();
startEmojiImageLoader();
startSystemDarkModeViewer();
Media::Player::start(_audio.get());
@@ -329,10 +327,7 @@ void Application::run() {
DEBUG_LOG(("Application Info: window created..."));
// Depend on primaryWindow() for now :(
startShortcuts();
startDomain();
startTray();
_lastActivePrimaryWindow->widget()->show();
@@ -567,7 +562,7 @@ bool Application::eventFilter(QObject *object, QEvent *e) {
const auto event = static_cast<QShortcutEvent*>(e);
DEBUG_LOG(("Shortcut event caught: %1"
).arg(event->key().toString()));
if (Shortcuts::HandleEvent(event)) {
if (Shortcuts::HandleEvent(object, event)) {
return true;
}
} break;