summaryrefslogtreecommitdiff
path: root/src/remoteauth/remoteauthdialog.hpp
blob: 465a1888a0eb49f01e1ecd048427306fc6353870 (plain)
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
#pragma once

#ifdef WITH_QRLOGIN

// clang-format off

#include <gtkmm/dialog.h>
#include "remoteauthclient.hpp"

// clang-format on

class RemoteAuthDialog : public Gtk::Dialog {
public:
    RemoteAuthDialog(Gtk::Window &parent);
    std::string GetToken();

protected:
    Gtk::Image m_image;
    Gtk::Label m_status;
    Gtk::Box m_layout;
    Gtk::Button m_ok;
    Gtk::Button m_cancel;
    Gtk::ButtonBox m_bbox;

private:
    RemoteAuthClient m_ra;

    void OnHello();
    void OnFingerprint(const std::string &fingerprint);
    void OnPendingTicket(Snowflake user_id, const std::string &discriminator, const std::string &avatar_hash, const std::string &username);
    void OnPendingLogin();
    void OnToken(const std::string &token);
    void OnError(const std::string &error);

    std::string m_token;
};

#endif