Browse Source

Simplify TorrentContentModel code

adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
5fe5c4d147
  1. 6
      src/torrentcontentmodel.cpp
  2. 6
      src/torrentcontentmodelfolder.cpp
  3. 10
      src/torrentcontentmodelitem.cpp
  4. 1
      src/torrentcontentmodelitem.h

6
src/torrentcontentmodel.cpp

@ -124,12 +124,6 @@ bool TorrentContentModel::setData(const QModelIndex& index, const QVariant& valu @@ -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;

6
src/torrentcontentmodelfolder.cpp

@ -170,5 +170,9 @@ void TorrentContentModelFolder::updateSize() @@ -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();
}
}

10
src/torrentcontentmodelitem.cpp

@ -63,16 +63,6 @@ qulonglong TorrentContentModelItem::size() const @@ -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());

1
src/torrentcontentmodelitem.h

@ -57,7 +57,6 @@ public: @@ -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…
Cancel
Save