From 318a959470ae2331c7d7adacec24954e7609004c Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 19 Mar 2010 11:12:17 +0000 Subject: [PATCH] Fix file filtering in complex torrent files --- src/torrentfilesmodel.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/torrentfilesmodel.h b/src/torrentfilesmodel.h index 7ce238333..08c5d226b 100644 --- a/src/torrentfilesmodel.h +++ b/src/torrentfilesmodel.h @@ -97,6 +97,7 @@ public: TreeItem(QList data) { parentItem = 0; type = ROOT; + Q_ASSERT(data.size() == 4); itemData = data; total_done = 0; } @@ -201,12 +202,13 @@ public: return itemData.value(3).toInt(); } - void setPriority(int new_prio, bool update_children=true) { + void setPriority(int new_prio, bool update_children=true, bool update_parent=true) { int old_prio = getPriority(); if(old_prio != new_prio) { + qDebug("setPriority(%s, %d)", qPrintable(getName()), new_prio); itemData.replace(3, new_prio); // Update parent - if(parentItem) { + if(update_parent && parentItem) { parentItem->updateSize(); parentItem->updateProgress(); parentItem->updatePriority(); @@ -215,9 +217,13 @@ public: // Update children if(update_children) { foreach(TreeItem* child, childItems) { - child->setPriority(new_prio); + child->setPriority(new_prio, true, false); } } + if(type==FOLDER) { + updateSize(); + updateProgress(); + } } void updatePriority() {