forked from KDE/okular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchlineedit.h
94 lines (75 loc) · 2.15 KB
/
searchlineedit.h
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
SPDX-FileCopyrightText: 2004 Enrico Ros <[email protected]>
SPDX-FileCopyrightText: 2007, 2009-2010 Pino Toscano <[email protected]>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef _OKULAR_SEARCHLINEEDIT_H_
#define _OKULAR_SEARCHLINEEDIT_H_
#include "core/document.h"
#include <KLineEdit>
#include <kwidgetsaddons_version.h>
class KBusyIndicatorWidget;
class QTimer;
/**
* @short A line edit for find-as-you-type search. Outputs to the Document.
*/
class SearchLineEdit : public KLineEdit
{
Q_OBJECT
public:
SearchLineEdit(QWidget *parent, Okular::Document *document);
void clearText();
void setSearchCaseSensitivity(Qt::CaseSensitivity cs);
void setSearchMinimumLength(int length);
void setSearchType(Okular::Document::SearchType type);
void setSearchId(int id);
void setSearchColor(const QColor &color);
void setSearchMoveViewport(bool move);
void setSearchFromStart(bool fromStart);
void setFindAsYouType(bool findAsYouType);
void resetSearch();
bool isSearchRunning() const;
Q_SIGNALS:
void searchStarted();
void searchStopped();
public Q_SLOTS:
void restartSearch();
void stopSearch();
void findNext();
void findPrev();
private:
void prepareLineEditForSearch();
Okular::Document *m_document;
QTimer *m_inputDelayTimer;
int m_minLength;
Qt::CaseSensitivity m_caseSensitivity;
Okular::Document::SearchType m_searchType;
int m_id;
QColor m_color;
bool m_moveViewport;
bool m_changed;
bool m_fromStart;
bool m_findAsYouType;
bool m_searchRunning;
private Q_SLOTS:
void slotTextChanged(const QString &text);
void slotReturnPressed(const QString &text);
void startSearch();
void searchFinished(int id, Okular::Document::SearchStatus endStatus);
};
class SearchLineWidget : public QWidget
{
Q_OBJECT
public:
SearchLineWidget(QWidget *parent, Okular::Document *document);
SearchLineEdit *lineEdit() const;
private Q_SLOTS:
void slotSearchStarted();
void slotSearchStopped();
void slotTimedout();
private:
SearchLineEdit *m_edit;
KBusyIndicatorWidget *m_anim;
QTimer *m_timer;
};
#endif