2017-11-23 19:12:48 +08:00
|
|
|
|
#ifndef QQTQTIOWEBPROTOCOL_H
|
|
|
|
|
#define QQTQTIOWEBPROTOCOL_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <qqtwebaccessmanager.h>
|
2017-11-25 14:37:54 +08:00
|
|
|
|
#include <qqtdictionary.h>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QTime>
|
2017-11-23 19:12:48 +08:00
|
|
|
|
|
|
|
|
|
class QQtQtIOWebUrlSession: public QQtWebAccessSession
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit QQtQtIOWebUrlSession ( QObject* parent = 0 ) :
|
|
|
|
|
QQtWebAccessSession ( parent ) {
|
|
|
|
|
url1 = "";
|
|
|
|
|
url2 = "";
|
|
|
|
|
}
|
|
|
|
|
virtual ~QQtQtIOWebUrlSession() {}
|
|
|
|
|
|
|
|
|
|
QString url1;
|
|
|
|
|
QString url2;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class QQtQtIOWebPageParser : public QQtWebAccessManager
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit QQtQtIOWebPageParser ( QObject* parent = nullptr );
|
|
|
|
|
|
2017-11-24 13:27:45 +08:00
|
|
|
|
void startNewParse ( QString url1 = "", QString url2 = "" );
|
|
|
|
|
|
|
|
|
|
typedef struct tagSdkNode
|
|
|
|
|
{
|
|
|
|
|
QString name;
|
|
|
|
|
QString time;
|
|
|
|
|
QString size;
|
|
|
|
|
QString detail;
|
|
|
|
|
} TSdkNode;
|
|
|
|
|
|
|
|
|
|
typedef struct tagSdkGroup
|
|
|
|
|
{
|
|
|
|
|
QString url1;
|
|
|
|
|
QString url2;
|
|
|
|
|
QList<TSdkNode> list;
|
|
|
|
|
} TSdkGroup;
|
|
|
|
|
|
|
|
|
|
QString getBaseUrl() { return m_baseUrl; }
|
|
|
|
|
QList<TSdkGroup>& getSdkGroup() { return sdkGroup; }
|
2017-11-23 19:12:48 +08:00
|
|
|
|
signals:
|
2017-11-25 14:37:54 +08:00
|
|
|
|
void fetchFinish();
|
|
|
|
|
//timeout
|
|
|
|
|
void fetchTimeout();
|
2017-11-23 19:12:48 +08:00
|
|
|
|
public slots:
|
|
|
|
|
private slots:
|
|
|
|
|
void replyFinished ( QQtWebAccessSession* session );
|
2017-11-25 14:37:54 +08:00
|
|
|
|
void detecteTimeout();
|
2017-11-23 19:12:48 +08:00
|
|
|
|
private:
|
|
|
|
|
QString m_baseUrl;
|
2017-11-25 14:37:54 +08:00
|
|
|
|
/*过去有用这种自定义的,有用xml的,有用json的,留作纪念*/
|
2017-11-24 13:27:45 +08:00
|
|
|
|
QList<TSdkGroup> sdkGroup;
|
2017-11-25 14:37:54 +08:00
|
|
|
|
/*现在用QQtDict*/
|
|
|
|
|
QQtDictNode m_sdkGroup;
|
|
|
|
|
/*格式:["5.7"]["5.7.3"][0-3]*/
|
|
|
|
|
QTimer* m_timer;
|
|
|
|
|
QTime m_time;
|
2017-11-23 19:12:48 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // QQTQTIOWEBPROTOCOL_H
|