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