Exemplo n.º 1
0
void DvbChannelTableModel::setChannelModel(DvbChannelModel *channelModel_)
{
	if (channelModel != NULL) {
		qWarning("Channel model already set");
		return;
	}

	channelModel = channelModel_;
	connect(channelModel, SIGNAL(channelAdded(DvbSharedChannel)),
		this, SLOT(channelAdded(DvbSharedChannel)));
	connect(channelModel, SIGNAL(channelAboutToBeUpdated(DvbSharedChannel)),
		this, SLOT(channelAboutToBeUpdated(DvbSharedChannel)));
	connect(channelModel, SIGNAL(channelUpdated(DvbSharedChannel)),
		this, SLOT(channelUpdated(DvbSharedChannel)));
	connect(channelModel, SIGNAL(channelRemoved(DvbSharedChannel)),
		this, SLOT(channelRemoved(DvbSharedChannel)));
	reset(channelModel->getChannels());
}
Exemplo n.º 2
0
void QDiscordStateComponent::channelUpdateReceived(const QJsonObject& object)
{
	QSharedPointer<QDiscordChannel> channel =
			QSharedPointer<QDiscordChannel>(
				new QDiscordChannel(
					object,
					guild(object["guild_id"].toString(""))
				)
			);
	if(channel->isPrivate())
	{
		_privateChannels.insert(channel->id(), channel);
		emit privateChannelUpdated(channel);
	}
	else
	{
		if(!channel->guild())
			return;
		channel->guild()->addChannel(channel);
		emit channelUpdated(channel);
	}
}