36 lines
789 B
C++
36 lines
789 B
C++
// action.h
|
|
#ifndef ACTION_H
|
|
#define ACTION_H
|
|
|
|
#include <QString>
|
|
#include <QVariantMap>
|
|
|
|
class Action {
|
|
public:
|
|
enum Type { KeyPress, Sound, Notification, File };
|
|
virtual ~Action() = default;
|
|
virtual Type type() const = 0;
|
|
virtual void execute() = 0;
|
|
virtual QVariantMap toJson() const = 0;
|
|
virtual void fromJson(const QVariantMap &data) = 0;
|
|
};
|
|
|
|
// Конкретные действия
|
|
class KeyPressAction : public Action {
|
|
public:
|
|
Type type() const override { return KeyPress; }
|
|
void execute() override;
|
|
QVariantMap toJson() const override;
|
|
void fromJson(const QVariantMap &data) override;
|
|
private:
|
|
int keyCode;
|
|
Qt::KeyboardModifiers modifiers;
|
|
};
|
|
|
|
class SoundAction : public Action {
|
|
// ...
|
|
};
|
|
|
|
// ... и т.д.
|
|
#endif // ACTION_H
|