File indexing completed on 2024-04-21 05:51:40

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 VERIFYBUTTONS_H
0008 #define VERIFYBUTTONS_H
0009 
0010 #include <QToolBar>
0011 
0012 class QToolButton;
0013 class QLabel;
0014 class QAction;
0015 class QMenu;
0016 class RegExpConverter;
0017 
0018 class VerifyButtons : public QToolBar
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit VerifyButtons(QWidget *parent, const QString &name = QString());
0024     RegExpConverter *setSyntax(const QString &);
0025     void setAllowNonQtSyntax(bool);
0026 
0027 Q_SIGNALS:
0028     void verify();
0029     void autoVerify(bool);
0030     void loadVerifyText(const QString &);
0031     void matchGreedy(bool);
0032 
0033     // Qt anchors do not work for <pre>...</pre>, thefore scrolling to next/prev match
0034     // do not work. Enable this when they work.
0035     // void gotoFirst();
0036     // void gotoPrev();
0037     // void gotoNext();
0038     // void gotoLast();
0039 
0040     void changeSyntax(const QString &);
0041 
0042 public Q_SLOTS:
0043     //     void enableForwardButtons( bool );
0044     //     void enableBackwardButtons( bool );
0045     void setMatchCount(int);
0046 
0047 protected Q_SLOTS:
0048     void updateVerifyButton(bool);
0049     void loadText();
0050     void slotChangeSyntax(QAction *action);
0051 
0052 private:
0053     QToolButton *_verify = nullptr;
0054     QLabel *_matches = nullptr;
0055     QMenu *_configMenu = nullptr;
0056     QMenu *_languages = nullptr;
0057 
0058     // Qt anchors do not work for <pre>...</pre>, thefore scrolling to next/prev match
0059     // do not work. Enable this when they work.
0060     // QToolButton* _first;
0061     // QToolButton* _prev;
0062     // QToolButton* _next;
0063     // QToolButton* _last;
0064 
0065     QList<QPair<RegExpConverter *, QAction *>> _converters;
0066 };
0067 
0068 #endif // VERIFYBUTTONS_H