From cf46a59d3a6b469a16fb5226896535d5eaabd581 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sun, 19 Jul 2026 11:04:35 +0300 Subject: [PATCH] fix(chatgui): replace qDebug with DEBUG_INFO for online trace logs --- tools/chatgui/src/channellist.cpp | 19 +++++++++++-------- tools/chatgui/src/mainwindow.cpp | 3 ++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tools/chatgui/src/channellist.cpp b/tools/chatgui/src/channellist.cpp index e5d49a02..b69b30ac 100644 --- a/tools/chatgui/src/channellist.cpp +++ b/tools/chatgui/src/channellist.cpp @@ -7,9 +7,12 @@ #include #include #include -#include #include +extern "C" { +#include "../../lib/debug_config.h" +} + /* QListView that prevents deselection, handles invite plus-button clicks */ class ChannelListView : public QListView { Q_OBJECT @@ -181,8 +184,8 @@ void ChannelList::loadChannels() { item->setData(QString(), ChannelLastMessageRole); item->setData(makeChannelIcon(colors[ci % 6], letter), ChannelIconRole); m_model->appendRow(item); - qDebug() << "ChannelList::loadChannels row=" << (m_model->rowCount()-1) - << "cid='" << ch.channelId << "' name='" << ch.name << "'"; + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "ChannelList::loadChannels row=%d cid='%s' name='%s'", + m_model->rowCount()-1, qPrintable(ch.channelId), qPrintable(ch.name)); ci++; } @@ -208,25 +211,25 @@ void ChannelList::selectChannel(const QString& channelId) { void ChannelList::setChannelPeersOnline(const QString& channelId, int count) { int found = 0; - qDebug() << "ChannelList::setChannelPeersOnline search='" << channelId - << "' online=" << count << " rows=" << m_model->rowCount(); + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "ChannelList::setChannelPeersOnline search='%s' online=%d rows=%d", + qPrintable(channelId), count, m_model->rowCount()); for (int row = 0; row < m_model->rowCount(); row++) { QStandardItem* item = m_model->item(row); if (item) { QString itemCid = item->data(ChannelChannelIdRole).toString(); int match = (itemCid == channelId) ? 1 : 0; - qDebug() << " row=" << row << "cid='" << itemCid << "' match=" << match; + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, " row=%d cid='%s' match=%d", row, qPrintable(itemCid), match); if (match) { item->setData(count, ChannelPeersOnlineRole); item->setData(m_autoConnectActive ? 1 : 0, ChannelAutoConnectActiveRole); - qDebug() << " SET online=" << count; + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, " SET online=%d", count); found = 1; break; } } } if (!found) - qDebug() << " NOT FOUND in model"; + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, " NOT FOUND in model"); } void ChannelList::setAutoConnectActive(bool active) { diff --git a/tools/chatgui/src/mainwindow.cpp b/tools/chatgui/src/mainwindow.cpp index 24521543..672106c5 100644 --- a/tools/chatgui/src/mainwindow.cpp +++ b/tools/chatgui/src/mainwindow.cpp @@ -297,7 +297,8 @@ void MainWindow::onAutoConnectStatus(uint8_t status, uint16_t /*total_tried*/, void MainWindow::onChannelPeersOnline(const char* ch_id, int ch_id_len, uint16_t online) { if (m_channelList) { QString cid = QString::fromUtf8(ch_id, ch_id_len); - qDebug() << "MainWindow::onChannelPeersOnline cid=" << cid << "online=" << online; + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MainWindow::onChannelPeersOnline cid=%s online=%u", + qPrintable(cid), online); m_channelList->setChannelPeersOnline(cid, (int)online); } }