Make toggle comments button.

This commit is contained in:
John Preston
2025-10-21 16:34:41 +04:00
parent 7bfe418c3e
commit 7afb9f1fc8
21 changed files with 217 additions and 71 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+5
View File
@@ -4155,6 +4155,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_send_anonymous_ph" = "Send anonymously...";
"lng_story_reply_ph" = "Reply privately...";
"lng_story_comment_ph" = "Comment story...";
"lng_video_stream_comment_ph" = "Comment";
"lng_video_stream_stars" = "Add Stars to highlight your comment";
"lng_video_stream_live" = "LIVE";
"lng_video_stream_watched#one" = "{count} watching";
"lng_video_stream_watched#other" = "{count} watching";
"lng_message_stars_ph#one" = "Message for {count} Star";
"lng_message_stars_ph#other" = "Message for {count} Stars";
"lng_send_text_no" = "Text not allowed.";
@@ -149,12 +149,15 @@ EmojiButton {
SendButton {
sendIconPosition: point;
sendIconFillPadding: pixels;
inner: IconButton;
stars: RoundButton;
record: icon;
recordOver: icon;
round: icon;
roundOver: icon;
editPrice: icon;
editPriceOver: icon;
sendDisabledFg: color;
}
@@ -205,12 +208,17 @@ ComposeControls {
padding: margins;
field: InputField;
fieldLeft: pixels;
send: SendButton;
attach: IconButton;
emoji: EmojiButton;
like: IconButton;
liked: icon;
editStars: IconButton;
commentsShow: IconButton;
commentsShown: icon;
commentsSkip: pixels;
starsInactiveFg: color;
starsSkip: pixels;
suggestions: EmojiSuggestions;
tabbed: EmojiPan;
tabbedHeightMin: pixels;
@@ -29,6 +29,7 @@ struct ComposeFeatures {
bool commonTabbedPanel : 1 = true;
bool recordMediaMessage : 1 = true;
bool editMessageStars : 1 = false;
bool emojiOnlyPanel : 1 = false;
};
} // namespace ChatHelpers
@@ -7,9 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "api/api_common.h"
namespace Api {
enum class SendProgressType;
struct SendOptions;
struct SendAction;
} // namespace Api
@@ -84,4 +85,10 @@ struct ReplyNextRequest {
const Direction direction;
};
enum class ToggleCommentsState {
Shown,
Hidden,
WithNew,
};
} // namespace HistoryView::Controls
@@ -898,7 +898,9 @@ ComposeControls::ComposeControls(
.show = _show,
.st = _st.tabbed,
.level = descriptor.panelsLevel,
.mode = ChatHelpers::TabbedSelector::Mode::Full,
.mode = (_features.emojiOnlyPanel
? ChatHelpers::TabbedSelector::Mode::EmojiOnly
: ChatHelpers::TabbedSelector::Mode::Full),
.features = _features,
}))
, _selector((_regularWindow && _features.commonTabbedPanel)
@@ -910,9 +912,6 @@ ComposeControls::ComposeControls(
, _like(_features.likes
? Ui::CreateChild<Ui::IconButton>(_wrap.get(), _st.like)
: nullptr)
, _editStars(_features.editMessageStars
? Ui::CreateChild<Ui::IconButton>(_wrap.get(), _st.editStars)
: nullptr)
, _attachToggle(_features.attachments
? Ui::CreateChild<Ui::IconButton>(_wrap.get(), _st.attach)
: nullptr)
@@ -1080,22 +1079,6 @@ void ComposeControls::initLikeButton() {
}
}
void ComposeControls::initEditStarsButton() {
if (_editStars) {
_editStars->setClickedCallback([=] {
_show->show(Calls::Group::MakeVideoStreamStarsBox({
.show = _show,
.current = _chosenStarsCount.value_or(0),
.save = crl::guard(_editStars, [=](int count) {
_chosenStarsCount = count;
updateSendButtonType();
}),
.name = _history ? _history->peer->name() : QString(),
}));
});
}
}
void ComposeControls::updateLikeParent() {
if (_like) {
using namespace Controls;
@@ -1131,19 +1114,8 @@ void ComposeControls::updateFeatures(ChatHelpers::ComposeFeatures features) {
}
changed = true;
}
if (was.editMessageStars != features.editMessageStars) {
if (!features.editMessageStars) {
delete base::take(_editStars);
_chosenStarsCount = std::nullopt;
} else {
_editStars = Ui::CreateChild<Ui::IconButton>(
_wrap.get(),
_st.editStars);
initEditStarsButton();
}
changed = true;
}
if (was.recordMediaMessage != features.recordMediaMessage) {
if (was.editMessageStars != features.editMessageStars
|| was.recordMediaMessage != features.recordMediaMessage) {
updateSendButtonType();
}
if (was.attachments != features.attachments) {
@@ -1158,6 +1130,9 @@ void ComposeControls::updateFeatures(ChatHelpers::ComposeFeatures features) {
updateAttachBotsMenu();
changed = true;
}
if (was.emojiOnlyPanel != features.emojiOnlyPanel) {
initFieldAutocomplete();
}
if (changed) {
updateControlsGeometry(_wrap->size());
}
@@ -1221,6 +1196,35 @@ const HistoryItemsList &ComposeControls::forwardItems() const {
return _header->forwardItems();
}
void ComposeControls::setToggleCommentsButton(
rpl::producer<ToggleCommentsState> state) {
if (!state) {
delete base::take(_commentsShown);
} else {
_commentsShown = Ui::CreateChild<Ui::IconButton>(
_wrap.get(),
_st.commentsShow);
_commentsShown->setClickedCallback([=] {
_commentsShownToggles.fire({});
});
std::move(
state
) | rpl::start_with_next([=](ToggleCommentsState value) {
const auto icon = (value == ToggleCommentsState::Shown)
? &_st.commentsShown
: nullptr;
_commentsShown->setIconOverride(icon, icon);
}, _commentsShown->lifetime());
}
updateControlsVisibility();
updateControlsGeometry(_wrap->size());
}
rpl::producer<> ComposeControls::commentsShownToggles() const {
return _commentsShownToggles.events();
}
bool ComposeControls::focus() {
if (_wrap->isHidden() || _field->isHidden()) {
return false;
@@ -1722,6 +1726,19 @@ bool ComposeControls::showRecordButton() const {
&& !isEditingMessage();
}
bool ComposeControls::showEditStarsButton() const {
return _features.editMessageStars
&& !HasSendText(_field)
&& !readyToForward()
&& !isEditingMessage()
&& !shownStarsPerMessage();
}
int ComposeControls::shownStarsPerMessage() const {
return _chosenStarsCount.value_or(
_history ? _history->peer->starsPerMessageChecked() : 0);
}
void ComposeControls::clearListenState() {
_voiceRecordBar->clearListenState();
}
@@ -1860,7 +1877,7 @@ void ComposeControls::updateSubmitSettings() {
void ComposeControls::initFieldAutocomplete() {
_emojiSuggestions = nullptr;
_autocomplete = nullptr;
if (!_history) {
if (!_history || _features.emojiOnlyPanel) {
return;
}
ChatHelpers::InitFieldAutocomplete(_autocomplete, {
@@ -2355,10 +2372,21 @@ void ComposeControls::initSendButton() {
_send->finishAnimating();
_send->clicks(
) | rpl::filter([=] {
return (_send->type() == Ui::SendButton::Type::Cancel);
}) | rpl::start_with_next([=] {
cancelInlineBot();
) | rpl::start_with_next([=] {
const auto type = _send->type();
if (type == Ui::SendButton::Type::EditPrice) {
_show->show(Calls::Group::MakeVideoStreamStarsBox({
.show = _show,
.current = _chosenStarsCount.value_or(0),
.save = crl::guard(_send, [=](int count) {
_chosenStarsCount = count;
updateSendButtonType();
}),
.name = _history ? _history->peer->name() : QString(),
}));
} else if (type == Ui::SendButton::Type::Cancel) {
cancelInlineBot();
}
}, _send->lifetime());
const auto send = crl::guard(_send.get(), [=](Api::SendOptions options) {
@@ -2764,6 +2792,8 @@ auto ComposeControls::computeSendButtonType() const {
return (video && _recordAvailability == both)
? Type::Round
: Type::Record;
} else if (showEditStarsButton()) {
return Type::EditPrice;
}
return (_mode == Mode::Normal) ? Type::Send : Type::Schedule;
}
@@ -2792,13 +2822,10 @@ void ComposeControls::updateSendButtonType() {
? _slowmodeSecondsLeft.current()
: 0;
}();
const auto peer = _history ? _history->peer.get() : nullptr;
const auto stars = _chosenStarsCount.value_or(
peer ? peer->starsPerMessageChecked() : 0);
_send->setState({
.type = type,
.slowmodeDelay = delay,
.starsToSend = stars,
.starsToSend = shownStarsPerMessage(),
});
_send->setDisabled(_sendDisabledBySlowmode.current()
&& (type == Type::Send
@@ -2812,10 +2839,16 @@ void ComposeControls::finishAnimating() {
}
void ComposeControls::updateControlsGeometry(QSize size) {
// (_attachToggle|_replaceMedia) (_sendAs) -- _inlineResults ------ _tabbedPanel -- _fieldBarCancel
// (_commentsShown) (_attachToggle|_replaceMedia) (_sendAs) -- _inlineResults ------ _tabbedPanel -- _fieldBarCancel
// (_attachDocument|_attachPhoto) _field (_ttlInfo) (_scheduled) (_silent|_botCommandStart) _tabbedSelectorToggle _send
const auto fieldWidth = size.width()
- (_commentsShown
? (_st.padding.left()
+ _commentsShown->width()
+ _st.padding.right()
+ _st.commentsSkip)
: 0)
- _st.padding.left()
- (_attachToggle ? _attachToggle->width() : 0)
- (_sendAs ? _sendAs->width() : 0)
@@ -2823,7 +2856,6 @@ void ComposeControls::updateControlsGeometry(QSize size) {
- _send->width()
- _tabbedSelectorToggle->width()
- (_likeShown ? _like->width() : 0)
- (_editStars ? _editStars->width() : 0)
- (_botCommandShown ? _botCommandStart->width() : 0)
- (_silent ? _silent->width() : 0)
- (_scheduled ? _scheduled->width() : 0)
@@ -2841,6 +2873,13 @@ void ComposeControls::updateControlsGeometry(QSize size) {
const auto buttonsTop = size.height() - _st.attach.height;
auto left = _st.padding.left();
if (_commentsShown) {
_commentsShown->moveToLeft(left, buttonsTop);
left += _commentsShown->width()
+ _st.padding.right()
+ _st.commentsSkip
+ _st.padding.left();
}
if (_replaceMedia) {
_replaceMedia->moveToLeft(left, buttonsTop);
}
@@ -2877,10 +2916,6 @@ void ComposeControls::updateControlsGeometry(QSize size) {
}
}
}
if (_editStars) {
_editStars->moveToRight(right, buttonsTop);
right += _editStars->width();
}
if (_botCommandStart) {
_botCommandStart->moveToRight(right, buttonsTop);
if (_botCommandShown) {
@@ -2912,9 +2947,6 @@ void ComposeControls::updateControlsVisibility() {
if (_like) {
_like->setVisible(_likeShown);
}
if (_editStars) {
_editStars->show();
}
if (_ttlInfo) {
_ttlInfo->show();
}
@@ -2930,6 +2962,9 @@ void ComposeControls::updateControlsVisibility() {
if (_scheduled) {
_scheduled->setVisible(!isEditingMessage());
}
if (_commentsShown) {
_commentsShown->show();
}
}
bool ComposeControls::updateLikeShown() {
@@ -3047,13 +3082,19 @@ void ComposeControls::updateAttachBotsMenu() {
void ComposeControls::paintBackground(QPainter &p, QRect full, QRect clip) {
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);
const auto r = _st.radius;
if (_commentsShown) {
p.drawRoundedRect(_commentsShown->geometry().marginsAdded(
{ _st.padding.left(), 0, _st.padding.right(), 0 }), r, r);
full.setLeft(full.left()
+ _commentsShown->width()
+ _st.padding.left()
+ _st.padding.right()
+ _st.commentsSkip);
}
p.drawRoundedRect(full, _st.radius, _st.radius);
} else {
p.fillRect(clip, _st.bg);
@@ -137,6 +137,7 @@ public:
using ReplyNextRequest = Controls::ReplyNextRequest;
using FieldHistoryAction = Ui::InputField::HistoryAction;
using Mode = ComposeControlsMode;
using ToggleCommentsState = Controls::ToggleCommentsState;
ComposeControls(
not_null<Ui::RpWidget*> parent,
@@ -159,6 +160,9 @@ public:
[[nodiscard]] rpl::producer<int> height() const;
[[nodiscard]] int heightCurrent() const;
void setToggleCommentsButton(rpl::producer<ToggleCommentsState> state);
[[nodiscard]] rpl::producer<> commentsShownToggles() const;
bool focus();
[[nodiscard]] bool focused() const;
[[nodiscard]] rpl::producer<bool> focusedValue() const;
@@ -284,7 +288,6 @@ private:
void initVoiceRecordBar();
void initKeyHandler();
void initLikeButton();
void initEditStarsButton();
void updateLikeParent();
void updateSubmitSettings();
void updateSendButtonType();
@@ -318,7 +321,9 @@ private:
void createTabbedPanel();
void setTabbedPanel(std::unique_ptr<ChatHelpers::TabbedPanel> panel);
bool showRecordButton() const;
[[nodiscard]] bool showRecordButton() const;
[[nodiscard]] bool showEditStarsButton() const;
[[nodiscard]] int shownStarsPerMessage() const;
bool updateBotCommandShown();
bool updateLikeShown();
@@ -393,9 +398,10 @@ private:
const std::shared_ptr<Ui::SendButton> _send;
Ui::IconButton *_like = nullptr;
Ui::IconButton *_editStars = nullptr;
std::optional<int> _chosenStarsCount;
Ui::IconButton *_commentsShown = nullptr;
Ui::IconButton *_attachToggle = nullptr;
Ui::AbstractButton *_starsReaction = nullptr;
std::unique_ptr<Ui::IconButton> _replaceMedia;
const not_null<Ui::EmojiButton*> _tabbedSelectorToggle;
rpl::producer<QString> _fieldCustomPlaceholder;
@@ -434,6 +440,7 @@ private:
rpl::event_stream<ReplyNextRequest> _replyNextRequests;
rpl::event_stream<> _focusRequests;
rpl::event_stream<> _showScheduledRequests;
rpl::event_stream<> _commentsShownToggles;
rpl::variable<bool> _recording;
rpl::variable<bool> _hasSendText;
@@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_stories.h"
#include "history/view/reactions/history_view_reactions_strip.h"
#include "history/view/controls/compose_controls_common.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "media/stories/media_stories_caption_full_view.h"
@@ -452,7 +453,7 @@ void Controller::initLayout() {
QSize(contentWidth, headerHeight));
}
layout.controlsWidth = std::max(
layout.content.width(),
layout.content.width() + st::storiesControlsExtend * 2,
st::storiesControlsMinWidth);
layout.controlsBottomPosition = QPoint(
(size.width() - layout.controlsWidth) / 2,
@@ -1701,6 +1702,20 @@ void Controller::unfocusReply() {
_wrap->setFocus();
}
rpl::producer<CommentsState> Controller::commentsStateValue() const {
return _commentsState.value();
}
void Controller::setCommentsShownToggles(rpl::producer<> toggles) {
_commentsState = std::move(
toggles
) | rpl::map([=] {
return (_commentsState.current() == CommentsState::Shown)
? CommentsState::Hidden
: CommentsState::Shown;
});
}
void Controller::shareRequested() {
const auto show = _delegate->storiesShow();
if (auto box = PrepareShareBox(show, _shown, true)) {
@@ -33,6 +33,10 @@ struct FileOrigin;
class DocumentMedia;
} // namespace Data
namespace HistoryView::Controls {
enum class ToggleCommentsState;
} // namespace HistoryView::Controls
namespace HistoryView::Reactions {
struct ChosenReaction;
enum class AttachSelectorResult;
@@ -75,6 +79,8 @@ enum class ReactionsMode;
class StoryAreaView;
struct RepostClickHandler;
using CommentsState = HistoryView::Controls::ToggleCommentsState;
enum class HeaderLayout {
Normal,
Outside,
@@ -170,6 +176,9 @@ public:
[[nodiscard]] const Data::StoryViews &views(int limit, bool initial);
[[nodiscard]] rpl::producer<> moreViewsLoaded() const;
[[nodiscard]] rpl::producer<CommentsState> commentsStateValue() const;
void setCommentsShownToggles(rpl::producer<> toggles);
void unfocusReply();
void shareRequested();
void deleteRequested();
@@ -320,6 +329,8 @@ private:
mutable std::vector<ActiveArea> _areas;
mutable rpl::variable<bool> _weatherInCelsius;
rpl::variable<CommentsState> _commentsState;
std::vector<CachedSource> _cachedSourcesList;
int _cachedSourceIndex = -1;
bool _showingUnreadSources = false;
@@ -115,6 +115,7 @@ namespace {
.autocompleteCommands = false,
.recordMediaMessage = !videoStream,
.editMessageStars = videoStream,
.emojiOnlyPanel = videoStream,
};
}
@@ -836,6 +837,11 @@ void ReplyArea::show(
_data = data;
if (streamChanged) {
_controls->updateFeatures(Features(_data.videoStream));
_controls->setToggleCommentsButton(_data.videoStream
? _controller->commentsStateValue()
: nullptr);
_controller->setCommentsShownToggles(
_controls->commentsShownToggles());
}
if (!peerChanged) {
if (_data.peer) {
@@ -457,6 +457,7 @@ storiesHeaderRepostWidthMin: 40px;
storiesShadowTop: icon{{ "mediaview/shadow_bottom-flip_vertical", windowShadowFg }};
storiesShadowBottom: mediaviewShadowBottom;
storiesControlsMinWidth: 280px;
storiesControlsExtend: 4px;
storiesFieldMargin: margins(0px, 18px, 0px, 12px);
storiesSideSkip: 145px;
storiesCaptionFull: FlatLabel(defaultFlatLabel) {
@@ -479,24 +480,27 @@ storiesComposeRipple: RippleAnimation(defaultRippleAnimation) {
color: groupCallMembersBgRipple;
}
storiesAttach: IconButton(historyAttach) {
width: 42px;
height: 42px;
icon: icon {{ "chat/input_attach", storiesComposeGrayIcon }};
iconOver: icon {{ "chat/input_attach", storiesComposeGrayIcon }};
rippleAreaPosition: point(2px, 1px);
rippleAreaPosition: point(1px, 1px);
ripple: storiesComposeRippleLight;
}
storiesLike: IconButton(storiesAttach) {
icon: icon {{ "chat/input_like", storiesComposeGrayIcon }};
iconOver: icon {{ "chat/input_like", storiesComposeGrayIcon }};
}
storiesEditStars: IconButton(storiesAttach) {
icon: icon{{ "chat/input_paid", storiesComposeGrayIcon }};
iconOver: icon{{ "chat/input_paid", storiesComposeGrayIcon }};
}
storiesRecordVoice: icon {{ "chat/input_record", storiesComposeGrayIcon }};
storiesRecordVoiceOver: icon {{ "chat/input_record", storiesComposeGrayIcon }};
storiesRecordRound: icon {{ "chat/input_video", storiesComposeGrayIcon }};
storiesRecordRoundOver: icon {{ "chat/input_video", storiesComposeGrayIcon }};
storiesEditPrice: icon{{ "chat/input_paid", storiesComposeGrayIcon }};
storiesEditPriceOver: icon{{ "chat/input_paid", storiesComposeGrayIcon }};
//storiesEditStars: IconButton(storiesAttach) {
// icon: storiesEditPrice;
// iconOver: storiesEditPriceOver;
//}
storiesRemoveSet: IconButton(stickerPanRemoveSet) {
icon: icon {{ "simple_close", storiesComposeGrayIcon }};
iconOver: icon {{ "simple_close", storiesComposeGrayIcon }};
@@ -689,8 +693,9 @@ storiesBoxInputField: InputField(defaultComposeFilesField) {
storiesComposeControls: ComposeControls(defaultComposeControls) {
bg: storiesComposeBg;
radius: 21px;
padding: margins(10px, 8px, 2px, 6px);
padding: margins(1px, 8px, 1px, 6px);
field: InputField(historyComposeField) {
textMargins: margins(2px, 0px, 2px, 0px);
textFg: storiesComposeWhiteText;
textBg: storiesComposeBg;
placeholderFg: storiesComposeGrayText;
@@ -698,23 +703,38 @@ storiesComposeControls: ComposeControls(defaultComposeControls) {
placeholderFgError: storiesComposeGrayText;
menu: storiesPopupMenu;
}
fieldLeft: 10px;
send: SendButton(historySend) {
sendIconPosition: point(10px, 10px);
sendIconPosition: point(9px, 9px);
sendIconFillPadding: 5px;
inner: IconButton(storiesAttach) {
icon: icon {{ "chat/input_send", storiesComposeBlue }};
iconOver: icon {{ "chat/input_send", storiesComposeBlue }};
width: 42px;
height: 42px;
icon: icon {{ "chat/input_send_round", windowFgActive }};
iconOver: icon {{ "chat/input_send_round", windowFgActive }};
rippleAreaSize: 40px;
rippleAreaPosition: point(1px, 1px);
}
record: storiesRecordVoice;
recordOver: storiesRecordVoiceOver;
round: storiesRecordRound;
roundOver: storiesRecordRoundOver;
editPrice: storiesEditPrice;
editPriceOver: storiesEditPriceOver;
sendDisabledFg: storiesComposeGrayText;
}
attach: storiesAttach;
emoji: storiesAttachEmoji;
like: storiesLike;
liked: icon{};
editStars: storiesEditStars;
commentsShow: IconButton(storiesAttach) {
icon: icon {{ "chat/input_comments_expand", storiesComposeGrayIcon }};
iconOver: icon {{ "chat/input_comments_expand", storiesComposeGrayIcon }};
}
commentsShown: icon {{ "chat/input_comments_hide", storiesComposeGrayIcon }};
commentsSkip: 8px;
starsInactiveFg: storiesComposeGrayIcon;
starsSkip: 8px;
suggestions: EmojiSuggestions(defaultEmojiSuggestions) {
dropdown: InnerDropdown(emojiSuggestionsDropdown) {
animation: PanelAnimation(defaultPanelAnimation) {
@@ -142,6 +142,7 @@ void SendButton::paintEvent(QPaintEvent *e) {
break;
case Type::Schedule: paintSchedule(p, over); break;
case Type::Slowmode: paintSlowmode(p); break;
case Type::EditPrice: paintEditPrice(p, over); break;
}
}
@@ -194,6 +195,14 @@ void SendButton::paintCancel(QPainter &p, bool over) {
void SendButton::paintSend(QPainter &p, bool over) {
const auto &sendIcon = over ? _st.inner.iconOver : _st.inner.icon;
if (const auto padding = _st.sendIconFillPadding; padding > 0) {
auto hq = PainterHighQualityEnabler(p);
p.setPen(Qt::NoPen);
p.setBrush(st::windowBgActive);
p.drawEllipse(
QRect(_st.sendIconPosition, sendIcon.size()).marginsAdded(
{ padding, padding, padding, padding }));
}
if (isDisabled()) {
const auto color = st::historyRecordVoiceFg->c;
sendIcon.paint(p, _st.sendIconPosition, width(), color);
@@ -309,4 +318,18 @@ QPoint SendButton::prepareRippleStartPosition() const {
return real - QPoint((width() - size) / 2, y);
}
void SendButton::paintEditPrice(QPainter &p, bool over) {
if (!isDisabled()) {
paintRipple(
p,
(width() - _st.inner.rippleAreaSize) / 2,
_st.inner.rippleAreaPosition.y());
}
const auto &icon = (isDisabled() || !over)
? _st.editPrice
: _st.editPriceOver;
icon.paintInCenter(p, rect());
}
} // namespace Ui
@@ -29,6 +29,7 @@ public:
Round,
Cancel,
Slowmode,
EditPrice,
};
struct State {
Type type = Type::Send;
@@ -71,6 +72,7 @@ private:
void paintSend(QPainter &p, bool over);
void paintSchedule(QPainter &p, bool over);
void paintSlowmode(QPainter &p);
void paintEditPrice(QPainter &p, bool over);
void paintStarsToSend(QPainter &p, bool over);
const style::SendButton &_st;