-
Notifications
You must be signed in to change notification settings - Fork 12
/
dialog.h
99 lines (82 loc) · 2.71 KB
/
dialog.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
//网络相关头文件
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkConfigurationManager>
#include <QtNetwork/QSslConfiguration>
#include <QtNetwork/QSslSocket>
#include <QNetworkInterface>
#include <QFile>
#include <QTimer>
#include <QLabel>
#include "cJSON.h"
#include "about.h"
namespace Ui {
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = 0);
~Dialog();
bool isNetWorkOnline();
void parseData(QString filename);
void lbeDisplay(QLabel *lbe, int num);
void disInfo(QString info);
void setLocation();
QString GetLocalmachineIP();
void init();
void iconInit();
void parseApi_0(QByteArray str);
void parseApi_1(QByteArray str);
void parseApi_2(QByteArray str);
void parseApi_3(QByteArray str);
void getChinaDayListData(cJSON *chinaDayList_arr);
void getChinaDayAddListData(cJSON *chinaDayAddList_arr);
void getArticelData(cJSON *article_arr);
void getGlobalStatis(cJSON *globalStatis_obj);
void getCityStatis(cJSON *cityStatis_obj);
private slots:
void on_btn_update_clicked();
void httpReadyRead(); //有可用数据
void httpFinished(); //完成下载
void update();
void clkUpdate();
void on_btn_close_clicked();
void on_btn_about_clicked();
void on_btn_autoUpdate_clicked();
private:
Ui::Dialog *ui;
QString api;
QUrl url;
QTimer *clk;
qint8 updateTime; //默认5分钟更新一次
QTimer *timer;
// QString apiUrl_0 = "https://ip.seeip.org/geoip"; //json
// QString apiUrl_0 = "http://pv.sohu.com/cityjson";
// QString apiUrl_0 = "https://apis.map.qq.com/ws/location/v1/ip?key=RMJBZ-2IP64-CSNUJ-DLU7O-O3DF7-MMB5E";
QString apiUrl_0 = "http://ip-api.com/json/?lang=zh-CN";
// QString apiUrl_0 = "http://ip-api.com/json"; //ip location
QString apiUrl_1 = "http://view.inews.qq.com/g2/getOnsInfo?name=disease_h5";
QString apiUrl_2 = "http://view.inews.qq.com/g2/getOnsInfo?name=disease_other";
// QString apiUrl_3 = "https://vp.fact.qq.com/loadmore?page=0";
//foreign data
QString apiUrl_3 = "http://view.inews.qq.com/g2/getOnsInfo?name=disease_foreign";
// QString apiUrl_4 = "https//vp.fact.qq.com/miniArtData?id=a2141851348ee5f3772c761e25bb57d7";
qint8 apiID = 0;
QNetworkAccessManager *manager;
QNetworkReply *reply;
QFile *file;
QString filename;
qint16 cnt_success;
qint16 cnt_error;
QString bgmClr_true = "42a163";
QString bgmClr_fake = "c41f20";
QString bgmClr_doubt = "484848";
about ab_win;
};
#endif // DIALOG_H