1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-04 10:54:35 +00:00

Simplify TorrentContentModel code

This commit is contained in:
Christophe Dumez 2012-08-26 19:49:29 +03:00
parent f3e465c142
commit 5fe5c4d147
4 changed files with 5 additions and 18 deletions

View File

@ -124,12 +124,6 @@ bool TorrentContentModel::setData(const QModelIndex& index, const QVariant& valu
case TorrentContentModelItem::COL_NAME:
item->setName(value.toString());
break;
case TorrentContentModelItem::COL_SIZE:
item->setSize(value.toULongLong());
break;
case TorrentContentModelItem::COL_PROGRESS:
item->setProgress(value.toDouble());
break;
case TorrentContentModelItem::COL_PRIO:
item->setPriority(value.toInt());
break;

View File

@ -170,5 +170,9 @@ void TorrentContentModelFolder::updateSize()
if (child->priority() != prio::IGNORED)
size += child->size();
}
setSize(size);
if (size != m_size) {
m_size = size;
m_parentItem->updateSize();
}
}

View File

@ -63,16 +63,6 @@ qulonglong TorrentContentModelItem::size() const
return m_size;
}
void TorrentContentModelItem::setSize(qulonglong size)
{
Q_ASSERT(!isRootItem());
if (m_size == size)
return;
m_size = size;
m_parentItem->updateSize();
}
void TorrentContentModelItem::setProgress(qulonglong done)
{
Q_ASSERT(!isRootItem());

View File

@ -57,7 +57,6 @@ public:
void setName(const QString& name);
qulonglong size() const;
void setSize(qulonglong size);
qulonglong totalDone() const;
void setProgress(qulonglong done);