mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-04 14:42:29 -06:00
committed by
GitHub
parent
e37661d53a
commit
1be5b3abd8
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2022 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006-2012 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -32,6 +33,7 @@
|
||||
#include <QVector>
|
||||
|
||||
#include "base/indexrange.h"
|
||||
#include "base/pathfwd.h"
|
||||
#include "torrentcontentmodelitem.h"
|
||||
|
||||
class QFileIconProvider;
|
||||
@@ -42,7 +44,7 @@ class TorrentContentModelFile;
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class AbstractFileStorage;
|
||||
class TorrentContentHandler;
|
||||
}
|
||||
|
||||
class TorrentContentModel final : public QAbstractItemModel
|
||||
@@ -56,35 +58,42 @@ public:
|
||||
UnderlyingDataRole = Qt::UserRole
|
||||
};
|
||||
|
||||
TorrentContentModel(QObject *parent = nullptr);
|
||||
explicit TorrentContentModel(QObject *parent = nullptr);
|
||||
~TorrentContentModel() override;
|
||||
|
||||
void updateFilesProgress(const QVector<qreal> &fp);
|
||||
void updateFilesPriorities(const QVector<BitTorrent::DownloadPriority> &fprio);
|
||||
void updateFilesAvailability(const QVector<qreal> &fa);
|
||||
void setContentHandler(BitTorrent::TorrentContentHandler *contentHandler);
|
||||
BitTorrent::TorrentContentHandler *contentHandler() const;
|
||||
|
||||
void refresh();
|
||||
|
||||
QVector<BitTorrent::DownloadPriority> getFilePriorities() const;
|
||||
bool allFiltered() const;
|
||||
TorrentContentModelItem::ItemType itemType(const QModelIndex &index) const;
|
||||
int getFileIndex(const QModelIndex &index) const;
|
||||
Path getItemPath(const QModelIndex &index) const;
|
||||
|
||||
int columnCount(const QModelIndex &parent = {}) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
TorrentContentModelItem::ItemType itemType(const QModelIndex &index) const;
|
||||
int getFileIndex(const QModelIndex &index);
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override;
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
int rowCount(const QModelIndex &parent = {}) const override;
|
||||
void clear();
|
||||
void setupModelData(const BitTorrent::AbstractFileStorage &info);
|
||||
|
||||
signals:
|
||||
void filteredFilesChanged();
|
||||
void renameFailed(const QString &errorMessage);
|
||||
|
||||
private:
|
||||
using ColumnInterval = IndexInterval<int>;
|
||||
|
||||
void populate();
|
||||
void updateFilesProgress();
|
||||
void updateFilesPriorities();
|
||||
void updateFilesAvailability();
|
||||
bool setItemPriority(const QModelIndex &index, BitTorrent::DownloadPriority priority);
|
||||
void notifySubtreeUpdated(const QModelIndex &index, const QVector<ColumnInterval> &columns);
|
||||
|
||||
BitTorrent::TorrentContentHandler *m_contentHandler = nullptr;
|
||||
TorrentContentModelFolder *m_rootItem = nullptr;
|
||||
QVector<TorrentContentModelFile *> m_filesIndex;
|
||||
QFileIconProvider *m_fileIconProvider = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user