mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-09 21:34:20 +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:
|
case TorrentContentModelItem::COL_NAME:
|
||||||
item->setName(value.toString());
|
item->setName(value.toString());
|
||||||
break;
|
break;
|
||||||
case TorrentContentModelItem::COL_SIZE:
|
|
||||||
item->setSize(value.toULongLong());
|
|
||||||
break;
|
|
||||||
case TorrentContentModelItem::COL_PROGRESS:
|
|
||||||
item->setProgress(value.toDouble());
|
|
||||||
break;
|
|
||||||
case TorrentContentModelItem::COL_PRIO:
|
case TorrentContentModelItem::COL_PRIO:
|
||||||
item->setPriority(value.toInt());
|
item->setPriority(value.toInt());
|
||||||
break;
|
break;
|
||||||
|
@ -170,5 +170,9 @@ void TorrentContentModelFolder::updateSize()
|
|||||||
if (child->priority() != prio::IGNORED)
|
if (child->priority() != prio::IGNORED)
|
||||||
size += child->size();
|
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;
|
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)
|
void TorrentContentModelItem::setProgress(qulonglong done)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!isRootItem());
|
Q_ASSERT(!isRootItem());
|
||||||
|
@ -57,7 +57,6 @@ public:
|
|||||||
void setName(const QString& name);
|
void setName(const QString& name);
|
||||||
|
|
||||||
qulonglong size() const;
|
qulonglong size() const;
|
||||||
void setSize(qulonglong size);
|
|
||||||
qulonglong totalDone() const;
|
qulonglong totalDone() const;
|
||||||
|
|
||||||
void setProgress(qulonglong done);
|
void setProgress(qulonglong done);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user