|
|
|
@ -7,9 +7,12 @@ |
|
|
|
#include <QPushButton> |
|
|
|
#include <QPushButton> |
|
|
|
#include <QPainter> |
|
|
|
#include <QPainter> |
|
|
|
#include <QPixmap> |
|
|
|
#include <QPixmap> |
|
|
|
#include <QDebug> |
|
|
|
|
|
|
|
#include <QMouseEvent> |
|
|
|
#include <QMouseEvent> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" { |
|
|
|
|
|
|
|
#include "../../lib/debug_config.h" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* QListView that prevents deselection, handles invite plus-button clicks */ |
|
|
|
/* QListView that prevents deselection, handles invite plus-button clicks */ |
|
|
|
class ChannelListView : public QListView { |
|
|
|
class ChannelListView : public QListView { |
|
|
|
Q_OBJECT |
|
|
|
Q_OBJECT |
|
|
|
@ -181,8 +184,8 @@ void ChannelList::loadChannels() { |
|
|
|
item->setData(QString(), ChannelLastMessageRole); |
|
|
|
item->setData(QString(), ChannelLastMessageRole); |
|
|
|
item->setData(makeChannelIcon(colors[ci % 6], letter), ChannelIconRole); |
|
|
|
item->setData(makeChannelIcon(colors[ci % 6], letter), ChannelIconRole); |
|
|
|
m_model->appendRow(item); |
|
|
|
m_model->appendRow(item); |
|
|
|
qDebug() << "ChannelList::loadChannels row=" << (m_model->rowCount()-1) |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "ChannelList::loadChannels row=%d cid='%s' name='%s'", |
|
|
|
<< "cid='" << ch.channelId << "' name='" << ch.name << "'"; |
|
|
|
m_model->rowCount()-1, qPrintable(ch.channelId), qPrintable(ch.name)); |
|
|
|
ci++; |
|
|
|
ci++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -208,25 +211,25 @@ void ChannelList::selectChannel(const QString& channelId) { |
|
|
|
|
|
|
|
|
|
|
|
void ChannelList::setChannelPeersOnline(const QString& channelId, int count) { |
|
|
|
void ChannelList::setChannelPeersOnline(const QString& channelId, int count) { |
|
|
|
int found = 0; |
|
|
|
int found = 0; |
|
|
|
qDebug() << "ChannelList::setChannelPeersOnline search='" << channelId |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "ChannelList::setChannelPeersOnline search='%s' online=%d rows=%d", |
|
|
|
<< "' online=" << count << " rows=" << m_model->rowCount(); |
|
|
|
qPrintable(channelId), count, m_model->rowCount()); |
|
|
|
for (int row = 0; row < m_model->rowCount(); row++) { |
|
|
|
for (int row = 0; row < m_model->rowCount(); row++) { |
|
|
|
QStandardItem* item = m_model->item(row); |
|
|
|
QStandardItem* item = m_model->item(row); |
|
|
|
if (item) { |
|
|
|
if (item) { |
|
|
|
QString itemCid = item->data(ChannelChannelIdRole).toString(); |
|
|
|
QString itemCid = item->data(ChannelChannelIdRole).toString(); |
|
|
|
int match = (itemCid == channelId) ? 1 : 0; |
|
|
|
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) { |
|
|
|
if (match) { |
|
|
|
item->setData(count, ChannelPeersOnlineRole); |
|
|
|
item->setData(count, ChannelPeersOnlineRole); |
|
|
|
item->setData(m_autoConnectActive ? 1 : 0, ChannelAutoConnectActiveRole); |
|
|
|
item->setData(m_autoConnectActive ? 1 : 0, ChannelAutoConnectActiveRole); |
|
|
|
qDebug() << " SET online=" << count; |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, " SET online=%d", count); |
|
|
|
found = 1; |
|
|
|
found = 1; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!found) |
|
|
|
if (!found) |
|
|
|
qDebug() << " NOT FOUND in model"; |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, " NOT FOUND in model"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ChannelList::setAutoConnectActive(bool active) { |
|
|
|
void ChannelList::setAutoConnectActive(bool active) { |
|
|
|
|