MCPcopy Create free account
hub / github.com/KDE/kdevelop / slotWork

Method slotWork

plugins/grepview/grepjob.cpp:218–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218void GrepJob::slotWork()
219{
220 Q_ASSERT(!m_findThread);
221
222 switch(m_workState)
223 {
224 case WorkUnstarted:
225 case WorkDead:
226 Q_UNREACHABLE();
227 break;
228 case WorkStarting:
229 m_workState = WorkCollectFiles;
230 emit showProgress(this, 0,0,0);
231 QMetaObject::invokeMethod(this, "slotWork", Qt::QueuedConnection);
232 break;
233 case WorkCollectFiles:
234 m_findThread = new GrepFindFilesThread(this, m_directoryChoice, m_settings.depth, m_settings.files, m_settings.exclude, m_settings.projectFilesOnly);
235 emit showMessage(this, i18n("Collecting files..."));
236 connect(m_findThread, &GrepFindFilesThread::finished, this, &GrepJob::slotFindFinished);
237 m_findThread->start();
238 break;
239 case WorkGrep:
240 if(m_fileIndex < m_fileList.length())
241 {
242 emit showProgress(this, 0, m_fileList.length(), m_fileIndex);
243 if(m_fileIndex < m_fileList.length()) {
244 QString file = m_fileList[m_fileIndex].toLocalFile();
245 GrepOutputItem::List items = grepFile(file, m_regExp);
246
247 if(!items.isEmpty())
248 {
249 m_findSomething = true;
250 emit foundMatches(file, items);
251 }
252
253 m_fileIndex++;
254 }
255 QMetaObject::invokeMethod(this, "slotWork", Qt::QueuedConnection);
256 }
257 else
258 {
259 die();
260 }
261 break;
262 case WorkCancelled:
263 dieAfterCancellation();
264 break;
265 }
266}
267
268void GrepJob::die()
269{

Callers

nothing calls this directly

Calls 5

grepFileFunction · 0.85
toLocalFileMethod · 0.80
startMethod · 0.45
lengthMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected