File indexing completed on 2024-04-21 03:58:08

0001 /*
0002     SPDX-FileCopyrightText: KDE Developers
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KATEVI_MACRORECORDER_H
0008 #define KATEVI_MACRORECORDER_H
0009 
0010 #include "keyevent.h"
0011 
0012 #include <QChar>
0013 #include <QKeyEvent>
0014 #include <QList>
0015 
0016 namespace KateVi
0017 {
0018 class InputModeManager;
0019 
0020 class MacroRecorder
0021 {
0022 public:
0023     explicit MacroRecorder(InputModeManager *viInputModeManager);
0024 
0025     void start(const QChar &macroRegister);
0026     void stop();
0027 
0028     bool isRecording() const;
0029 
0030     void record(const QKeyEvent &event);
0031     void dropLast();
0032 
0033     void replay(const QChar &macroRegister);
0034     bool isReplaying() const;
0035 
0036 private:
0037     InputModeManager *m_viInputModeManager;
0038 
0039     bool m_isRecording;
0040     QChar m_register;
0041     QList<KeyEvent> m_eventsLog;
0042 
0043     int m_macrosBeingReplayedCount;
0044     QChar m_lastPlayedMacroRegister;
0045 };
0046 }
0047 
0048 #endif // KATEVI_MACRORECORDER_H