|
|
@ -114,7 +114,7 @@ bool TorrentModelItem::setData(int column, const QVariant &value, int role) |
|
|
|
{ |
|
|
|
{ |
|
|
|
qDebug() << Q_FUNC_INFO << column << value; |
|
|
|
qDebug() << Q_FUNC_INFO << column << value; |
|
|
|
if (role != Qt::DisplayRole) return false; |
|
|
|
if (role != Qt::DisplayRole) return false; |
|
|
|
// Label and Name columns can be edited
|
|
|
|
// Label, seed date and Name columns can be edited
|
|
|
|
switch(column) { |
|
|
|
switch(column) { |
|
|
|
case TR_NAME: |
|
|
|
case TR_NAME: |
|
|
|
m_name = value.toString(); |
|
|
|
m_name = value.toString(); |
|
|
@ -130,6 +130,10 @@ bool TorrentModelItem::setData(int column, const QVariant &value, int role) |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case TR_SEED_DATE: { |
|
|
|
|
|
|
|
m_seedTime = value.toDateTime(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -219,7 +223,7 @@ void TorrentModel::populate() { |
|
|
|
connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle)), SLOT(addTorrent(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle)), SLOT(addTorrent(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(torrentAboutToBeRemoved(QTorrentHandle)), SLOT(handleTorrentAboutToBeRemoved(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(torrentAboutToBeRemoved(QTorrentHandle)), SLOT(handleTorrentAboutToBeRemoved(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), SLOT(removeTorrent(QString))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), SLOT(removeTorrent(QString))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle)), SLOT(handleFinishedTorrent(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(resumedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(resumedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(pausedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); |
|
|
|
connect(QBtSession::instance(), SIGNAL(pausedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle))); |
|
|
@ -378,6 +382,17 @@ void TorrentModel::handleTorrentUpdate(const QTorrentHandle &h) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TorrentModel::handleFinishedTorrent(const QTorrentHandle& h) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const int row = torrentRow(h.hash()); |
|
|
|
|
|
|
|
if (row < 0) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update completion date
|
|
|
|
|
|
|
|
m_torrents[row]->setData(TorrentModelItem::TR_SEED_DATE, QDateTime::currentDateTime(), Qt::DisplayRole); |
|
|
|
|
|
|
|
notifyTorrentChanged(row); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TorrentModel::notifyTorrentChanged(int row) |
|
|
|
void TorrentModel::notifyTorrentChanged(int row) |
|
|
|
{ |
|
|
|
{ |
|
|
|
emit dataChanged(index(row, 0), index(row, columnCount()-1)); |
|
|
|
emit dataChanged(index(row, 0), index(row, columnCount()-1)); |
|
|
|