File indexing completed on 2024-05-12 04:33:32

0001 /*
0002     SPDX-FileCopyrightText: 2018 Intevation GmbH <intevation@intevation.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef OKULAR_SCRIPT_JS_EVENT_P_H
0008 #define OKULAR_SCRIPT_JS_EVENT_P_H
0009 
0010 #include <QJSValue>
0011 #include <QObject>
0012 
0013 namespace Okular
0014 {
0015 class Event;
0016 
0017 class JSEvent : public QObject
0018 {
0019     Q_OBJECT
0020     Q_PROPERTY(QString name READ name CONSTANT)
0021     Q_PROPERTY(QString type READ type CONSTANT)
0022     Q_PROPERTY(QString targetName READ targetName WRITE setTargetName) // clazy:exclude=qproperty-without-notify
0023     Q_PROPERTY(bool shift READ shift CONSTANT)
0024     Q_PROPERTY(QJSValue source READ source CONSTANT)
0025     Q_PROPERTY(QJSValue target READ target CONSTANT)
0026     Q_PROPERTY(bool willCommit READ willCommit CONSTANT)
0027     Q_PROPERTY(QJSValue value READ value WRITE setValue)    // clazy:exclude=qproperty-without-notify
0028     Q_PROPERTY(bool rc READ returnCode WRITE setReturnCode) // clazy:exclude=qproperty-without-notify
0029     Q_PROPERTY(QString change READ change CONSTANT)
0030 
0031 public:
0032     explicit JSEvent(Event *event, QObject *parent = nullptr);
0033     ~JSEvent() override;
0034 
0035     QString name() const;
0036     QString type() const;
0037     QString targetName() const;
0038     void setTargetName(const QString &targetName);
0039     bool shift() const;
0040     QJSValue source() const;
0041     QJSValue target() const;
0042     bool willCommit() const;
0043     QJSValue value() const;
0044     void setValue(const QJSValue &value);
0045     bool returnCode() const;
0046     void setReturnCode(bool rc);
0047     QString change() const;
0048 
0049 private:
0050     Event *m_event = nullptr;
0051 };
0052 
0053 }
0054 
0055 #endif