mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Delegated responsibility for clearing listen state to sections.
This commit is contained in:
parent
b1b01385d0
commit
0a0dcb9054
7 changed files with 19 additions and 2 deletions
|
@ -797,6 +797,7 @@ void HistoryWidget::initVoiceRecordBar() {
|
||||||
data.waveform,
|
data.waveform,
|
||||||
data.duration,
|
data.duration,
|
||||||
action);
|
action);
|
||||||
|
_voiceRecordBar->clearListenState();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_voiceRecordBar->lockShowStarts(
|
_voiceRecordBar->lockShowStarts(
|
||||||
|
|
|
@ -1018,6 +1018,10 @@ bool ComposeControls::showRecordButton() const {
|
||||||
&& !isEditingMessage();
|
&& !isEditingMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ComposeControls::clearListenState() {
|
||||||
|
_voiceRecordBar->clearListenState();
|
||||||
|
}
|
||||||
|
|
||||||
void ComposeControls::drawRestrictedWrite(Painter &p, const QString &error) {
|
void ComposeControls::drawRestrictedWrite(Painter &p, const QString &error) {
|
||||||
p.fillRect(_writeRestricted->rect(), st::historyReplyBg);
|
p.fillRect(_writeRestricted->rect(), st::historyReplyBg);
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,7 @@ public:
|
||||||
void setText(const TextWithTags &text);
|
void setText(const TextWithTags &text);
|
||||||
void clear();
|
void clear();
|
||||||
void hidePanelsAnimated();
|
void hidePanelsAnimated();
|
||||||
|
void clearListenState();
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<bool> lockShowStarts() const;
|
[[nodiscard]] rpl::producer<bool> lockShowStarts() const;
|
||||||
[[nodiscard]] bool isLockPresent() const;
|
[[nodiscard]] bool isLockPresent() const;
|
||||||
|
|
|
@ -1399,7 +1399,6 @@ void VoiceRecordBar::requestToSendWithOptions(Api::SendOptions options) {
|
||||||
data->waveform,
|
data->waveform,
|
||||||
Duration(data->samples),
|
Duration(data->samples),
|
||||||
options });
|
options });
|
||||||
hideAnimated();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1416,6 +1415,9 @@ bool VoiceRecordBar::isRecording() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoiceRecordBar::hideAnimated() {
|
void VoiceRecordBar::hideAnimated() {
|
||||||
|
if (isHidden()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
visibilityAnimate(false, [=] { hide(); });
|
visibilityAnimate(false, [=] { hide(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1455,6 +1457,12 @@ float64 VoiceRecordBar::activeAnimationRatio() const {
|
||||||
return _activeAnimation.value(_inField.current() ? 1. : 0.);
|
return _activeAnimation.value(_inField.current() ? 1. : 0.);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VoiceRecordBar::clearListenState() {
|
||||||
|
if (isListenState()) {
|
||||||
|
hideAnimated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float64 VoiceRecordBar::showAnimationRatio() const {
|
float64 VoiceRecordBar::showAnimationRatio() const {
|
||||||
// There is no reason to set the final value to zero,
|
// There is no reason to set the final value to zero,
|
||||||
// because at zero this widget is hidden.
|
// because at zero this widget is hidden.
|
||||||
|
|
|
@ -49,7 +49,9 @@ public:
|
||||||
|
|
||||||
void startRecording();
|
void startRecording();
|
||||||
void finishAnimating();
|
void finishAnimating();
|
||||||
|
void hideAnimated();
|
||||||
void hideFast();
|
void hideFast();
|
||||||
|
void clearListenState();
|
||||||
|
|
||||||
void orderControls();
|
void orderControls();
|
||||||
|
|
||||||
|
@ -102,7 +104,6 @@ private:
|
||||||
bool isTypeRecord() const;
|
bool isTypeRecord() const;
|
||||||
bool hasDuration() const;
|
bool hasDuration() const;
|
||||||
|
|
||||||
void hideAnimated();
|
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
void activeAnimate(bool active);
|
void activeAnimate(bool active);
|
||||||
|
|
|
@ -890,6 +890,7 @@ void RepliesWidget::sendVoice(ComposeControls::VoiceToSend &&data) {
|
||||||
std::move(action));
|
std::move(action));
|
||||||
|
|
||||||
_composeControls->cancelReplyMessage();
|
_composeControls->cancelReplyMessage();
|
||||||
|
_composeControls->clearListenState();
|
||||||
finishSending();
|
finishSending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -573,6 +573,7 @@ void ScheduledWidget::sendVoice(
|
||||||
auto action = Api::SendAction(_history);
|
auto action = Api::SendAction(_history);
|
||||||
action.options = options;
|
action.options = options;
|
||||||
session().api().sendVoiceMessage(bytes, waveform, duration, action);
|
session().api().sendVoiceMessage(bytes, waveform, duration, action);
|
||||||
|
_composeControls->clearListenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScheduledWidget::edit(
|
void ScheduledWidget::edit(
|
||||||
|
|
Loading…
Add table
Reference in a new issue