forked from qtexe/qt_2019_ncov
-
Notifications
You must be signed in to change notification settings - Fork 15
/
rumor.h
66 lines (52 loc) · 1.5 KB
/
rumor.h
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
58
59
60
61
62
63
64
65
66
#ifndef RUMOR_H
#define RUMOR_H
#include <QDialog>
#include <QFile>
//网络相关头文件
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkConfigurationManager>
#include <QDesktopServices>
//JSON相关头文件
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include "rumor_info.h"
#include "news_info.h"
namespace Ui {
class rumor;
}
class rumor : public QDialog
{
Q_OBJECT
public:
explicit rumor(QWidget *parent = 0);
~rumor();
void getRumorNews(uint8_t page);
void parseRumor(QString filename);
void disRumorNews(QJsonArray content_arr);
private slots:
void anchorClickedSlot(const QUrl& url);
void httpReadyRead(); //有可用数据
void httpFinished(); //完成下载
private:
Ui::rumor *ui;
// QString rumorApi = "https://vp.fact.qq.com/loadmore?page=0&_=1581341095686";
QString rumorApi = "https://vp.fact.qq.com/loadmore?page=";
QString rumorUrl = "https://vp.fact.qq.com/article?id=";
uint8_t rumorPage = 0;
QString bgmClr_true = "42a163";
QString bgmClr_fake = "c41f20";
QString bgmClr_doubt = "484848";
QString rumorHtmlFileName = "html_rumor.txt";
QNetworkAccessManager *manager;
QNetworkReply *reply;
QUrl url;
QFile *file;
QString filename;
// QString html;
rumor_info info;
news_info moreRumor;
};
#endif // RUMOR_H