summary refs log tree commit diff
path: root/src/ReCaptcha.h
blob: 84d65478d21306696f1c51fc0eb42c8fa5ed2f08 (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
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include <QQmlEngine>

class ReCaptcha : public QObject
{
    Q_OBJECT
    QML_ELEMENT
    QML_UNCREATABLE("")

    Q_PROPERTY(QString context MEMBER m_context CONSTANT)
    Q_PROPERTY(QString session MEMBER m_session CONSTANT)

public:
    ReCaptcha(const QString &session, const QString &context, QObject *parent = nullptr);

    Q_INVOKABLE void openReCaptcha();
    Q_INVOKABLE void confirm() { emit confirmation(); }
    Q_INVOKABLE void cancel() { emit cancelled(); }

signals:
    void confirmation();
    void cancelled();

private:
    QString m_session;
    QString m_context;
};