Merge pull request #18104 from sledgehammer999/remove_dead_code
[qBittorrent.git] / src / gui / advancedsettings.h
blob79e3146b2e64ed4406ea2ce2e2224878396c6b65
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2015
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 <QCheckBox>
32 #include <QComboBox>
33 #include <QLineEdit>
34 #include <QSpinBox>
35 #include <QTableWidget>
37 #include "guiapplicationcomponent.h"
39 class AdvancedSettings final : public QTableWidget, public GUIApplicationComponent
41 Q_OBJECT
42 Q_DISABLE_COPY_MOVE(AdvancedSettings)
44 public:
45 explicit AdvancedSettings(IGUIApplication *app, QWidget *parent = nullptr);
47 public slots:
48 void saveAdvancedSettings() const;
50 signals:
51 void settingsChanged();
53 private slots:
54 #ifndef QBT_USES_LIBTORRENT2
55 void updateCacheSpinSuffix(int value);
56 #endif
57 void updateSaveResumeDataIntervalSuffix(int value);
58 void updateInterfaceAddressCombo();
60 private:
61 void loadAdvancedSettings();
62 template <typename T> void addRow(int row, const QString &text, T *widget);
64 QSpinBox m_spinBoxAsyncIOThreads, m_spinBoxFilePoolSize, m_spinBoxCheckingMemUsage, m_spinBoxDiskQueueSize,
65 m_spinBoxSaveResumeDataInterval, m_spinBoxOutgoingPortsMin, m_spinBoxOutgoingPortsMax, m_spinBoxUPnPLeaseDuration, m_spinBoxPeerToS,
66 m_spinBoxListRefresh, m_spinBoxTrackerPort, m_spinBoxSendBufferWatermark, m_spinBoxSendBufferLowWatermark,
67 m_spinBoxSendBufferWatermarkFactor, m_spinBoxConnectionSpeed, m_spinBoxSocketBacklogSize, m_spinBoxMaxConcurrentHTTPAnnounces, m_spinBoxStopTrackerTimeout,
68 m_spinBoxSavePathHistoryLength, m_spinBoxPeerTurnover, m_spinBoxPeerTurnoverCutoff, m_spinBoxPeerTurnoverInterval, m_spinBoxRequestQueueSize;
69 QCheckBox m_checkBoxOsCache, m_checkBoxRecheckCompleted, m_checkBoxResolveCountries, m_checkBoxResolveHosts,
70 m_checkBoxProgramNotifications, m_checkBoxTorrentAddedNotifications, m_checkBoxReannounceWhenAddressChanged, m_checkBoxTrackerFavicon, m_checkBoxTrackerStatus,
71 m_checkBoxTrackerPortForwarding, m_checkBoxConfirmTorrentRecheck, m_checkBoxConfirmRemoveAllTags, m_checkBoxAnnounceAllTrackers, m_checkBoxAnnounceAllTiers,
72 m_checkBoxMultiConnectionsPerIp, m_checkBoxValidateHTTPSTrackerCertificate, m_checkBoxSSRFMitigation, m_checkBoxBlockPeersOnPrivilegedPorts, m_checkBoxPieceExtentAffinity,
73 m_checkBoxSuggestMode, m_checkBoxSpeedWidgetEnabled, m_checkBoxIDNSupport;
74 QComboBox m_comboBoxInterface, m_comboBoxInterfaceAddress, m_comboBoxDiskIOReadMode, m_comboBoxDiskIOWriteMode, m_comboBoxUtpMixedMode, m_comboBoxChokingAlgorithm,
75 m_comboBoxSeedChokingAlgorithm, m_comboBoxResumeDataStorage;
76 QLineEdit m_lineEditAnnounceIP;
78 #ifndef QBT_USES_LIBTORRENT2
79 QSpinBox m_spinBoxCache, m_spinBoxCacheTTL;
80 QCheckBox m_checkBoxCoalesceRW;
81 #else
82 QComboBox m_comboBoxDiskIOType;
83 QSpinBox m_spinBoxMemoryWorkingSetLimit, m_spinBoxHashingThreads;
84 #endif
86 // OS dependent settings
87 #if defined(Q_OS_WIN)
88 QComboBox m_comboBoxOSMemoryPriority;
89 #endif
91 #ifndef Q_OS_MACOS
92 QCheckBox m_checkBoxIconsInMenusEnabled;
93 #endif
95 #if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
96 QSpinBox m_spinBoxNotificationTimeout;
97 #endif