fix: play button not responding + debug logging to log file

- chatview: QListView::mousePressEvent(event) instead of event->accept()
  (Qt needs base class press to set pressedIndex for editorEvent to fire)
- messagedelegate: GUI_DEBUG replaces qDebug (writes to log file)
- voiceplayback: DEBUG_DEBUG/DEBUG_WARN + debug_config.h include
- voicemessageencoder: same debug migration
- inputbar: GUI_INFO replaces qDebug
- messagelist: DEBUG_DEBUG/DEBUG_WARN replaces qDebug/qWarning
This commit is contained in:
Evgeny committed 2026-07-27 00:30:09 +03:00
1 parent 01012675d0
commit 2687c3ed82
6 files changed
+32 -27

No files matched your search

+10 -7
View File
@@ -4,6 +4,8 @@ extern "C" {
#include "../../../lib/opus_codec.h"
}
#include "../../lib/debug_config.h"
#include <QDebug>
#include <QDir>
#include <QDateTime>
@@ -29,7 +31,7 @@ int VoiceEncoder::preset() { return s_preset; }
int VoiceEncoder::encodeToFile(const std::vector<int16_t>& pcm, int sampleRate, int channels,
const QString& filePath, float& outDurationSec) {
if (pcm.empty() || sampleRate <= 0 || channels <= 0) {
qWarning("VoiceEncoder: invalid input (pcm=%zu rate=%d ch=%d)", pcm.size(), sampleRate, channels);
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "VoiceEncoder: invalid input (pcm=%zu rate=%d ch=%d)", pcm.size(), sampleRate, channels);
return -1;
}
@@ -39,7 +41,7 @@ int VoiceEncoder::encodeToFile(const std::vector<int16_t>& pcm, int sampleRate,
opus_codec_encoder_t* enc = opus_codec_encoder_create(sampleRate, channels);
if (!enc) {
qWarning("VoiceEncoder: encoder create failed");
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "VoiceEncoder: encoder create failed");
return -1;
}
opus_codec_encoder_bitrate_set(enc, s_bitrates[s_preset]);
@@ -47,11 +49,12 @@ int VoiceEncoder::encodeToFile(const std::vector<int16_t>& pcm, int sampleRate,
QFile file(filePath);
if (!file.open(QIODevice::WriteOnly)) {
qWarning("VoiceEncoder: cannot open file %s (%s)", qPrintable(filePath), qPrintable(file.errorString()));
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "VoiceEncoder: cannot open file %s (%s)", qPrintable(filePath), qPrintable(file.errorString()));
opus_codec_encoder_destroy(enc);
return -1;
}
qDebug("VoiceEncoder::encodeToFile: writing to %s pcm=%zu samples", qPrintable(filePath), pcm.size());
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "VoiceEncoder::encodeToFile: writing to %s pcm=%zu samples preset=%d",
qPrintable(filePath), pcm.size(), s_preset);
/* write header */
uint32_t magic = OPUS_MAGIC;
@@ -78,7 +81,7 @@ int VoiceEncoder::encodeToFile(const std::vector<int16_t>& pcm, int sampleRate,
file.write((const char*)packet, len);
frameCount++;
} else if (len < 0) {
qWarning("VoiceEncoder: encode error at frame %d: %d", frameCount, len);
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "VoiceEncoder: encode error at frame %d: %d", frameCount, len);
}
}
@@ -89,7 +92,7 @@ int VoiceEncoder::encodeToFile(const std::vector<int16_t>& pcm, int sampleRate,
outDurationSec = (float)frameCount * FRAME_MS / 1000.0f;
qDebug("VoiceEncoder: wrote %d frames (%.1fs) to %s", frameCount, outDurationSec, qPrintable(filePath));
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "VoiceEncoder: wrote %d frames (%.1fs) to %s", frameCount, outDurationSec, qPrintable(filePath));
opus_codec_encoder_destroy(enc);
return frameCount;
}
@@ -110,6 +113,6 @@ QString VoiceEncoder::mediaDir(const QString& dbPath, const QString& channelId)
void VoiceEncoder::ensureMediaDir(const QString& dir) {
QDir d;
if (!d.mkpath(dir)) {
qWarning("VoiceEncoder: cannot create media dir %s", qPrintable(dir));
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "VoiceEncoder: cannot create media dir %s", qPrintable(dir));
}
}