Browse Source

fix(chatgui): replace qDebug with DEBUG_INFO for online trace logs

topo_upd
Evgeny 3 months ago
parent
commit
cf46a59d3a
  1. 19
      tools/chatgui/src/channellist.cpp
  2. 3
      tools/chatgui/src/mainwindow.cpp

19
tools/chatgui/src/channellist.cpp

@ -7,9 +7,12 @@
#include <QPushButton>
#include <QPainter>
#include <QPixmap>
#include <QDebug>
#include <QMouseEvent>
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) {

3
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);
}
}

Loading…
Cancel
Save