From 61511201db595dbdd6c64c6260a79c23c40f6826 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 26 Aug 2012 20:35:18 +0300 Subject: [PATCH] TorrentContentModel code clean up --- src/torrentcontentmodelfolder.cpp | 13 +++---------- src/torrentcontentmodelitem.cpp | 1 + 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/torrentcontentmodelfolder.cpp b/src/torrentcontentmodelfolder.cpp index 6ba6bb0f9..670b20cf4 100644 --- a/src/torrentcontentmodelfolder.cpp +++ b/src/torrentcontentmodelfolder.cpp @@ -124,21 +124,14 @@ void TorrentContentModelFolder::setPriority(int new_prio, bool update_parent) m_priority = new_prio; - // Update parent - if (update_parent) { - m_parentItem->updateSize(); - m_parentItem->updateProgress(); + // Update parent priority + if (update_parent) m_parentItem->updatePriority(); - } // Update children if (m_priority != prio::PARTIAL) { - qDebug("Updating children items"); - foreach (TorrentContentModelItem* child, m_childItems) { - // Do not update the parent since - // the parent is causing the update + foreach (TorrentContentModelItem* child, m_childItems) child->setPriority(m_priority, false); - } } updateSize(); diff --git a/src/torrentcontentmodelitem.cpp b/src/torrentcontentmodelitem.cpp index 742aeb867..23aa99ce5 100644 --- a/src/torrentcontentmodelitem.cpp +++ b/src/torrentcontentmodelitem.cpp @@ -60,6 +60,7 @@ void TorrentContentModelItem::setName(const QString& name) qulonglong TorrentContentModelItem::size() const { Q_ASSERT(!isRootItem()); + return m_size; }