示例#1
0
void LocalImageLoader::onImageFailed(quint64 id) {
	{
		QMutexLocker lock(toPrepareMutex());
		if (toPrepare.isEmpty()) {
			if (priv) priv->deleteLater();
			priv = 0;
			if (thread) thread->deleteLater();
			thread = 0;
		}
	}

	emit imageFailed(id);
}
示例#2
0
void LocalImageLoader::append(const QStringList &files, const PeerId &peer, MsgId replyTo, ToPrepareMediaType t) {
	{
		QMutexLocker lock(toPrepareMutex());
		for (QStringList::const_iterator i = files.cbegin(), e = files.cend(); i != e; ++i) {
			toPrepare.push_back(ToPrepareMedia(*i, peer, t, false, replyTo));
		}
	}
	if (!thread) {
		thread = new QThread();
		priv = new LocalImageLoaderPrivate(MTP::authedId(), this, thread);
		thread->start();
	}
	emit needToPrepare();
}
示例#3
0
PhotoId LocalImageLoader::append(const QString &file, const PeerId &peer, MsgId replyTo, ToPrepareMediaType t) {
	PhotoId result = 0;
	{
		QMutexLocker lock(toPrepareMutex());
		toPrepare.push_back(ToPrepareMedia(file, peer, t, false, replyTo));
		result = toPrepare.back().id;
	}
	if (!thread) {
		thread = new QThread();
		priv = new LocalImageLoaderPrivate(MTP::authedId(), this, thread);
		thread->start();
	}
	emit needToPrepare();
	return result;
}
示例#4
0
PhotoId LocalImageLoader::append(const QImage &img, const PeerId &peer, MsgId replyTo, ToPrepareMediaType t, bool ctrlShiftEnter) {
	PhotoId result = 0;
	{
		QMutexLocker lock(toPrepareMutex());
		toPrepare.push_back(ToPrepareMedia(img, peer, t, ctrlShiftEnter, replyTo));
		result = toPrepare.back().id;
	}
	if (!thread) {
		thread = new QThread();
		priv = new LocalImageLoaderPrivate(MTP::authedId(), this, thread);
		thread->start();
	}
	emit needToPrepare();
	return result;
}
示例#5
0
AudioId LocalImageLoader::append(const QByteArray &audio, int32 duration, const PeerId &peer, MsgId replyTo, ToPrepareMediaType t) {
	AudioId result = 0;
	{
		QMutexLocker lock(toPrepareMutex());
		toPrepare.push_back(ToPrepareMedia(audio, duration, peer, t, false, replyTo));
		result = toPrepare.back().id;
	}
	if (!thread) {
		thread = new QThread();
		priv = new LocalImageLoaderPrivate(MTP::authedId(), this, thread);
		thread->start();
	}
	emit needToPrepare();
	return result;
}
示例#6
0
PhotoId LocalImageLoader::append(const QByteArray &img, const PeerId &peer, bool broadcast, MsgId replyTo, ToPrepareMediaType t) {
	PhotoId result = 0;
	{
		QMutexLocker lock(toPrepareMutex());
		toPrepare.push_back(ToPrepareMedia(img, peer, t, broadcast, false, replyTo));
		result = toPrepare.back().id;
	}
	if (!thread) {
		thread = new QThread();
		priv = new LocalImageLoaderPrivate(this, thread);
		thread->start();
	}
	emit needToPrepare();
	return result;
}
示例#7
0
PhotoId LocalImageLoader::append(const QByteArray &img, const PeerId &peer, ToPrepareMediaType t) {
	PhotoId result = 0;
	{
		QMutexLocker lock(toPrepareMutex());
		toPrepare.push_back(ToPrepareMedia(img, peer, t));
		result = toPrepare.back().id;
	}
	if (!thread) {
		thread = new QThread();
		priv = new LocalImageLoaderPrivate(MTP::authedId(), this, thread);
		thread->start();
	}
	emit needToPrepare();
	return result;
}