Changeset View
Changeset View
Standalone View
Standalone View
src/search/katesearchbar.h
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 94 | public Q_SLOTS: | |||
---|---|---|---|---|---|
128 | void slotReadWriteChanged(); | 128 | void slotReadWriteChanged(); | ||
129 | 129 | | |||
130 | protected: | 130 | protected: | ||
131 | // Overridden | 131 | // Overridden | ||
132 | void showEvent(QShowEvent *event) override; | 132 | void showEvent(QShowEvent *event) override; | ||
133 | 133 | | |||
134 | private Q_SLOTS: | 134 | private Q_SLOTS: | ||
135 | void onIncPatternChanged(const QString &pattern); | 135 | void onIncPatternChanged(const QString &pattern); | ||
136 | void incrementalSearch(); | ||||
136 | void onMatchCaseToggled(bool matchCase); | 137 | void onMatchCaseToggled(bool matchCase); | ||
137 | 138 | | |||
138 | void onReturnPressed(); | 139 | void onReturnPressed(); | ||
139 | void updateSelectionOnly(); | 140 | void updateSelectionOnly(); | ||
140 | void updateIncInitCursor(); | 141 | void updateIncInitCursor(); | ||
141 | 142 | | |||
142 | void onPowerPatternChanged(const QString &pattern); | 143 | void onPowerPatternChanged(const QString &pattern); | ||
143 | void onPowerModeChanged(int index); | 144 | void onPowerModeChanged(int index); | ||
144 | void onPowerPatternContextMenuRequest(); | 145 | void onPowerPatternContextMenuRequest(); | ||
145 | void onPowerPatternContextMenuRequest(const QPoint &); | 146 | void onPowerPatternContextMenuRequest(const QPoint &); | ||
146 | void onPowerReplacmentContextMenuRequest(); | 147 | void onPowerReplacmentContextMenuRequest(); | ||
147 | void onPowerReplacmentContextMenuRequest(const QPoint &); | 148 | void onPowerReplacmentContextMenuRequest(const QPoint &); | ||
148 | void onPowerCancelFindOrReplace(); | 149 | void onPowerCancelFindOrReplace(); | ||
149 | 150 | | |||
150 | /** | 151 | /** | ||
151 | * This function do the hard search & replace work in time slice steps. | 152 | * This function do the hard search & replace work in time slice steps. | ||
152 | * When all is done @ref m_matchCounter is set and the signal | 153 | * When all is done @ref m_matchCounter is set and the signal | ||
153 | * @ref findOrReplaceAllFinished() is emitted. | 154 | * @ref findOrReplaceAllFinished() is emitted. | ||
154 | */ | 155 | */ | ||
155 | void findOrReplaceAll(); | 156 | void findOrReplaceAll(); | ||
156 | 157 | | |||
157 | | ||||
158 | /** | 158 | /** | ||
159 | * Restore needed settings when signal @ref findOrReplaceAllFinished() | 159 | * Restore needed settings when signal @ref findOrReplaceAllFinished() | ||
160 | * was received. | 160 | * was received. | ||
161 | */ | 161 | */ | ||
162 | void endFindOrReplaceAll(); | 162 | void endFindOrReplaceAll(); | ||
163 | 163 | | |||
164 | Q_SIGNALS: | 164 | Q_SIGNALS: | ||
165 | /** | 165 | /** | ||
166 | * Will emitted by @ref findOrReplaceAll() when all is done. | 166 | * Will emitted by @ref findOrReplaceAll() when all is done. | ||
167 | */ | 167 | */ | ||
168 | void findOrReplaceAllFinished(); | 168 | void findOrReplaceAllFinished(); | ||
169 | 169 | | |||
170 | private: | 170 | private: | ||
171 | // Helpers | 171 | // Helpers | ||
172 | bool hasRangeMatch(const KTextEditor::Range &range); | ||||
172 | bool find(SearchDirection searchDirection = SearchForward) { return findOrReplace(searchDirection, nullptr); }; | 173 | bool find(SearchDirection searchDirection = SearchForward) { return findOrReplace(searchDirection, nullptr); }; | ||
173 | bool findOrReplace(SearchDirection searchDirection, const QString *replacement); | 174 | bool findOrReplace(SearchDirection searchDirection, const QString *replacement); | ||
174 | 175 | | |||
175 | /** | 176 | /** | ||
176 | * The entry point to start a search & replace task. | 177 | * The entry point to start a search & replace task. | ||
177 | * Set needed member variables and call @ref findOrReplaceAll() to do the work. | 178 | * Set needed member variables and call @ref findOrReplaceAll() to do the work. | ||
178 | */ | 179 | */ | ||
179 | void beginFindOrReplaceAll(KTextEditor::Range inputRange, const QString &replacement, bool replaceMode = true); | 180 | void beginFindOrReplaceAll(KTextEditor::Range inputRange, const QString &replacement, bool replaceMode = true); | ||
Show All 31 Lines | 205 | private: | |||
211 | 212 | | |||
212 | // Shared by both dialogs | 213 | // Shared by both dialogs | ||
213 | QVBoxLayout *const m_layout; | 214 | QVBoxLayout *const m_layout; | ||
214 | QWidget *m_widget; | 215 | QWidget *m_widget; | ||
215 | 216 | | |||
216 | // Incremental search related | 217 | // Incremental search related | ||
217 | Ui::IncrementalSearchBar *m_incUi; | 218 | Ui::IncrementalSearchBar *m_incUi; | ||
218 | KTextEditor::Cursor m_incInitCursor; | 219 | KTextEditor::Cursor m_incInitCursor; | ||
220 | QVector<KTextEditor::Range> m_incSearchRanges; | ||||
221 | int m_currentSearchRange; | ||||
219 | 222 | | |||
220 | // Power search related | 223 | // Power search related | ||
221 | Ui::PowerSearchBar *m_powerUi = nullptr; | 224 | Ui::PowerSearchBar *m_powerUi = nullptr; | ||
222 | KTextEditor::MovingRange *m_workingRange = nullptr; | 225 | KTextEditor::MovingRange *m_workingRange = nullptr; | ||
223 | KTextEditor::Range m_inputRange; | 226 | KTextEditor::Range m_inputRange; | ||
224 | QString m_replacement; | 227 | QString m_replacement; | ||
225 | uint m_matchCounter = 0; | 228 | uint m_matchCounter = 0; | ||
226 | bool m_replaceMode = false; | 229 | bool m_replaceMode = false; | ||
Show All 19 Lines |