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);
}, _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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;