Removed redundant methods for record from SendButton.

This commit is contained in:
23rd 2020-10-11 14:49:23 +03:00 committed by John Preston
parent cab22c07a5
commit 6ed7615653
4 changed files with 2 additions and 43 deletions

View file

@ -540,8 +540,6 @@ void VoiceRecordBar::init() {
stop(true); stop(true);
}, _recordingLifetime); }, _recordingLifetime);
_send->setLockRecord(true);
_send->setForceRippled(true);
rpl::single( rpl::single(
false false
) | rpl::then( ) | rpl::then(
@ -700,9 +698,6 @@ void VoiceRecordBar::stop(bool send) {
_recordingSamples = 0; _recordingSamples = 0;
_sendActionUpdates.fire({ Api::SendProgressType::RecordVoice, -1 }); _sendActionUpdates.fire({ Api::SendProgressType::RecordVoice, -1 });
_send->setForceRippled(false);
_send->clearRecordState();
_controller->widget()->setInnerFocus(); _controller->widget()->setInnerFocus();
}; };
_lockShowing = false; _lockShowing = false;

View file

@ -333,9 +333,7 @@ historyRecordVoiceDuration: 120;
historyRecordVoice: icon {{ "send_control_record", historyRecordVoiceFg }}; historyRecordVoice: icon {{ "send_control_record", historyRecordVoiceFg }};
historyRecordVoiceOver: icon {{ "send_control_record", historyRecordVoiceFgOver }}; historyRecordVoiceOver: icon {{ "send_control_record", historyRecordVoiceFgOver }};
historyRecordVoiceActive: icon {{ "send_control_record_active", recordActiveIcon }}; historyRecordVoiceActive: icon {{ "send_control_record_active", recordActiveIcon }};
historyRecordVoiceCancel: icon {{ "send_control_record_active", attentionButtonFg }};
historyRecordVoiceRippleBgActive: lightButtonBgOver; historyRecordVoiceRippleBgActive: lightButtonBgOver;
historyRecordVoiceRippleBgCancel: attentionButtonBgRipple;
historyRecordSignalColor: attentionButtonFg; historyRecordSignalColor: attentionButtonFg;
historyRecordSignalRadius: 5px; historyRecordSignalRadius: 5px;
historyRecordCancel: windowSubTextFg; historyRecordCancel: windowSubTextFg;

View file

@ -42,9 +42,6 @@ void SendButton::setType(Type type) {
setPointerCursor(_type != Type::Slowmode); setPointerCursor(_type != Type::Slowmode);
update(); update();
} }
if (_type != Type::Record) {
clearRecordState();
}
} }
void SendButton::setSlowmodeDelay(int seconds) { void SendButton::setSlowmodeDelay(int seconds) {
@ -66,26 +63,6 @@ void SendButton::finishAnimating() {
update(); 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) { void SendButton::paintEvent(QPaintEvent *e) {
Painter p(this); Painter p(this);
@ -115,12 +92,10 @@ void SendButton::paintEvent(QPaintEvent *e) {
} }
void SendButton::paintRecord(Painter &p, bool over) { void SendButton::paintRecord(Painter &p, bool over) {
const auto recordActive = _recordProgress; const auto recordActive = 0.;
if (!isDisabled()) { if (!isDisabled()) {
auto rippleColor = anim::color( auto rippleColor = anim::color(
_recordLocked st::historyAttachEmoji.ripple.color,
? st::historyRecordVoiceRippleBgCancel
: st::historyAttachEmoji.ripple.color,
st::historyRecordVoiceRippleBgActive, st::historyRecordVoiceRippleBgActive,
recordActive); recordActive);
paintRipple( paintRipple(
@ -135,8 +110,6 @@ void SendButton::paintRecord(Painter &p, bool over) {
return &st::historyRecordVoice; return &st::historyRecordVoice;
} else if (recordActive == 1.) { } else if (recordActive == 1.) {
return &st::historyRecordVoiceActive; return &st::historyRecordVoiceActive;
} else if (_recordLocked) {
return &st::historyRecordVoiceCancel;
} else if (over) { } else if (over) {
return &st::historyRecordVoiceOver; return &st::historyRecordVoiceOver;
} }

View file

@ -29,13 +29,9 @@ public:
return _type; return _type;
} }
void setType(Type state); void setType(Type state);
void setLockRecord(bool lock);
void clearRecordState();
void setSlowmodeDelay(int seconds); void setSlowmodeDelay(int seconds);
void finishAnimating(); void finishAnimating();
void requestPaintRecord(float64 progress);
protected: protected:
void paintEvent(QPaintEvent *e) override; void paintEvent(QPaintEvent *e) override;
@ -59,9 +55,6 @@ private:
Ui::Animations::Simple _a_typeChanged; Ui::Animations::Simple _a_typeChanged;
bool _recordLocked = false;
float64 _recordProgress = 0.;
int _slowmodeDelay = 0; int _slowmodeDelay = 0;
QString _slowmodeDelayText; QString _slowmodeDelayText;