Fix coding style for various things
[qBittorrent.git] / src / gui / transferlistwidget.h
blob2807d03259cc94cb353af251d6998ed62e3dd26c
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
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.
29 #ifndef TRANSFERLISTWIDGET_H
30 #define TRANSFERLISTWIDGET_H
32 #include <functional>
33 #include <QTreeView>
35 namespace BitTorrent
37 class TorrentHandle;
40 class QShortcut;
41 class QSortFilterProxyModel;
42 class QStandardItemModel;
44 class MainWindow;
45 class TransferListDelegate;
46 class TransferListModel;
47 class TransferListSortModel;
49 class TransferListWidget : public QTreeView
51 Q_OBJECT
53 public:
54 TransferListWidget(QWidget *parent, MainWindow *mainWindow);
55 ~TransferListWidget() override;
56 TransferListModel *getSourceModel() const;
58 public slots:
59 void setSelectionCategory(QString category);
60 void addSelectionTag(const QString &tag);
61 void removeSelectionTag(const QString &tag);
62 void clearSelectionTags();
63 void setSelectedTorrentsLocation();
64 void pauseAllTorrents();
65 void resumeAllTorrents();
66 void startSelectedTorrents();
67 void forceStartSelectedTorrents();
68 void startVisibleTorrents();
69 void pauseSelectedTorrents();
70 void pauseVisibleTorrents();
71 void softDeleteSelectedTorrents();
72 void permDeleteSelectedTorrents();
73 void deleteSelectedTorrents(bool deleteLocalFiles);
74 void deleteVisibleTorrents();
75 void increasePrioSelectedTorrents();
76 void decreasePrioSelectedTorrents();
77 void topPrioSelectedTorrents();
78 void bottomPrioSelectedTorrents();
79 void copySelectedMagnetURIs() const;
80 void copySelectedNames() const;
81 void copySelectedHashes() const;
82 void openSelectedTorrentsFolder() const;
83 void recheckSelectedTorrents();
84 void reannounceSelectedTorrents();
85 void setDlLimitSelectedTorrents();
86 void setUpLimitSelectedTorrents();
87 void setMaxRatioSelectedTorrents();
88 void previewSelectedTorrents();
89 void hidePriorityColumn(bool hide);
90 void displayDLHoSMenu(const QPoint&);
91 void applyNameFilter(const QString &name);
92 void applyStatusFilter(int f);
93 void applyCategoryFilter(QString category);
94 void applyTagFilter(const QString &tag);
95 void applyTrackerFilterAll();
96 void applyTrackerFilter(const QStringList &hashes);
97 void previewFile(QString filePath);
98 void renameSelectedTorrent();
100 protected:
101 QModelIndex mapToSource(const QModelIndex &index) const;
102 QModelIndex mapFromSource(const QModelIndex &index) const;
103 bool loadSettings();
104 QList<BitTorrent::TorrentHandle *> getSelectedTorrents() const;
106 protected slots:
107 void torrentDoubleClicked();
108 void displayListMenu(const QPoint&);
109 void currentChanged(const QModelIndex &current, const QModelIndex&) override;
110 void toggleSelectedTorrentsSuperSeeding() const;
111 void toggleSelectedTorrentsSequentialDownload() const;
112 void toggleSelectedFirstLastPiecePrio() const;
113 void setSelectedAutoTMMEnabled(bool enabled) const;
114 void askNewCategoryForSelection();
115 void saveSettings();
117 signals:
118 void currentTorrentChanged(BitTorrent::TorrentHandle *const torrent);
120 private:
121 void wheelEvent(QWheelEvent *event) override;
122 void askAddTagsForSelection();
123 void confirmRemoveAllTagsForSelection();
124 QStringList askTagsForSelection(const QString &dialogTitle);
125 void applyToSelectedTorrents(const std::function<void (BitTorrent::TorrentHandle *const)> &fn);
127 TransferListDelegate *m_listDelegate;
128 TransferListModel *m_listModel;
129 TransferListSortModel *m_sortFilterModel;
130 MainWindow *m_mainWindow;
131 QShortcut *m_editHotkey;
132 QShortcut *m_deleteHotkey;
133 QShortcut *m_permDeleteHotkey;
134 QShortcut *m_doubleClickHotkey;
135 QShortcut *m_recheckHotkey;
138 #endif // TRANSFERLISTWIDGET_H