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
66 auto beginSearch() -> bool {
67 m_cancelled = false;
68 if (!m_busy) {
69 m_busy = true;
70 return true;
71 }
72 return false;
73 }
74
79 auto cancelSearch() -> bool {
80 m_cancelled = true;
81 if (m_busy) {
82 m_busy = false;
83 return true;
84 }
85 return false;
86 }
87
95 m_busy = false;
96 m_cancelled = false;
97 return outcome;
98 }
99
100private:
101 bool m_mode = false;
102 bool m_busy = false;
103 bool m_cancelled = false;
104};
105
106#endif // SRC_GREPSEARCHCONTROLLER_H_
State machine for MainWindow's content-search (grep) mode.
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.