mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Added red coloring of record button.
This commit is contained in:
@@ -43,7 +43,7 @@ void SendButton::setType(Type type) {
|
||||
update();
|
||||
}
|
||||
if (_type != Type::Record) {
|
||||
_recordProgress = 0.;
|
||||
clearRecordState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,19 @@ void SendButton::requestPaintRecord(float64 progress) {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -104,8 +117,17 @@ void SendButton::paintEvent(QPaintEvent *e) {
|
||||
void SendButton::paintRecord(Painter &p, bool over) {
|
||||
const auto recordActive = _recordProgress;
|
||||
if (!isDisabled()) {
|
||||
auto rippleColor = anim::color(st::historyAttachEmoji.ripple.color, st::historyRecordVoiceRippleBgActive, recordActive);
|
||||
paintRipple(p, (width() - st::historyAttachEmoji.rippleAreaSize) / 2, st::historyAttachEmoji.rippleAreaPosition.y(), &rippleColor);
|
||||
auto rippleColor = anim::color(
|
||||
_recordLocked
|
||||
? st::historyRecordVoiceRippleBgCancel
|
||||
: st::historyAttachEmoji.ripple.color,
|
||||
st::historyRecordVoiceRippleBgActive,
|
||||
recordActive);
|
||||
paintRipple(
|
||||
p,
|
||||
(width() - st::historyAttachEmoji.rippleAreaSize) / 2,
|
||||
st::historyAttachEmoji.rippleAreaPosition.y(),
|
||||
&rippleColor);
|
||||
}
|
||||
|
||||
auto fastIcon = [&] {
|
||||
@@ -113,6 +135,8 @@ 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user