feat: message field configuration
BIN
Telegram/Resources/icons/ayu/message_field/attach.png
Normal file
After Width: | Height: | Size: 452 B |
BIN
Telegram/Resources/icons/ayu/message_field/attach@2x.png
Normal file
After Width: | Height: | Size: 789 B |
BIN
Telegram/Resources/icons/ayu/message_field/attach@3x.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Telegram/Resources/icons/ayu/message_field/commands.png
Normal file
After Width: | Height: | Size: 444 B |
BIN
Telegram/Resources/icons/ayu/message_field/commands@2x.png
Normal file
After Width: | Height: | Size: 760 B |
BIN
Telegram/Resources/icons/ayu/message_field/commands@3x.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Telegram/Resources/icons/ayu/message_field/emoji.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
Telegram/Resources/icons/ayu/message_field/emoji@2x.png
Normal file
After Width: | Height: | Size: 970 B |
BIN
Telegram/Resources/icons/ayu/message_field/emoji@3x.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
Telegram/Resources/icons/ayu/message_field/ttl.png
Normal file
After Width: | Height: | Size: 493 B |
BIN
Telegram/Resources/icons/ayu/message_field/ttl@2x.png
Normal file
After Width: | Height: | Size: 891 B |
BIN
Telegram/Resources/icons/ayu/message_field/ttl@3x.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/ayu/message_field/voice.png
Normal file
After Width: | Height: | Size: 499 B |
BIN
Telegram/Resources/icons/ayu/message_field/voice@2x.png
Normal file
After Width: | Height: | Size: 911 B |
BIN
Telegram/Resources/icons/ayu/message_field/voice@3x.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
|
@ -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**.";
|
||||
|
|
|
@ -42,6 +42,7 @@ rpl::variable<QString> editedMarkReactive;
|
|||
rpl::variable<int> showPeerIdReactive;
|
||||
|
||||
rpl::variable<bool> 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<bool> get_hideFromBlockedReactive() {
|
|||
return hideFromBlockedReactive.value();
|
||||
}
|
||||
|
||||
void triggerHistoryUpdate() {
|
||||
historyUpdateReactive.fire({});
|
||||
}
|
||||
|
||||
rpl::producer<> get_historyUpdateReactive() {
|
||||
return historyUpdateReactive.events();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<bool> get_ghostModeEnabledReactive();
|
|||
|
||||
rpl::producer<bool> get_hideFromBlockedReactive();
|
||||
|
||||
void triggerHistoryUpdate();
|
||||
rpl::producer<> get_historyUpdateReactive();
|
||||
|
||||
}
|
||||
|
|
|
@ -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 }};
|
||||
|
|
|
@ -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<Ui::VerticalLayout*> container,
|
|||
}
|
||||
|
||||
void AddChooseButtonWithIconAndRightTextInner(not_null<Ui::VerticalLayout*> container,
|
||||
not_null<Window::SessionController*> controller,
|
||||
int initialState,
|
||||
std::vector<QString> options,
|
||||
rpl::producer<QString> text,
|
||||
rpl::producer<QString> boxTitle,
|
||||
const style::SettingsButton & st,
|
||||
Settings::IconDescriptor && descriptor,
|
||||
const Fn<void(int)> &setter) {
|
||||
not_null<Window::SessionController*> controller,
|
||||
int initialState,
|
||||
std::vector<QString> options,
|
||||
rpl::producer<QString> text,
|
||||
rpl::producer<QString> boxTitle,
|
||||
const style::SettingsButton &st,
|
||||
Settings::IconDescriptor &&descriptor,
|
||||
const Fn<void(int)> &setter) {
|
||||
auto reactiveVal = container->lifetime().make_state<rpl::variable<int>>(initialState);
|
||||
|
||||
rpl::producer<QString> rightTextReactive = reactiveVal->value() | rpl::map(
|
||||
|
@ -885,6 +888,166 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
|
|||
AddDividerText(container, tr::ayu_SettingsContextMenuDescription());
|
||||
}
|
||||
|
||||
void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> 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<Ui::VerticalLayout*> 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<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -1250,9 +1413,9 @@ void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Windo
|
|||
// not about folders, but it's a good place for it
|
||||
#ifdef Q_OS_WIN
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_HideNotificationBadge(),
|
||||
st::settingsButtonNoIcon
|
||||
container,
|
||||
tr::ayu_HideNotificationBadge(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->hideNotificationBadge)
|
||||
)->toggledValue(
|
||||
|
@ -1440,6 +1603,8 @@ void SetupCustomization(not_null<Ui::VerticalLayout*> container,
|
|||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
SetupContextMenuElements(container, controller);
|
||||
SetupMessageFieldElements(container);
|
||||
SetupMessageFieldPopups(container);
|
||||
SetupDrawerElements(container);
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
|
|
|
@ -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<base::options::details::ScopeFlag>(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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|