summaryrefslogblamecommitdiffstats
path: root/src/qrlogin.h
blob: 3c3c61d1f79de49ba3b5ed395c81965595f84257 (plain) (tree)






















                                                                       


                            
        



                                                      








                               
#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