Correctly handle "torrent finished" events
[qBittorrent.git] / src / gui / advancedsettings.h
blob5c81745bede7fa46a45562bf29049ea99504d241
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2015-2024 qBittorrent project
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 #pragma once
31 #include <libtorrent/config.hpp>
33 #include <QtSystemDetection>
34 #include <QCheckBox>
35 #include <QComboBox>
36 #include <QLineEdit>
37 #include <QSpinBox>
38 #include <QTableWidget>
40 #include "guiapplicationcomponent.h"
42 class AdvancedSettings final : public GUIApplicationComponent<QTableWidget>
44 Q_OBJECT
45 Q_DISABLE_COPY_MOVE(AdvancedSettings)
47 public:
48 explicit AdvancedSettings(IGUIApplication *app, QWidget *parent = nullptr);
50 public slots:
51 void saveAdvancedSettings() const;
53 signals:
54 void settingsChanged();
56 private slots:
57 void updateInterfaceAddressCombo();
59 #ifndef QBT_USES_LIBTORRENT2
60 void updateCacheSpinSuffix(int value);
61 #endif
63 #ifdef QBT_USES_DBUS
64 void updateNotificationTimeoutSuffix(int value);
65 #endif
67 private:
68 void loadAdvancedSettings();
69 template <typename T> void addRow(int row, const QString &text, T *widget);
71 QSpinBox m_spinBoxSaveResumeDataInterval, m_spinBoxSaveStatisticsInterval, m_spinBoxTorrentFileSizeLimit, m_spinBoxBdecodeDepthLimit, m_spinBoxBdecodeTokenLimit,
72 m_spinBoxAsyncIOThreads, m_spinBoxFilePoolSize, m_spinBoxCheckingMemUsage, m_spinBoxDiskQueueSize,
73 m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxUPnPLeaseDuration, m_spinBoxPeerToS,
74 m_spinBoxListRefresh, m_spinBoxTrackerPort, m_spinBoxSendBufferWatermark, m_spinBoxSendBufferLowWatermark,
75 m_spinBoxSendBufferWatermarkFactor, m_spinBoxConnectionSpeed, m_spinBoxSocketSendBufferSize, m_spinBoxSocketReceiveBufferSize, m_spinBoxSocketBacklogSize,
76 m_spinBoxMaxConcurrentHTTPAnnounces, m_spinBoxStopTrackerTimeout, m_spinBoxSessionShutdownTimeout,
77 m_spinBoxSavePathHistoryLength, m_spinBoxPeerTurnover, m_spinBoxPeerTurnoverCutoff, m_spinBoxPeerTurnoverInterval, m_spinBoxRequestQueueSize;
78 QCheckBox m_checkBoxOsCache, m_checkBoxRecheckCompleted, m_checkBoxResolveCountries, m_checkBoxResolveHosts,
79 m_checkBoxProgramNotifications, m_checkBoxTorrentAddedNotifications, m_checkBoxReannounceWhenAddressChanged, m_checkBoxTrackerFavicon, m_checkBoxTrackerStatus,
80 m_checkBoxTrackerPortForwarding, m_checkBoxIgnoreSSLErrors, m_checkBoxConfirmTorrentRecheck, m_checkBoxConfirmRemoveAllTags, m_checkBoxAnnounceAllTrackers,
81 m_checkBoxAnnounceAllTiers, m_checkBoxMultiConnectionsPerIp, m_checkBoxValidateHTTPSTrackerCertificate, m_checkBoxSSRFMitigation, m_checkBoxBlockPeersOnPrivilegedPorts,
82 m_checkBoxPieceExtentAffinity, m_checkBoxSuggestMode, m_checkBoxSpeedWidgetEnabled, m_checkBoxIDNSupport, m_checkBoxConfirmRemoveTrackerFromAllTorrents,
83 m_checkBoxStartSessionPaused;
84 QComboBox m_comboBoxInterface, m_comboBoxInterfaceAddress, m_comboBoxDiskIOReadMode, m_comboBoxDiskIOWriteMode, m_comboBoxUtpMixedMode, m_comboBoxChokingAlgorithm,
85 m_comboBoxSeedChokingAlgorithm, m_comboBoxResumeDataStorage, m_comboBoxTorrentContentRemoveOption;
86 QLineEdit m_lineEditAppInstanceName, m_pythonExecutablePath, m_lineEditAnnounceIP, m_lineEditDHTBootstrapNodes;
88 #ifndef QBT_USES_LIBTORRENT2
89 QSpinBox m_spinBoxCache, m_spinBoxCacheTTL;
90 QCheckBox m_checkBoxCoalesceRW;
91 #else
92 QComboBox m_comboBoxDiskIOType;
93 QSpinBox m_spinBoxHashingThreads;
94 #endif
96 #if defined(QBT_USES_LIBTORRENT2) && !defined(Q_OS_MACOS)
97 QSpinBox m_spinBoxMemoryWorkingSetLimit;
98 #endif
100 #if defined(QBT_USES_LIBTORRENT2) && TORRENT_USE_I2P
101 QSpinBox m_spinBoxI2PInboundQuantity, m_spinBoxI2POutboundQuantity, m_spinBoxI2PInboundLength, m_spinBoxI2POutboundLength;
102 #endif
104 // OS dependent settings
105 #ifdef Q_OS_WIN
106 QComboBox m_comboBoxOSMemoryPriority;
107 #endif
109 #ifndef Q_OS_MACOS
110 QCheckBox m_checkBoxIconsInMenusEnabled;
111 #endif
113 #if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
114 QCheckBox m_checkBoxMarkOfTheWeb;
115 #endif // Q_OS_MACOS || Q_OS_WIN
117 #ifdef QBT_USES_DBUS
118 QSpinBox m_spinBoxNotificationTimeout;
119 #endif