1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/examples/QtSdkManager/qqtqtiowebpageparser.h

70 lines
1.5 KiB
C
Raw Normal View History

2017-11-23 19:12:48 +08:00
#ifndef QQTQTIOWEBPROTOCOL_H
#define QQTQTIOWEBPROTOCOL_H
#include <QObject>
#include <qqtwebaccessmanager.h>
#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:
void fetchFinish();
//timeout
void fetchTimeout();
2017-11-23 19:12:48 +08:00
public slots:
private slots:
void replyFinished ( QQtWebAccessSession* session );
void detecteTimeout();
2017-11-23 19:12:48 +08:00
private:
QString m_baseUrl;
/*过去有用这种自定义的有用xml的有用json的留作纪念*/
2017-11-24 13:27:45 +08:00
QList<TSdkGroup> sdkGroup;
/*现在用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