Bump to 4.6.7
[qBittorrent.git] / src / gui / torrentoptionsdialog.h
blobd6d8222d7f3c621e38515d1bad4fa08fa8fb047c
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2020 thalieht
4 * Copyright (C) 2011 Christian Kandeler
5 * Copyright (C) 2011 Christophe Dumez <chris@qbittorrent.org>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * In addition, as a special exception, the copyright holders give permission to
22 * link this program with the OpenSSL project's "OpenSSL" library (or with
23 * modified versions of it that use the same license as the "OpenSSL" library),
24 * and distribute the linked executables. You must obey the GNU General Public
25 * License in all respects for all of the code used other than "OpenSSL". If you
26 * modify file(s), you may extend this exception to your version of the file(s),
27 * but you are not obligated to do so. If you do not wish to do so, delete this
28 * exception statement from your version.
31 #pragma once
33 #include <QDialog>
35 #include "base/path.h"
36 #include "base/settingvalue.h"
38 class QAbstractButton;
40 namespace BitTorrent
42 class Torrent;
43 class TorrentID;
46 namespace Ui
48 class TorrentOptionsDialog;
51 class TorrentOptionsDialog final : public QDialog
53 Q_OBJECT
54 Q_DISABLE_COPY_MOVE(TorrentOptionsDialog)
56 public:
57 explicit TorrentOptionsDialog(QWidget *parent, const QVector<BitTorrent::Torrent *> &torrents);
58 ~TorrentOptionsDialog() override;
60 public slots:
61 void accept() override;
63 private slots:
64 void handleCategoryChanged(int index);
65 void handleTMMChanged();
66 void handleUseDownloadPathChanged();
68 void handleUpSpeedLimitChanged();
69 void handleDownSpeedLimitChanged();
71 void handleRatioTypeChanged();
73 private:
74 qreal getRatio() const;
75 int getSeedingTime() const;
76 int getInactiveSeedingTime() const;
78 QVector<BitTorrent::TorrentID> m_torrentIDs;
79 Ui::TorrentOptionsDialog *m_ui = nullptr;
80 SettingValue<QSize> m_storeDialogSize;
81 QStringList m_categories;
82 QString m_currentCategoriesString;
83 bool m_allSameCategory = true;
84 QAbstractButton *m_previousRadio = nullptr;
85 struct
87 Path savePath;
88 Path downloadPath;
89 QString category;
90 qreal ratio;
91 int seedingTime;
92 int inactiveSeedingTime;
93 int upSpeedLimit;
94 int downSpeedLimit;
95 Qt::CheckState autoTMM;
96 Qt::CheckState useDownloadPath;
97 Qt::CheckState disableDHT;
98 Qt::CheckState disablePEX;
99 Qt::CheckState disableLSD;
100 Qt::CheckState sequential;
101 Qt::CheckState firstLastPieces;
102 } m_initialValues;