MCPcopy Create free account
hub / github.com/KDE/krusader / compareLoop

Method compareLoop

app/Synchronizer/synchronizer.cpp:178–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void Synchronizer::compareLoop()
179{
180 while (!stopped && !stack.isEmpty()) {
181 for (int thread = 0; thread < (int)stack.count() && thread < parallelThreads; thread++) {
182 SynchronizerTask *entry = stack.at(thread);
183
184 if (entry->state() == ST_STATE_NEW)
185 entry->start(parentWidget);
186
187 if (entry->inherits("CompareTask")) {
188 if (entry->state() == ST_STATE_READY) {
189 auto *ctentry = qobject_cast<CompareTask *>(entry);
190 if (ctentry->isDuplicate())
191 compareDirectory(ctentry->parent(), ctentry->leftDirList(), ctentry->rightDirList(), ctentry->leftDir(), ctentry->rightDir());
192 else
193 addSingleDirectory(ctentry->parent(), ctentry->dirList(), ctentry->dir(), ctentry->isLeft());
194 }
195 if (entry->state() == ST_STATE_READY || entry->state() == ST_STATE_ERROR)
196 comparedDirs++;
197 }
198 switch (entry->state()) {
199 case ST_STATE_STATUS:
200 emit statusInfo(entry->status());
201 break;
202 case ST_STATE_READY:
203 case ST_STATE_ERROR:
204 emit statusInfo(i18n("Number of compared folders: %1", comparedDirs));
205 stack.removeAll(entry);
206 delete entry;
207 continue;
208 default:
209 break;
210 }
211 }
212 if (!stack.isEmpty())
213 qApp->processEvents();
214 }
215
216 QListIterator<SynchronizerTask *> it(stack);
217 while (it.hasNext())
218 delete it.next();
219 stack.clear();
220}
221
222void Synchronizer::compareDirectory(SynchronizerFileItem *parent,
223 SynchronizerDirList *left_directory,

Callers

nothing calls this directly

Calls 14

isEmptyMethod · 0.80
stateMethod · 0.80
isDuplicateMethod · 0.80
leftDirListMethod · 0.80
rightDirListMethod · 0.80
dirListMethod · 0.80
statusMethod · 0.80
processEventsMethod · 0.80
nextMethod · 0.80
countMethod · 0.45
startMethod · 0.45
parentMethod · 0.45

Tested by

no test coverage detected