2009-11-07 22:55:33 +03:00
|
|
|
/*
|
2018-06-06 16:48:17 +03:00
|
|
|
* Bittorrent Client using Qt and libtorrent.
|
|
|
|
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
2009-11-07 22:55:33 +03:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
|
|
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
|
|
|
* and distribute the linked executables. You must obey the GNU General Public
|
|
|
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
|
|
|
* modify file(s), you may extend this exception to your version of the file(s),
|
|
|
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
|
|
|
* exception statement from your version.
|
|
|
|
*/
|
|
|
|
|
2020-12-10 20:56:37 +03:00
|
|
|
#pragma once
|
2009-11-07 22:55:33 +03:00
|
|
|
|
2017-06-05 03:22:17 +03:00
|
|
|
#include <functional>
|
2021-07-24 15:37:11 +03:00
|
|
|
|
2020-11-30 09:39:03 +03:00
|
|
|
#include <QtContainerFwd>
|
2010-06-07 12:32:41 +04:00
|
|
|
#include <QTreeView>
|
2009-11-07 22:55:33 +03:00
|
|
|
|
2021-07-24 15:37:11 +03:00
|
|
|
#include "base/bittorrent/infohash.h"
|
|
|
|
|
2010-11-14 00:15:52 +03:00
|
|
|
class MainWindow;
|
2022-04-16 09:57:21 +03:00
|
|
|
class Path;
|
2018-06-14 12:54:23 +03:00
|
|
|
class TransferListModel;
|
2014-09-13 17:12:07 +04:00
|
|
|
class TransferListSortModel;
|
2009-11-07 22:55:33 +03:00
|
|
|
|
2019-07-13 08:03:46 +03:00
|
|
|
namespace BitTorrent
|
|
|
|
{
|
2021-01-06 15:12:40 +03:00
|
|
|
class Torrent;
|
2019-07-13 08:03:46 +03:00
|
|
|
}
|
|
|
|
|
2021-06-25 20:44:23 +03:00
|
|
|
enum class CopyInfohashPolicy
|
|
|
|
{
|
|
|
|
Version1,
|
|
|
|
Version2
|
|
|
|
};
|
|
|
|
|
2020-04-19 05:42:11 +03:00
|
|
|
class TransferListWidget final : public QTreeView
|
2014-12-08 04:40:58 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2021-06-25 20:44:23 +03:00
|
|
|
Q_DISABLE_COPY_MOVE(TransferListWidget)
|
2009-11-07 22:55:33 +03:00
|
|
|
|
|
|
|
public:
|
2017-09-25 20:03:24 +03:00
|
|
|
TransferListWidget(QWidget *parent, MainWindow *mainWindow);
|
2018-09-07 14:12:38 +03:00
|
|
|
~TransferListWidget() override;
|
2018-06-14 12:54:23 +03:00
|
|
|
TransferListModel *getSourceModel() const;
|
2009-11-07 22:55:33 +03:00
|
|
|
|
|
|
|
public slots:
|
2019-02-12 03:45:30 +03:00
|
|
|
void setSelectionCategory(const QString &category);
|
2017-06-05 03:22:17 +03:00
|
|
|
void addSelectionTag(const QString &tag);
|
|
|
|
void removeSelectionTag(const QString &tag);
|
|
|
|
void clearSelectionTags();
|
2022-01-14 09:45:03 +03:00
|
|
|
void setSelectedTorrentsLocation();
|
2015-04-19 18:17:47 +03:00
|
|
|
void pauseAllTorrents();
|
|
|
|
void resumeAllTorrents();
|
2014-12-08 04:40:58 +03:00
|
|
|
void startSelectedTorrents();
|
2015-04-14 02:22:14 +03:00
|
|
|
void forceStartSelectedTorrents();
|
2014-12-08 04:40:58 +03:00
|
|
|
void startVisibleTorrents();
|
|
|
|
void pauseSelectedTorrents();
|
|
|
|
void pauseVisibleTorrents();
|
2016-08-05 21:15:13 +03:00
|
|
|
void softDeleteSelectedTorrents();
|
|
|
|
void permDeleteSelectedTorrents();
|
|
|
|
void deleteSelectedTorrents(bool deleteLocalFiles);
|
2014-12-08 04:40:58 +03:00
|
|
|
void deleteVisibleTorrents();
|
2018-12-08 02:01:09 +03:00
|
|
|
void increaseQueuePosSelectedTorrents();
|
|
|
|
void decreaseQueuePosSelectedTorrents();
|
|
|
|
void topQueuePosSelectedTorrents();
|
|
|
|
void bottomQueuePosSelectedTorrents();
|
2014-12-08 04:40:58 +03:00
|
|
|
void copySelectedMagnetURIs() const;
|
2015-02-06 21:56:24 +03:00
|
|
|
void copySelectedNames() const;
|
2021-06-25 20:44:23 +03:00
|
|
|
void copySelectedInfohashes(CopyInfohashPolicy policy) const;
|
|
|
|
void copySelectedIDs() const;
|
2014-12-08 04:40:58 +03:00
|
|
|
void openSelectedTorrentsFolder() const;
|
|
|
|
void recheckSelectedTorrents();
|
2018-01-03 05:40:52 +03:00
|
|
|
void reannounceSelectedTorrents();
|
2020-11-29 17:36:07 +03:00
|
|
|
void setTorrentOptions();
|
2014-12-08 04:40:58 +03:00
|
|
|
void previewSelectedTorrents();
|
2018-12-08 02:01:09 +03:00
|
|
|
void hideQueuePosColumn(bool hide);
|
2018-06-06 16:48:17 +03:00
|
|
|
void applyNameFilter(const QString &name);
|
2014-12-08 04:40:58 +03:00
|
|
|
void applyStatusFilter(int f);
|
2019-02-12 03:45:30 +03:00
|
|
|
void applyCategoryFilter(const QString &category);
|
2017-06-05 03:22:17 +03:00
|
|
|
void applyTagFilter(const QString &tag);
|
2015-03-22 02:18:21 +03:00
|
|
|
void applyTrackerFilterAll();
|
2021-03-05 12:43:58 +03:00
|
|
|
void applyTrackerFilter(const QSet<BitTorrent::TorrentID> &torrentIDs);
|
2022-02-08 06:03:48 +03:00
|
|
|
void previewFile(const Path &filePath);
|
2014-12-08 04:40:58 +03:00
|
|
|
void renameSelectedTorrent();
|
2009-11-07 22:55:33 +03:00
|
|
|
|
2021-06-25 20:44:23 +03:00
|
|
|
signals:
|
|
|
|
void currentTorrentChanged(BitTorrent::Torrent *const torrent);
|
2010-03-04 00:59:12 +03:00
|
|
|
|
2021-06-25 20:44:23 +03:00
|
|
|
private slots:
|
2017-01-24 14:10:08 +03:00
|
|
|
void torrentDoubleClicked();
|
2022-01-21 12:31:31 +03:00
|
|
|
void displayListMenu();
|
2022-01-18 10:15:54 +03:00
|
|
|
void displayColumnHeaderMenu();
|
2018-11-06 18:49:17 +03:00
|
|
|
void currentChanged(const QModelIndex ¤t, const QModelIndex&) override;
|
2019-07-07 16:02:13 +03:00
|
|
|
void setSelectedTorrentsSuperSeeding(bool enabled) const;
|
2022-01-14 09:45:03 +03:00
|
|
|
void setSelectedTorrentsSequentialDownload(bool enabled) const;
|
|
|
|
void setSelectedFirstLastPiecePrio(bool enabled) const;
|
2022-01-23 21:37:38 +03:00
|
|
|
void setSelectedAutoTMMEnabled(bool enabled);
|
2016-02-09 11:56:48 +03:00
|
|
|
void askNewCategoryForSelection();
|
2014-12-15 15:05:49 +03:00
|
|
|
void saveSettings();
|
2010-03-04 00:59:12 +03:00
|
|
|
|
|
|
|
private:
|
2016-11-27 10:14:41 +03:00
|
|
|
void wheelEvent(QWheelEvent *event) override;
|
2021-06-25 20:44:23 +03:00
|
|
|
QModelIndex mapToSource(const QModelIndex &index) const;
|
|
|
|
QModelIndex mapFromSource(const QModelIndex &index) const;
|
|
|
|
bool loadSettings();
|
|
|
|
QVector<BitTorrent::Torrent *> getSelectedTorrents() const;
|
2017-06-05 03:22:17 +03:00
|
|
|
void askAddTagsForSelection();
|
2019-06-24 18:37:31 +03:00
|
|
|
void editTorrentTrackers();
|
2022-04-16 09:57:21 +03:00
|
|
|
void exportTorrent();
|
2017-06-05 03:22:17 +03:00
|
|
|
void confirmRemoveAllTagsForSelection();
|
|
|
|
QStringList askTagsForSelection(const QString &dialogTitle);
|
2021-01-06 15:12:40 +03:00
|
|
|
void applyToSelectedTorrents(const std::function<void (BitTorrent::Torrent *const)> &fn);
|
|
|
|
QVector<BitTorrent::Torrent *> getVisibleTorrents() const;
|
2022-01-18 10:15:54 +03:00
|
|
|
int visibleColumnsCount() const;
|
2016-11-27 10:14:41 +03:00
|
|
|
|
2022-06-23 07:28:00 +03:00
|
|
|
TransferListModel *m_listModel = nullptr;
|
|
|
|
TransferListSortModel *m_sortFilterModel = nullptr;
|
|
|
|
MainWindow *m_mainWindow = nullptr;
|
2009-11-07 22:55:33 +03:00
|
|
|
};
|