File indexing completed on 2024-05-05 03:58:35

0001 /*
0002     SPDX-FileCopyrightText: 2013-2016 Simon St James <kdedevel@etotheipiplusone.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KATEVI_EMULATED_COMMAND_BAR_INTERACTIVESEDREPLACEMODE_H
0008 #define KATEVI_EMULATED_COMMAND_BAR_INTERACTIVESEDREPLACEMODE_H
0009 
0010 #include "activemode.h"
0011 
0012 #include "../cmds.h"
0013 
0014 class QKeyEvent;
0015 class QLabel;
0016 
0017 namespace KateVi
0018 {
0019 class EmulatedCommandBar;
0020 class MatchHighlighter;
0021 
0022 class InteractiveSedReplaceMode : public ActiveMode
0023 {
0024 public:
0025     InteractiveSedReplaceMode(EmulatedCommandBar *emulatedCommandBar,
0026                               MatchHighlighter *matchHighlighter,
0027                               InputModeManager *viInputModeManager,
0028                               KTextEditor::ViewPrivate *view);
0029     ~InteractiveSedReplaceMode() override
0030     {
0031     }
0032     void activate(std::shared_ptr<SedReplace::InteractiveSedReplacer> interactiveSedReplace);
0033     bool isActive() const
0034     {
0035         return m_isActive;
0036     }
0037     bool handleKeyPress(const QKeyEvent *keyEvent) override;
0038     void deactivate(bool wasAborted) override;
0039     QWidget *label();
0040 
0041 private:
0042     void updateInteractiveSedReplaceLabelText();
0043     void finishInteractiveSedReplace();
0044     std::shared_ptr<SedReplace::InteractiveSedReplacer> m_interactiveSedReplacer;
0045     bool m_isActive;
0046     QLabel *m_interactiveSedReplaceLabel;
0047 };
0048 }
0049 
0050 #endif