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:
parent
f3e465c142
commit
5fe5c4d147
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -57,7 +57,6 @@ public:
|
||||
void setName(const QString& name);
|
||||
|
||||
qulonglong size() const;
|
||||
void setSize(qulonglong size);
|
||||
qulonglong totalDone() const;
|
||||
|
||||
void setProgress(qulonglong done);
|
||||
|
Loading…
x
Reference in New Issue
Block a user