| 1 | /* |
| 2 | SPDX-FileCopyrightText: KDE Developers |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KATEVI_MACRORECORDER_H |
| 8 | #define KATEVI_MACRORECORDER_H |
| 9 | |
| 10 | #include "keyevent.h" |
| 11 | |
| 12 | #include <QChar> |
| 13 | #include <QKeyEvent> |
| 14 | #include <QList> |
| 15 | |
| 16 | namespace KateVi |
| 17 | { |
| 18 | class InputModeManager; |
| 19 | |
| 20 | class MacroRecorder |
| 21 | { |
| 22 | public: |
| 23 | explicit MacroRecorder(InputModeManager *viInputModeManager); |
| 24 | |
| 25 | void start(const QChar ¯oRegister); |
| 26 | void stop(); |
| 27 | |
| 28 | bool isRecording() const; |
| 29 | |
| 30 | void record(const QKeyEvent &event); |
| 31 | void dropLast(); |
| 32 | |
| 33 | void replay(const QChar ¯oRegister); |
| 34 | bool isReplaying() const; |
| 35 | |
| 36 | private: |
| 37 | InputModeManager *m_viInputModeManager; |
| 38 | |
| 39 | bool m_isRecording; |
| 40 | QChar m_register; |
| 41 | QList<KeyEvent> m_eventsLog; |
| 42 | |
| 43 | int m_macrosBeingReplayedCount; |
| 44 | QChar m_lastPlayedMacroRegister; |
| 45 | }; |
| 46 | } |
| 47 | |
| 48 | #endif // KATEVI_MACRORECORDER_H |
| 49 | |