mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Fix torrent deletion
This commit is contained in:
parent
9c67aaf641
commit
e57f8b6204
2 changed files with 4 additions and 4 deletions
|
@ -9,6 +9,7 @@ using namespace libtorrent;
|
||||||
TorrentModelItem::TorrentModelItem(const QTorrentHandle &h)
|
TorrentModelItem::TorrentModelItem(const QTorrentHandle &h)
|
||||||
{
|
{
|
||||||
m_torrent = h;
|
m_torrent = h;
|
||||||
|
m_hash = h.hash();
|
||||||
m_name = TorrentPersistentData::getName(h.hash());
|
m_name = TorrentPersistentData::getName(h.hash());
|
||||||
if(m_name.isEmpty()) m_name = h.name();
|
if(m_name.isEmpty()) m_name = h.name();
|
||||||
m_addedTime = TorrentPersistentData::getAddedDate(h.hash());
|
m_addedTime = TorrentPersistentData::getAddedDate(h.hash());
|
||||||
|
@ -277,11 +278,9 @@ bool TorrentModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||||
int TorrentModel::torrentRow(const QString &hash) const
|
int TorrentModel::torrentRow(const QString &hash) const
|
||||||
{
|
{
|
||||||
QList<TorrentModelItem*>::const_iterator it;
|
QList<TorrentModelItem*>::const_iterator it;
|
||||||
int row;
|
int row = 0;
|
||||||
for(it = m_torrents.constBegin(); it != m_torrents.constEnd(); it++) {
|
for(it = m_torrents.constBegin(); it != m_torrents.constEnd(); it++) {
|
||||||
try {
|
|
||||||
if((*it)->hash() == hash) return row;
|
if((*it)->hash() == hash) return row;
|
||||||
}catch(invalid_handle&) {}
|
|
||||||
++row;
|
++row;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
inline int columnCount() const { return NB_COLUMNS; }
|
inline int columnCount() const { return NB_COLUMNS; }
|
||||||
QVariant data(int column, int role = Qt::DisplayRole) const;
|
QVariant data(int column, int role = Qt::DisplayRole) const;
|
||||||
bool setData(int column, const QVariant &value, int role = Qt::DisplayRole);
|
bool setData(int column, const QVariant &value, int role = Qt::DisplayRole);
|
||||||
inline QString hash() const { return m_torrent.hash(); }
|
inline QString hash() const { return m_hash; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void labelChanged(QString previous, QString current);
|
void labelChanged(QString previous, QString current);
|
||||||
|
@ -42,6 +42,7 @@ private:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
mutable QIcon m_icon;
|
mutable QIcon m_icon;
|
||||||
mutable QColor m_fgColor;
|
mutable QColor m_fgColor;
|
||||||
|
QString m_hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TorrentModel : public QAbstractListModel
|
class TorrentModel : public QAbstractListModel
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue