QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
grepsearchcontroller.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2014 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
8#ifndef SRC_GREPSEARCHCONTROLLER_H_
9#define SRC_GREPSEARCHCONTROLLER_H_
10
25public:
31 bool discard;
32 };
33
38 auto inGrepMode() const -> bool { return m_mode; }
39
43 void enterGrepMode() { m_mode = true; }
44
52 auto leaveGrepMode() -> bool {
53 m_mode = false;
54 if (m_busy) {
55 m_busy = false;
56 m_cancelled = true;
57 return true;
58 }
59 return false;
60 }
61
67 void clearGrepMode() { m_mode = false; }
68
73 auto beginSearch() -> bool {
74 m_cancelled = false;
75 if (!m_busy) {
76 m_busy = true;
77 return true;
78 }
79 return false;
80 }
81
86 auto cancelSearch() -> bool {
87 m_cancelled = true;
88 if (m_busy) {
89 m_busy = false;
90 return true;
91 }
92 return false;
93 }
94
102 m_busy = false;
103 m_cancelled = false;
104 return outcome;
105 }
106
107private:
108 bool m_mode = false;
109 bool m_busy = false;
110 bool m_cancelled = false;
111};
112
113#endif // SRC_GREPSEARCHCONTROLLER_H_
State machine for MainWindow's content-search (grep) mode.
void clearGrepMode()
Drop the mode flag only, without touching busy/cancelled state.
auto beginSearch() -> bool
Begin a search for a non-empty query.
auto leaveGrepMode() -> bool
Leave content-search mode (search button toggled off).
auto finishSearch() -> FinishOutcome
Record that a search finished and report required side effects.
void enterGrepMode()
Enter content-search mode (search button toggled on).
auto cancelSearch() -> bool
Cancel the current search (e.g. query cleared).
bool m_cancelled
Pending results should be discarded.
auto inGrepMode() const -> bool
Whether content-search mode is currently active.
bool m_busy
A grep subprocess is in flight.
bool m_mode
Content-search mode active.
Outcome of a search-completion transition.
bool discard
The finished search was cancelled; ignore results.
bool restoreCursor
A wait cursor was active and must be restored.