aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coreplugin/find/findtoolwindow.h
blob: 10b48aa76c166d8b7d825876dc3dc99e6d0f720a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QList>
#include <QWidget>

QT_BEGIN_NAMESPACE
class QCheckBox;
class QComboBox;
class QCompleter;
class QLabel;
class QPushButton;
QT_END_NAMESPACE

namespace Core { class IFindFilter; }
namespace Utils { class FancyLineEdit; }

namespace Core::Internal {

class FindToolWindow : public QWidget
{
    Q_OBJECT

public:
    explicit FindToolWindow(QWidget *parent = nullptr);
    ~FindToolWindow() override;
    static FindToolWindow *instance();

    void setFindFilters(const QList<IFindFilter *> &filters);
    QList<IFindFilter *> findFilters() const;

    void setFindText(const QString &text);
    void setCurrentFilter(IFindFilter *filter);
    void readSettings();
    void writeSettings();

protected:
    bool event(QEvent *event) override;
    bool eventFilter(QObject *obj, QEvent *event) override;

private:
    void search();
    void replace();
    void setCurrentFilter(int index);
    void updateButtonStates();
    void updateFindFlags();
    void updateFindFilterName(IFindFilter *filter);
    static void findCompleterActivated(const QModelIndex &index);

    void acceptAndGetParameters(QString *term, IFindFilter **filter);

    QList<IFindFilter *> m_filters;
    QCompleter *m_findCompleter;
    QWidgetList m_configWidgets;
    IFindFilter *m_currentFilter;
    QWidget *m_configWidget;

    QWidget *m_uiConfigWidget;
    QPushButton *m_searchButton;
    QPushButton *m_replaceButton;
    QLabel *m_searchLabel;
    QComboBox *m_filterList;
    QWidget *m_optionsWidget;
    QCheckBox *m_matchCase;
    QCheckBox *m_wholeWords;
    QCheckBox *m_regExp;
    Utils::FancyLineEdit *m_searchTerm;
};

} // Core::Internal