Add copy options to webui context menu (addresses #6815) (#7036)
[qBittorrent.git] / src / gui / transferlistwidget.h
blob0686f446617b5a0aa91507e86fdfa3f10821e6f7
1 /*
2 * Bittorrent Client using Qt4 and libtorrent.
3 * Copyright (C) 2006 Christophe Dumez
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.
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.
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.
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.
28 * Contact : chris@qbittorrent.org
31 #ifndef TRANSFERLISTWIDGET_H
32 #define TRANSFERLISTWIDGET_H
34 #include <functional>
35 #include <QTreeView>
37 namespace BitTorrent
39 class TorrentHandle;
42 class MainWindow;
43 class TransferListDelegate;
44 class TransferListSortModel;
45 class TorrentModel;
47 QT_BEGIN_NAMESPACE
48 class QShortcut;
49 class QSortFilterProxyModel;
50 class QStandardItemModel;
51 QT_END_NAMESPACE
53 class TransferListWidget: public QTreeView
55 Q_OBJECT
57 public:
58 TransferListWidget(QWidget *parent, MainWindow *main_window);
59 ~TransferListWidget();
60 TorrentModel* getSourceModel() const;
62 public slots:
63 void setSelectionCategory(QString category);
64 void addSelectionTag(const QString &tag);
65 void removeSelectionTag(const QString &tag);
66 void clearSelectionTags();
67 void setSelectedTorrentsLocation();
68 void pauseAllTorrents();
69 void resumeAllTorrents();
70 void startSelectedTorrents();
71 void forceStartSelectedTorrents();
72 void startVisibleTorrents();
73 void pauseSelectedTorrents();
74 void pauseVisibleTorrents();
75 void softDeleteSelectedTorrents();
76 void permDeleteSelectedTorrents();
77 void deleteSelectedTorrents(bool deleteLocalFiles);
78 void deleteVisibleTorrents();
79 void increasePrioSelectedTorrents();
80 void decreasePrioSelectedTorrents();
81 void topPrioSelectedTorrents();
82 void bottomPrioSelectedTorrents();
83 void copySelectedMagnetURIs() const;
84 void copySelectedNames() const;
85 void copySelectedHashes() const;
86 void openSelectedTorrentsFolder() const;
87 void recheckSelectedTorrents();
88 void setDlLimitSelectedTorrents();
89 void setUpLimitSelectedTorrents();
90 void setMaxRatioSelectedTorrents();
91 void previewSelectedTorrents();
92 void hidePriorityColumn(bool hide);
93 void displayDLHoSMenu(const QPoint&);
94 void applyNameFilter(const QString& name);
95 void applyStatusFilter(int f);
96 void applyCategoryFilter(QString category);
97 void applyTagFilter(const QString &tag);
98 void applyTrackerFilterAll();
99 void applyTrackerFilter(const QStringList &hashes);
100 void previewFile(QString filePath);
101 void renameSelectedTorrent();
103 protected:
104 QModelIndex mapToSource(const QModelIndex &index) const;
105 QModelIndex mapFromSource(const QModelIndex &index) const;
106 bool loadSettings();
107 QList<BitTorrent::TorrentHandle *> getSelectedTorrents() const;
109 protected slots:
110 void torrentDoubleClicked();
111 void displayListMenu(const QPoint&);
112 void currentChanged(const QModelIndex& current, const QModelIndex&);
113 void toggleSelectedTorrentsSuperSeeding() const;
114 void toggleSelectedTorrentsSequentialDownload() const;
115 void toggleSelectedFirstLastPiecePrio() const;
116 void setSelectedAutoTMMEnabled(bool enabled) const;
117 void askNewCategoryForSelection();
118 void saveSettings();
120 signals:
121 void currentTorrentChanged(BitTorrent::TorrentHandle *const torrent);
123 private:
124 void wheelEvent(QWheelEvent *event) override;
125 void askAddTagsForSelection();
126 void confirmRemoveAllTagsForSelection();
127 QStringList askTagsForSelection(const QString &dialogTitle);
128 void applyToSelectedTorrents(const std::function<void (BitTorrent::TorrentHandle *const)> &fn);
130 TransferListDelegate *listDelegate;
131 TorrentModel *listModel;
132 TransferListSortModel *nameFilterModel;
133 MainWindow *main_window;
134 QShortcut *editHotkey;
135 QShortcut *deleteHotkey;
136 QShortcut *permDeleteHotkey;
137 QShortcut *doubleClickHotkey;
138 QShortcut *recheckHotkey;
141 #endif // TRANSFERLISTWIDGET_H