void tst_IrcChannel::testDebug() { QString str; QDebug dbg(&str); dbg << static_cast<IrcChannel*>(0); QCOMPARE(str.trimmed(), QString::fromLatin1("IrcChannel(0x0)")); str.clear(); IrcChannel channel; dbg << &channel; QVERIFY(QRegExp("IrcChannel\\(0x[0-9A-Fa-f]+\\) ").exactMatch(str)); str.clear(); channel.setObjectName("obj"); dbg << &channel; QVERIFY(QRegExp("IrcChannel\\(0x[0-9A-Fa-f]+, name=obj\\) ").exactMatch(str)); str.clear(); channel.setPrefix("#"); channel.setName("communi"); dbg << &channel; QVERIFY(QRegExp("IrcChannel\\(0x[0-9A-Fa-f]+, name=obj, title=#communi\\) ").exactMatch(str)); str.clear(); }
static IrcBuffer* createChannel(const QString& name, QObject* parent) { IrcChannel* channel = new Channel(parent); channel->setPrefix("#"); channel->setName(name); return channel; }
QStringList IrcUser::channels() const { QStringList chanList; IrcChannel *channel; foreach(channel, _channels) { chanList << channel->name(); } return chanList; }
void TreeWidget::onPartTriggered() { QAction* action = qobject_cast<QAction*>(sender()); if (action) { TreeItem* item = action->data().value<TreeItem*>(); IrcChannel* channel = item->buffer()->toChannel(); if (channel && channel->isActive()) channel->part(qApp->property("description").toString()); } }
void IrcChannelListForm::onDoubleClick(const QModelIndex &index) { if (!index.isValid()) return; QString channelName = m_model->channels().value(index.row()).name; if (!channelName.isEmpty()) { IrcChannel *channel = m_account->getChannel(channelName, true); channel->join(); ChatLayer::instance()->getSession(channel, true)->activate(); } }
bool IrcProtocol::event(QEvent *ev) { if (ev->type() == ActionCreatedEvent::eventType()) { ActionCreatedEvent *event = static_cast<ActionCreatedEvent*>(ev); if (d->autojoinAction == event->generator()) { IrcChannel *channel = qobject_cast<IrcChannel*>(event->controller()); if (!channel) return false; event->action()->setChecked(channel->autoJoin()); connect(channel, SIGNAL(autoJoinChanged(bool)), event->action(), SLOT(setChecked(bool))); return true; }
void InputWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { QItemSelectionRange changedArea(topLeft, bottomRight); if (changedArea.contains(selectionModel()->currentIndex())) { updateEnabledState(); bool encrypted = false; IrcChannel *chan = qobject_cast<IrcChannel *>(Client::bufferModel()->data(selectionModel()->currentIndex(), NetworkModel::IrcChannelRole).value<QObject *>()); if (chan) encrypted = chan->encrypted(); IrcUser *user = qobject_cast<IrcUser *>(Client::bufferModel()->data(selectionModel()->currentIndex(), NetworkModel::IrcUserRole).value<QObject *>()); if (user) encrypted = user->encrypted(); if (encrypted) ui.encryptionIconLabel->show(); else ui.encryptionIconLabel->hide(); } }
void tst_IrcChannel::testDefaults() { IrcChannel channel; QVERIFY(channel.title().isEmpty()); QVERIFY(channel.name().isEmpty()); QVERIFY(channel.prefix().isEmpty()); QVERIFY(channel.isChannel()); QVERIFY(channel.toChannel()); QVERIFY(!channel.connection()); QVERIFY(!channel.network()); QVERIFY(!channel.model()); QVERIFY(!channel.isActive()); QVERIFY(!channel.isSticky()); QVERIFY(!channel.isPersistent()); QVERIFY(channel.mode().isEmpty()); QVERIFY(channel.topic().isEmpty()); }