| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2013-2016 Simon St James <kdedevel@etotheipiplusone.com> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KATEVI_EMULATED_COMMAND_BAR_INTERACTIVESEDREPLACEMODE_H |
| 8 | #define KATEVI_EMULATED_COMMAND_BAR_INTERACTIVESEDREPLACEMODE_H |
| 9 | |
| 10 | #include "activemode.h" |
| 11 | |
| 12 | #include "../cmds.h" |
| 13 | |
| 14 | class QKeyEvent; |
| 15 | class QLabel; |
| 16 | |
| 17 | namespace KateVi |
| 18 | { |
| 19 | class EmulatedCommandBar; |
| 20 | class MatchHighlighter; |
| 21 | |
| 22 | class InteractiveSedReplaceMode : public ActiveMode |
| 23 | { |
| 24 | public: |
| 25 | InteractiveSedReplaceMode(EmulatedCommandBar *emulatedCommandBar, |
| 26 | MatchHighlighter *matchHighlighter, |
| 27 | InputModeManager *viInputModeManager, |
| 28 | KTextEditor::ViewPrivate *view); |
| 29 | ~InteractiveSedReplaceMode() override |
| 30 | { |
| 31 | } |
| 32 | void activate(std::shared_ptr<SedReplace::InteractiveSedReplacer> interactiveSedReplace); |
| 33 | bool isActive() const |
| 34 | { |
| 35 | return m_isActive; |
| 36 | } |
| 37 | bool handleKeyPress(const QKeyEvent *keyEvent) override; |
| 38 | void deactivate(bool wasAborted) override; |
| 39 | QWidget *label(); |
| 40 | |
| 41 | private: |
| 42 | void updateInteractiveSedReplaceLabelText(); |
| 43 | void finishInteractiveSedReplace(); |
| 44 | std::shared_ptr<SedReplace::InteractiveSedReplacer> m_interactiveSedReplacer; |
| 45 | bool m_isActive; |
| 46 | QLabel *m_interactiveSedReplaceLabel; |
| 47 | }; |
| 48 | } |
| 49 | |
| 50 | #endif |
| 51 | |