File indexing completed on 2024-04-14 05:44:24

0001 /*
0002  *  SPDX-FileCopyrightText: 2002-2003 Jesper K. Pedersen <blackie@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-only
0005  **/
0006 
0007 #ifndef kregexpeditorprivate_h
0008 #define kregexpeditorprivate_h
0009 
0010 #include <QMainWindow>
0011 #include <QStack>
0012 
0013 #include "errormap.h"
0014 
0015 class QTimer;
0016 class RegExpScrolledEditorWindow;
0017 class QLineEdit;
0018 class InfoPage;
0019 class UserDefinedRegExps;
0020 class QSplitter;
0021 class Verifier;
0022 class VerifyButtons;
0023 class AuxButtons;
0024 class RegExpButtons;
0025 class RegExp;
0026 class QLabel;
0027 class RegExpConverter;
0028 
0029 /**
0030    Widget used to build a regular expression
0031 
0032    @author Jesper K. Pedersen <blackie@kde.org>
0033    @version 0.1
0034 **/
0035 class KRegExpEditorPrivate : public QMainWindow
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     explicit KRegExpEditorPrivate(QWidget *parent);
0041     ~KRegExpEditorPrivate();
0042     QString regexp();
0043     void setMinimal(bool);
0044     void setCaseSensitive(bool);
0045 
0046 protected Q_SLOTS:
0047     void slotUpdateEditor(const QString &);
0048     void slotUpdateLineEdit();
0049     void slotShowEditor();
0050     void slotTriggerUpdate();
0051     void slotTimeout();
0052     void maybeVerify();
0053 
0054 public Q_SLOTS:
0055     void slotUndo();
0056     void slotRedo();
0057     void slotCut();
0058     void slotCopy();
0059     void slotPaste();
0060     void slotSave();
0061     void slotSetRegexp(const QString &regexp);
0062     void setMatchText(const QString &text);
0063     void setSyntax(RegExpConverter *converter);
0064     void showHelp();
0065 
0066     void doVerify();
0067     void setAutoVerify(bool);
0068     void setVerifyText(const QString &fileName);
0069     void setMatchGreedy(bool);
0070 
0071 Q_SIGNALS:
0072     void canUndo(bool);
0073     void canRedo(bool);
0074     void anythingSelected(bool);
0075     void anythingOnClipboard(bool);
0076     void canSave(bool);
0077     void changes(bool);
0078 
0079 protected:
0080     void recordUndoInfo();
0081     void emitUndoRedoSignals();
0082 
0083 private:
0084     RegExpScrolledEditorWindow *_scrolledEditorWindow = nullptr;
0085     RegExpButtons *_regExpButtons = nullptr;
0086     VerifyButtons *_verifyButtons = nullptr;
0087     AuxButtons *_auxButtons = nullptr;
0088     InfoPage *_info = nullptr;
0089     QLineEdit *_regexpEdit = nullptr;
0090     QSplitter *_editor = nullptr;
0091     bool _updating;
0092     QLabel *_error;
0093     QStack<RegExp *> _undoStack;
0094     QStack<RegExp *> _redoStack;
0095     UserDefinedRegExps *_userRegExps;
0096     QTimer *_timer = nullptr;
0097     Verifier *_verifier = nullptr;
0098     bool _autoVerify;
0099     ErrorMap _errorMap;
0100     bool _matchGreedy;
0101 };
0102 
0103 #endif