1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
/*
uploadmanger.h
Copyright (c) 2011 by Evgeny Khryukin
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
*/
#ifndef UPLOADMANAGER_H
#define UPLOADMANAGER_H
#include <QNetworkCookie>
class QNetworkAccessManager;
class QFile;
class HttpDevice;
class UploadManager : public QObject
{
Q_OBJECT
public:
UploadManager(QObject* p = 0);
~UploadManager();
void go(const QString& file);
void setCookies(const QList<QNetworkCookie>& cookies);
bool success() const { return success_; };
signals:
void transferProgress(qint64, qint64);
void uploaded();
void statusText(const QString&);
void uploadFileURL(const QString&);
private slots:
void getStorageFinished();
void uploadFinished();
void verifyingFinished();
private:
void doUpload(const QUrl& url);
private:
QNetworkAccessManager* manager_;
QString fileName_;
bool success_;
HttpDevice *hd_;
};
#endif // UPLOADMANAGER_H
|