Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "qseqbuffer.h"
- #include <QDebug>
- QSeqBuffer::QSeqBuffer(QObject *parent) :
- QBuffer(parent),
- networkReply(0)
- {
- }
- void QSeqBuffer::startStreaming(QNetworkReply *parentReply){
- networkReply = parentReply;
- connect(networkReply,SIGNAL(downloadProgress(qint64,qint64)),SLOT(downloading(qint64,qint64)));
- }
- bool QSeqBuffer::atEnd()
- {
- qDebug() << QString("QIODevice::atEnd = %1").arg(QIODevice::atEnd());
- qDebug() << QString("networkReply->isFinished = %1").arg(networkReply->isFinished());
- if(networkReply == NULL) return true;
- if(QIODevice::atEnd() && networkReply->isFinished()) return true;
- return false;
- }
- void QSeqBuffer::downloading(qint64 cur, qint64 tot){
- if(size() == 0){
- write(networkReply->readAll());
- emit readyStream();
- }else{
- write(networkReply->readAll());
- }
- }
- bool QSeqBuffer::isSequential(){
- qDebug() << "isSequential called";
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement