diff --git a/Telegram/Resources/icons/ayu/message_field/attach.png b/Telegram/Resources/icons/ayu/message_field/attach.png new file mode 100644 index 000000000..d803dc06f Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/attach.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/attach@2x.png b/Telegram/Resources/icons/ayu/message_field/attach@2x.png new file mode 100644 index 000000000..d6f0b2906 Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/attach@2x.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/attach@3x.png b/Telegram/Resources/icons/ayu/message_field/attach@3x.png new file mode 100644 index 000000000..ee49f9e68 Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/attach@3x.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/commands.png b/Telegram/Resources/icons/ayu/message_field/commands.png new file mode 100644 index 000000000..5f51931a4 Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/commands.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/commands@2x.png b/Telegram/Resources/icons/ayu/message_field/commands@2x.png new file mode 100644 index 000000000..ece04b63d Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/commands@2x.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/commands@3x.png b/Telegram/Resources/icons/ayu/message_field/commands@3x.png new file mode 100644 index 000000000..c15d1580c Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/commands@3x.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/emoji.png b/Telegram/Resources/icons/ayu/message_field/emoji.png new file mode 100644 index 000000000..4bc32775a Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/emoji.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/emoji@2x.png b/Telegram/Resources/icons/ayu/message_field/emoji@2x.png new file mode 100644 index 000000000..5bb39acdf Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/emoji@2x.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/emoji@3x.png b/Telegram/Resources/icons/ayu/message_field/emoji@3x.png new file mode 100644 index 000000000..37e585411 Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/emoji@3x.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/ttl.png b/Telegram/Resources/icons/ayu/message_field/ttl.png new file mode 100644 index 000000000..04b61a19a Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/ttl.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/ttl@2x.png b/Telegram/Resources/icons/ayu/message_field/ttl@2x.png new file mode 100644 index 000000000..ecd5bcfc9 Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/ttl@2x.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/ttl@3x.png b/Telegram/Resources/icons/ayu/message_field/ttl@3x.png new file mode 100644 index 000000000..2d40692c6 Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/ttl@3x.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/voice.png b/Telegram/Resources/icons/ayu/message_field/voice.png new file mode 100644 index 000000000..bfe1eefe0 Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/voice.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/voice@2x.png b/Telegram/Resources/icons/ayu/message_field/voice@2x.png new file mode 100644 index 000000000..9529172e3 Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/voice@2x.png differ diff --git a/Telegram/Resources/icons/ayu/message_field/voice@3x.png b/Telegram/Resources/icons/ayu/message_field/voice@3x.png new file mode 100644 index 000000000..445428062 Binary files /dev/null and b/Telegram/Resources/icons/ayu/message_field/voice@3x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 69a77a487..1ca622721 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -5699,6 +5699,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ayu_SettingsContextMenuReactionsPanel" = "Reactions Panel"; "ayu_SettingsContextMenuViewsPanel" = "Views Panel"; "ayu_ContextMenuElementsHeader" = "Context Menu Elements"; +"ayu_MessageFieldElementsHeader" = "Message Field Elements"; +"ayu_MessageFieldPopupsHeader" = "Message Field Popups"; +"ayu_MessageFieldElementAttach" = "Attach"; +"ayu_MessageFieldElementCommands" = "Commands"; +"ayu_MessageFieldElementTTL" = "TTL"; +"ayu_MessageFieldElementEmoji" = "Emoji"; +"ayu_MessageFieldElementVoice" = "Voice"; "ayu_DrawerElementsHeader" = "Drawer Elements"; "ayu_TrayElementsHeader" = "Tray Elements"; "ayu_SettingsSpoofWebviewAsAndroid" = "Spoof Client as Android"; @@ -5741,8 +5748,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ayu_RegexFiltersAdd" = "Add Filter"; "ayu_RegexFiltersEdit" = "Edit Filter"; "ayu_RegexFiltersPlaceholder" = "Expression"; -"ayu_EnableExpression" = "Enable expression"; -"ayu_CaseInsensitiveExpression" = "Case insensitive expression"; +"ayu_EnableExpression" = "Enable Filter"; +"ayu_CaseInsensitiveExpression" = "Case Insensitive"; +"ayu_ReversedExpression" = "Reversed"; "ayu_RegexFiltersAddError" = "Regex syntax error"; "ayu_RegexFilterQuickAdd" = "Add Filter"; "ayu_RegexFilterBulletinText" = "Filter added to the **Shared filters**."; diff --git a/Telegram/SourceFiles/ayu/ayu_settings.cpp b/Telegram/SourceFiles/ayu/ayu_settings.cpp index d5168cf3e..ecf8bba0b 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.cpp +++ b/Telegram/SourceFiles/ayu/ayu_settings.cpp @@ -42,6 +42,7 @@ rpl::variable editedMarkReactive; rpl::variable showPeerIdReactive; rpl::variable hideFromBlockedReactive; +rpl::event_stream<> historyUpdateReactive; rpl::lifetime lifetime = rpl::lifetime(); @@ -249,6 +250,15 @@ AyuGramSettings::AyuGramSettings() { showUserMessagesInContextMenu = 2; showMessageDetailsInContextMenu = 2; + showAttachButtonInMessageField = true; + showCommandsButtonInMessageField = true; + showEmojiButtonInMessageField = true; + showMicrophoneButtonInMessageField = true; + showAutoDeleteButtonInMessageField = true; + + showAttachPopup = true; + showEmojiPopup = true; + showLReadToggleInDrawer = false; showSReadToggleInDrawer = true; showGhostToggleInDrawer = true; @@ -431,6 +441,41 @@ void AyuGramSettings::set_showMessageDetailsInContextMenu(int val) { showMessageDetailsInContextMenu = val; } +void AyuGramSettings::set_showAttachButtonInMessageField(bool val) { + showAttachButtonInMessageField = val; + triggerHistoryUpdate(); +} + +void AyuGramSettings::set_showCommandsButtonInMessageField(bool val) { + showCommandsButtonInMessageField = val; + triggerHistoryUpdate(); +} + +void AyuGramSettings::set_showEmojiButtonInMessageField(bool val) { + showEmojiButtonInMessageField = val; + triggerHistoryUpdate(); +} + +void AyuGramSettings::set_showMicrophoneButtonInMessageField(bool val) { + showMicrophoneButtonInMessageField = val; + triggerHistoryUpdate(); +} + +void AyuGramSettings::set_showAutoDeleteButtonInMessageField(bool val) { + showAutoDeleteButtonInMessageField = val; + triggerHistoryUpdate(); +} + +void AyuGramSettings::set_showAttachPopup(bool val) { + showAttachPopup = val; + triggerHistoryUpdate(); +} + +void AyuGramSettings::set_showEmojiPopup(bool val) { + showEmojiPopup = val; + triggerHistoryUpdate(); +} + void AyuGramSettings::set_showLReadToggleInDrawer(bool val) { showLReadToggleInDrawer = val; } @@ -524,4 +569,12 @@ rpl::producer get_hideFromBlockedReactive() { return hideFromBlockedReactive.value(); } +void triggerHistoryUpdate() { + historyUpdateReactive.fire({}); +} + +rpl::producer<> get_historyUpdateReactive() { + return historyUpdateReactive.events(); +} + } diff --git a/Telegram/SourceFiles/ayu/ayu_settings.h b/Telegram/SourceFiles/ayu/ayu_settings.h index a68106ae0..abb6c79ca 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.h +++ b/Telegram/SourceFiles/ayu/ayu_settings.h @@ -57,6 +57,15 @@ public: int showUserMessagesInContextMenu; int showMessageDetailsInContextMenu; + bool showAttachButtonInMessageField; + bool showCommandsButtonInMessageField; + bool showEmojiButtonInMessageField; + bool showMicrophoneButtonInMessageField; + bool showAutoDeleteButtonInMessageField; + + bool showAttachPopup; + bool showEmojiPopup; + bool showLReadToggleInDrawer; bool showSReadToggleInDrawer; bool showGhostToggleInDrawer; @@ -123,6 +132,15 @@ public: void set_showUserMessagesInContextMenu(int val); void set_showMessageDetailsInContextMenu(int val); + void set_showAttachButtonInMessageField(bool val); + void set_showCommandsButtonInMessageField(bool val); + void set_showEmojiButtonInMessageField(bool val); + void set_showMicrophoneButtonInMessageField(bool val); + void set_showAutoDeleteButtonInMessageField(bool val); + + void set_showAttachPopup(bool val); + void set_showEmojiPopup(bool val); + void set_showLReadToggleInDrawer(bool val); void set_showSReadToggleInDrawer(bool val); void set_showGhostToggleInDrawer(bool val); @@ -181,6 +199,13 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( showHideMessageInContextMenu, showUserMessagesInContextMenu, showMessageDetailsInContextMenu, + showAttachButtonInMessageField, + showCommandsButtonInMessageField, + showEmojiButtonInMessageField, + showMicrophoneButtonInMessageField, + showAutoDeleteButtonInMessageField, + showAttachPopup, + showEmojiPopup, showLReadToggleInDrawer, showSReadToggleInDrawer, showGhostToggleInDrawer, @@ -215,4 +240,7 @@ rpl::producer get_ghostModeEnabledReactive(); rpl::producer get_hideFromBlockedReactive(); +void triggerHistoryUpdate(); +rpl::producer<> get_historyUpdateReactive(); + } diff --git a/Telegram/SourceFiles/ayu/ui/ayu_icons.style b/Telegram/SourceFiles/ayu/ui/ayu_icons.style index fb98cb99d..4f4934b86 100644 --- a/Telegram/SourceFiles/ayu/ui/ayu_icons.style +++ b/Telegram/SourceFiles/ayu/ui/ayu_icons.style @@ -19,6 +19,12 @@ ayuStreamerModeMenuIcon: icon {{ "ayu/streamer", menuIconColor }}; ayuMenuIconToBeginning: icon {{ "ayu/to_beginning", menuIconColor }}; +messageFieldAttachIcon: icon {{ "ayu/message_field/attach", menuIconColor }}; +messageFieldCommandsIcon: icon {{ "ayu/message_field/commands", menuIconColor }}; +messageFieldEmojiIcon: icon {{ "ayu/message_field/emoji", menuIconColor }}; +messageFieldVoiceIcon: icon {{ "ayu/message_field/voice", menuIconColor }}; +messageFieldTTLIcon: icon {{ "ayu/message_field/ttl", menuIconColor }}; + inChannelBadgeIcon: icon {{ "ayu/channel", msgInDateFg }}; inChannelBadgeSelectedIcon: icon {{ "ayu/channel", msgInDateFgSelected }}; outChannelBadgeIcon: icon {{ "ayu/channel", msgOutDateFg }}; diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp index c3860948e..06edd51ae 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp @@ -5,6 +5,8 @@ // // Copyright @Radolyn, 2024 #include "settings_ayu.h" + + #include "ayu/ayu_settings.h" #include "ayu/ui/boxes/edit_deleted_mark.h" #include "ayu/ui/boxes/edit_edited_mark.h" @@ -17,6 +19,7 @@ #include "main/main_session.h" #include "settings/settings_common.h" #include "storage/localstorage.h" +#include "styles/style_chat_helpers.h" #include "styles/style_ayu_styles.h" #include "styles/style_basic.h" #include "styles/style_boxes.h" @@ -346,14 +349,14 @@ void AddCollapsibleToggle(not_null container, } void AddChooseButtonWithIconAndRightTextInner(not_null container, - not_null controller, - int initialState, - std::vector options, - rpl::producer text, - rpl::producer boxTitle, - const style::SettingsButton & st, - Settings::IconDescriptor && descriptor, - const Fn &setter) { + not_null controller, + int initialState, + std::vector options, + rpl::producer text, + rpl::producer boxTitle, + const style::SettingsButton &st, + Settings::IconDescriptor &&descriptor, + const Fn &setter) { auto reactiveVal = container->lifetime().make_state>(initialState); rpl::producer rightTextReactive = reactiveVal->value() | rpl::map( @@ -885,6 +888,166 @@ void SetupContextMenuElements(not_null container, AddDividerText(container, tr::ayu_SettingsContextMenuDescription()); } +void SetupMessageFieldElements(not_null container) { + auto settings = &AyuSettings::getInstance(); + + AddSkip(container); + AddSubsectionTitle(container, tr::ayu_MessageFieldElementsHeader()); + + AddButtonWithIcon( + container, + tr::ayu_MessageFieldElementAttach(), + st::settingsButton, + {&st::messageFieldAttachIcon} + )->toggleOn( + rpl::single(settings->showAttachButtonInMessageField) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (enabled != settings->showAttachButtonInMessageField); + }) | start_with_next( + [=](bool enabled) + { + settings->set_showAttachButtonInMessageField(enabled); + AyuSettings::save(); + }, + container->lifetime()); + + AddButtonWithIcon( + container, + tr::ayu_MessageFieldElementCommands(), + st::settingsButton, + {&st::messageFieldCommandsIcon} + )->toggleOn( + rpl::single(settings->showCommandsButtonInMessageField) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (enabled != settings->showCommandsButtonInMessageField); + }) | start_with_next( + [=](bool enabled) + { + settings->set_showCommandsButtonInMessageField(enabled); + AyuSettings::save(); + }, + container->lifetime()); + + AddButtonWithIcon( + container, + tr::ayu_MessageFieldElementTTL(), + st::settingsButton, + {&st::messageFieldTTLIcon} + )->toggleOn( + rpl::single(settings->showAutoDeleteButtonInMessageField) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (enabled != settings->showAutoDeleteButtonInMessageField); + }) | start_with_next( + [=](bool enabled) + { + settings->set_showAutoDeleteButtonInMessageField(enabled); + AyuSettings::save(); + }, + container->lifetime()); + + AddButtonWithIcon( + container, + tr::ayu_MessageFieldElementEmoji(), + st::settingsButton, + {&st::messageFieldEmojiIcon} + )->toggleOn( + rpl::single(settings->showEmojiButtonInMessageField) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (enabled != settings->showEmojiButtonInMessageField); + }) | start_with_next( + [=](bool enabled) + { + settings->set_showEmojiButtonInMessageField(enabled); + AyuSettings::save(); + }, + container->lifetime()); + + AddButtonWithIcon( + container, + tr::ayu_MessageFieldElementVoice(), + st::settingsButton, + {&st::messageFieldVoiceIcon} + )->toggleOn( + rpl::single(settings->showMicrophoneButtonInMessageField) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (enabled != settings->showMicrophoneButtonInMessageField); + }) | start_with_next( + [=](bool enabled) + { + settings->set_showMicrophoneButtonInMessageField(enabled); + AyuSettings::save(); + }, + container->lifetime()); + + AddSkip(container); + AddDivider(container); +} + +void SetupMessageFieldPopups(not_null container) { + auto settings = &AyuSettings::getInstance(); + + AddSkip(container); + AddSubsectionTitle(container, tr::ayu_MessageFieldPopupsHeader()); + + AddButtonWithIcon( + container, + tr::ayu_MessageFieldElementAttach(), + st::settingsButton, + {&st::messageFieldAttachIcon} + )->toggleOn( + rpl::single(settings->showAttachPopup) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (enabled != settings->showAttachPopup); + }) | start_with_next( + [=](bool enabled) + { + settings->set_showAttachPopup(enabled); + AyuSettings::save(); + }, + container->lifetime()); + + AddButtonWithIcon( + container, + tr::ayu_MessageFieldElementEmoji(), + st::settingsButton, + {&st::messageFieldEmojiIcon} + )->toggleOn( + rpl::single(settings->showEmojiPopup) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (enabled != settings->showEmojiPopup); + }) | start_with_next( + [=](bool enabled) + { + settings->set_showEmojiPopup(enabled); + AyuSettings::save(); + }, + container->lifetime()); + + AddSkip(container); + AddDivider(container); +} + void SetupDrawerElements(not_null container) { auto settings = &AyuSettings::getInstance(); @@ -1250,9 +1413,9 @@ void SetupFolderSettings(not_null container, not_nulltoggleOn( rpl::single(settings->hideNotificationBadge) )->toggledValue( @@ -1440,6 +1603,8 @@ void SetupCustomization(not_null container, AddSkip(container); AddDivider(container); SetupContextMenuElements(container, controller); + SetupMessageFieldElements(container); + SetupMessageFieldPopups(container); SetupDrawerElements(container); AddSkip(container); AddDivider(container); diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp index 7d399a596..d1368a8af 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp @@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "chat_helpers/tabbed_selector.h" #include "window/window_session_controller.h" #include "mainwindow.h" +#include "ayu/ayu_settings.h" #include "core/application.h" #include "base/options.h" #include "styles/style_chat_helpers.h" @@ -27,6 +28,7 @@ base::options::toggle TabbedPanelShowOnClick({ .id = kOptionTabbedPanelShowOnClick, .name = "Show tabbed panel by click", .description = "Show Emoji / Stickers / GIFs panel only after a click.", + .scope = static_cast(0), }); } // namespace @@ -464,7 +466,9 @@ void TabbedPanel::showStarted() { } bool TabbedPanel::eventFilter(QObject *obj, QEvent *e) { - if (TabbedPanelShowOnClick.value()) { + const auto settings = &AyuSettings::getInstance(); + + if (TabbedPanelShowOnClick.value() || !settings->showEmojiPopup) { return false; } else if (e->type() == QEvent::Enter) { otherEnter(); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 5243b429d..5bab52a2d 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -228,6 +228,13 @@ const auto kPsaAboutPrefix = "cloud_lng_about_psa_"; return QString(); } +#define SWITCH_BUTTON(button, show_v) \ + if (show_v) { \ + (button)->show(); \ + } else { \ + (button)->hide(); \ + } + } // namespace HistoryWidget::HistoryWidget( @@ -478,12 +485,13 @@ HistoryWidget::HistoryWidget( _fieldCharsCountManager.limitExceeds( ) | rpl::start_with_next([=] { + const auto settings = &AyuSettings::getInstance(); const auto hide = _fieldCharsCountManager.isLimitExceeded(); if (_silent) { _silent->setVisible(!hide); } if (_ttlInfo) { - _ttlInfo->setVisible(!hide); + _ttlInfo->setVisible(!hide && settings->showAutoDeleteButtonInMessageField); } if (_scheduled) { _scheduled->setVisible(!hide); @@ -807,6 +815,15 @@ HistoryWidget::HistoryWidget( } }, lifetime()); + AyuSettings::get_historyUpdateReactive() | rpl::start_with_next([=] + { + refreshAttachBotsMenu(); + updateHistoryGeometry(); + updateControlsVisibility(); + updateControlsGeometry(); + this->update(); + }, lifetime()); + using MessageUpdateFlag = Data::MessageUpdate::Flag; session().changes().messageUpdates( MessageUpdateFlag::Destroyed @@ -2640,8 +2657,10 @@ void HistoryWidget::setHistory(History *history) { return; } + const auto settings = &AyuSettings::getInstance(); + const auto was = _attachBotsMenu && _history && _history->peer->isUser(); - const auto now = _attachBotsMenu && history && history->peer->isUser(); + const auto now = _attachBotsMenu && history && history->peer->isUser() && settings->showAttachPopup; if (was && !now) { _attachToggle->removeEventFilter(_attachBotsMenu.get()); _attachBotsMenu->hideFast(); @@ -2722,6 +2741,9 @@ void HistoryWidget::refreshAttachBotsMenu() { if (!_history) { return; } + + const auto settings = &AyuSettings::getInstance(); + _attachBotsMenu = InlineBots::MakeAttachBotsMenu( this, controller(), @@ -2733,7 +2755,9 @@ void HistoryWidget::refreshAttachBotsMenu() { } _attachBotsMenu->setOrigin( Ui::PanelAnimation::Origin::BottomLeft); - _attachToggle->installEventFilter(_attachBotsMenu.get()); + if (settings->showAttachPopup) { + _attachToggle->installEventFilter(_attachBotsMenu.get()); + } _attachBotsMenu->heightValue( ) | rpl::start_with_next([=] { moveFieldControls(); @@ -2982,6 +3006,8 @@ bool HistoryWidget::canWriteMessage() const { } void HistoryWidget::updateControlsVisibility() { + const auto settings = &AyuSettings::getInstance(); + auto fieldDisabledRemoved = (_fieldDisabled != nullptr); const auto hideExtraButtons = _fieldCharsCountManager.isLimitExceeded(); const auto guard = gsl::finally([&] { @@ -3162,27 +3188,27 @@ void HistoryWidget::updateControlsVisibility() { _botCommandStart->hide(); } else if (_kbReplyTo) { _kbScroll->hide(); - _tabbedSelectorToggle->show(); + SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField); _botKeyboardHide->hide(); _botKeyboardShow->hide(); _botCommandStart->hide(); } else { _kbScroll->hide(); - _tabbedSelectorToggle->show(); + SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField); _botKeyboardHide->hide(); if (_keyboard->hasMarkup()) { _botKeyboardShow->show(); _botCommandStart->hide(); } else { _botKeyboardShow->hide(); - _botCommandStart->setVisible(_cmdStartShown); + _botCommandStart->setVisible(_cmdStartShown && settings->showCommandsButtonInMessageField); } } if (_replaceMedia) { _replaceMedia->show(); _attachToggle->hide(); } else { - _attachToggle->show(); + SWITCH_BUTTON(_attachToggle, settings->showAttachButtonInMessageField); } if (_botMenu.button) { _botMenu.button->show(); @@ -3210,7 +3236,7 @@ void HistoryWidget::updateControlsVisibility() { } if (_ttlInfo) { const auto was = _ttlInfo->isVisible(); - const auto now = (!_editMsgId) && (!hideExtraButtons); + const auto now = (!_editMsgId) && (!hideExtraButtons) && settings->showAutoDeleteButtonInMessageField; if (was != now) { _ttlInfo->setVisible(now); rightButtonsChanged = true; @@ -5024,6 +5050,11 @@ bool HistoryWidget::isSearching() const { } bool HistoryWidget::showRecordButton() const { + const auto settings = &AyuSettings::getInstance(); + if (!settings->showMicrophoneButtonInMessageField) { + return false; + } + return Media::Capture::instance()->available() && !_voiceRecordBar->isListenState() && !_voiceRecordBar->isRecordingByAnotherBar() @@ -5233,6 +5264,8 @@ void HistoryWidget::showKeyboardHideButton() { } void HistoryWidget::toggleKeyboard(bool manual) { + const auto settings = &AyuSettings::getInstance(); + auto fieldEnabled = canWriteMessage() && !_showAnimation; if (_kbShown || _kbReplyTo) { _botKeyboardHide->hide(); @@ -5268,7 +5301,7 @@ void HistoryWidget::toggleKeyboard(bool manual) { _botKeyboardHide->hide(); _botKeyboardShow->hide(); if (fieldEnabled) { - _botCommandStart->show(); + SWITCH_BUTTON(_botCommandStart, settings->showCommandsButtonInMessageField); } _kbScroll->hide(); _kbShown = false; @@ -5308,11 +5341,7 @@ void HistoryWidget::toggleKeyboard(bool manual) { } updateControlsGeometry(); updateFieldPlaceholder(); - if (_botKeyboardHide->isHidden() && canWriteMessage() && !_showAnimation) { - _tabbedSelectorToggle->show(); - } else { - _tabbedSelectorToggle->hide(); - } + SWITCH_BUTTON(_tabbedSelectorToggle, _botKeyboardHide->isHidden() && canWriteMessage() && !_showAnimation && settings->showEmojiButtonInMessageField); updateField(); } @@ -5451,6 +5480,8 @@ bool HistoryWidget::fieldOrDisabledShown() const { } void HistoryWidget::moveFieldControls() { + const auto settings = &AyuSettings::getInstance(); + auto keyboardHeight = 0; auto bottom = height(); auto maxKeyboardHeight = computeMaxFieldHeight() - fieldHeight(); @@ -5474,7 +5505,9 @@ void HistoryWidget::moveFieldControls() { if (_replaceMedia) { _replaceMedia->moveToLeft(left, buttonsBottom); } - _attachToggle->moveToLeft(left, buttonsBottom); left += _attachToggle->width(); + if (settings->showAttachButtonInMessageField) { + _attachToggle->moveToLeft(left, buttonsBottom); left += _attachToggle->width(); + } if (_sendAs) { _sendAs->moveToLeft(left, buttonsBottom); left += _sendAs->width(); } @@ -5488,14 +5521,14 @@ void HistoryWidget::moveFieldControls() { _send->moveToRight(right, buttonsBottom); right += _send->width(); _voiceRecordBar->moveToLeft(0, bottom - _voiceRecordBar->height()); _tabbedSelectorToggle->moveToRight(right, buttonsBottom); - _botKeyboardHide->moveToRight(right, buttonsBottom); right += _botKeyboardHide->width(); + _botKeyboardHide->moveToRight(right, buttonsBottom); right += settings->showEmojiButtonInMessageField || !_botKeyboardHide->isHidden() ? _botKeyboardHide->width() : 0; _botKeyboardShow->moveToRight(right, buttonsBottom); _botCommandStart->moveToRight(right, buttonsBottom); if (_silent) { _silent->moveToRight(right, buttonsBottom); } const auto kbShowShown = _history && !_kbShown && _keyboard->hasMarkup(); - if (kbShowShown || _cmdStartShown || _silent) { + if (kbShowShown || (_cmdStartShown && settings->showCommandsButtonInMessageField) || _silent) { right += _botCommandStart->width(); } if (_scheduled) { @@ -5536,12 +5569,14 @@ void HistoryWidget::moveFieldControls() { } void HistoryWidget::updateFieldSize() { + const auto settings = &AyuSettings::getInstance(); + const auto kbShowShown = _history && !_kbShown && _keyboard->hasMarkup(); auto fieldWidth = width() - - _attachToggle->width() + - (settings->showAttachButtonInMessageField ? _attachToggle->width() : 0) - st::historySendRight - _send->width() - - _tabbedSelectorToggle->width(); + - (settings->showEmojiButtonInMessageField ? _tabbedSelectorToggle->width() : 0); if (_botMenu.button) { fieldWidth -= st::historyBotMenuSkip + _botMenu.button->width(); } @@ -5551,7 +5586,7 @@ void HistoryWidget::updateFieldSize() { if (kbShowShown) { fieldWidth -= _botKeyboardShow->width(); } - if (_cmdStartShown) { + if (_cmdStartShown && settings->showCommandsButtonInMessageField) { fieldWidth -= _botCommandStart->width(); } if (_silent && _silent->isVisible()) { @@ -5560,7 +5595,7 @@ void HistoryWidget::updateFieldSize() { if (_scheduled && _scheduled->isVisible()) { fieldWidth -= _scheduled->width(); } - if (_ttlInfo && _ttlInfo->isVisible()) { + if (_ttlInfo && _ttlInfo->isVisible() && settings->showAutoDeleteButtonInMessageField) { fieldWidth -= _ttlInfo->width(); } @@ -6586,6 +6621,8 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) { return; } + const auto settings = &AyuSettings::getInstance(); + const auto wasVisible = _kbShown || _kbReplyTo; const auto wasMsgId = _keyboard->forMsgId(); auto changed = false; @@ -6628,7 +6665,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) { showKeyboardHideButton(); } else { _kbScroll->hide(); - _tabbedSelectorToggle->show(); + SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField); _botKeyboardHide->hide(); } _botKeyboardShow->hide(); @@ -6648,7 +6685,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) { } else { if (!_showAnimation) { _kbScroll->hide(); - _tabbedSelectorToggle->show(); + SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField); _botKeyboardHide->hide(); _botKeyboardShow->show(); _botCommandStart->hide(); @@ -6666,10 +6703,11 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) { } else { if (!_scroll->isHidden()) { _kbScroll->hide(); + //SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField); _tabbedSelectorToggle->show(); _botKeyboardHide->hide(); _botKeyboardShow->hide(); - _botCommandStart->setVisible(!_editMsgId); + _botCommandStart->setVisible(!_editMsgId && settings->showCommandsButtonInMessageField); } _field->setMaxHeight(computeMaxFieldHeight()); _kbShown = false; diff --git a/Telegram/SourceFiles/settings/settings_experimental.cpp b/Telegram/SourceFiles/settings/settings_experimental.cpp index 983497e8a..9ff718b40 100644 --- a/Telegram/SourceFiles/settings/settings_experimental.cpp +++ b/Telegram/SourceFiles/settings/settings_experimental.cpp @@ -140,11 +140,11 @@ void SetupExperimental( : rpl::producer<>())); }; - addToggle(ChatHelpers::kOptionTabbedPanelShowOnClick); + // addToggle(ChatHelpers::kOptionTabbedPanelShowOnClick); addToggle(Dialogs::kOptionForumHideChatsList); addToggle(Core::kOptionFractionalScalingEnabled); addToggle(Window::kOptionViewProfileInChatsListContextMenu); - addToggle(Info::Profile::kOptionShowPeerIdBelowAbout); + // addToggle(Info::Profile::kOptionShowPeerIdBelowAbout); addToggle(Ui::kOptionUseSmallMsgBubbleRadius); addToggle(Media::Player::kOptionDisableAutoplayNext); addToggle(kOptionSendLargePhotos);