1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/examples/QtSdkManager/qqthttpdownloadmanager.h
2017-11-25 17:55:19 +08:00

56 lines
1.3 KiB
C++

#ifndef QQTHTTPDOWNLOADPROTOCOL_H
#define QQTHTTPDOWNLOADPROTOCOL_H
#include <qqtwebaccessmanager.h>
class QQtHttpDownloadWebWorkSession: public QQtWebAccessSession
{
Q_OBJECT
public:
explicit QQtHttpDownloadWebWorkSession ( QObject* parent = 0 ) :
QQtWebAccessSession ( parent ) {
filename = "tmp.download";
}
virtual ~QQtHttpDownloadWebWorkSession() {}
QString filename;
QString url;//?x
QString filesize;
QString filedownloaded;
QString elipsedSize;
QString downloadingTime;
QString elipsedTime;
QString wholeTime;
QString speed;
};
class QQtHttpDownloadManager : public QQtWebAccessManager
{
Q_OBJECT
public:
explicit QQtHttpDownloadManager ( QObject* parent = nullptr );
virtual ~QQtHttpDownloadManager() {}
void sendRequest ( QString strUrl, QString filename );
signals:
public slots:
protected:
/* 字节转KB、MB、GB */
QString getSize ( qint64 bytes );
/* 速度转KB/S、MB/S、GB/S */
QString getSpeed ( double speed );
/* 秒转*d *h *m *s */
QString getElipsedTime ( int seconds );
private slots:
void replyReadyRead ( QQtWebAccessSession* session );
void updateDownloadProgress ( QQtWebAccessSession* session, qint64 bytesReceived, qint64 bytesTotal );
private:
};
#endif // QQTHTTPDOWNLOADPROTOCOL_H