MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / clearTasks

Method clearTasks

src/plugins/reversedebug/taskmodel.cpp:230–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230void TaskModel::clearTasks(const QString &categoryId)
231{
232 typedef QHash<QString, CategoryData>::ConstIterator IdCategoryConstIt;
233
234 if (categoryId.isEmpty()) {
235 if (allTasks.count() == 0)
236 return;
237 beginRemoveRows(QModelIndex(), 0, allTasks.count() - 1);
238 allTasks.clear();
239 const IdCategoryConstIt cend = categories.constEnd();
240 for (IdCategoryConstIt it = categories.constBegin(); it != cend; ++it)
241 categories[it.key()].clear();
242 endRemoveRows();
243 } else {
244 int index = 0;
245 int start = 0;
246 CategoryData &global = categories[Core::Id()];
247 CategoryData &cat = categories[categoryId];
248
249 while (index < allTasks.count()) {
250 while (index < allTasks.count() && allTasks.at(index).category != categoryId) {
251 ++start;
252 ++index;
253 }
254 if (index == allTasks.count())
255 break;
256 while (index < allTasks.count() && allTasks.at(index).category == categoryId)
257 ++index;
258
259 // Index is now on the first non category
260 beginRemoveRows(QModelIndex(), start, index - 1);
261
262 for (int i = start; i < index; ++i) {
263 global.removeTask(allTasks.at(i));
264 cat.removeTask(allTasks.at(i));
265 }
266
267 allTasks.erase(allTasks.begin() + start, allTasks.begin() + index);
268
269 endRemoveRows();
270 index = start;
271 }
272 }
273}
274
275int TaskModel::getSizeOfLineNumber(const QFont &font)
276{

Callers

nothing calls this directly

Calls 10

IdFunction · 0.85
atMethod · 0.80
eraseMethod · 0.80
QModelIndexClass · 0.70
isEmptyMethod · 0.45
countMethod · 0.45
clearMethod · 0.45
keyMethod · 0.45
removeTaskMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected