diff --git a/Telegram/SourceFiles/settings/sections/settings_shortcuts.cpp b/Telegram/SourceFiles/settings/sections/settings_shortcuts.cpp index 6fb0bf5715..04cebaa577 100644 --- a/Telegram/SourceFiles/settings/sections/settings_shortcuts.cpp +++ b/Telegram/SourceFiles/settings/sections/settings_shortcuts.cpp @@ -146,7 +146,8 @@ struct SetupShortcutsResult { [[nodiscard]] SetupShortcutsResult SetupShortcutsContent( not_null controller, - not_null content) { + not_null content, + HighlightRegistry *highlights) { const auto &defaults = S::KeysDefaults(); const auto ¤ts = S::KeysCurrents(); @@ -236,6 +237,15 @@ struct SetupShortcutsResult { entry.wrap, rpl::duplicate(entry.label), st::settingsButtonNoIcon)); + if (highlights && index == 0) { + const auto id = ShortcutsHighlightId(entry.command); + if (!id.isEmpty()) { + highlights->push_back({ + id, + { widget, { .rippleShape = true } }, + }); + } + } const auto keys = Ui::CreateChild( widget, st::settingsButtonNoIcon.rightLabel); @@ -562,7 +572,10 @@ void Shortcuts::setupContent() { .highlights = highlights, }); - auto result = SetupShortcutsContent(controller, container); + auto result = SetupShortcutsContent( + controller, + container, + highlights); *save = std::move(result.save); *resetButton = result.resetButton; @@ -609,6 +622,15 @@ Type ShortcutsId() { return Shortcuts::Id(); } +QString ShortcutsHighlightId(::Shortcuts::Command command) { + switch (command) { + case ::Shortcuts::Command::ComposeAiApplyInPlace: + return u"shortcuts/ai_compose_apply"_q; + default: + return {}; + } +} + namespace Builder { SectionBuildMethod ShortcutsSection = kMeta.build; diff --git a/Telegram/SourceFiles/settings/sections/settings_shortcuts.h b/Telegram/SourceFiles/settings/sections/settings_shortcuts.h index 673bef8228..9740e0a5ab 100644 --- a/Telegram/SourceFiles/settings/sections/settings_shortcuts.h +++ b/Telegram/SourceFiles/settings/sections/settings_shortcuts.h @@ -9,6 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "settings/settings_type.h" +namespace Shortcuts { +enum class Command; +} // namespace Shortcuts + namespace Window { class SessionController; } // namespace Window @@ -16,5 +20,6 @@ class SessionController; namespace Settings { [[nodiscard]] Type ShortcutsId(); +[[nodiscard]] QString ShortcutsHighlightId(::Shortcuts::Command command); } // namespace Settings