From 5cfe2f5d344518b04b8c83a03be62fed1b03b27c Mon Sep 17 00:00:00 2001 From: Sergei Ilinykh Date: Thu, 21 Mar 2024 20:01:26 +0300 Subject: [PATCH] qite update --- 3rdparty/qite | 2 +- src/msgmle.cpp | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/3rdparty/qite b/3rdparty/qite index 8b005dc47..89e226764 160000 --- a/3rdparty/qite +++ b/3rdparty/qite @@ -1 +1 @@ -Subproject commit 8b005dc4710bbc58b02450168972b207c7affc2c +Subproject commit 89e226764b3227ecb6dcfffd15c689bb37ab718c diff --git a/src/msgmle.cpp b/src/msgmle.cpp index 3e1eaf028..e2456e5fc 100644 --- a/src/msgmle.cpp +++ b/src/msgmle.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -675,7 +676,11 @@ void ChatEdit::addSoundRecButton() recorder_.reset(new AudioRecorder); recorder_->setMaxDuration(TIMEOUT); - connect(recorder_.get(), &AudioRecorder::recorded, this, [this]() { + connect(recorder_.get(), &AudioRecorder::finished, this, [this](bool success) { + if (!success) { + QMessageBox::warning(this, tr("Audio recording failed"), recorder_->errorString(), QMessageBox::Ok); + return; + } if (recorder_->duration() < 1000) return; @@ -686,25 +691,20 @@ void ChatEdit::addSoundRecButton() md.setData("application/x-psi-amplitudes", recorder_->amplitudes()); emit fileSharingRequested(&md); }); - connect(recorder_.get(), &AudioRecorder::stateChanged, this, [this]() { - if (recorder_->state() != AudioRecorder::RecordingState) { - return; + recButton_->setIcon(IconsetFactory::iconPixmap("psi/mic_rec", fontInfo().pixelSize() * 1.5)); + overlay_->setVisible(true); + timeout_ = TIMEOUT; + timer_ = new QTimer(this); // countdown timer to stop recording while the button is pressed + connect(timer_, &QTimer::timeout, this, [this]() { + if (timeout_ > 0) { + timeout_ -= SECOND; + setOverlayText(timeout_ / SECOND); + } else { + timer_->stop(); + recorder_->stop(); } - recButton_->setIcon(IconsetFactory::iconPixmap("psi/mic_rec", fontInfo().pixelSize() * 1.5)); - overlay_->setVisible(true); - timeout_ = TIMEOUT; - timer_ = new QTimer(this); // countdown timer to stop recording while the button is pressed - connect(timer_, &QTimer::timeout, this, [this]() { - if (timeout_ > 0) { - timeout_ -= SECOND; - setOverlayText(timeout_ / SECOND); - } else { - timer_->stop(); - recorder_->stop(); - } - }); - timer_->start(SECOND); }); + timer_->start(SECOND); recorder_->record(); }); connect(recButton_, &QToolButton::released, this, [this]() { // Rec button relesed