From 77ebdd3576201dcb56e6c6bd04f48a7efb308ffd Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 16 Aug 2019 18:08:51 +0300 Subject: [PATCH] Send from scheduled messages section. --- .../Resources/icons/send_control_schedule.png | Bin 0 -> 743 bytes .../icons/send_control_schedule@2x.png | Bin 0 -> 1586 bytes .../icons/send_control_schedule@3x.png | Bin 0 -> 2360 bytes Telegram/SourceFiles/boxes/confirm_box.cpp | 16 +++- Telegram/SourceFiles/boxes/confirm_box.h | 6 +- Telegram/SourceFiles/history/history.style | 2 + .../view/history_view_compose_controls.cpp | 74 +++++++++++++++ .../view/history_view_compose_controls.h | 8 ++ .../view/history_view_schedule_box.cpp | 7 +- .../view/history_view_scheduled_section.cpp | 88 ++++++++++++++++++ .../view/history_view_scheduled_section.h | 11 +++ Telegram/SourceFiles/ui/special_buttons.cpp | 18 ++++ Telegram/SourceFiles/ui/special_buttons.h | 2 + 13 files changed, 224 insertions(+), 8 deletions(-) create mode 100644 Telegram/Resources/icons/send_control_schedule.png create mode 100644 Telegram/Resources/icons/send_control_schedule@2x.png create mode 100644 Telegram/Resources/icons/send_control_schedule@3x.png diff --git a/Telegram/Resources/icons/send_control_schedule.png b/Telegram/Resources/icons/send_control_schedule.png new file mode 100644 index 0000000000000000000000000000000000000000..f1d0b922d204846c4b46ae13358ffc1838529fbe GIT binary patch literal 743 zcmV?P)NklEHSc7^ za=9EWmrLQmX0v%jZY1V=Mbqh2EYNH=l_Zi(Kf`u7912@}xkcEG#I;&Y7>>td^7(v@ zh~Wsx<(Fg6_0HX%wZzeAlz6s^f&IHTLihuLfacx3{{9|ehalnL$i41%uO%**%fjI8 z?acs260O&3dU<&<=oAb8PB>m_D!i6>Fc=8pVzFodKRrFsd_Je`c1!Vi+@RN!!%+yY za}`!gyjraUI1-7dz?9GDh5qyNlak4#5+fbJRzY}^QQ@@2=kr;BJsyt=EZ)hQ-R*Xi z$z)7%sB_5abW&lo!~j8HBt6&9i9~{~*Q>xCk4H+SQcCRe^RvL%B1Tvs`i$0-HyRCr z!==?~DT%E@Z8#QZvl-`LESt@W+3ZrSR@wXeyHHCTJyx#4n~`26o;BVg^&!|tuC*Kp zWjdWEm&>KZ$y~5iPAGO1Jp@hQ5xJS(aRb3ZXmb#>J(I3u>Cm@YCWz74(cmFy_)f@y z{q`XNa-63)+93FHJ7EV#9uD6+7UjNyTz)wmK(e3>qD)Zdf8|F&k|XTcbD3~(z)YO{ z`nYZce6kk4cdSq-h`|pC77PZ30Y5Mp>bTSCh_T=Atrxm!Z4=vC%>l^Jxg6O35%k|9 Z{sOLd&BsNdQ!D@g002ovPDHLkV1f=`V^aVC literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/send_control_schedule@2x.png b/Telegram/Resources/icons/send_control_schedule@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..b4debc667af670e80720fd1ad6a7bf4f7ce7b1f8 GIT binary patch literal 1586 zcmV-22F>}2P)0};Vc6GamR4@5WANJYU^6cGb8(`Zo; zOgsWHP(f4>6og&a#S0Al0Un5`XdoVV1zxrFHP&oZO;30A%=E16&V!lis($s}`|5o4 zsv`&?l>Po2iu`YoegF*v{?~gv+{57>{>NJ2zZ=rgZg*f!O%0itm>}`-@rJ65j0_`v ze}5MGgU*&&p=>l#41YroUeQ)a(DU0hty@$qq5QBmQRP40n3 zLk2?Y>+7_*xH#CrKQCb3Sc{8`G$$t~D8M5=hO;rR-1uWgOJXA;ppuZ3loayi%NLTB zl|{0%vq@!TC8@2gC247C5amimyfZgcVe(Sa*VjjHZ*S@D?k>&E&GmZE>x+vPo_V=l zT2fL%H#avWz&tZDGNLWVM2~a8Jv}{Kw~@}y&iXWfZA%nD@x!x;0hVPQ9UT-st5N_x z?F?{JQxj!-sHA^xZqCwZryy1Ss;Vl==CGs_jo|0jr4JYio}Zs3#aCBXmP1-K-rszF ze!dsz>+5TOR&PDPv9Ym~c|{V~r>7^1x#lkjr}fxM?lruzWjU0i2e`AdQv!=2_4Vsl zr^*86$DCHlp>tvnnC*=eLsz8X;o*Rdci1x?ed_AHv9aNKry>3Z*LyJn7cZ?3*n=qqn>(rW^SdfQMP>W$V9>^OH;lz;Ks&AQ7+xy-nKP{ zw{&`Xy0n!{PEOLu$Vlz_T#i`^HxyG#B%Q^}HsVoMR>t)Gp|!QOKN*`Rw$PD*fdLO! zTU#5Mo}MOAQBj^Ue;?RLGXe%;eH=b?$g;&*6hdr7T3uaj$@xid2}wlZydn9X6S(Jn79rMz8+d1i$9-V$4VeLY!NSRiq6aZvFP_4}LTR<E*dh{awc`JHXAKy`L?jF&4WXtyY>v@~ zhX+xd=NaxIwi+k0{Tb4>ixy(XBIzy+VjcbrSOVky=NCp&<@t|fp=#;AE12gh6_IPNN+ z(>!x8X=`gM9UB{?-QC^P>FV#=;Q>I{WtfQ9h#NZv7;Jvmj)yQ5hijEW8Ou@|%k=;N z6yjn_B}YT=-9k);wE!Hqc$nQ8+=cgQZ& zIA~m1nh{peU~E~Cp{~YUU&yaZIcT)9S?j|vI0o>BoVcOjMIF_t;6R}(fSxthnSeie zz+r*~w$N&HU07*qoM6N<$f}+y?#{d8T literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/send_control_schedule@3x.png b/Telegram/Resources/icons/send_control_schedule@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..e94d8ef29083c5c281dd70f3c1110199dbfb2957 GIT binary patch literal 2360 zcmaKuc{~%0AICSxD7k(aWv-aiL*tRyW;BmujvS5TmQc%m)|j%~w`mBg+($X8@mTH< z#^WZ*kr6X;ELUji=l9?5ujh~N_w)Jd{rY_W_`F`gI4}X25{l44UTHAJo zu$ikvXg#3be7L?z(IHGYwB`EW8F28vPZs%Ww7eur6bE~EL_LtcK z3=9;q#D(ZAwuGw7qCR48XRO>(5$V6f8rcP*R0`bTh@S`B%a&oR;d6*boc(a%FMmLF z_}Zt}u0cOGW`h{-AGZR3(}=djv8apM+S)CTXUA(rK(+AGB2_Bp<|4b1QJ(6!VYxr? zYzAFE7amxYqwbkxSBJ~UL59AnsHuE0;(VM(RnvD0dWoejbhid&Emm#pNkB%DUQLUU`M~)Wxx;kX8nK)igA+fA~vM-U-Wpq{*9XWjO zVK|Q_?mTY$i(KSC1nlaD4I!seZbtyr`=}^N>EIi;&c&`|i7dM{@R%_WBBg~+mpTSV z96SL_#S-?`0ztOoX!7dL%9zqrk#}q<#7^$#?zd$ulY`bTP`+7%Tk5Xy=}tKdi@iTO z5hn;Kx@WGm-}><9Gxo~L4hJoZ!doeM*DZ9;m`b|sHuJq9)91_1%MP1mtBmxW(7r$0 z7}_3Hg*@{@SK5tl1=r*!9OCU=8L`hUv@mK2+h#KKK$AJOWN~_xK*K70;G+zy+L7j^ zryICnpiitqKfY3Q`G}Da#MrIn4u4MsZVgbhREEXCfx8d3r|jRFT9dD_sfp5Qe?K(z^GQ*i z_sE?mnSU*ul-6Nr%hDnw5R5sX=dWL21+!%`&mW49?&6cY2 zJB^YRs?4*gIY7ZVbqs=sr3j~){p1|fI=u^UdmWzLcgK%ALvnV<4N=ffobbh_$>`+S zCqhYa!m={!!`{Fr3|n})07z1vYI^V*&)E+&4_-_Ims{qG zE8A98G~6_3U!SIZz9Sl{rRZMJlXA9m3;%QPlB1t>!tn3xOOBJ6ULe%sIa1NK+M(;q z1N(#zCTVoe*CgwIQkW1JJ}InA`E^S=Y<1dua!X)N+ihauo8WeD-sJg6E|gQfzKU1Jci4Ytopi_obw6B@T^)aU5TG z$6S@9+|#)g9zYMZ%%>+!+QPHq+xX*HqJoMPti9S#Ko2x4FZI-OAn(fHVnD+gNy-EG zdRRg?`s*zrjHVIlQ(Dd1- zTgf}DC7VW&23^u)ss?NGR0hP(m`R2D-_RQOW+$=$LOntO95e=jt!NG<`MCm~N5LHm zjV=g{Lq&xaD;f)(A5B!9svT=;p_t0W=}oEsivFu+I2E0Hdd{M=eY>YAqrcab#e8uLWFy);p(o&!kL9JV!neFZkNDyNou;-d5R@{k1lD2Ag&jqe&R z)Gz+z(J=*RKYU+)-DO-FI^3-@1`s~8{N)PKLNCdVYyG98X@OaR&N)V+Iil!aj1KTf aHZMl{yDR9O)$uC?Ffp_+sQK$w)PDgu4uM$! literal 0 HcmV?d00001 diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index 088c4034ed..4f8699f378 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -543,10 +543,11 @@ void DeleteMessagesBox::prepare() { : tr::lng_selected_delete_sure(tr::now, lt_count, _ids.size()); if (const auto peer = checkFromSinglePeer()) { auto count = int(_ids.size()); - if (auto revoke = revokeText(peer)) { + if (hasScheduledMessages()) { + } else if (auto revoke = revokeText(peer)) { _revoke.create(this, revoke->checkbox, false, st::defaultBoxCheckbox); appendDetails(std::move(revoke->description)); - } else if (peer && peer->isChannel()) { + } else if (peer->isChannel()) { if (peer->isMegagroup()) { appendDetails({ tr::lng_delete_for_everyone_hint(tr::now, lt_count, count) }); } @@ -581,6 +582,17 @@ void DeleteMessagesBox::prepare() { setDimensions(st::boxWidth, fullHeight); } +bool DeleteMessagesBox::hasScheduledMessages() const { + for (const auto fullId : std::as_const(_ids)) { + if (const auto item = _session->data().message(fullId)) { + if (item->isScheduled()) { + return true; + } + } + } + return false; +} + PeerData *DeleteMessagesBox::checkFromSinglePeer() const { auto result = (PeerData*)nullptr; for (const auto fullId : std::as_const(_ids)) { diff --git a/Telegram/SourceFiles/boxes/confirm_box.h b/Telegram/SourceFiles/boxes/confirm_box.h index e1fe143143..3d21f5bc51 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.h +++ b/Telegram/SourceFiles/boxes/confirm_box.h @@ -176,8 +176,10 @@ private: TextWithEntities description; }; void deleteAndClear(); - PeerData *checkFromSinglePeer() const; - std::optional revokeText(not_null peer) const; + [[nodiscard]] PeerData *checkFromSinglePeer() const; + [[nodiscard]] bool hasScheduledMessages() const; + [[nodiscard]] std::optional revokeText( + not_null peer) const; const not_null _session; diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index 050ff6c517..9bc5a7d7b6 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -220,6 +220,8 @@ historySendIcon: icon {{ "send_control_send", historySendIconFg }}; historySendIconOver: icon {{ "send_control_send", historySendIconFgOver }}; historySendIconPosition: point(11px, 11px); historySendSize: size(46px, 46px); +historyScheduleIcon: icon {{ "send_control_schedule", historyComposeAreaBg }}; +historyScheduleIconPosition: point(8px, 8px); historyEditSaveIcon: icon {{ "send_control_save", historySendIconFg, point(3px, 7px) }}; historyEditSaveIconOver: icon {{ "send_control_save", historySendIconFgOver, point(3px, 7px) }}; diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp index 90b2fcab02..b2e7f69ba7 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp @@ -79,6 +79,10 @@ rpl::producer<> ComposeControls::cancelRequests() const { return _cancelRequests.events(); } +rpl::producer<> ComposeControls::sendRequests() const { + return _send->clicks() | rpl::map([] { return rpl::empty_value(); }); +} + void ComposeControls::showStarted() { if (_inlineResults) { _inlineResults->hideFast(); @@ -103,9 +107,41 @@ void ComposeControls::showForGrab() { showFinished(); } +TextWithTags ComposeControls::getTextWithAppliedMarkdown() const { + return _field->getTextWithAppliedMarkdown(); +} + +void ComposeControls::clear() { + setText(TextWithTags()); +} + +void ComposeControls::setText(const TextWithTags &textWithTags) { + //_textUpdateEvents = events; + _field->setTextWithTags(textWithTags, Ui::InputField::HistoryAction::Clear/*fieldHistoryAction*/); + auto cursor = _field->textCursor(); + cursor.movePosition(QTextCursor::End); + _field->setTextCursor(cursor); + //_textUpdateEvents = TextUpdateEvent::SaveDraft + // | TextUpdateEvent::SendTyping; + + //previewCancel(); + //_previewCancelled = false; +} + +void ComposeControls::hidePanelsAnimated() { + //_fieldAutocomplete->hideAnimated(); + if (_tabbedPanel) { + _tabbedPanel->hideAnimated(); + } + if (_inlineResults) { + _inlineResults->hideAnimated(); + } +} + void ComposeControls::init() { initField(); initTabbedSelector(); + initSendButton(); _wrap->sizeValue( ) | rpl::start_with_next([=](QSize size) { @@ -182,6 +218,44 @@ void ComposeControls::initTabbedSelector() { }, wrap->lifetime()); } +void ComposeControls::initSendButton() { + updateSendButtonType(); + _send->finishAnimating(); +} + +void ComposeControls::updateSendButtonType() { + using Type = Ui::SendButton::Type; + const auto type = [&] { + //if (_editMsgId) { + // return Type::Save; + //} else if (_isInlineBot) { + // return Type::Cancel; + //} else if (showRecordButton()) { + // return Type::Record; + //} + return Type::Schedule; + }(); + _send->setType(type); + + const auto delay = [&] { + return /*(type != Type::Cancel && type != Type::Save && _peer) + ? _peer->slowmodeSecondsLeft() + : */0; + }(); + _send->setSlowmodeDelay(delay); + //_send->setDisabled(_peer + // && _peer->slowmodeApplied() + // && (_history->latestSendingMessage() != nullptr) + // && (type == Type::Send || type == Type::Record)); + + //if (delay != 0) { + // App::CallDelayed( + // kRefreshSlowmodeLabelTimeout, + // this, + // [=] { updateSendButtonType(); }); + //} +} + void ComposeControls::updateControlsGeometry(QSize size) { // _attachToggle -- _inlineResults ------ _tabbedPanel -- _fieldBarCancel // (_attachDocument|_attachPhoto) _field _tabbedSelectorToggle _send diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.h b/Telegram/SourceFiles/history/view/history_view_compose_controls.h index d251d8c1d1..e9aeb844c4 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.h +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.h @@ -64,6 +64,7 @@ public: void focus(); [[nodiscard]] rpl::producer<> cancelRequests() const; + [[nodiscard]] rpl::producer<> sendRequests() const; void pushTabbedSelectorToThirdSection(const Window::SectionShow ¶ms); bool returnTabbedSelector(); @@ -72,10 +73,16 @@ public: void showStarted(); void showFinished(); + [[nodiscard]] TextWithTags getTextWithAppliedMarkdown() const; + void clear(); + void hidePanelsAnimated(); + private: void init(); void initField(); void initTabbedSelector(); + void initSendButton(); + void updateSendButtonType(); void updateHeight(); void updateControlsGeometry(QSize size); void updateOuterGeometry(QRect rect); @@ -85,6 +92,7 @@ private: void toggleTabbedSelectorMode(); void createTabbedPanel(); void setTabbedPanel(std::unique_ptr panel); + void setText(const TextWithTags &text); const not_null _parent; const not_null _window; diff --git a/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp b/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp index faad6b7be6..8843c8e26e 100644 --- a/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp +++ b/Telegram/SourceFiles/history/view/history_view_schedule_box.cpp @@ -507,9 +507,7 @@ void TimeInput::startBorderAnimation() { } // namespace TimeId DefaultScheduleTime() { - const auto result = base::unixtime::now() + 3600; - const auto time = base::unixtime::parse(result).time(); - return result - (time.minute() % 5) * 60 - time.second(); + return base::unixtime::now() + 600; } void ScheduleBox( @@ -597,7 +595,8 @@ void ScheduleBox( timeInput->showError(); return; } - result.scheduled = QDateTime(date->current(), time).toTime_t(); + result.scheduled = base::unixtime::serialize( + QDateTime(date->current(), time)); if (result.scheduled <= base::unixtime::now() + kMinimalSchedule) { timeInput->showError(); return; diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 7c12f6910c..0987bdd223 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -10,11 +10,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/view/history_view_compose_controls.h" #include "history/view/history_view_top_bar_widget.h" #include "history/view/history_view_list_widget.h" +#include "history/view/history_view_schedule_box.h" #include "history/history.h" #include "history/history_item.h" #include "ui/widgets/scroll_area.h" #include "ui/widgets/shadow.h" #include "ui/special_buttons.h" +#include "api/api_common.h" +#include "apiwrap.h" #include "boxes/confirm_box.h" #include "window/window_session_controller.h" #include "window/window_peer_menu.h" @@ -103,6 +106,58 @@ void ScheduledWidget::setupComposeControls() { ) | rpl::start_with_next([=] { controller()->showBackFromStack(); }, lifetime()); + + _composeControls->sendRequests( + ) | rpl::start_with_next([=] { + send(); + }, lifetime()); +} + +void ScheduledWidget::send() { + if (_composeControls->getTextWithAppliedMarkdown().text.isEmpty()) { + return; + } + const auto callback = crl::guard(this, [=](Api::SendOptions options) { + send(options); + }); + Ui::show( + Box(ScheduleBox, callback, DefaultScheduleTime()), + LayerOption::KeepOther); +} + +void ScheduledWidget::send(Api::SendOptions options) { + const auto webPageId = 0;/* _previewCancelled + ? CancelledWebPageId + : ((_previewData && _previewData->pendingTill >= 0) + ? _previewData->id + : WebPageId(0));*/ + + auto message = ApiWrap::MessageToSend(_history); + message.textWithTags = _composeControls->getTextWithAppliedMarkdown(); + message.action.options = options; + //message.action.replyTo = replyToId(); + message.webPageId = webPageId; + + //const auto error = GetErrorTextForForward( + // _peer, + // _toForward, + // message.textWithTags); + //if (!error.isEmpty()) { + // ShowErrorToast(error); + // return; + //} + + session().api().sendMessage(std::move(message)); + + _composeControls->clear(); + //_saveDraftText = true; + //_saveDraftStart = crl::now(); + //onDraftSave(); + + _composeControls->hidePanelsAnimated(); + + //if (_previewData && _previewData->pendingTill) previewCancel(); + _composeControls->focus(); } void ScheduledWidget::setupScrollDownButton() { @@ -402,9 +457,42 @@ rpl::producer ScheduledWidget::listSource( data->scheduledMessages().updates(_history) ) | rpl::map([=] { return data->scheduledMessages().list(_history); + }) | rpl::after_next([=](const Data::MessagesSlice &slice) { + highlightSingleNewMessage(slice); }); } +void ScheduledWidget::highlightSingleNewMessage( + const Data::MessagesSlice &slice) { + const auto guard = gsl::finally([&] { _lastSlice = slice; }); + if (_lastSlice.ids.empty() + || (slice.ids.size() != _lastSlice.ids.size() + 1)) { + return; + } + auto firstDifferent = 0; + for (; firstDifferent != _lastSlice.ids.size(); ++firstDifferent) { + if (slice.ids[firstDifferent] != _lastSlice.ids[firstDifferent]) { + break; + } + ++firstDifferent; + } + auto lastDifferent = slice.ids.size() - 1; + for (; lastDifferent != firstDifferent;) { + if (slice.ids[lastDifferent] != _lastSlice.ids[lastDifferent - 1]) { + break; + } + --lastDifferent; + } + if (firstDifferent != lastDifferent) { + return; + } + const auto newId = slice.ids[firstDifferent]; + if (const auto item = session().data().message(newId)) { + // _highlightMessageId = newId; + showAtPosition(item->position()); + } +} + bool ScheduledWidget::listAllowsMultiSelect() { return true; } diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h index 38b6c98e57..d649d173c1 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h @@ -10,9 +10,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/section_widget.h" #include "window/section_memento.h" #include "history/view/history_view_list_widget.h" +#include "data/data_messages.h" class History; +namespace Api { +struct SendOptions; +} // namespace Api + namespace Notify { struct PeerUpdate; } // namespace Notify @@ -125,6 +130,10 @@ private: void confirmDeleteSelected(); void clearSelected(); + void send(); + void send(Api::SendOptions options); + void highlightSingleNewMessage(const Data::MessagesSlice &slice); + const not_null _history; object_ptr _scroll; QPointer _inner; @@ -141,6 +150,8 @@ private: bool _scrollDownIsShown = false; object_ptr _scrollDown; + Data::MessagesSlice _lastSlice; + }; class ScheduledMemento : public Window::SectionMemento { diff --git a/Telegram/SourceFiles/ui/special_buttons.cpp b/Telegram/SourceFiles/ui/special_buttons.cpp index fa5aba2bba..0fc52e7642 100644 --- a/Telegram/SourceFiles/ui/special_buttons.cpp +++ b/Telegram/SourceFiles/ui/special_buttons.cpp @@ -369,6 +369,7 @@ void SendButton::paintEvent(QPaintEvent *e) { case Type::Save: paintSave(p, over); break; case Type::Cancel: paintCancel(p, over); break; case Type::Send: paintSend(p, over); break; + case Type::Schedule: paintSchedule(p, over); break; case Type::Slowmode: paintSlowmode(p); break; } } @@ -426,6 +427,23 @@ void SendButton::paintSend(Painter &p, bool over) { } } +void SendButton::paintSchedule(Painter &p, bool over) { + { + PainterHighQualityEnabler hq(p); + p.setPen(Qt::NoPen); + p.setBrush(over ? st::historySendIconFgOver : st::historySendIconFg); + p.drawEllipse( + st::historyScheduleIconPosition.x(), + st::historyScheduleIconPosition.y(), + st::historyScheduleIcon.width(), + st::historyScheduleIcon.height()); + } + st::historyScheduleIcon.paint( + p, + st::historyScheduleIconPosition, + width()); +} + void SendButton::paintSlowmode(Painter &p) { p.setFont(st::normalFont); p.setPen(st::windowSubTextFg); diff --git a/Telegram/SourceFiles/ui/special_buttons.h b/Telegram/SourceFiles/ui/special_buttons.h index 4261615c21..b297703d30 100644 --- a/Telegram/SourceFiles/ui/special_buttons.h +++ b/Telegram/SourceFiles/ui/special_buttons.h @@ -82,6 +82,7 @@ public: enum class Type { Send, + Schedule, Save, Record, Cancel, @@ -129,6 +130,7 @@ private: void paintSave(Painter &p, bool over); void paintCancel(Painter &p, bool over); void paintSend(Painter &p, bool over); + void paintSchedule(Painter &p, bool over); void paintSlowmode(Painter &p); Type _type = Type::Send;