Added icon to button for resuming of voice recording.
This commit is contained in:
parent
091c13bc23
commit
30e694420a
Binary file not shown.
After Width: | Height: | Size: 528 B |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -1122,6 +1122,7 @@ historyRecordLockBodyShadow: icon {{ "voice_lock/record_lock_body_shadow", histo
|
||||||
historyRecordLockBody: icon {{ "voice_lock/record_lock_body", historyToDownBg }};
|
historyRecordLockBody: icon {{ "voice_lock/record_lock_body", historyToDownBg }};
|
||||||
historyRecordLockMargin: margins(4px, 4px, 4px, 4px);
|
historyRecordLockMargin: margins(4px, 4px, 4px, 4px);
|
||||||
historyRecordLockArrow: icon {{ "voice_lock/voice_arrow", historyToDownFg }};
|
historyRecordLockArrow: icon {{ "voice_lock/voice_arrow", historyToDownFg }};
|
||||||
|
historyRecordLockInput: icon {{ "voice_lock/input_mic_s", historyToDownFg }};
|
||||||
historyRecordLockRippleMargin: margins(6px, 6px, 6px, 6px);
|
historyRecordLockRippleMargin: margins(6px, 6px, 6px, 6px);
|
||||||
|
|
||||||
historyRecordDelete: IconButton(historyAttach) {
|
historyRecordDelete: IconButton(historyAttach) {
|
||||||
|
|
|
@ -574,6 +574,8 @@ void ListenWrap::init() {
|
||||||
|
|
||||||
if (!_isShowAnimation) {
|
if (!_isShowAnimation) {
|
||||||
p.setOpacity(progress);
|
p.setOpacity(progress);
|
||||||
|
} else {
|
||||||
|
p.fillRect(bgRect, _st.bg);
|
||||||
}
|
}
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.setBrush(_st.cancelActive);
|
p.setBrush(_st.cancelActive);
|
||||||
|
@ -826,6 +828,7 @@ public:
|
||||||
|
|
||||||
void requestPaintProgress(float64 progress);
|
void requestPaintProgress(float64 progress);
|
||||||
void requestPaintLockToStopProgress(float64 progress);
|
void requestPaintLockToStopProgress(float64 progress);
|
||||||
|
void requestPaintPauseToInputProgress(float64 progress);
|
||||||
void setVisibleTopPart(int part);
|
void setVisibleTopPart(int part);
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<> locks() const;
|
[[nodiscard]] rpl::producer<> locks() const;
|
||||||
|
@ -852,6 +855,7 @@ private:
|
||||||
Ui::Animations::Simple _lockEnderAnimation;
|
Ui::Animations::Simple _lockEnderAnimation;
|
||||||
|
|
||||||
float64 _lockToStopProgress = 0.;
|
float64 _lockToStopProgress = 0.;
|
||||||
|
float64 _pauseToInputProgress = 0.;
|
||||||
rpl::variable<float64> _progress = 0.;
|
rpl::variable<float64> _progress = 0.;
|
||||||
int _visibleTopPart = -1;
|
int _visibleTopPart = -1;
|
||||||
|
|
||||||
|
@ -888,6 +892,7 @@ void RecordLock::init() {
|
||||||
setAttribute(Qt::WA_TransparentForMouseEvents, true);
|
setAttribute(Qt::WA_TransparentForMouseEvents, true);
|
||||||
_lockEnderAnimation.stop();
|
_lockEnderAnimation.stop();
|
||||||
_lockToStopProgress = 0.;
|
_lockToStopProgress = 0.;
|
||||||
|
_pauseToInputProgress = 0.;
|
||||||
_progress = 0.;
|
_progress = 0.;
|
||||||
}
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
@ -964,6 +969,13 @@ void RecordLock::drawProgress(QPainter &p) {
|
||||||
p.translate(inner.topLeft() + lockTranslation);
|
p.translate(inner.topLeft() + lockTranslation);
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.setBrush(_st.fg);
|
p.setBrush(_st.fg);
|
||||||
|
if (_pauseToInputProgress > 0.) {
|
||||||
|
p.setOpacity(_pauseToInputProgress);
|
||||||
|
st::historyRecordLockInput.paintInCenter(
|
||||||
|
p,
|
||||||
|
blockRect.toRect());
|
||||||
|
p.setOpacity(1. - _pauseToInputProgress);
|
||||||
|
}
|
||||||
p.drawRoundedRect(
|
p.drawRoundedRect(
|
||||||
blockRect - QMargins(0, 0, pauseLineOffset, 0),
|
blockRect - QMargins(0, 0, pauseLineOffset, 0),
|
||||||
xRadius,
|
xRadius,
|
||||||
|
@ -1078,6 +1090,11 @@ void RecordLock::requestPaintLockToStopProgress(float64 progress) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RecordLock::requestPaintPauseToInputProgress(float64 progress) {
|
||||||
|
_pauseToInputProgress = progress;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
float64 RecordLock::lockToStopProgress() const {
|
float64 RecordLock::lockToStopProgress() const {
|
||||||
return _lockToStopProgress;
|
return _lockToStopProgress;
|
||||||
}
|
}
|
||||||
|
@ -1420,10 +1437,24 @@ void VoiceRecordBar::init() {
|
||||||
}, _recordingLifetime);
|
}, _recordingLifetime);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto paintShowListenCallback = [=](float64 value) {
|
||||||
|
_listen->requestPaintProgress(value);
|
||||||
|
_level->requestPaintProgress(1. - value);
|
||||||
|
_lock->requestPaintPauseToInputProgress(value);
|
||||||
|
update();
|
||||||
|
};
|
||||||
|
|
||||||
_lock->setClickedCallback([=] {
|
_lock->setClickedCallback([=] {
|
||||||
if (isListenState()) {
|
if (isListenState()) {
|
||||||
startRecording();
|
startRecording();
|
||||||
|
_showListenAnimation.stop();
|
||||||
|
_showListenAnimation.start([=](float64 value) {
|
||||||
|
_listen->requestPaintProgress(1.);
|
||||||
|
paintShowListenCallback(value);
|
||||||
|
if (!value) {
|
||||||
_listen = nullptr;
|
_listen = nullptr;
|
||||||
|
}
|
||||||
|
}, 1., 0., st::historyRecordVoiceShowDuration * 2);
|
||||||
setLevelAsSend();
|
setLevelAsSend();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1445,10 +1476,7 @@ void VoiceRecordBar::init() {
|
||||||
const auto to = 1.;
|
const auto to = 1.;
|
||||||
const auto &duration = st::historyRecordVoiceShowDuration;
|
const auto &duration = st::historyRecordVoiceShowDuration;
|
||||||
auto callback = [=](float64 value) {
|
auto callback = [=](float64 value) {
|
||||||
_listen->requestPaintProgress(value);
|
paintShowListenCallback(value);
|
||||||
const auto reverseValue = to - value;
|
|
||||||
_level->requestPaintProgress(reverseValue);
|
|
||||||
update();
|
|
||||||
if (to == value) {
|
if (to == value) {
|
||||||
_recordingLifetime.destroy();
|
_recordingLifetime.destroy();
|
||||||
}
|
}
|
||||||
|
@ -1956,7 +1984,11 @@ float64 VoiceRecordBar::showAnimationRatio() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
float64 VoiceRecordBar::showListenAnimationRatio() const {
|
float64 VoiceRecordBar::showListenAnimationRatio() const {
|
||||||
return _showListenAnimation.value(_listen ? 1. : 0.);
|
const auto value = _showListenAnimation.value(_listen ? 1. : 0.);
|
||||||
|
if (_paused.current()) {
|
||||||
|
return value * value;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoiceRecordBar::computeAndSetLockProgress(QPoint globalPos) {
|
void VoiceRecordBar::computeAndSetLockProgress(QPoint globalPos) {
|
||||||
|
|
Loading…
Reference in New Issue