Ejemplo n.º 1
0
QList<QXmppMessage> UnreadMessageModel::take(QString jid)
{
    QString resource = QXmppUtils::jidToResource(jid);
    QString bareJid = QXmppUtils::jidToBareJid(jid);
    QList<QXmppMessage> results;

    if (resource.isEmpty()) {
        results = m_messageStore.take(bareJid);
    } else {
        QList<QXmppMessage> mid = m_messageStore.take(bareJid);
        foreach (QXmppMessage message, mid) {
            if (QXmppUtils::jidToResource(message.from()) == resource) {
                results << message;
            } else {
                add(message);
            }
        }
    }
    if (m_messageStore.isEmpty()) {
        emit messageCleared();
    } else {
        qDebug("no empty");
    }
    //modification to reset() function, to match qt5, I don't know what really reset() does, to improve
    QTextStream newclass;
    newclass.reset();
//////////
    return results;
}
Ejemplo n.º 2
0
void UnreadMessageModel::add(const QXmppMessage &message)
{
    m_messageStore[QXmppUtils::jidToBareJid(message.from())] << message;
    //modification to reset() function, to match qt5, I don't know what really reset() does, to improve
    QTextStream newclass;
    newclass.reset();
//////////
}
Ejemplo n.º 3
0
void TransferManagerModel::clearJob()
{
    QList<QXmppTransferJob *> unfinished;
    foreach (QXmppTransferJob *job, m_jobList) {
        if (job->state() != QXmppTransferJob::FinishedState)
            unfinished << job;
    }
    m_jobList = unfinished;
        //modification to reset() function, to match qt5, I don't know what really reset() does, to improve
    QTextStream newclass;
    newclass.reset();
//////////
}
Ejemplo n.º 4
0
void nVIDIAEmbedder::embed( const char *name )
{
	QFileInfo   fileinfo( name );
	QString     basename( fileinfo.baseName() );
	QString     codename( basename );
	QImage      image( name );
	
	codename = codename.replace( QRegExp("[^a-zA-Z0-9]"), "_" );
	
	stream << "static const QRgb " << codename << "_data[] = {" << endl << "\t";
	stream.setf( QTextStream::hex | QTextStream::right );
	stream.fill( '0' );
	
	int pixels = image.width() * image.height();
	Q_UINT32 *data = reinterpret_cast<Q_UINT32*>( image.bits() );
	bool hasAlpha = false;

	
	for ( int i = 0, j = 0; i < pixels; i++ ) {
		if ( qAlpha( *data ) && qAlpha( *data ) != 0xff )
			hasAlpha = true;
		
		stream << "0x" << qSetW(8) << *(data++);
		
		if ( i != pixels-1 ) {
			stream << ',';
		
			if ( j++ > 4 ) {
				j = 0;
				stream << endl << "\t";
			} else
				stream << ' ';
		}
	}

	stream.reset();
	
	stream << endl << "}; // " << codename << "_data" << endl << endl;

	EmbedImage *imginfo = new EmbedImage;
	imginfo->width = image.width();
	imginfo->height = image.height();
	imginfo->alpha = hasAlpha;
	imginfo->name = codename;
	imginfo->string = basename;
	index->append( imginfo ); 
}