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 <QChar>
11 #include <QKeyEvent>
12 #include <QList>
13 
14 namespace KateVi
15 {
16 class InputModeManager;
17 
18 class MacroRecorder
19 {
20 public:
21     explicit MacroRecorder(InputModeManager *viInputModeManager);
22 
23     void start(const QChar &macroRegister);
24     void stop();
25 
26     bool isRecording() const;
27 
28     void record(const QKeyEvent &event);
29     void dropLast();
30 
31     void replay(const QChar &macroRegister);
32     bool isReplaying();
33 
34 private:
35     InputModeManager *m_viInputModeManager;
36 
37     bool m_isRecording;
38     QChar m_register;
39     QList<QKeyEvent> m_eventsLog;
40 
41     int m_macrosBeingReplayedCount;
42     QChar m_lastPlayedMacroRegister;
43 };
44 }
45 
46 #endif // KATEVI_MACRORECORDER_H
47