summaryrefslogtreecommitdiffstats
path: root/src/qrlogin.h
blob: 3c3c61d1f79de49ba3b5ed395c81965595f84257 (plain) (blame)
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
#ifndef _QRLOGIN_H_
#define _QRLOGIN_H_

#include <QObject>

class QLabel;
class QTimer;
class QElapsedTimer;
class QNetworkAccessManager;

class QrLogin : public QObject
{
    Q_OBJECT
public:
    explicit QrLogin(QObject *parent);
    void loadQrCode(QLabel *dest);
    void abort();

signals:
    void triggerReset(const QString &message);
    void startAuthentication(const QString &user, const QString &pass);
    void updateStatus(const QString &msg);

private slots:
    void pollQrCodeStatus();

private:
    void handleAuthReceived(const QStringList &lines);
    void handleNoContentReceived();
    void renderReceivedSvg();

    QLabel *dest;
    QTimer *timer;
    QNetworkAccessManager *nam;
    QString token;
    QByteArray svgData;
    QElapsedTimer *elapsed;
};

#endif