Changed QSharedPointer<QIODevice> to <QTcpSocket>

So we don't need a separate pointer.
This commit is contained in:
Albert Vaca 2013-09-26 21:34:08 +02:00
parent 2fd082f4a0
commit cfe13a739c
2 changed files with 8 additions and 8 deletions

View file

@ -24,25 +24,26 @@ DownloadJob::DownloadJob(QHostAddress address, QVariantMap transferInfo): KJob()
{
mAddress = address;
mPort = transferInfo["port"].toInt();
mSocket = new QTcpSocket();
mOutput = QSharedPointer<QIODevice>(mSocket);
mSocket = QSharedPointer<QTcpSocket>(new QTcpSocket);
}
void DownloadJob::start()
{
qDebug() << "start";
//qDebug() << "DownloadJob Start";
mSocket->connectToHost(mAddress, mPort, QIODevice::ReadOnly);
connect(mSocket, SIGNAL(disconnected()), this, SLOT(disconnected()));
connect(mSocket.data(), SIGNAL(disconnected()),
this, SLOT(disconnected()));
//TODO: Implement payload encryption somehow (create an intermediate iodevice to encrypt the payload here?)
}
void DownloadJob::disconnected()
{
//qDebug() << "DownloadJob End";
emitResult();
}
QSharedPointer<QIODevice> DownloadJob::getPayload()
{
qDebug() << "getPayload";
return mOutput;
//qDebug() << "getPayload";
return mSocket.staticCast<QIODevice>();
}

View file

@ -41,8 +41,7 @@ public:
private:
QHostAddress mAddress;
qint16 mPort;
QTcpSocket* mSocket;
QSharedPointer<QIODevice> mOutput;
QSharedPointer<QTcpSocket> mSocket;
private Q_SLOTS: