From 86b9d16747437a509d4547f0b817469d528cdcba Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 15 Apr 2024 23:30:57 +0300 Subject: [PATCH] Added additional note for macOS keys to json of custom shortcuts. --- Telegram/SourceFiles/core/shortcuts.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 270785fcb..8c0727db0 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -230,8 +230,24 @@ void WriteDefaultCustomFile() { const auto path = CustomFilePath(); auto input = QFile(":/misc/default_shortcuts-custom.json"); auto output = QFile(path); - if (input.open(QIODevice::ReadOnly) && output.open(QIODevice::WriteOnly)) { + if (input.open(QIODevice::ReadOnly) + && output.open(QIODevice::WriteOnly)) { +#ifdef Q_OS_MAC + auto text = qs(input.readAll()); + const auto note = R"( +// Note: +// On Apple platforms, reference to "ctrl" corresponds to the Command keys )" + + QByteArray() + + R"(on the Macintosh keyboard. +// On Apple platforms, reference to "meta" corresponds to the Control keys. + +[ +)"; + text.replace(u"\n\n["_q, QString(note)); + output.write(text.toUtf8()); +#else output.write(input.readAll()); +#endif // !Q_OS_MAC } }