-
Notifications
You must be signed in to change notification settings - Fork 22
/
logindlg.h
64 lines (48 loc) · 1.08 KB
/
logindlg.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
#ifndef LOGINDLG_H
#define LOGINDLG_H
#include <QFrame>
#include <QJsonParseError>
#include <QJsonDocument>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QEventLoop>
#include <QNetworkCookieJar>
#include <QNetworkCookie>
enum LOGIN_ERROR
{
LONIN_SUCCESS_ERROR,
USER_PASSWD_ERROR,
VERIFY_PICTURE_ERROR
};
namespace Ui {
class LoginDlg;
}
class LoginDlg : public QFrame
{
Q_OBJECT
public:
explicit LoginDlg(QWidget *parent = 0, QNetworkCookieJar *cookie = NULL);
~LoginDlg();
private slots:
void on_toolButtonLogIn_clicked();
void on_toolButtonCancel_clicked();
private:
Ui::LoginDlg *ui;
public:
void showDlg(int iShowState = 0);
int logIn();
private:
int getRandNum();
QString getWebResponse(QString url);
QString getToken(QString url);
QString postWebResponse(QString url, QByteArray postData);
private:
QNetworkCookieJar *m_cookJar;
int m_iLoginError;
QString m_userName;
QString m_passWd;
signals:
void loginSuccess(QString userName);
};
#endif // LOGINDLG_H