From 75d2b5994f6cdf8dd46955fd07bc1441d375c1dd Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 16 May 2023 19:48:49 +0400 Subject: [PATCH] Apply dark theme to reply controls in stories. --- .../chat_helpers/chat_helpers.style | 505 ++++++++++++++++-- .../chat_helpers/emoji_list_widget.cpp | 17 +- .../chat_helpers/field_autocomplete.cpp | 19 +- .../chat_helpers/field_autocomplete.h | 8 +- .../chat_helpers/gifs_list_widget.cpp | 4 +- .../chat_helpers/message_field.cpp | 1 + .../chat_helpers/stickers_list_footer.cpp | 2 +- .../chat_helpers/stickers_list_widget.cpp | 15 +- .../chat_helpers/stickers_list_widget.h | 3 + .../chat_helpers/tabbed_selector.cpp | 53 +- .../chat_helpers/tabbed_selector.h | 26 +- .../SourceFiles/history/history_widget.cpp | 2 +- .../history_view_compose_controls.cpp | 83 ++- .../controls/history_view_compose_controls.h | 23 +- .../media/stories/media_stories_reply.cpp | 9 + .../SourceFiles/media/view/media_view.style | 111 +++- .../media/view/media_view_overlay_widget.cpp | 3 + .../SourceFiles/ui/boxes/time_picker_box.cpp | 2 +- .../attach_abstract_single_file_preview.cpp | 1 + .../ui/chat/attach/attach_album_thumbnail.cpp | 1 + Telegram/SourceFiles/ui/chat/chat.style | 359 +------------ Telegram/SourceFiles/ui/chat/message_bar.cpp | 1 + Telegram/SourceFiles/ui/chat/pinned_bar.cpp | 2 +- Telegram/SourceFiles/ui/chat/requests_bar.cpp | 4 +- .../SourceFiles/ui/controls/emoji_button.cpp | 28 +- .../SourceFiles/ui/controls/emoji_button.h | 8 +- .../ui/controls/jump_down_button.cpp | 2 +- .../SourceFiles/ui/controls/send_button.cpp | 62 +-- .../SourceFiles/ui/controls/send_button.h | 8 +- .../SourceFiles/ui/controls/tabbed_search.cpp | 2 +- .../window/themes/window_theme_preview.cpp | 22 +- Telegram/SourceFiles/window/window.style | 2 +- 32 files changed, 836 insertions(+), 552 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index 97f94cb19..ceec7e3ec 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -11,9 +11,17 @@ using "boxes/boxes.style"; using "ui/layers/layers.style"; using "ui/widgets/widgets.style"; +GroupCallUserpics { + size: pixels; + shift: pixels; + stroke: pixels; + align: align; +} + TabbedSearch { outer: color; bg: color; + bgActive: color; fg: color; fgActive: color; fadeLeft: icon; @@ -44,14 +52,53 @@ EmojiPan { iconArea: pixels; bg: color; overBg: color; + expandBg: color; + pathBg: color; + pathFg: color; + textFg: color; categoriesBg: color; categoriesBgOver: color; fadeLeft: icon; fadeRight: icon; + tabs: SettingsSlider; search: TabbedSearch; searchMargin: margins; } +MessageBar { + title: TextStyle; + titleFg: color; + text: TextStyle; + textFg: color; + textPalette: TextPalette; + duration: int; +} + +EmojiButton { + inner: IconButton; + bg: color; + lineFg: color; + lineFgOver: color; +} + +SendButton { + inner: IconButton; + record: icon; + recordOver: icon; + sendDisabledFg: color; +} + +ComposeControls { + bg: color; + radius: pixels; + + field: InputField; + send: SendButton; + attach: IconButton; + emoji: EmojiButton; + tabbed: EmojiPan; +} + switchPmButton: RoundButton(defaultBoxButton) { width: 320px; height: 34px; @@ -196,50 +243,55 @@ emojiPanSlideDuration: 200; emojiPanArea: size(34px, 32px); emojiPanRadius: 8px; +defaultTabbedSearchCancel: CrossButton { + width: 33px; + height: 33px; + + cross: CrossAnimation { + size: 27px; + skip: 8px; + stroke: 1.; + minScale: 0.3; + } + crossFg: menuIconFg; + crossFgOver: menuIconFg; + crossPosition: point(1px, 3px); + + duration: 150; + loadingPeriod: 1000; + ripple: emptyRippleAnimation; +} +defaultTabbedSearchField: InputField(defaultMultiSelectSearchField) { + textMargins: margins(2px, 7px, 2px, 0px); +} +defaultTabbedSearchButton: IconButton(defaultIconButton) { + width: 33px; + height: 33px; + icon: icon{{ "emoji/emoji_search_input", emojiIconFg }}; + iconOver: icon{{ "emoji/emoji_search_input", emojiIconFg }}; + iconPosition: point(7px, -1px); + ripple: emptyRippleAnimation; +} +defaultTabbedSearchBack: IconButton(defaultIconButton) { + width: 33px; + height: 33px; + icon: icon{{ "emoji/emoji_back", menuIconFg }}; + iconOver: icon{{ "emoji/emoji_back", menuIconFg }}; + iconPosition: point(7px, -1px); + ripple: emptyRippleAnimation; +} defaultTabbedSearch: TabbedSearch { outer: emojiPanBg; bg: emojiPanHover; + bgActive: windowBgRipple; fg: emojiIconFg; fgActive: emojiSubIconFgActive; fadeLeft: icon {{ "fade_horizontal-flip_horizontal", emojiPanHover }}; fadeRight: icon {{ "fade_horizontal", emojiPanHover }}; - field: InputField(defaultMultiSelectSearchField) { - textMargins: margins(2px, 7px, 2px, 0px); - } - search: IconButton(defaultIconButton) { - width: 33px; - height: 33px; - icon: icon{{ "emoji/emoji_search_input", emojiIconFg }}; - iconOver: icon{{ "emoji/emoji_search_input", emojiIconFg }}; - iconPosition: point(7px, -1px); - ripple: emptyRippleAnimation; - } - back: IconButton(defaultIconButton) { - width: 33px; - height: 33px; - icon: icon{{ "emoji/emoji_back", menuIconFg }}; - iconOver: icon{{ "emoji/emoji_back", menuIconFg }}; - iconPosition: point(7px, -1px); - ripple: emptyRippleAnimation; - } - cancel: CrossButton { - width: 33px; - height: 33px; - - cross: CrossAnimation { - size: 27px; - skip: 8px; - stroke: 1.; - minScale: 0.3; - } - crossFg: menuIconFg; - crossFgOver: menuIconFg; - crossPosition: point(1px, 3px); - - duration: 150; - loadingPeriod: 1000; - ripple: emptyRippleAnimation; - } + field: defaultTabbedSearchField; + search: defaultTabbedSearchButton; + back: defaultTabbedSearchBack; + cancel: defaultTabbedSearchCancel; defaultFieldWidth: 103px; groupWidth: 30px; groupSkip: 2px; @@ -261,10 +313,15 @@ defaultEmojiPan: EmojiPan { iconArea: 28px; bg: emojiPanBg; overBg: emojiPanHover; + expandBg: emojiPanHeaderFg; + pathBg: windowBgRipple; + pathFg: windowBgOver; + textFg: windowFg; categoriesBg: emojiPanCategories; categoriesBgOver: windowBgRipple; fadeLeft: icon {{ "fade_horizontal-flip_horizontal", emojiPanCategories }}; fadeRight: icon {{ "fade_horizontal", emojiPanCategories }}; + tabs: emojiTabs; search: defaultTabbedSearch; searchMargin: margins(1px, 11px, 2px, 5px); } @@ -428,3 +485,377 @@ emojiSuggestionsFadeRight: icon {{ "fade_horizontal", boxBg }}; choosePeerGroupIcon: icon {{ "info/edit/create_group", lightButtonFg }}; choosePeerChannelIcon: icon {{ "info/edit/create_channel", lightButtonFg }}; choosePeerCreateIconLeft: 25px; + +historyRequestsUserpics: GroupCallUserpics { + size: 22px; + shift: 8px; + stroke: 4px; + align: align(left); +} +historyRequestsHeight: 33px; + +historySlowmodeCounterMargins: margins(0px, 0px, 10px, 0px); + +historyComposeAreaPalette: TextPalette(defaultTextPalette) { + linkFg: historyComposeAreaFgService; +} + +defaultMessageBar: MessageBar { + title: semiboldTextStyle; + titleFg: windowActiveTextFg; + text: defaultTextStyle; + textFg: historyComposeAreaFg; + textPalette: historyComposeAreaPalette; + duration: 160; +} + +historyComposeButton: FlatButton { + color: windowActiveTextFg; + overColor: windowActiveTextFg; + + bgColor: historyComposeButtonBg; + overBgColor: historyComposeButtonBgOver; + + width: -32px; + height: 46px; + + textTop: 14px; + + font: semiboldFont; + overFont: semiboldFont; + + ripple: RippleAnimation(defaultRippleAnimation) { + color: historyComposeButtonBgRipple; + } +} +historyUnblock: FlatButton(historyComposeButton) { + color: attentionButtonFg; + overColor: attentionButtonFgOver; +} +historyContactStatusButton: FlatButton(historyComposeButton) { + height: 49px; + textTop: 16px; + overBgColor: historyComposeButtonBg; + ripple: RippleAnimation(defaultRippleAnimation) { + color: historyComposeButtonBgOver; + } +} +historyContactStatusBlock: FlatButton(historyContactStatusButton) { + color: attentionButtonFg; + overColor: attentionButtonFg; +} +historyContactStatusLabel: FlatLabel(defaultFlatLabel) { + minWidth: 240px; +} +historyEmojiStatusInfoLabel: FlatLabel(historyContactStatusLabel) { + align: align(top); + textFg: windowSubTextFg; +} +historyContactStatusMinSkip: 16px; + +historyReplySkip: 51px; +historyReplyNameFg: windowActiveTextFg; +historyReplyHeight: 49px; +historyReplyIconPosition: point(5px, 5px); +historyReplyIcon: icon {{ "chat/input_reply", historyReplyIconFg }}; +historyForwardIcon: icon {{ "chat/input_forward", historyReplyIconFg }}; +historyEditIcon: icon {{ "chat/input_edit", historyReplyIconFg }}; +historyReplyCancel: IconButton { + width: 49px; + height: 49px; + + icon: historyReplyCancelIcon; + iconOver: historyReplyCancelIconOver; + iconPosition: point(-1px, -1px); + + rippleAreaPosition: point(4px, 4px); + rippleAreaSize: 40px; + ripple: RippleAnimation(defaultRippleAnimation) { + color: windowBgOver; + } +} +historyPinnedShowAll: IconButton(historyReplyCancel) { + icon: icon {{ "pinned_show_all", historyReplyCancelFg }}; + iconOver: icon {{ "pinned_show_all", historyReplyCancelFgOver }}; +} +historyPinnedBotButton: RoundButton(defaultActiveButton) { + width: -34px; + height: 30px; + textTop: 6px; + padding: margins(2px, 10px, 10px, 9px); +} +historyPinnedBotButtonMaxWidth: 150px; + +historyToDownPosition: point(12px, 10px); +historyToDownAbove: icon {{ "history_down_arrow", historyToDownFg }}; +historyToDownAboveOver: icon {{ "history_down_arrow", historyToDownFgOver }}; +historyToDownPaddingTop: 10px; +historyToDownBelow: icon { + { "history_down_shadow", historyToDownShadow }, + { "history_down_circle", historyToDownBg }, +}; +historyToDownBelowOver: icon { + { "history_down_shadow", historyToDownShadow }, + { "history_down_circle", historyToDownBgOver }, +}; +historyToDown: TwoIconButton { + width: 52px; + height: 62px; + + iconBelow: historyToDownBelow; + iconBelowOver: historyToDownBelowOver; + iconAbove: historyToDownAbove; + iconAboveOver: historyToDownAboveOver; + iconPosition: point(0px, historyToDownPaddingTop); + + rippleAreaPosition: point(5px, 15px); + rippleAreaSize: 42px; + ripple: RippleAnimation(defaultRippleAnimation) { + color: historyToDownBgRipple; + } +} +historyToDownBadgeFont: semiboldFont; +historyToDownBadgeSize: 22px; + +historyToDownShownAfter: 480px; +historyToDownDuration: 150; + +dialogsToUpAbove: icon {{ "history_down_arrow-flip_vertical", historyToDownFg, point(0px, 1px) }}; +dialogsToUpAboveOver: icon {{ "history_down_arrow-flip_vertical", historyToDownFgOver, point(0px, 1px) }}; + +dialogsToUp: TwoIconButton(historyToDown) { + iconAbove: dialogsToUpAbove; + iconAboveOver: dialogsToUpAboveOver; +} + +historyUnreadMentions: TwoIconButton(historyToDown) { + iconAbove: icon {{ "history_unread_mention", historyToDownFg }}; + iconAboveOver: icon {{ "history_unread_mention", historyToDownFgOver }}; +} +historyUnreadReactions: TwoIconButton(historyToDown) { + iconAbove: icon {{ "history_unread_reaction", historyToDownFg }}; + iconAboveOver: icon {{ "history_unread_reaction", historyToDownFgOver }}; +} +historyUnreadThingsSkip: 4px; + +historyComposeField: InputField(defaultInputField) { + font: normalFont; + textMargins: margins(0px, 0px, 0px, 0px); + textAlign: align(left); + textFg: historyComposeAreaFg; + textBg: historyComposeAreaBg; + heightMin: 36px; + heightMax: 72px; + placeholderFg: placeholderFg; + placeholderFgActive: placeholderFgActive; + placeholderFgError: placeholderFgActive; + placeholderMargins: margins(7px, 5px, 7px, 5px); + placeholderAlign: align(topleft); + placeholderScale: 0.; + placeholderFont: normalFont; + placeholderShift: -50px; + border: 0px; + borderActive: 0px; + duration: 100; +} +historyComposeFieldMaxHeight: 224px; +// historyMinHeight: 56px; + +historyAttach: IconButton(defaultIconButton) { + width: 44px; + height: 46px; + + icon: icon {{ "chat/input_attach", historyComposeIconFg }}; + iconOver: icon {{ "chat/input_attach", historyComposeIconFgOver }}; + + rippleAreaPosition: point(2px, 3px); + rippleAreaSize: 40px; + ripple: RippleAnimation(defaultRippleAnimation) { + color: windowBgOver; + } +} + +historyMessagesTTL: IconButtonWithText { + iconButton: IconButton(historyAttach) { + icon: icon {{ "chat/input_autodelete", historyComposeIconFg }}; + iconOver: icon {{ "chat/input_autodelete", historyComposeIconFgOver }}; + } + textFg: historyComposeIconFg; + textFgOver: historyComposeIconFgOver; + textPadding: margins(21px, 20px, 3px, 7px); + textAlign: align(left); + + font: font(10px semibold); +} +historyReplaceMedia: IconButton(historyAttach) { + icon: icon {{ "chat/input_replace", windowBgActive }}; + iconOver: icon {{ "chat/input_replace", windowBgActive }}; + ripple: RippleAnimation(defaultRippleAnimation) { + color: lightButtonBgOver; + } +} + +historyAttachEmojiActive: icon {{ "chat/input_smile_face", windowBgActive }}; +historyEmojiCircle: size(20px, 20px); +historyEmojiCircleLine: 1.5; +historyEmojiCircleFg: historyComposeIconFg; +historyEmojiCircleFgOver: historyComposeIconFgOver; +historyBotKeyboardShow: IconButton(historyAttach) { + icon: icon {{ "chat/input_bot_keyboard", historyComposeIconFg }}; + iconOver: icon {{ "chat/input_bot_keyboard", historyComposeIconFgOver }}; +} +historyBotKeyboardHide: IconButton(historyAttach) { + icon: icon {{ "chat/input_bot_keyboard_hide", historyComposeIconFg }}; + iconOver: icon {{ "chat/input_bot_keyboard_hide", historyComposeIconFgOver }}; +} +historyBotCommandStart: IconButton(historyAttach) { + icon: icon {{ "chat/input_bot_command", historyComposeIconFg }}; + iconOver: icon {{ "chat/input_bot_command", historyComposeIconFgOver }}; +} +historyScheduledToggle: IconButton(historyAttach) { + icon: icon { + { "chat/input_scheduled", historyComposeIconFg }, + { "chat/input_scheduled_dot", attentionButtonFg } + }; + iconOver: icon { + { "chat/input_scheduled", historyComposeIconFgOver }, + { "chat/input_scheduled_dot", attentionButtonFg } + }; +} + +historyAttachEmojiInner: IconButton(historyAttach) { + icon: icon {{ "chat/input_smile_face", historyComposeIconFg }}; + iconOver: icon {{ "chat/input_smile_face", historyComposeIconFgOver }}; +} +historyAttachEmoji: EmojiButton { + inner: historyAttachEmojiInner; + bg: historyComposeAreaBg; + lineFg: historyEmojiCircleFg; + lineFgOver: historyEmojiCircleFgOver; +} +boxAttachEmoji: EmojiButton(historyAttachEmoji) { + inner: IconButton(historyAttachEmojiInner) { + width: 30px; + height: 30px; + rippleAreaSize: 0px; + } +} +boxAttachEmojiTop: 20px; + +historySendIcon: icon {{ "chat/input_send", historySendIconFg }}; +historySendIconOver: icon {{ "chat/input_send", historySendIconFgOver }}; +historySendIconPosition: point(10px, 11px); +historySendSize: size(44px, 46px); +historyScheduleIcon: icon {{ "chat/input_schedule", historyComposeAreaBg }}; +historyScheduleIconPosition: point(7px, 8px); +historyEditSaveIcon: icon {{ "chat/input_save", historySendIconFg }}; +historyEditSaveIconOver: icon {{ "chat/input_save", historySendIconFgOver }}; + +historyEditMediaBg: videoPlayIconBg; +historyEditMedia: icon{{ "chat/input_draw", videoPlayIconFg }}; +historyMessagesTTLPickerHeight: 200px; +historyMessagesTTLPickerItemHeight: 40px; +historyMessagesTTLLabel: FlatLabel(defaultFlatLabel) { + minWidth: 200px; + align: align(topleft); + textFg: windowSubTextFg; +} + +historyRecordVoiceFg: historyComposeIconFg; +historyRecordVoiceFgOver: historyComposeIconFgOver; +historyRecordVoiceFgInactive: attentionButtonFg; +historyRecordVoiceFgActive: windowBgActive; +historyRecordVoiceFgActiveIcon: windowFgActive; +historyRecordVoiceShowDuration: 120; +historyRecordVoiceDuration: 120; +historyRecordVoice: icon {{ "chat/input_record", historyRecordVoiceFg }}; +historyRecordVoiceOver: icon {{ "chat/input_record", historyRecordVoiceFgOver }}; +historyRecordVoiceActive: icon {{ "chat/input_record_filled", historyRecordVoiceFgActiveIcon }}; +historyRecordSendIconPosition: point(2px, 0px); +historyRecordVoiceRippleBgActive: lightButtonBgOver; +historyRecordSignalRadius: 5px; +historyRecordCancel: windowSubTextFg; +historyRecordCancelActive: windowActiveTextFg; +historyRecordFont: font(13px); +historyRecordDurationSkip: 12px; +historyRecordDurationFg: historyComposeAreaFg; + +historyRecordMainBlobMinRadius: 23px; +historyRecordMainBlobMaxRadius: 37px; +historyRecordMinorBlobMinRadius: 40px; +historyRecordMinorBlobMaxRadius: 47px; +historyRecordMajorBlobMinRadius: 43px; +historyRecordMajorBlobMaxRadius: 50px; + +historyRecordTextStyle: TextStyle(defaultTextStyle) { + font: historyRecordFont; +} + +historyRecordTextWidthForWrap: 210px; +historyRecordTextLeft: 15px; +historyRecordTextRight: 25px; + +historyRecordLockShowDuration: historyToDownDuration; +historyRecordLockSize: size(75px, 133px); + +historyRecordLockIconFg: historyToDownFg; +historyRecordLockIconSize: size(14px, 17px); +historyRecordLockIconBottomHeight: 9px; +historyRecordLockIconLineHeight: 2px; +historyRecordLockIconLineSkip: 3px; +historyRecordLockIconLineWidth: 2px; +historyRecordLockIconArcHeight: 4px; +historyRecordStopIconWidth: 12px; + +historyRecordLockTopShadow: icon {{ "voice_lock/record_lock_top_shadow", historyToDownShadow }}; +historyRecordLockTop: icon {{ "voice_lock/record_lock_top", historyToDownBg }}; +historyRecordLockBottomShadow: icon {{ "voice_lock/record_lock_bottom_shadow", historyToDownShadow }}; +historyRecordLockBottom: icon {{ "voice_lock/record_lock_bottom", historyToDownBg }}; +historyRecordLockBodyShadow: icon {{ "voice_lock/record_lock_body_shadow", historyToDownShadow }}; +historyRecordLockBody: icon {{ "voice_lock/record_lock_body", historyToDownBg }}; +historyRecordLockMargin: margins(4px, 4px, 4px, 4px); +historyRecordLockArrow: icon {{ "voice_lock/voice_arrow", historyToDownFg }}; +historyRecordLockRippleMargin: margins(6px, 6px, 6px, 6px); + +historyRecordDelete: IconButton(historyAttach) { + icon: icon {{ "info/info_media_delete", historyComposeIconFg }}; + iconOver: icon {{ "info/info_media_delete", historyComposeIconFgOver }}; + iconPosition: point(10px, 11px); +} +historyRecordWaveformRightSkip: 10px; +historyRecordWaveformBgMargins: margins(5px, 7px, 5px, 7px); + +historyRecordWaveformBar: 3px; + +historyRecordLockPosition: point(1px, 35px); + +historyRecordCancelButtonWidth: 100px; +historyRecordCancelButtonFg: lightButtonFg; + +historySilentToggle: IconButton(historyBotKeyboardShow) { + icon: icon {{ "chat/input_silent", historyComposeIconFg }}; + iconOver: icon {{ "chat/input_silent", historyComposeIconFgOver }}; +} +historySilentToggleOn: icon {{ "chat/input_silent_on", historyComposeIconFg }}; +historySilentToggleOnOver: icon {{ "chat/input_silent_on", historyComposeIconFgOver }}; + +historySend: SendButton { + inner: IconButton(historyAttach) { + icon: historySendIcon; + iconOver: historySendIconOver; + } + record: historyRecordVoice; + recordOver: historyRecordVoiceOver; + sendDisabledFg: historyComposeIconFg; +} + +defaultComposeControls: ComposeControls { + bg: historyComposeAreaBg; + radius: 0px; + + field: historyComposeField; + send: historySend; + attach: historyAttach; + emoji: historyAttachEmoji; + tabbed: defaultEmojiPan; +} diff --git a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp index 19dd9c827..a6ff9af75 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp @@ -56,7 +56,7 @@ using Core::RecentEmojiDocument; class EmojiColorPicker final : public Ui::RpWidget { public: - EmojiColorPicker(QWidget *parent); + EmojiColorPicker(QWidget *parent, const style::EmojiPan &st); void showEmoji(EmojiPtr emoji); @@ -87,6 +87,8 @@ private: void updateSelected(); void setSelected(int newSelected); + const style::EmojiPan &_st; + bool _ignoreShow = false; QVector _variants; @@ -118,9 +120,12 @@ struct EmojiListWidget::RecentOne { RecentEmojiId id; }; -EmojiColorPicker::EmojiColorPicker(QWidget *parent) +EmojiColorPicker::EmojiColorPicker( + QWidget *parent, + const style::EmojiPan &st) : RpWidget(parent) -, _overBg(st::emojiPanRadius, st::emojiPanHover) { +, _st(st) +, _overBg(st::emojiPanRadius, _st.overBg) { setMouseTracking(true); } @@ -398,7 +403,7 @@ EmojiListWidget::EmojiListWidget( , _customRecentFactory(std::move(descriptor.customRecentFactory)) , _overBg(st::emojiPanRadius, st().overBg) , _collapsedBg(st::emojiPanExpand.height / 2, st::emojiPanHeaderFg) -, _picker(this) +, _picker(this, st()) , _showPickerTimer([=] { showPicker(); }) { setMouseTracking(true); if (st().bg->c.alpha() > 0) { @@ -1006,7 +1011,7 @@ void EmojiListWidget::validateEmojiPaintContext( st::stickerPanPremium1, st::stickerPanPremium2, 0.5) - : st::windowFg->c), + : st().textFg->c), .size = QSize(_customSingleSize, _customSingleSize), .now = crl::now(), .scale = context.progress, @@ -1178,7 +1183,7 @@ void EmojiListWidget::drawCollapsedBadge( const auto buttonx = position.x() + (_singleSize.width() - buttonw) / 2; const auto buttony = position.y() + (_singleSize.height() - buttonh) / 2; _collapsedBg.paint(p, QRect(buttonx, buttony, buttonw, buttonh)); - p.setPen(st::emojiPanBg); + p.setPen(this->st().bg); p.setFont(st.font); p.drawText( buttonx + (buttonw - textWidth) / 2, diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index 8b24df18a..b78615721 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -69,6 +69,7 @@ public: Inner( std::shared_ptr show, + const style::EmojiPan &st, not_null parent, not_null mrows, not_null hrows, @@ -126,11 +127,13 @@ private: const std::shared_ptr _show; const not_null _session; + const style::EmojiPan &_st; const not_null _parent; const not_null _mrows; const not_null _hrows; const not_null _brows; const not_null _srows; + Ui::RoundRect _overBg; rpl::lifetime _stickersLifetime; std::weak_ptr _lottieRenderer; base::unique_qptr _menu; @@ -192,10 +195,12 @@ FieldAutocomplete::FieldAutocomplete( FieldAutocomplete::FieldAutocomplete( QWidget *parent, - std::shared_ptr show) + std::shared_ptr show, + const style::EmojiPan *stOverride) : RpWidget(parent) , _show(std::move(show)) , _session(&_show->session()) +, _st(stOverride ? *stOverride : st::defaultEmojiPan) , _scroll(this) { hide(); @@ -204,6 +209,7 @@ FieldAutocomplete::FieldAutocomplete( _inner = _scroll->setOwnedWidget( object_ptr( _show, + _st, this, &_mrows, &_hrows, @@ -285,7 +291,7 @@ void FieldAutocomplete::paintEvent(QPaintEvent *e) { return; } - p.fillRect(rect(), st::mentionBg); + p.fillRect(rect(), _st.bg); } void FieldAutocomplete::showFiltered( @@ -817,6 +823,7 @@ bool FieldAutocomplete::eventFilter(QObject *obj, QEvent *e) { FieldAutocomplete::Inner::Inner( std::shared_ptr show, + const style::EmojiPan &st, not_null parent, not_null mrows, not_null hrows, @@ -824,14 +831,16 @@ FieldAutocomplete::Inner::Inner( not_null srows) : _show(std::move(show)) , _session(&_show->session()) +, _st(st) , _parent(parent) , _mrows(mrows) , _hrows(hrows) , _brows(brows) , _srows(srows) +, _overBg(st::roundRadiusSmall, _st.overBg) , _pathGradient(std::make_unique( - st::windowBgRipple, - st::windowBgOver, + _st.pathBg, + _st.pathFg, [=] { update(); })) , _premiumMark(_session) , _previewTimer([=] { showPreview(); }) { @@ -900,7 +909,7 @@ void FieldAutocomplete::Inner::paintEvent(QPaintEvent *e) { if (_sel == index) { QPoint tl(pos); if (rtl()) tl.setX(width() - tl.x() - st::stickerPanSize.width()); - Ui::FillRoundRect(p, QRect(tl, st::stickerPanSize), st::emojiPanHover, Ui::StickerHoverCorners); + _overBg.paint(p, QRect(tl, st::stickerPanSize)); } media->checkStickerSmall(); diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.h b/Telegram/SourceFiles/chat_helpers/field_autocomplete.h index 1bb75f122..2606dc1f2 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.h +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.h @@ -14,6 +14,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/timer.h" #include "base/object_ptr.h" +namespace style { +struct EmojiPan; +} // namespace style + namespace Ui { class PopupMenu; class ScrollArea; @@ -53,7 +57,8 @@ public: not_null controller); FieldAutocomplete( QWidget *parent, - std::shared_ptr show); + std::shared_ptr show, + const style::EmojiPan *stOverride = nullptr); ~FieldAutocomplete(); [[nodiscard]] std::shared_ptr uiShow() const; @@ -153,6 +158,7 @@ private: const std::shared_ptr _show; const not_null _session; + const style::EmojiPan &_st; QPixmap _cache; MentionRows _mrows; HashtagRows _hrows; diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp index d8ba04cf5..9ff10845d 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp @@ -98,7 +98,7 @@ GifsListWidget::GifsListWidget( GifsListDescriptor &&descriptor) : Inner( parent, - st::defaultEmojiPan, + descriptor.st ? *descriptor.st : st::defaultEmojiPan, descriptor.show, descriptor.paused) , _show(std::move(descriptor.show)) @@ -332,7 +332,7 @@ void GifsListWidget::inlineResultsDone(const MTPmessages_BotResults &result) { void GifsListWidget::paintEvent(QPaintEvent *e) { Painter p(this); auto clip = e->rect(); - p.fillRect(clip, st::emojiPanBg); + p.fillRect(clip, st().bg); paintInlineItems(p, clip); } diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 36696ccab..03430e3ab 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -36,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_layers.h" #include "styles/style_boxes.h" #include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" #include "base/qt/qt_common_adapters.h" #include diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_footer.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_footer.cpp index a846b5362..a9aa598d6 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_footer.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_footer.cpp @@ -1351,7 +1351,7 @@ void StickersListFooter::paintSetIconToCache( const auto y = (st().footer - icon.pixh) / 2; if (icon.custom) { icon.custom->paint(p, Ui::Text::CustomEmoji::Context{ - .textColor = st::windowFg->c, + .textColor = st().textFg->c, .size = QSize(icon.pixw, icon.pixh), .now = now, .scale = context.progress, diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 349980b6c..40aae70eb 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -179,15 +179,17 @@ StickersListWidget::StickersListWidget( StickersListDescriptor &&descriptor) : Inner( parent, - st::defaultEmojiPan, + descriptor.st ? *descriptor.st : st::defaultEmojiPan, descriptor.show, descriptor.paused) , _mode(descriptor.mode) , _show(std::move(descriptor.show)) +, _overBg(st::roundRadiusSmall, st().overBg) , _api(&session().mtp()) , _localSetsManager(std::make_unique(&session())) , _section(Section::Stickers) , _isMasks(_mode == Mode::Masks) +, _settingsHidden(descriptor.settingsHidden) , _updateItemsTimer([=] { updateItems(); }) , _updateSetsTimer([=] { updateSets(); }) , _trendingAddBgOver( @@ -201,8 +203,8 @@ StickersListWidget::StickersListWidget( ImageRoundRadius::Small, st::stickerGroupCategoryAdd.textBg) , _pathGradient(std::make_unique( - st::windowBgRipple, - st::windowBgOver, + st().pathBg, + st().pathFg, [=] { update(); })) , _megagroupSetAbout(st::columnMinimalWidthThird - st::emojiScroll.width - st().headerLeft) , _addText(tr::lng_stickers_featured_add(tr::now).toUpper()) @@ -284,7 +286,8 @@ object_ptr StickersListWidget::createFooter() { .session = &session(), .paused = footerPaused, .parent = this, - .settingsButtonVisible = true, + .settingsButtonVisible = !_settingsHidden, + .st = &st(), }); _footer = result; @@ -844,7 +847,7 @@ QRect StickersListWidget::stickerRect(int section, int sel) { void StickersListWidget::paintEvent(QPaintEvent *e) { Painter p(this); auto clip = e->rect(); - p.fillRect(clip, st::emojiPanBg); + p.fillRect(clip, st().bg); paintStickers(p, clip); } @@ -1342,7 +1345,7 @@ void StickersListWidget::paintSticker( if (selected) { auto tl = pos; if (rtl()) tl.setX(width() - tl.x() - _singleSize.width()); - Ui::FillRoundRect(p, QRect(tl, _singleSize), st::emojiPanHover, Ui::StickerHoverCorners); + _overBg.paint(p, QRect(tl, _singleSize)); } media->checkStickerSmall(); diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h index afde28b81..dc4e7dc44 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h @@ -70,6 +70,7 @@ struct StickersListDescriptor { StickersListMode mode = StickersListMode::Full; Fn paused; const style::EmojiPan *st = nullptr; + bool settingsHidden = false; }; class StickersListWidget final : public TabbedSelector::Inner { @@ -351,6 +352,7 @@ private: const Mode _mode; const std::shared_ptr _show; + Ui::RoundRect _overBg; std::unique_ptr _search; MTP::Sender _api; std::unique_ptr _localSetsManager; @@ -373,6 +375,7 @@ private: Section _section = Section::Stickers; const bool _isMasks; + bool _settingsHidden = false; base::Timer _updateItemsTimer; base::Timer _updateSetsTimer; diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp index 463b35f16..5131c9f9b 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp @@ -50,7 +50,7 @@ public: void setFinalImages(Direction direction, QImage &&left, QImage &&right, QRect inner, bool wasSectionIcons); void start(); - void paintFrame(QPainter &p, float64 dt, float64 opacity); + void paintFrame(QPainter &p, const style::EmojiPan &st, float64 dt, float64 opacity); private: Direction _direction = Direction::LeftToRight; @@ -131,7 +131,11 @@ void TabbedSelector::SlideAnimation::start() { _frameIntsPerLineAdd = (_width - _innerWidth) + _frameIntsPerLineAdded; } -void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64 opacity) { +void TabbedSelector::SlideAnimation::paintFrame( + QPainter &p, + const style::EmojiPan &st, + float64 dt, + float64 opacity) { Expects(started()); Expects(dt >= 0.); @@ -168,8 +172,8 @@ void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64 { auto p = QPainter(&_frame); p.setOpacity(opacity); - p.fillRect(_painterInnerLeft, _painterInnerTop, _painterInnerWidth, _painterCategoriesTop - _painterInnerTop, st::emojiPanBg); - p.fillRect(_painterInnerLeft, _painterCategoriesTop, _painterInnerWidth, _painterInnerBottom - _painterCategoriesTop, _wasSectionIcons ? st::emojiPanCategories : st::emojiPanBg); + p.fillRect(_painterInnerLeft, _painterInnerTop, _painterInnerWidth, _painterCategoriesTop - _painterInnerTop, st.bg); + p.fillRect(_painterInnerLeft, _painterCategoriesTop, _painterInnerWidth, _painterInnerBottom - _painterCategoriesTop, _wasSectionIcons ? st.categoriesBg : st.bg); p.setCompositionMode(QPainter::CompositionMode_SourceOver); if (leftTo > _innerLeft) { p.setOpacity(opacity * leftAlpha); @@ -325,11 +329,24 @@ TabbedSelector::TabbedSelector( std::shared_ptr show, PauseReason level, Mode mode) +: TabbedSelector(parent, { + .show = std::move(show), + .st = (mode == Mode::EmojiStatus + ? st::statusEmojiPan + : st::defaultEmojiPan), + .level = level, + .mode = mode, +}) { +} + +TabbedSelector::TabbedSelector( + QWidget *parent, + TabbedSelectorDescriptor &&descriptor) : RpWidget(parent) -, _st((mode == Mode::EmojiStatus) ? st::statusEmojiPan : st::defaultEmojiPan) -, _show(std::move(show)) -, _level(level) -, _mode(mode) +, _st(descriptor.st) +, _show(std::move(descriptor.show)) +, _level(descriptor.level) +, _mode(descriptor.mode) , _panelRounding(Ui::PrepareCornerPixmaps(st::emojiPanRadius, _st.bg)) , _categoriesRounding( Ui::PrepareCornerPixmaps(st::emojiPanRadius, _st.categoriesBg)) @@ -360,6 +377,7 @@ TabbedSelector::TabbedSelector( : SelectorTab::Emoji) , _hasEmojiTab(ranges::contains(_tabs, SelectorTab::Emoji, &Tab::type)) , _hasStickersTab(ranges::contains(_tabs, SelectorTab::Stickers, &Tab::type)) +, _stickersSettingsHidden(descriptor.stickersSettingsHidden) , _hasGifsTab(ranges::contains(_tabs, SelectorTab::Gifs, &Tab::type)) , _hasMasksTab(ranges::contains(_tabs, SelectorTab::Masks, &Tab::type)) , _tabbed(_tabs.size() > 1) { @@ -445,10 +463,10 @@ TabbedSelector::TabbedSelector( ) | rpl::start_with_next([=] { _panelRounding = Ui::PrepareCornerPixmaps( st::emojiPanRadius, - st::emojiPanBg); + _st.bg); _categoriesRounding = Ui::PrepareCornerPixmaps( st::emojiPanRadius, - st::emojiPanCategories); + _st.categoriesBg); }, lifetime()); if (hasEmojiTab()) { @@ -503,6 +521,7 @@ TabbedSelector::Tab TabbedSelector::createTab(SelectorTab type, int index) { .mode = StickersMode::Full, .paused = paused, .st = &_st, + .settingsHidden = _stickersSettingsHidden, }); } case SelectorTab::Gifs: { @@ -704,10 +723,10 @@ void TabbedSelector::paintSlideFrame(QPainter &p) { if (_roundRadius > 0) { paintBgRoundedPart(p); } else if (_tabsSlider) { - p.fillRect(0, 0, width(), _tabsSlider->height(), st::emojiPanBg); + p.fillRect(0, 0, width(), _tabsSlider->height(), _st.bg); } auto slideDt = _a_slide.value(1.); - _slideAnimation->paintFrame(p, slideDt, 1.); + _slideAnimation->paintFrame(p, _st, slideDt, 1.); } void TabbedSelector::paintBgRoundedPart(QPainter &p) { @@ -716,7 +735,7 @@ void TabbedSelector::paintBgRoundedPart(QPainter &p) { : _tabsSlider ? QRect(0, 0, width(), _tabsSlider->height()) : QRect(0, 0, width(), _roundRadius); - Ui::FillRoundRect(p, fill, st::emojiPanBg, { + Ui::FillRoundRect(p, fill, _st.bg, { .p = { _dropDown ? QPixmap() : _panelRounding.p[0], _dropDown ? QPixmap() : _panelRounding.p[1], @@ -765,10 +784,10 @@ void TabbedSelector::paintContent(QPainter &p) { sidesTop, st::emojiScroll.width, sidesHeight), - st::emojiPanBg); + _st.bg); p.fillRect( myrtlrect(0, sidesTop, st::emojiPanRadius, sidesHeight), - st::emojiPanBg); + _st.bg); } } @@ -1030,7 +1049,7 @@ void TabbedSelector::setAllowEmojiWithoutPremium(bool allow) { } void TabbedSelector::createTabsSlider() { - _tabsSlider.create(this, st::emojiTabs); + _tabsSlider.create(this, _st.tabs); fillTabsSliderSections(); @@ -1324,7 +1343,7 @@ void TabbedSelector::Inner::paintEmptySearchResults( iconTop + icon.height() - st::normalFont->height, height() - 2 * st::normalFont->height); p.setFont(st::normalFont); - p.setPen(st::windowSubTextFg); + p.setPen(_st.tabs.labelFg); p.drawTextLeft( (width() - textWidth) / 2, textTop, diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h index f7f65811a..bcaa4fdee 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h @@ -75,6 +75,21 @@ struct EmojiChosen { using InlineChosen = InlineBots::ResultSelected; +enum class TabbedSelectorMode { + Full, + EmojiOnly, + MediaEditor, + EmojiStatus, +}; + +struct TabbedSelectorDescriptor { + std::shared_ptr show; + const style::EmojiPan &st; + PauseReason level = {}; + TabbedSelectorMode mode = TabbedSelectorMode::Full; + bool stickersSettingsHidden = false; +}; + [[nodiscard]] std::unique_ptr MakeSearch( not_null parent, const style::EmojiPan &st, @@ -86,12 +101,7 @@ using InlineChosen = InlineBots::ResultSelected; class TabbedSelector : public Ui::RpWidget { public: static constexpr auto kPickCustomTimeId = -1; - enum class Mode { - Full, - EmojiOnly, - MediaEditor, - EmojiStatus, - }; + using Mode = TabbedSelectorMode; enum class Action { Update, Cancel, @@ -102,6 +112,9 @@ public: std::shared_ptr show, PauseReason level, Mode mode = Mode::Full); + TabbedSelector( + QWidget *parent, + TabbedSelectorDescriptor &&descriptor); ~TabbedSelector(); [[nodiscard]] Main::Session &session() const; @@ -278,6 +291,7 @@ private: const bool _hasEmojiTab; const bool _hasStickersTab; + const bool _stickersSettingsHidden; const bool _hasGifsTab; const bool _hasMasksTab; const bool _tabbed; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 86e37617c..87da53703 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -229,7 +229,7 @@ HistoryWidget::HistoryWidget( , _supportAutocomplete(session().supportMode() ? object_ptr(this, &session()) : nullptr) -, _send(std::make_shared(this)) +, _send(std::make_shared(this, st::historySend)) , _unblock(this, tr::lng_unblock_button(tr::now).toUpper(), st::historyUnblock) , _botStart(this, tr::lng_bot_start(tr::now).toUpper(), st::historyComposeButton) , _joinChannel( diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index a4edc44cd..a3fd8b3c8 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -58,7 +58,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/session/send_as_peers.h" #include "media/audio/media_audio_capture.h" #include "media/audio/media_audio.h" -#include "styles/style_chat.h" #include "ui/text/text_options.h" #include "ui/ui_utility.h" #include "ui/widgets/input_fields.h" @@ -72,6 +71,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_adaptive.h" #include "window/window_session_controller.h" #include "mainwindow.h" +#include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" namespace HistoryView { namespace { @@ -938,7 +939,11 @@ ComposeControls::ComposeControls( ComposeControls::ComposeControls( not_null parent, ComposeControlsDescriptor descriptor) -: _parent(parent) +: _st(descriptor.stOverride + ? *descriptor.stOverride + : st::defaultComposeControls) +, _features(descriptor.features) +, _parent(parent) , _show(std::move(descriptor.show)) , _session(&_show->session()) , _regularWindow(descriptor.regularWindow) @@ -946,30 +951,37 @@ ComposeControls::ComposeControls( ? nullptr : std::make_unique( _parent, - _show, - Window::GifPauseReason::TabbedPanel)) + ChatHelpers::TabbedSelectorDescriptor{ + .show = _show, + .st = _st.tabbed, + .level = Window::GifPauseReason::TabbedPanel, + .mode = ChatHelpers::TabbedSelector::Mode::Full, + .stickersSettingsHidden = !_features.stickersSettings, + })) , _selector(_regularWindow ? _regularWindow->tabbedSelector() : not_null(_ownedSelector.get())) , _mode(descriptor.mode) , _wrap(std::make_unique(parent)) , _writeRestricted(std::make_unique(parent)) -, _send(std::make_shared(_wrap.get())) +, _send(std::make_shared(_wrap.get(), _st.send)) , _attachToggle(Ui::CreateChild( _wrap.get(), - st::historyAttach)) + _st.attach)) , _tabbedSelectorToggle(Ui::CreateChild( _wrap.get(), - st::historyAttachEmoji)) + _st.emoji)) , _field( Ui::CreateChild( _wrap.get(), - st::historyComposeField, + _st.field, Ui::InputField::Mode::MultiLine, tr::lng_message_ph())) -, _botCommandStart(Ui::CreateChild( - _wrap.get(), - st::historyBotCommandStart)) +, _botCommandStart(_features.botCommandSend + ? Ui::CreateChild( + _wrap.get(), + st::historyBotCommandStart) + : nullptr) , _autocomplete(std::make_unique(parent, _show)) , _header(std::make_unique(_wrap.get(), _show)) , _voiceRecordBar(std::make_unique( @@ -982,6 +994,9 @@ ComposeControls::ComposeControls( , _unavailableEmojiPasted(std::move(descriptor.unavailableEmojiPasted)) , _saveDraftTimer([=] { saveDraft(); }) , _saveCloudDraftTimer([=] { saveCloudDraft(); }) { + if (_st.radius > 0) { + _backgroundRect.emplace(_st.radius, _st.bg); + } if (descriptor.stickerOrEmojiChosen) { std::move( descriptor.stickerOrEmojiChosen @@ -1421,7 +1436,9 @@ void ComposeControls::init() { updateWrappingVisibility(); }, _wrap->lifetime()); - _botCommandStart->setClickedCallback([=] { setText({ "/" }); }); + if (_botCommandStart) { + _botCommandStart->setClickedCallback([=] { setText({ "/" }); }); + } _wrap->sizeValue( ) | rpl::start_with_next([=](QSize size) { @@ -2382,9 +2399,11 @@ void ComposeControls::updateControlsGeometry(QSize size) { right += _send->width(); _tabbedSelectorToggle->moveToRight(right, buttonsTop); right += _tabbedSelectorToggle->width(); - _botCommandStart->moveToRight(right, buttonsTop); - if (_botCommandShown) { - right += _botCommandStart->width(); + if (_botCommandStart) { + _botCommandStart->moveToRight(right, buttonsTop); + if (_botCommandShown) { + right += _botCommandStart->width(); + } } if (_silent) { _silent->moveToRight(right, buttonsTop); @@ -2401,7 +2420,9 @@ void ComposeControls::updateControlsGeometry(QSize size) { } void ComposeControls::updateControlsVisibility() { - _botCommandStart->setVisible(_botCommandShown); + if (_botCommandStart) { + _botCommandStart->setVisible(_botCommandShown); + } if (_ttlInfo) { _ttlInfo->show(); } @@ -2419,7 +2440,8 @@ void ComposeControls::updateControlsVisibility() { bool ComposeControls::updateBotCommandShown() { auto shown = false; const auto peer = _history ? _history->peer.get() : nullptr; - if (peer + if (_botCommandStart + && peer && ((peer->isChat() && peer->asChat()->botStatus > 0) || (peer->isMegagroup() && peer->asChannel()->mgInfo->botStatus > 0) || (peer->isUser() && peer->asUser()->isBot()))) { @@ -2449,7 +2471,9 @@ void ComposeControls::updateOuterGeometry(QRect rect) { void ComposeControls::updateMessagesTTLShown() { const auto peer = _history ? _history->peer.get() : nullptr; - const auto shown = peer && (peer->messagesTTL() > 0); + const auto shown = _features.ttlInfo + && peer + && (peer->messagesTTL() > 0); if (!shown && _ttlInfo) { _ttlInfo = nullptr; updateControlsVisibility(); @@ -2467,7 +2491,8 @@ void ComposeControls::updateMessagesTTLShown() { bool ComposeControls::updateSendAsButton() { const auto peer = _history ? _history->peer.get() : nullptr; - if (!peer + if (!_features.sendAs + || !peer || !_regularWindow || isEditingMessage() || !session().sendAsPeers().shouldChoose(peer)) { @@ -2491,7 +2516,10 @@ bool ComposeControls::updateSendAsButton() { void ComposeControls::updateAttachBotsMenu() { _attachBotsMenu = nullptr; - if (!_history || !_sendActionFactory || !_regularWindow) { + if (!_features.attachBotsMenu + || !_history + || !_sendActionFactory + || !_regularWindow) { return; } _attachBotsMenu = InlineBots::MakeAttachBotsMenu( @@ -2515,7 +2543,18 @@ void ComposeControls::updateAttachBotsMenu() { void ComposeControls::paintBackground(QRect clip) { Painter p(_wrap.get()); - p.fillRect(clip, st::historyComposeAreaBg); + if (_backgroundRect) { + //p.setCompositionMode(QPainter::CompositionMode_Source); + //p.fillRect(clip, Qt::transparent); + //p.setCompositionMode(QPainter::CompositionMode_SourceOver); + //_backgroundRect->paint(p, _wrap->rect()); + auto hq = PainterHighQualityEnabler(p); + p.setBrush(_st.bg); + p.setPen(Qt::NoPen); + p.drawRoundedRect(_wrap->rect(), _st.radius, _st.radius); + } else { + p.fillRect(clip, _st.bg); + } } void ComposeControls::escape() { @@ -2913,7 +2952,7 @@ bool ComposeControls::preventsClose(Fn &&continueCallback) const { } bool ComposeControls::hasSilentBroadcastToggle() const { - if (!_history) { + if (!_features.silentBroadcastToggle || !_history) { return false; } const auto &peer = _history->peer; diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.h b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.h index 16a114ec8..d5749bfcb 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.h +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.h @@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/timer.h" #include "dialogs/dialogs_key.h" #include "history/view/controls/compose_controls_common.h" +#include "ui/round_rect.h" #include "ui/rp_widget.h" #include "ui/effects/animations.h" #include "ui/widgets/input_fields.h" @@ -21,6 +22,10 @@ class History; class DocumentData; class FieldAutocomplete; +namespace style { +struct ComposeControls; +} // namespace style + namespace SendMenu { enum class Type; } // namespace SendMenu @@ -88,13 +93,25 @@ enum class ComposeControlsMode { Scheduled, }; +struct ComposeControlsFeatures { + bool sendAs = true; + bool ttlInfo = true; + bool botCommandSend = true; + bool silentBroadcastToggle = true; + bool attachBotsMenu = true; + bool inlineBots = true; + bool stickersSettings = true; +}; + struct ComposeControlsDescriptor { + const style::ComposeControls *stOverride = nullptr; std::shared_ptr show; Fn)> unavailableEmojiPasted; ComposeControlsMode mode = ComposeControlsMode::Normal; SendMenu::Type sendMenuType = {}; Window::SessionController *regularWindow = nullptr; rpl::producer stickerOrEmojiChosen; + ComposeControlsFeatures features; }; class ComposeControls final { @@ -311,6 +328,8 @@ private: void registerDraftSource(); void changeFocusedControl(); + const style::ComposeControls &_st; + const ComposeControlsFeatures _features; const not_null _parent; const std::shared_ptr _show; const not_null _session; @@ -332,12 +351,14 @@ private: const std::unique_ptr _wrap; const std::unique_ptr _writeRestricted; + std::optional _backgroundRect; + const std::shared_ptr _send; const not_null _attachToggle; std::unique_ptr _replaceMedia; const not_null _tabbedSelectorToggle; const not_null _field; - const not_null _botCommandStart; + Ui::IconButton * const _botCommandStart = nullptr; std::unique_ptr _sendAs; std::unique_ptr _silent; std::unique_ptr _ttlInfo; diff --git a/Telegram/SourceFiles/media/stories/media_stories_reply.cpp b/Telegram/SourceFiles/media/stories/media_stories_reply.cpp index 000635db6..f800f192c 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_reply.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_reply.cpp @@ -26,6 +26,7 @@ ReplyArea::ReplyArea(not_null controller) , _controls(std::make_unique( _controller->wrap(), HistoryView::ComposeControlsDescriptor{ + .stOverride = &st::storiesComposeControls, .show = _controller->uiShow(), .unavailableEmojiPasted = [=](not_null emoji) { showPremiumToast(emoji); @@ -33,6 +34,14 @@ ReplyArea::ReplyArea(not_null controller) .mode = HistoryView::ComposeControlsMode::Normal, .sendMenuType = SendMenu::Type::SilentOnly, .stickerOrEmojiChosen = _controller->stickerOrEmojiChosen(), + .features = { + .sendAs = false, + .ttlInfo = false, + .botCommandSend = false, + .silentBroadcastToggle = false, + .attachBotsMenu = false, + .inlineBots = false, + }, } )) { initGeometry(); diff --git a/Telegram/SourceFiles/media/view/media_view.style b/Telegram/SourceFiles/media/view/media_view.style index 3cd675b90..7e01278eb 100644 --- a/Telegram/SourceFiles/media/view/media_view.style +++ b/Telegram/SourceFiles/media/view/media_view.style @@ -11,6 +11,7 @@ using "ui/widgets/widgets.style"; using "ui/menu_icons.style"; using "media/player/media_player.style"; using "boxes/boxes.style"; +using "chat_helpers/chat_helpers.style"; mediaviewOverDuration: 150; @@ -434,22 +435,106 @@ storiesShadowTop: icon{{ "mediaview/shadow_bottom-flip_vertical", windowShadowFg storiesShadowBottom: mediaviewShadowBottom; storiesControlsMinWidth: 200px; storiesFieldMargin: margins(0px, 14px, 0px, 16px); -storiesAttach: IconButton(defaultIconButton) { - width: 44px; - height: 46px; - - icon: icon {{ "chat/input_attach", historyComposeIconFg }}; - iconOver: icon {{ "chat/input_attach", historyComposeIconFgOver }}; - - rippleAreaPosition: point(2px, 3px); - rippleAreaSize: 40px; - ripple: RippleAnimation(defaultRippleAnimation) { - color: windowBgOver; - } -} storiesSideSkip: 145px; storiesCaptionFull: FlatLabel(defaultFlatLabel) { style: mediaviewCaptionStyle; textFg: mediaviewCaptionFg; minWidth: 360px; } +storiesComposeBg: groupCallMembersBg; +storiesComposeBgOver: groupCallMembersBgOver; +storiesComposeBgRipple: groupCallMembersBgRipple; +storiesComposeWhiteText: groupCallMembersFg; +storiesComposeGrayText: groupCallMemberNotJoinedStatus; +storiesComposeGrayIcon: groupCallMemberInactiveIcon; +storiesComposeBlue: groupCallActiveFg; +storiesComposeRipple: RippleAnimation(defaultRippleAnimation) { + color: groupCallMembersBgRipple; +} +storiesAttach: IconButton(historyAttach) { + icon: icon {{ "chat/input_attach", storiesComposeGrayIcon }}; + iconOver: icon {{ "chat/input_attach", storiesComposeGrayIcon }}; + ripple: RippleAnimation(defaultRippleAnimation) { + color: storiesComposeBgOver; + } +} +storiesRecordVoice: icon {{ "chat/input_record", storiesComposeGrayIcon }}; +storiesRecordVoiceOver: icon {{ "chat/input_record", storiesComposeGrayIcon }}; +storiesComposeControls: ComposeControls(defaultComposeControls) { + bg: storiesComposeBg; + radius: storiesRadius; + field: InputField(historyComposeField) { + textFg: storiesComposeWhiteText; + textBg: storiesComposeBg; + placeholderFg: storiesComposeGrayText; + placeholderFgActive: storiesComposeGrayText; + placeholderFgError: storiesComposeGrayText; + } + send: SendButton(historySend) { + inner: IconButton(storiesAttach) { + icon: icon {{ "chat/input_send", storiesComposeBlue }}; + iconOver: icon {{ "chat/input_send", storiesComposeBlue }}; + } + record: storiesRecordVoice; + recordOver: storiesRecordVoiceOver; + sendDisabledFg: storiesComposeGrayText; + } + attach: storiesAttach; + emoji: EmojiButton(historyAttachEmoji) { + inner: IconButton(storiesAttach) { + icon: icon {{ "chat/input_smile_face", storiesComposeGrayIcon }}; + iconOver: icon {{ "chat/input_smile_face", storiesComposeGrayIcon }}; + } + bg: storiesComposeBg; + lineFg: storiesComposeGrayIcon; + lineFgOver: storiesComposeGrayIcon; + } + tabbed: EmojiPan(defaultEmojiPan) { + bg: storiesComposeBg; + overBg: storiesComposeBgOver; + expandBg: storiesComposeGrayText; + pathBg: storiesComposeBgRipple; + pathFg: storiesComposeBgOver; + textFg: storiesComposeWhiteText; + categoriesBg: storiesComposeBg; + categoriesBgOver: storiesComposeBgOver; + fadeLeft: icon {{ "fade_horizontal-flip_horizontal", storiesComposeBg }}; + fadeRight: icon {{ "fade_horizontal", storiesComposeBg }}; + tabs: SettingsSlider(emojiTabs) { + barFgActive: storiesComposeBlue; + labelFg: storiesComposeGrayText; + labelFgActive: storiesComposeBlue; + rippleBg: storiesComposeBgOver; + rippleBgActive: storiesComposeBgOver; + } + search: TabbedSearch(defaultTabbedSearch) { + outer: storiesComposeBg; + bg: storiesComposeBgOver; + bgActive: storiesComposeBgRipple; + fg: storiesComposeGrayIcon; + fgActive: storiesComposeWhiteText; + fadeLeft: icon {{ "fade_horizontal-flip_horizontal", storiesComposeBgOver }}; + fadeRight: icon {{ "fade_horizontal", storiesComposeBgOver }}; + field: InputField(defaultTabbedSearchField) { + placeholderFg: storiesComposeGrayText; + placeholderFgActive: storiesComposeGrayText; + placeholderFgError: storiesComposeGrayText; + } + search: IconButton(defaultTabbedSearchButton) { + icon: icon{{ "emoji/emoji_search_input", storiesComposeGrayIcon }}; + iconOver: icon{{ "emoji/emoji_search_input", storiesComposeGrayIcon }}; + ripple: storiesComposeRipple; + } + back: IconButton(defaultTabbedSearchBack) { + icon: icon{{ "emoji/emoji_back", storiesComposeGrayIcon }}; + iconOver: icon{{ "emoji/emoji_back", storiesComposeGrayIcon }}; + ripple: storiesComposeRipple; + } + cancel: CrossButton(defaultTabbedSearchCancel) { + crossFg: storiesComposeGrayIcon; + crossFgOver: storiesComposeGrayIcon; + ripple: emptyRippleAnimation; + } + } + } +} diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 2d7da4d8b..8ff30f817 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -89,6 +89,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_account.h" #include "calls/calls_instance.h" #include "styles/style_media_view.h" +#include "styles/style_calls.h" #include "styles/style_chat.h" #include "styles/style_menu_icons.h" @@ -336,6 +337,8 @@ OverlayWidget::OverlayWidget() , _lastAction(-st::mediaviewDeltaFromLastAction, -st::mediaviewDeltaFromLastAction) , _stateAnimation([=](crl::time now) { return stateAnimationCallback(now); }) , _dropdown(_body, st::mediaviewDropdownMenu) { + _layerBg->setStyleOverrides(&st::groupCallBox, &st::groupCallLayerBox); + CrashReports::SetAnnotation("OpenGL Renderer", "[not-initialized]"); Lang::Updated( diff --git a/Telegram/SourceFiles/ui/boxes/time_picker_box.cpp b/Telegram/SourceFiles/ui/boxes/time_picker_box.cpp index 746fbd4e2..0cf0d5121 100644 --- a/Telegram/SourceFiles/ui/boxes/time_picker_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/time_picker_box.cpp @@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/animation_value.h" #include "ui/ui_utility.h" #include "ui/widgets/vertical_drum_picker.h" -#include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" #include "styles/style_layers.h" namespace Ui { diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_abstract_single_file_preview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_abstract_single_file_preview.cpp index f6e8ee28e..60cc5ae68 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_abstract_single_file_preview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_abstract_single_file_preview.cpp @@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/painter.h" #include "base/timer_rpl.h" #include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" #include "styles/style_boxes.h" namespace Ui { diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_album_thumbnail.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_album_thumbnail.cpp index 56e4bdcb7..2e71553ab 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_album_thumbnail.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_album_thumbnail.cpp @@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/power_saving.h" #include "base/call_delayed.h" #include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" #include "styles/style_boxes.h" #include diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index 7e6b3dfcd..d4b66ab07 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -9,22 +9,7 @@ using "ui/basic.style"; using "dialogs/dialogs.style"; using "ui/widgets/widgets.style"; using "ui/menu_icons.style"; - -MessageBar { - title: TextStyle; - titleFg: color; - text: TextStyle; - textFg: color; - textPalette: TextPalette; - duration: int; -} - -GroupCallUserpics { - size: pixels; - shift: pixels; - stroke: pixels; - align: align; -} +using "chat_helpers/chat_helpers.style"; // GroupCallUserpics msgMaxWidth: 430px; msgFont: font(fsize); @@ -145,9 +130,6 @@ outSemiboldPalette: TextPalette(outTextPalette) { selectFg: msgOutServiceFgSelected; selectLinkFg: msgOutServiceFgSelected; } -historyComposeAreaPalette: TextPalette(defaultTextPalette) { - linkFg: historyComposeAreaFgService; -} mediaCaptionSkip: 5px; mediaInBubbleSkip: 5px; @@ -162,15 +144,6 @@ mediaInPaletteSelected: TextPalette(defaultTextPalette) { linkFg: mediaInFgSelected; } -defaultMessageBar: MessageBar { - title: semiboldTextStyle; - titleFg: windowActiveTextFg; - text: messageTextStyle; - textFg: historyComposeAreaFg; - textPalette: historyComposeAreaPalette; - duration: 160; -} - minPhotoSize: 100px; maxMediaSize: 430px; maxStickerSize: 224px; @@ -229,58 +202,6 @@ historyPremiumViewSet: RoundButton(defaultActiveButton) { ripple: emptyRippleAnimation; } -historyToDownPosition: point(12px, 10px); -historyToDownAbove: icon {{ "history_down_arrow", historyToDownFg }}; -historyToDownAboveOver: icon {{ "history_down_arrow", historyToDownFgOver }}; -historyToDownPaddingTop: 10px; -historyToDownBelow: icon { - { "history_down_shadow", historyToDownShadow }, - { "history_down_circle", historyToDownBg }, -}; -historyToDownBelowOver: icon { - { "history_down_shadow", historyToDownShadow }, - { "history_down_circle", historyToDownBgOver }, -}; -historyToDown: TwoIconButton { - width: 52px; - height: 62px; - - iconBelow: historyToDownBelow; - iconBelowOver: historyToDownBelowOver; - iconAbove: historyToDownAbove; - iconAboveOver: historyToDownAboveOver; - iconPosition: point(0px, historyToDownPaddingTop); - - rippleAreaPosition: point(5px, 15px); - rippleAreaSize: 42px; - ripple: RippleAnimation(defaultRippleAnimation) { - color: historyToDownBgRipple; - } -} -historyToDownBadgeFont: semiboldFont; -historyToDownBadgeSize: 22px; - -historyToDownShownAfter: 480px; -historyToDownDuration: 150; - -dialogsToUpAbove: icon {{ "history_down_arrow-flip_vertical", historyToDownFg, point(0px, 1px) }}; -dialogsToUpAboveOver: icon {{ "history_down_arrow-flip_vertical", historyToDownFgOver, point(0px, 1px) }}; - -dialogsToUp: TwoIconButton(historyToDown) { - iconAbove: dialogsToUpAbove; - iconAboveOver: dialogsToUpAboveOver; -} - -historyUnreadMentions: TwoIconButton(historyToDown) { - iconAbove: icon {{ "history_unread_mention", historyToDownFg }}; - iconAboveOver: icon {{ "history_unread_mention", historyToDownFgOver }}; -} -historyUnreadReactions: TwoIconButton(historyToDown) { - iconAbove: icon {{ "history_unread_reaction", historyToDownFg }}; - iconAboveOver: icon {{ "history_unread_reaction", historyToDownFgOver }}; -} -historyUnreadThingsSkip: 4px; - membersInnerWidth: 310px; membersInnerHeightMax: 360px; membersInnerDropdown: InnerDropdown(defaultInnerDropdown) { @@ -366,29 +287,6 @@ historyPinOutIcon: icon {{ "history_pin", historyOutIconFg }}; historyPinOutSelectedIcon: icon {{ "history_pin", historyOutIconFgSelected }}; historyPinInvertedIcon: icon {{ "history_pin", historySendingInvertedIconFg }}; -historyComposeField: InputField(defaultInputField) { - font: msgFont; - textMargins: margins(0px, 0px, 0px, 0px); - textAlign: align(left); - textFg: historyComposeAreaFg; - textBg: historyComposeAreaBg; - heightMin: 36px; - heightMax: 72px; - placeholderFg: placeholderFg; - placeholderFgActive: placeholderFgActive; - placeholderFgError: placeholderFgActive; - placeholderMargins: margins(7px, 5px, 7px, 5px); - placeholderAlign: align(topleft); - placeholderScale: 0.; - placeholderFont: normalFont; - placeholderShift: -50px; - border: 0px; - borderActive: 0px; - duration: 100; -} -historyComposeFieldMaxHeight: 224px; -// historyMinHeight: 56px; - historySendPadding: 9px; historySendRight: 2px; historyBotMenuSkip: 8px; @@ -399,245 +297,6 @@ historyBotMenuButton: RoundButton(defaultActiveButton) { textTop: 6px; } -historyComposeButton: FlatButton { - color: windowActiveTextFg; - overColor: windowActiveTextFg; - - bgColor: historyComposeButtonBg; - overBgColor: historyComposeButtonBgOver; - - width: -32px; - height: 46px; - - textTop: 14px; - - font: semiboldFont; - overFont: semiboldFont; - - ripple: RippleAnimation(defaultRippleAnimation) { - color: historyComposeButtonBgRipple; - } -} -historyUnblock: FlatButton(historyComposeButton) { - color: attentionButtonFg; - overColor: attentionButtonFgOver; -} -historyContactStatusButton: FlatButton(historyComposeButton) { - height: 49px; - textTop: 16px; - overBgColor: historyComposeButtonBg; - ripple: RippleAnimation(defaultRippleAnimation) { - color: historyComposeButtonBgOver; - } -} -historyContactStatusBlock: FlatButton(historyContactStatusButton) { - color: attentionButtonFg; - overColor: attentionButtonFg; -} -historyContactStatusLabel: FlatLabel(defaultFlatLabel) { - minWidth: 240px; -} -historyEmojiStatusInfoLabel: FlatLabel(historyContactStatusLabel) { - align: align(top); - textFg: windowSubTextFg; -} -historyContactStatusMinSkip: 16px; - -historySendIcon: icon {{ "chat/input_send", historySendIconFg }}; -historySendIconOver: icon {{ "chat/input_send", historySendIconFgOver }}; -historySendIconPosition: point(10px, 11px); -historySendSize: size(44px, 46px); -historyScheduleIcon: icon {{ "chat/input_schedule", historyComposeAreaBg }}; -historyScheduleIconPosition: point(7px, 8px); -historyEditSaveIcon: icon {{ "chat/input_save", historySendIconFg }}; -historyEditSaveIconOver: icon {{ "chat/input_save", historySendIconFgOver }}; - -historyAttach: IconButton(defaultIconButton) { - width: 44px; - height: 46px; - - icon: icon {{ "chat/input_attach", historyComposeIconFg }}; - iconOver: icon {{ "chat/input_attach", historyComposeIconFgOver }}; - - rippleAreaPosition: point(2px, 3px); - rippleAreaSize: 40px; - ripple: RippleAnimation(defaultRippleAnimation) { - color: windowBgOver; - } -} - -historyAttachEmoji: IconButton(historyAttach) { - icon: icon {{ "chat/input_smile_face", historyComposeIconFg }}; - iconOver: icon {{ "chat/input_smile_face", historyComposeIconFgOver }}; -} -historyMessagesTTL: IconButtonWithText { - iconButton: IconButton(historyAttach) { - icon: icon {{ "chat/input_autodelete", historyComposeIconFg }}; - iconOver: icon {{ "chat/input_autodelete", historyComposeIconFgOver }}; - } - textFg: historyComposeIconFg; - textFgOver: historyComposeIconFgOver; - textPadding: margins(21px, 20px, 3px, 7px); - textAlign: align(left); - - font: font(10px semibold); -} -historyReplaceMedia: IconButton(historyAttach) { - icon: icon {{ "chat/input_replace", windowBgActive }}; - iconOver: icon {{ "chat/input_replace", windowBgActive }}; - ripple: RippleAnimation(defaultRippleAnimation) { - color: lightButtonBgOver; - } -} -historyEditMediaBg: videoPlayIconBg; -historyEditMedia: icon{{ "chat/input_draw", videoPlayIconFg }}; -historyMessagesTTLPickerHeight: 200px; -historyMessagesTTLPickerItemHeight: 40px; -historyMessagesTTLLabel: FlatLabel(defaultFlatLabel) { - minWidth: 200px; - align: align(topleft); - textFg: windowSubTextFg; -} - -historyAttachEmojiActive: icon {{ "chat/input_smile_face", windowBgActive }}; -historyEmojiCircle: size(20px, 20px); -historyEmojiCircleLine: 1.5; -historyEmojiCircleFg: historyComposeIconFg; -historyEmojiCircleFgOver: historyComposeIconFgOver; -historyBotKeyboardShow: IconButton(historyAttach) { - icon: icon {{ "chat/input_bot_keyboard", historyComposeIconFg }}; - iconOver: icon {{ "chat/input_bot_keyboard", historyComposeIconFgOver }}; -} -historyBotKeyboardHide: IconButton(historyAttach) { - icon: icon {{ "chat/input_bot_keyboard_hide", historyComposeIconFg }}; - iconOver: icon {{ "chat/input_bot_keyboard_hide", historyComposeIconFgOver }}; -} -historyBotCommandStart: IconButton(historyAttach) { - icon: icon {{ "chat/input_bot_command", historyComposeIconFg }}; - iconOver: icon {{ "chat/input_bot_command", historyComposeIconFgOver }}; -} -historyScheduledToggle: IconButton(historyAttach) { - icon: icon { - { "chat/input_scheduled", historyComposeIconFg }, - { "chat/input_scheduled_dot", attentionButtonFg } - }; - iconOver: icon { - { "chat/input_scheduled", historyComposeIconFgOver }, - { "chat/input_scheduled_dot", attentionButtonFg } - }; -} - -historyRecordVoiceFg: historyComposeIconFg; -historyRecordVoiceFgOver: historyComposeIconFgOver; -historyRecordVoiceFgInactive: attentionButtonFg; -historyRecordVoiceFgActive: windowBgActive; -historyRecordVoiceFgActiveIcon: windowFgActive; -historyRecordVoiceShowDuration: 120; -historyRecordVoiceDuration: 120; -historyRecordVoice: icon {{ "chat/input_record", historyRecordVoiceFg }}; -historyRecordVoiceOver: icon {{ "chat/input_record", historyRecordVoiceFgOver }}; -historyRecordVoiceActive: icon {{ "chat/input_record_filled", historyRecordVoiceFgActiveIcon }}; -historyRecordSendIconPosition: point(2px, 0px); -historyRecordVoiceRippleBgActive: lightButtonBgOver; -historyRecordSignalRadius: 5px; -historyRecordCancel: windowSubTextFg; -historyRecordCancelActive: windowActiveTextFg; -historyRecordFont: font(13px); -historyRecordDurationSkip: 12px; -historyRecordDurationFg: historyComposeAreaFg; - -historyRecordMainBlobMinRadius: 23px; -historyRecordMainBlobMaxRadius: 37px; -historyRecordMinorBlobMinRadius: 40px; -historyRecordMinorBlobMaxRadius: 47px; -historyRecordMajorBlobMinRadius: 43px; -historyRecordMajorBlobMaxRadius: 50px; - -historyRecordTextStyle: TextStyle(defaultTextStyle) { - font: historyRecordFont; -} - -historyRecordTextWidthForWrap: 210px; -historyRecordTextLeft: 15px; -historyRecordTextRight: 25px; - -historyRecordLockShowDuration: historyToDownDuration; -historyRecordLockSize: size(75px, 133px); - -historyRecordLockIconFg: historyToDownFg; -historyRecordLockIconSize: size(14px, 17px); -historyRecordLockIconBottomHeight: 9px; -historyRecordLockIconLineHeight: 2px; -historyRecordLockIconLineSkip: 3px; -historyRecordLockIconLineWidth: 2px; -historyRecordLockIconArcHeight: 4px; -historyRecordStopIconWidth: 12px; - -historyRecordLockTopShadow: icon {{ "voice_lock/record_lock_top_shadow", historyToDownShadow }}; -historyRecordLockTop: icon {{ "voice_lock/record_lock_top", historyToDownBg }}; -historyRecordLockBottomShadow: icon {{ "voice_lock/record_lock_bottom_shadow", historyToDownShadow }}; -historyRecordLockBottom: icon {{ "voice_lock/record_lock_bottom", historyToDownBg }}; -historyRecordLockBodyShadow: icon {{ "voice_lock/record_lock_body_shadow", historyToDownShadow }}; -historyRecordLockBody: icon {{ "voice_lock/record_lock_body", historyToDownBg }}; -historyRecordLockMargin: margins(4px, 4px, 4px, 4px); -historyRecordLockArrow: icon {{ "voice_lock/voice_arrow", historyToDownFg }}; -historyRecordLockRippleMargin: margins(6px, 6px, 6px, 6px); - -historyRecordDelete: IconButton(historyAttach) { - icon: icon {{ "info/info_media_delete", historyComposeIconFg }}; - iconOver: icon {{ "info/info_media_delete", historyComposeIconFgOver }}; - iconPosition: point(10px, 11px); -} -historyRecordWaveformRightSkip: 10px; -historyRecordWaveformBgMargins: margins(5px, 7px, 5px, 7px); - -historyRecordWaveformBar: 3px; - -historyRecordLockPosition: point(1px, 35px); - -historyRecordCancelButtonWidth: 100px; -historyRecordCancelButtonFg: lightButtonFg; - -historySilentToggle: IconButton(historyBotKeyboardShow) { - icon: icon {{ "chat/input_silent", historyComposeIconFg }}; - iconOver: icon {{ "chat/input_silent", historyComposeIconFgOver }}; -} -historySilentToggleOn: icon {{ "chat/input_silent_on", historyComposeIconFg }}; -historySilentToggleOnOver: icon {{ "chat/input_silent_on", historyComposeIconFgOver }}; - -historyReplySkip: 51px; -historyReplyNameFg: windowActiveTextFg; -historyReplyHeight: 49px; -historyReplyIconPosition: point(5px, 5px); -historyReplyIcon: icon {{ "chat/input_reply", historyReplyIconFg }}; -historyForwardIcon: icon {{ "chat/input_forward", historyReplyIconFg }}; -historyEditIcon: icon {{ "chat/input_edit", historyReplyIconFg }}; -historyReplyCancel: IconButton { - width: 49px; - height: 49px; - - icon: historyReplyCancelIcon; - iconOver: historyReplyCancelIconOver; - iconPosition: point(-1px, -1px); - - rippleAreaPosition: point(4px, 4px); - rippleAreaSize: 40px; - ripple: RippleAnimation(defaultRippleAnimation) { - color: windowBgOver; - } -} -historyPinnedShowAll: IconButton(historyReplyCancel) { - icon: icon {{ "pinned_show_all", historyReplyCancelFg }}; - iconOver: icon {{ "pinned_show_all", historyReplyCancelFgOver }}; -} -historyPinnedBotButton: RoundButton(defaultActiveButton) { - width: -34px; - height: 30px; - textTop: 6px; - padding: margins(2px, 10px, 10px, 9px); -} -historyPinnedBotButtonMaxWidth: 150px; - topicButtonSkip: 3px; topicButtonPadding: margins(6px, 3px, 8px, 3px); topicButtonArrowSkip: 8px; @@ -960,13 +619,6 @@ historyCommentsUserpics: GroupCallUserpics { align: align(left); } -boxAttachEmoji: IconButton(historyAttachEmoji) { - width: 30px; - height: 30px; - rippleAreaSize: 0px; -} -boxAttachEmojiTop: 20px; - historyGroupAboutMargin: 16px; historyGroupAboutPadding: margins(24px, 16px, 24px, 16px); historyGroupAboutBulletSkip: 16px; @@ -1012,8 +664,6 @@ historyCommentsOpenInSelected: icon {{ "history_comments_open", msgFileThumbLink historyCommentsOpenOut: icon {{ "history_comments_open", msgFileThumbLinkOutFg }}; historyCommentsOpenOutSelected: icon {{ "history_comments_open", msgFileThumbLinkOutFgSelected }}; -historySlowmodeCounterMargins: margins(0px, 0px, 10px, 0px); - historyGroupCallUserpics: GroupCallUserpics { size: 32px; shift: 12px; @@ -1137,13 +787,6 @@ reactionsTabs: MultiSelect(defaultMultiSelect) { padding: margins(12px, 10px, 12px, 10px); } reactionsTabIconSkip: 3px; -historyRequestsUserpics: GroupCallUserpics { - size: 22px; - shift: 8px; - stroke: 4px; - align: align(left); -} -historyRequestsHeight: 33px; SendAsButton { width: pixels; diff --git a/Telegram/SourceFiles/ui/chat/message_bar.cpp b/Telegram/SourceFiles/ui/chat/message_bar.cpp index 868d7a615..722e8322a 100644 --- a/Telegram/SourceFiles/ui/chat/message_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/message_bar.cpp @@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/painter.h" #include "ui/power_saving.h" #include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" #include "styles/palette.h" namespace Ui { diff --git a/Telegram/SourceFiles/ui/chat/pinned_bar.cpp b/Telegram/SourceFiles/ui/chat/pinned_bar.cpp index fddd61fe4..dcd4133c0 100644 --- a/Telegram/SourceFiles/ui/chat/pinned_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/pinned_bar.cpp @@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/shadow.h" #include "ui/widgets/buttons.h" #include "ui/wrap/fade_wrap.h" -#include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" #include "styles/palette.h" #include diff --git a/Telegram/SourceFiles/ui/chat/requests_bar.cpp b/Telegram/SourceFiles/ui/chat/requests_bar.cpp index 9636e02ce..c8841f579 100644 --- a/Telegram/SourceFiles/ui/chat/requests_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/requests_bar.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/text/text_options.h" #include "ui/painter.h" #include "lang/lang_keys.h" -#include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" #include "styles/style_calls.h" #include "styles/style_info.h" // st::topBarArrowPadding, like TopBarWidget. #include "styles/style_window.h" // st::columnMinimalWidthLeft @@ -145,7 +145,7 @@ void RequestsBar::paint(Painter &p) { const auto userpicsLeft = userpicsTop * 2; const auto textTop = st::lineWidth + (st::historyRequestsHeight - st::lineWidth - - st::msgServiceNameFont->height) / 2; + - st::semiboldFont->height) / 2; const auto width = _inner->width(); const auto &font = st::defaultMessageBar.title.font; p.setPen(st::defaultMessageBar.titleFg); diff --git a/Telegram/SourceFiles/ui/controls/emoji_button.cpp b/Telegram/SourceFiles/ui/controls/emoji_button.cpp index 06775e2a0..b2656f584 100644 --- a/Telegram/SourceFiles/ui/controls/emoji_button.cpp +++ b/Telegram/SourceFiles/ui/controls/emoji_button.cpp @@ -10,29 +10,30 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/radial_animation.h" #include "ui/effects/ripple_animation.h" #include "ui/painter.h" -#include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" namespace Ui { -EmojiButton::EmojiButton(QWidget *parent, const style::IconButton &st) -: RippleButton(parent, st.ripple) +EmojiButton::EmojiButton(QWidget *parent, const style::EmojiButton &st) +: RippleButton(parent, st.inner.ripple) , _st(st) { - resize(_st.width, _st.height); + resize(_st.inner.width, _st.inner.height); setCursor(style::cur_pointer); } void EmojiButton::paintEvent(QPaintEvent *e) { auto p = QPainter(this); - p.fillRect(e->rect(), st::historyComposeAreaBg); - paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), _rippleOverride ? &(*_rippleOverride)->c : nullptr); + p.fillRect(e->rect(), _st.bg); + const auto &st = _st.inner; + paintRipple(p, st.rippleAreaPosition.x(), st.rippleAreaPosition.y(), _rippleOverride ? &(*_rippleOverride)->c : nullptr); const auto over = isOver(); const auto loadingState = _loading ? _loading->computeState() : RadialState{ 0., 0, RadialState::kFull }; - const auto icon = _iconOverride ? _iconOverride : &(over ? _st.iconOver : _st.icon); - auto position = _st.iconPosition; + const auto icon = _iconOverride ? _iconOverride : &(over ? st.iconOver : st.icon); + auto position = st.iconPosition; if (position.x() < 0) { position.setX((width() - icon->width()) / 2); } @@ -53,9 +54,7 @@ void EmojiButton::paintEvent(QPaintEvent *e) { const auto color = (_colorOverride ? *_colorOverride - : (over - ? st::historyEmojiCircleFgOver - : st::historyEmojiCircleFg)); + : (over ? _st.lineFgOver : _st.lineFg)); const auto line = style::ConvertScaleExact(st::historyEmojiCircleLine); if (anim::Disabled() && _loading && _loading->animating()) { anim::DrawStaticLoading(p, inner, line, color); @@ -112,14 +111,15 @@ void EmojiButton::onStateChanged(State was, StateChangeSource source) { } QPoint EmojiButton::prepareRippleStartPosition() const { - if (!_st.rippleAreaSize) { + if (!_st.inner.rippleAreaSize) { return DisabledRippleStartPosition(); } - return mapFromGlobal(QCursor::pos()) - _st.rippleAreaPosition; + return mapFromGlobal(QCursor::pos()) - _st.inner.rippleAreaPosition; } QImage EmojiButton::prepareRippleMask() const { - return RippleAnimation::EllipseMask(QSize(_st.rippleAreaSize, _st.rippleAreaSize)); + const auto size = _st.inner.rippleAreaSize; + return RippleAnimation::EllipseMask(QSize(size, size)); } } // namespace Ui diff --git a/Telegram/SourceFiles/ui/controls/emoji_button.h b/Telegram/SourceFiles/ui/controls/emoji_button.h index a39d40c9c..bee3b68f6 100644 --- a/Telegram/SourceFiles/ui/controls/emoji_button.h +++ b/Telegram/SourceFiles/ui/controls/emoji_button.h @@ -9,13 +9,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/buttons.h" +namespace style { +struct EmojiButton; +} // namespace style + namespace Ui { class InfiniteRadialAnimation; class EmojiButton final : public RippleButton { public: - EmojiButton(QWidget *parent, const style::IconButton &st); + EmojiButton(QWidget *parent, const style::EmojiButton &st); void setLoading(bool loading); void setColorOverrides( @@ -33,7 +37,7 @@ protected: private: void loadingAnimationCallback(); - const style::IconButton &_st; + const style::EmojiButton &_st; std::unique_ptr _loading; diff --git a/Telegram/SourceFiles/ui/controls/jump_down_button.cpp b/Telegram/SourceFiles/ui/controls/jump_down_button.cpp index 24c54d8d6..aded3fc78 100644 --- a/Telegram/SourceFiles/ui/controls/jump_down_button.cpp +++ b/Telegram/SourceFiles/ui/controls/jump_down_button.cpp @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/ripple_animation.h" #include "ui/unread_badge_paint.h" -#include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" namespace Ui { diff --git a/Telegram/SourceFiles/ui/controls/send_button.cpp b/Telegram/SourceFiles/ui/controls/send_button.cpp index fe9f6b115..2e83de2fc 100644 --- a/Telegram/SourceFiles/ui/controls/send_button.cpp +++ b/Telegram/SourceFiles/ui/controls/send_button.cpp @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/ripple_animation.h" #include "ui/painter.h" -#include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" namespace Ui { namespace { @@ -18,9 +18,10 @@ constexpr int kWideScale = 5; } // namespace -SendButton::SendButton(QWidget *parent) -: RippleButton(parent, st::historyReplyCancel.ripple) { - resize(st::historySendSize); +SendButton::SendButton(QWidget *parent, const style::SendButton &st) +: RippleButton(parent, st.inner.ripple) +, _st(st) { + resize(_st.inner.width, _st.inner.height); } void SendButton::setType(Type type) { @@ -93,35 +94,17 @@ void SendButton::paintEvent(QPaintEvent *e) { } void SendButton::paintRecord(QPainter &p, bool over) { - const auto recordActive = 0.; if (!isDisabled()) { - auto rippleColor = anim::color( - st::historyAttachEmoji.ripple.color, - st::historyRecordVoiceRippleBgActive, - recordActive); paintRipple( p, - (width() - st::historyAttachEmoji.rippleAreaSize) / 2, - st::historyAttachEmoji.rippleAreaPosition.y(), - &rippleColor); + (width() - _st.inner.rippleAreaSize) / 2, + _st.inner.rippleAreaPosition.y()); } - auto fastIcon = [&] { - if (isDisabled()) { - return &st::historyRecordVoice; - } else if (recordActive == 1.) { - return &st::historyRecordVoiceActive; - } else if (over) { - return &st::historyRecordVoiceOver; - } - return &st::historyRecordVoice; - }; - fastIcon()->paintInCenter(p, rect()); - if (!isDisabled() && recordActive > 0. && recordActive < 1.) { - p.setOpacity(recordActive); - st::historyRecordVoiceActive.paintInCenter(p, rect()); - p.setOpacity(1.); - } + const auto &icon = (isDisabled() || !over) + ? _st.record + : _st.recordOver; + icon.paintInCenter(p, rect()); } void SendButton::paintSave(QPainter &p, bool over) { @@ -132,7 +115,10 @@ void SendButton::paintSave(QPainter &p, bool over) { } void SendButton::paintCancel(QPainter &p, bool over) { - paintRipple(p, (width() - st::historyAttachEmoji.rippleAreaSize) / 2, st::historyAttachEmoji.rippleAreaPosition.y()); + paintRipple( + p, + (width() - _st.inner.rippleAreaSize) / 2, + _st.inner.rippleAreaPosition.y()); const auto &cancelIcon = over ? st::historyReplyCancelIconOver @@ -141,9 +127,7 @@ void SendButton::paintCancel(QPainter &p, bool over) { } void SendButton::paintSend(QPainter &p, bool over) { - const auto &sendIcon = over - ? st::historySendIconOver - : st::historySendIcon; + const auto &sendIcon = over ? _st.inner.iconOver : _st.inner.icon; if (isDisabled()) { const auto color = st::historyRecordVoiceFg->c; sendIcon.paint(p, st::historySendIconPosition, width(), color); @@ -199,20 +183,14 @@ QPixmap SendButton::grabContent() { } QImage SendButton::prepareRippleMask() const { - auto size = (_type == Type::Record) - ? st::historyAttachEmoji.rippleAreaSize - : st::historyReplyCancel.rippleAreaSize; + const auto size = _st.inner.rippleAreaSize; return RippleAnimation::EllipseMask(QSize(size, size)); } QPoint SendButton::prepareRippleStartPosition() const { - auto real = mapFromGlobal(QCursor::pos()); - auto size = (_type == Type::Record) - ? st::historyAttachEmoji.rippleAreaSize - : st::historyReplyCancel.rippleAreaSize; - auto y = (_type == Type::Record) - ? st::historyAttachEmoji.rippleAreaPosition.y() - : (height() - st::historyReplyCancel.rippleAreaSize) / 2; + const auto real = mapFromGlobal(QCursor::pos()); + const auto size = _st.inner.rippleAreaSize; + const auto y = (height() - _st.inner.rippleAreaSize) / 2; return real - QPoint((width() - size) / 2, y); } diff --git a/Telegram/SourceFiles/ui/controls/send_button.h b/Telegram/SourceFiles/ui/controls/send_button.h index 02ac3c093..5b3cc104d 100644 --- a/Telegram/SourceFiles/ui/controls/send_button.h +++ b/Telegram/SourceFiles/ui/controls/send_button.h @@ -9,11 +9,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/buttons.h" +namespace style { +struct SendButton; +} // namespace style + namespace Ui { class SendButton final : public RippleButton { public: - explicit SendButton(QWidget *parent); + SendButton(QWidget *parent, const style::SendButton &st); static constexpr auto kSlowmodeDelayLimit = 100 * 60; @@ -49,6 +53,8 @@ private: void paintSchedule(QPainter &p, bool over); void paintSlowmode(QPainter &p); + const style::SendButton &_st; + Type _type = Type::Send; Type _afterSlowmodeType = Type::Send; QPixmap _contentFrom, _contentTo; diff --git a/Telegram/SourceFiles/ui/controls/tabbed_search.cpp b/Telegram/SourceFiles/ui/controls/tabbed_search.cpp index cb28ea643..a4bf604a5 100644 --- a/Telegram/SourceFiles/ui/controls/tabbed_search.cpp +++ b/Telegram/SourceFiles/ui/controls/tabbed_search.cpp @@ -181,7 +181,7 @@ void GroupsStrip::paintEvent(QPaintEvent *e) { const auto size = SearchWithGroups::IconSizeOverride(); if (_chosen == index) { p.setPen(Qt::NoPen); - p.setBrush(st::windowBgRipple); + p.setBrush(_st.bgActive); p.drawEllipse( left + skip, top + (height - single) / 2 + skip, diff --git a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp index f30c88d8f..8db74f0f2 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp @@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_window.h" #include "styles/style_media_view.h" #include "styles/style_chat.h" +#include "styles/style_chat_helpers.h" #include "styles/style_dialogs.h" #include "styles/style_info.h" @@ -561,16 +562,17 @@ void Generator::paintComposeArea() { auto right = st::historySendRight + st::historySendSize.width(); st::historyRecordVoice[_palette].paintInCenter(*_p, QRect(_composeArea.x() + _composeArea.width() - right, controlsTop, st::historySendSize.width(), st::historySendSize.height())); - const auto emojiIconLeft = (st::historyAttachEmoji.iconPosition.x() < 0) - ? ((st::historyAttachEmoji.width - st::historyAttachEmoji.icon.width()) / 2) - : st::historyAttachEmoji.iconPosition.x(); - const auto emojiIconTop = (st::historyAttachEmoji.iconPosition.y() < 0) - ? ((st::historyAttachEmoji.height - st::historyAttachEmoji.icon.height()) / 2) - : st::historyAttachEmoji.iconPosition.y(); - const auto &emojiIcon = st::historyAttachEmoji.icon[_palette]; - right += st::historyAttachEmoji.width; + const auto &emojiButton = st::historyAttachEmoji.inner; + const auto emojiIconLeft = (emojiButton.iconPosition.x() < 0) + ? ((emojiButton.width - emojiButton.icon.width()) / 2) + : emojiButton.iconPosition.x(); + const auto emojiIconTop = (emojiButton.iconPosition.y() < 0) + ? ((emojiButton.height - emojiButton.icon.height()) / 2) + : emojiButton.iconPosition.y(); + const auto &emojiIcon = emojiButton.icon[_palette]; + right += emojiButton.width; auto attachEmojiLeft = _composeArea.x() + _composeArea.width() - right; - _p->fillRect(attachEmojiLeft, controlsTop, st::historyAttachEmoji.width, st::historyAttachEmoji.height, st::historyComposeAreaBg[_palette]); + _p->fillRect(attachEmojiLeft, controlsTop, emojiButton.width, emojiButton.height, st::historyComposeAreaBg[_palette]); emojiIcon.paint(*_p, attachEmojiLeft + emojiIconLeft, controlsTop + emojiIconTop, _rect.width()); auto pen = st::historyEmojiCircleFg[_palette]->p; @@ -591,7 +593,7 @@ void Generator::paintComposeArea() { auto fieldLeft = _composeArea.x() + st::historyAttach.width; auto fieldTop = _composeArea.y() + _composeArea.height() - st::historyAttach.height + st::historySendPadding; - auto fieldWidth = _composeArea.width() - st::historyAttach.width - st::historySendSize.width() - st::historySendRight - st::historyAttachEmoji.width; + auto fieldWidth = _composeArea.width() - st::historyAttach.width - st::historySendSize.width() - st::historySendRight - emojiButton.width; auto fieldHeight = st::historySendSize.height() - 2 * st::historySendPadding; auto field = QRect(fieldLeft, fieldTop, fieldWidth, fieldHeight); _p->fillRect(field, st::historyComposeField.textBg[_palette]); diff --git a/Telegram/SourceFiles/window/window.style b/Telegram/SourceFiles/window/window.style index 3f079cacb..b2acd7367 100644 --- a/Telegram/SourceFiles/window/window.style +++ b/Telegram/SourceFiles/window/window.style @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ using "ui/basic.style"; using "ui/widgets/widgets.style"; -using "ui/chat/chat.style"; +using "chat_helpers/chat_helpers.style"; using "boxes/boxes.style"; // UserpicButton windowMinWidth: 380px;