File indexing completed on 2024-05-05 04:37:31

0001 /*
0002     SPDX-FileCopyrightText: 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_DOCUMENTATIONFINDWIDGET_H
0008 #define KDEVPLATFORM_DOCUMENTATIONFINDWIDGET_H
0009 
0010 #include <QWidget>
0011 #include "documentationexport.h"
0012 
0013 namespace Ui { class FindWidget; }
0014 namespace KDevelop
0015 {
0016     
0017 class KDEVPLATFORMDOCUMENTATION_EXPORT DocumentationFindWidget : public QWidget
0018 {
0019     Q_OBJECT
0020     public:
0021         enum FindOption {
0022             Next = 1,
0023             Previous = 2,
0024             MatchCase = 4
0025         };
0026         Q_DECLARE_FLAGS(FindOptions, FindOption)
0027         
0028         explicit DocumentationFindWidget(QWidget* parent = nullptr);
0029         ~DocumentationFindWidget() override;
0030 
0031         void hideEvent(QHideEvent* event) override;
0032 
0033     public Q_SLOTS:
0034         void startSearch();
0035 
0036     private Q_SLOTS:
0037         void searchNext();
0038         void searchPrevious();
0039         void emitDataChanged();
0040 
0041     Q_SIGNALS:
0042         /**
0043          * Emitted when the user requests a search.
0044          * @param text text to search in documentation
0045          * @param options MatchCase being set or empty flags (Next/Previous unused here)
0046          */
0047         void searchRequested(const QString& text, KDevelop::DocumentationFindWidget::FindOptions options);
0048         /**
0049          * Emitted when the user edits the search field or changes the case-sensitivity checkbox.
0050          * Allows documentation views capable of live searches to show live results while the user types.
0051          * @param text current text in search text field
0052          * @param options MatchCase being set or empty flags (Next/Previous unused here)
0053          */
0054         void searchDataChanged(const QString& text, KDevelop::DocumentationFindWidget::FindOptions options);
0055         /**
0056          * Emitted when the search tool view is closed, so no more search hits should be displayed.
0057          */
0058         void searchFinished();
0059 
0060     private:
0061         Ui::FindWidget* m_ui;
0062 };
0063 
0064 }
0065 
0066 #endif // KDEVPLATFORM_DOCUMENTATIONFINDWIDGET_H