| 176 | } |
| 177 | |
| 178 | void 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 | |
| 222 | void Synchronizer::compareDirectory(SynchronizerFileItem *parent, |
| 223 | SynchronizerDirList *left_directory, |
nothing calls this directly
no test coverage detected