qBittorrent
transferlistwidget.h
Go to the documentation of this file.
1 /*
2  * Bittorrent Client using Qt and libtorrent.
3  * Copyright (C) 2006 Christophe Dumez <[email protected]>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  * In addition, as a special exception, the copyright holders give permission to
20  * link this program with the OpenSSL project's "OpenSSL" library (or with
21  * modified versions of it that use the same license as the "OpenSSL" library),
22  * and distribute the linked executables. You must obey the GNU General Public
23  * License in all respects for all of the code used other than "OpenSSL". If you
24  * modify file(s), you may extend this exception to your version of the file(s),
25  * but you are not obligated to do so. If you do not wish to do so, delete this
26  * exception statement from your version.
27  */
28 
29 #pragma once
30 
31 #include <functional>
32 
33 #include <QtContainerFwd>
34 #include <QTreeView>
35 
37 
38 class MainWindow;
39 class TransferListModel;
41 
42 namespace BitTorrent
43 {
44  class Torrent;
45 }
46 
48 {
49  Version1,
50  Version2
51 };
52 
53 class TransferListWidget final : public QTreeView
54 {
55  Q_OBJECT
56  Q_DISABLE_COPY_MOVE(TransferListWidget)
57 
58 public:
59  TransferListWidget(QWidget *parent, MainWindow *mainWindow);
60  ~TransferListWidget() override;
62 
63 public slots:
64  void setSelectionCategory(const QString &category);
65  void addSelectionTag(const QString &tag);
66  void removeSelectionTag(const QString &tag);
67  void clearSelectionTags();
68  void pauseAllTorrents();
69  void resumeAllTorrents();
70  void startSelectedTorrents();
72  void startVisibleTorrents();
73  void pauseSelectedTorrents();
74  void pauseVisibleTorrents();
77  void deleteSelectedTorrents(bool deleteLocalFiles);
78  void deleteVisibleTorrents();
83  void copySelectedMagnetURIs() const;
84  void copySelectedNames() const;
85  void copySelectedInfohashes(CopyInfohashPolicy policy) const;
86  void copySelectedIDs() const;
87  void openSelectedTorrentsFolder() const;
90  void setTorrentOptions();
92  void hideQueuePosColumn(bool hide);
93  void displayDLHoSMenu(const QPoint&);
94  void applyNameFilter(const QString &name);
95  void applyStatusFilter(int f);
96  void applyCategoryFilter(const QString &category);
97  void applyTagFilter(const QString &tag);
98  void applyTrackerFilterAll();
99  void applyTrackerFilter(const QSet<BitTorrent::TorrentID> &torrentIDs);
100  void previewFile(const QString &filePath);
101  void renameSelectedTorrent();
102 
103 signals:
105 
106 private slots:
107  void torrentDoubleClicked();
108  void displayListMenu(const QPoint &);
109  void currentChanged(const QModelIndex &current, const QModelIndex&) override;
110  void setSelectedTorrentsSuperSeeding(bool enabled) const;
111  void setSelectedAutoTMMEnabled(bool enabled) const;
113  void saveSettings();
114 
115 private:
116  void wheelEvent(QWheelEvent *event) override;
117  QModelIndex mapToSource(const QModelIndex &index) const;
118  QModelIndex mapFromSource(const QModelIndex &index) const;
119  bool loadSettings();
120  QVector<BitTorrent::Torrent *> getSelectedTorrents() const;
121  void askAddTagsForSelection();
122  void editTorrentTrackers();
124  QStringList askTagsForSelection(const QString &dialogTitle);
125  void applyToSelectedTorrents(const std::function<void (BitTorrent::Torrent *const)> &fn);
126  QVector<BitTorrent::Torrent *> getVisibleTorrents() const;
127 
131 };
void addSelectionTag(const QString &tag)
void copySelectedInfohashes(CopyInfohashPolicy policy) const
void setSelectedAutoTMMEnabled(bool enabled) const
TransferListModel * getSourceModel() const
void setSelectionCategory(const QString &category)
void displayDLHoSMenu(const QPoint &)
void previewFile(const QString &filePath)
void applyCategoryFilter(const QString &category)
void setSelectedTorrentsSuperSeeding(bool enabled) const
void wheelEvent(QWheelEvent *event) override
void currentTorrentChanged(BitTorrent::Torrent *const torrent)
void deleteSelectedTorrents(bool deleteLocalFiles)
QVector< BitTorrent::Torrent * > getSelectedTorrents() const
void removeSelectionTag(const QString &tag)
TransferListModel * m_listModel
void displayListMenu(const QPoint &)
TransferListWidget(QWidget *parent, MainWindow *mainWindow)
void hideQueuePosColumn(bool hide)
void applyTrackerFilter(const QSet< BitTorrent::TorrentID > &torrentIDs)
TransferListSortModel * m_sortFilterModel
QModelIndex mapToSource(const QModelIndex &index) const
void applyTagFilter(const QString &tag)
QVector< BitTorrent::Torrent * > getVisibleTorrents() const
QStringList askTagsForSelection(const QString &dialogTitle)
void openSelectedTorrentsFolder() const
void applyNameFilter(const QString &name)
void currentChanged(const QModelIndex &current, const QModelIndex &) override
QModelIndex mapFromSource(const QModelIndex &index) const
void copySelectedNames() const
void copySelectedMagnetURIs() const
void applyToSelectedTorrents(const std::function< void(BitTorrent::Torrent *const)> &fn)
void f()
Definition: test2.c:1
CopyInfohashPolicy