From 0773a82342979cd086a9ef9152f60efc705e40a3 Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 5 Oct 2026 21:30:01 +0200 Subject: [PATCH] Keep debug focused on file browser event delivery --- tools/chatgui/src/audiodevicesettingspage.cpp | 3 ++- tools/chatgui/src/mainwindow.cpp | 22 +++++++++++-------- tools/chatgui/src/messagelist.cpp | 4 ++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/tools/chatgui/src/audiodevicesettingspage.cpp b/tools/chatgui/src/audiodevicesettingspage.cpp index 2eb0ca0b..4bd36750 100644 --- a/tools/chatgui/src/audiodevicesettingspage.cpp +++ b/tools/chatgui/src/audiodevicesettingspage.cpp @@ -338,7 +338,8 @@ void AudioDeviceSettingsPage::applyAndSave() { m_savedCompressorMaxGainDb = compMaxGain; m_savedCompressorRiseRate = compRiseRate; m_savedAecEnabled = aecEnabled; - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "saved output_default=%d input_default=%d codec=%d radioOpus=%d/%dkbps stereo=%d compressor=%d gain=%ddB rise=%.1fx aec=%d", + DEBUG_DEBUG(DEBUG_CATEGORY_CONFIG, + "saved output_default=%d input_default=%d codec=%d radioOpus=%d/%dkbps stereo=%d compressor=%d gain=%ddB rise=%.1fx aec=%d", outputId.isEmpty(), inputId.isEmpty(), codecPreset, radioOpusMode, radioOpusBitrate, radioCaptureStereo, compEnabled, compMaxGain, (float)compRiseRate, aecEnabled); diff --git a/tools/chatgui/src/mainwindow.cpp b/tools/chatgui/src/mainwindow.cpp index fd5d806c..3a19ee5b 100644 --- a/tools/chatgui/src/mainwindow.cpp +++ b/tools/chatgui/src/mainwindow.cpp @@ -379,7 +379,7 @@ void MainWindow::setupSoundFromConfig() { m_recorder->configureCompressor(compCfg); } } - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "AudioRecorder initialized (opusPreset=%d, compressor=%d)", + DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "AudioRecorder initialized (opusPreset=%d, compressor=%d)", VoiceEncoder::preset(), m_recorder->isCompressorEnabled() ? 1 : 0); } @@ -388,9 +388,13 @@ void MainWindow::setupSoundFromConfig() { void MainWindow::setupBridgeCallbacks() { s_mainWindow = this; gui_bridge_set_member_files_response_cb([](const uint8_t* data, int length) { + DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI response route bytes=%d browser=%d", + length, (int)(s_mainWindow && s_mainWindow->m_fileBrowser)); if (s_mainWindow && s_mainWindow->m_fileBrowser) s_mainWindow->m_fileBrowser->onResponse(data, length); }); gui_bridge_set_member_files_transfer_cb([](const uint8_t* data, int length) { + DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "member_files: GUI progress route bytes=%d browser=%d", + length, (int)(s_mainWindow && s_mainWindow->m_fileBrowser)); if (s_mainWindow && s_mainWindow->m_fileBrowser) s_mainWindow->m_fileBrowser->onTransfer(data, length); }); gui_bridge_set_msg_received_cb(onMsgReceivedCallback); @@ -664,7 +668,7 @@ void MainWindow::onCallEnded(quint64 callId, uint8_t reason) { void MainWindow::onCallError(quint64 callId, uint8_t err) { /* пир офлайн / нет маршрута — звонок не состоялся */ - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MainWindow: call error id=%016llx err=%u", (unsigned long long)callId, (unsigned)err); + DEBUG_WARN(DEBUG_CATEGORY_CALL, "MainWindow: call error id=%016llx err=%u", (unsigned long long)callId, (unsigned)err); closeCallWindow(callId); } @@ -927,7 +931,7 @@ void MainWindow::onMessageReceived(const char* ch_id, int ch_id_len, uint64_t au m_messageList->refresh(); } else if (m_channelList) { int unread = m_channelList->getChannelUnreadCount(cid) + 1; - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow::onMessageReceived increment unread ch=%s %d->%d", + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT, "MainWindow::onMessageReceived increment unread ch=%s %d->%d", qPrintable(cid), unread - 1, unread); m_channelList->setChannelUnreadCount(cid, unread); } @@ -1009,7 +1013,7 @@ void MainWindow::onCreateGroupRequested() { u_free(name_copy); } - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MainWindow: create group request posted name=%s", qPrintable(name)); + DEBUG_INFO(DEBUG_CATEGORY_CHAT, "MainWindow: create group request posted name=%s", qPrintable(name)); } void MainWindow::showChannelSettings(const QString& channelId) { @@ -1056,7 +1060,7 @@ void MainWindow::autoPlayCheckNewMessage(const QString& channelId) { QString fullPath = autoPlayMediaDir() + QStringLiteral("/") + channelId + QStringLiteral("/") + fp; if (QFile::exists(fullPath)) { m_autoPlayQueue.enqueue(item); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "auto-play: enqueue ch=%s msg=%lld file=%s", + DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "auto-play: enqueue ch=%s msg=%lld file=%s", qPrintable(channelId), (long long)msg.id, qPrintable(fullPath)); if (!m_autoPlayTimer->isActive()) m_autoPlayTimer->start(200); @@ -1078,7 +1082,7 @@ void MainWindow::autoPlayCheckNewMessage(const QString& channelId) { item.downloadStarted = true; m_autoPlayQueue.enqueue(item); m_autoPlayDownloading.insert(msg.id); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "auto-play: download started ch=%s msg=%lld", + DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "auto-play: download started ch=%s msg=%lld", qPrintable(channelId), (long long)msg.id); if (!m_autoPlayTimer->isActive()) m_autoPlayTimer->start(200); @@ -1093,7 +1097,7 @@ void MainWindow::autoPlayTimerTick() { MessageRow msg = m_db->getMessageById(item.channelId, item.msgId); if (msg.id == 0) { - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "auto-play: msg %lld not found in DB, removing from queue", + DEBUG_WARN(DEBUG_CATEGORY_MEDIA, "auto-play: msg %lld not found in DB, removing from queue", (long long)item.msgId); m_autoPlayQueue.dequeue(); continue; @@ -1110,7 +1114,7 @@ void MainWindow::autoPlayTimerTick() { float dur = item.durationSec; m_autoPlayQueue.dequeue(); m_autoPlayDownloading.remove(msgId); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "auto-play: playing ch=%s msg=%lld file=%s dur=%.1fs", + DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "auto-play: playing ch=%s msg=%lld file=%s dur=%.1fs", qPrintable(chId), (long long)msgId, qPrintable(fullPath), (double)dur); MessageDelegate::stopAllAutoPlay(); VoicePlayer::playOpusFile(fullPath, this, [fullPath](float actualDur, uint64_t playbackId) { @@ -1131,7 +1135,7 @@ void MainWindow::autoPlayTimerTick() { gui_bridge_post_uasync_fn(chat_core_attachment_download_trampoline, req); item.downloadStarted = true; m_autoPlayDownloading.insert(item.msgId); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "auto-play: download started ch=%s msg=%lld (from queue)", + DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "auto-play: download started ch=%s msg=%lld (from queue)", qPrintable(item.channelId), (long long)item.msgId); } return; diff --git a/tools/chatgui/src/messagelist.cpp b/tools/chatgui/src/messagelist.cpp index f53c8d3a..524977f2 100644 --- a/tools/chatgui/src/messagelist.cpp +++ b/tools/chatgui/src/messagelist.cpp @@ -807,7 +807,7 @@ void MessageList::saveChannelState() { } qint64 lastReadMsgId = m_lastReadMsgId; - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MessageList::saveChannelState ch=%s bottom=%d read=%lld pos=%lld", + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT, "MessageList::saveChannelState ch=%s bottom=%d read=%lld pos=%lld", qPrintable(m_currentChannelId), (int)atBottom, (long long)lastReadMsgId, (long long)lastPosMsgId); QByteArray cid = m_currentChannelId.toUtf8(); @@ -898,7 +898,7 @@ void MessageList::updateReadPosition() { bool atBottom = sb && (sb->value() >= sb->maximum()); qint64 lastPosMsgId = (!atBottom && topIdx.isValid()) ? topIdx.data(MsgIdRole).toLongLong() : 0; - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT, "MessageList::updateReadPosition ch=%s oldRead=%lld newRead=%lld pos=%lld bottom=%d lastVisRow=%d/%d", qPrintable(m_currentChannelId), (long long)m_lastReadMsgId, (long long)newReadMsgId, (long long)lastPosMsgId, (int)atBottom,