From 6ed7615653752cefa8e5a07557239507bcb236fd Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 11 Oct 2020 14:49:23 +0300 Subject: [PATCH] Removed redundant methods for record from SendButton. --- .../history_view_voice_record_bar.cpp | 5 --- Telegram/SourceFiles/ui/chat/chat.style | 2 -- .../SourceFiles/ui/controls/send_button.cpp | 31 ++----------------- .../SourceFiles/ui/controls/send_button.h | 7 ----- 4 files changed, 2 insertions(+), 43 deletions(-) diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp index 5724baf44a..d87e563fb1 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp @@ -540,8 +540,6 @@ void VoiceRecordBar::init() { stop(true); }, _recordingLifetime); - _send->setLockRecord(true); - _send->setForceRippled(true); rpl::single( false ) | rpl::then( @@ -700,9 +698,6 @@ void VoiceRecordBar::stop(bool send) { _recordingSamples = 0; _sendActionUpdates.fire({ Api::SendProgressType::RecordVoice, -1 }); - _send->setForceRippled(false); - _send->clearRecordState(); - _controller->widget()->setInnerFocus(); }; _lockShowing = false; diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index f37fead111..bd386eb653 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -333,9 +333,7 @@ historyRecordVoiceDuration: 120; historyRecordVoice: icon {{ "send_control_record", historyRecordVoiceFg }}; historyRecordVoiceOver: icon {{ "send_control_record", historyRecordVoiceFgOver }}; historyRecordVoiceActive: icon {{ "send_control_record_active", recordActiveIcon }}; -historyRecordVoiceCancel: icon {{ "send_control_record_active", attentionButtonFg }}; historyRecordVoiceRippleBgActive: lightButtonBgOver; -historyRecordVoiceRippleBgCancel: attentionButtonBgRipple; historyRecordSignalColor: attentionButtonFg; historyRecordSignalRadius: 5px; historyRecordCancel: windowSubTextFg; diff --git a/Telegram/SourceFiles/ui/controls/send_button.cpp b/Telegram/SourceFiles/ui/controls/send_button.cpp index ec96357914..d1c3c30800 100644 --- a/Telegram/SourceFiles/ui/controls/send_button.cpp +++ b/Telegram/SourceFiles/ui/controls/send_button.cpp @@ -42,9 +42,6 @@ void SendButton::setType(Type type) { setPointerCursor(_type != Type::Slowmode); update(); } - if (_type != Type::Record) { - clearRecordState(); - } } void SendButton::setSlowmodeDelay(int seconds) { @@ -66,26 +63,6 @@ void SendButton::finishAnimating() { update(); } -void SendButton::requestPaintRecord(float64 progress) { - if (_type == Type::Record) { - _recordProgress = progress; - update(); - } -} - -void SendButton::setLockRecord(bool lock) { - if (_type == Type::Record) { - _recordLocked = lock; - update(); - } -} - -void SendButton::clearRecordState() { - _recordLocked = false; - _recordProgress = 0.; - update(); -} - void SendButton::paintEvent(QPaintEvent *e) { Painter p(this); @@ -115,12 +92,10 @@ void SendButton::paintEvent(QPaintEvent *e) { } void SendButton::paintRecord(Painter &p, bool over) { - const auto recordActive = _recordProgress; + const auto recordActive = 0.; if (!isDisabled()) { auto rippleColor = anim::color( - _recordLocked - ? st::historyRecordVoiceRippleBgCancel - : st::historyAttachEmoji.ripple.color, + st::historyAttachEmoji.ripple.color, st::historyRecordVoiceRippleBgActive, recordActive); paintRipple( @@ -135,8 +110,6 @@ void SendButton::paintRecord(Painter &p, bool over) { return &st::historyRecordVoice; } else if (recordActive == 1.) { return &st::historyRecordVoiceActive; - } else if (_recordLocked) { - return &st::historyRecordVoiceCancel; } else if (over) { return &st::historyRecordVoiceOver; } diff --git a/Telegram/SourceFiles/ui/controls/send_button.h b/Telegram/SourceFiles/ui/controls/send_button.h index 938a0aa0c6..da67bcbf5f 100644 --- a/Telegram/SourceFiles/ui/controls/send_button.h +++ b/Telegram/SourceFiles/ui/controls/send_button.h @@ -29,13 +29,9 @@ public: return _type; } void setType(Type state); - void setLockRecord(bool lock); - void clearRecordState(); void setSlowmodeDelay(int seconds); void finishAnimating(); - void requestPaintRecord(float64 progress); - protected: void paintEvent(QPaintEvent *e) override; @@ -59,9 +55,6 @@ private: Ui::Animations::Simple _a_typeChanged; - bool _recordLocked = false; - float64 _recordProgress = 0.; - int _slowmodeDelay = 0; QString _slowmodeDelayText;