2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
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.
33 #include "base/pathfwd.h"
34 #include "base/settingvalue.h"
35 #include "guiapplicationcomponent.h"
37 class QListWidgetItem
;
39 class AdvancedSettings
;
41 // actions on double-click on torrents
42 enum DoubleClickAction
61 class OptionsDialog final
: public QDialog
, public GUIApplicationComponent
64 Q_DISABLE_COPY_MOVE(OptionsDialog
)
66 using ThisType
= OptionsDialog
;
81 explicit OptionsDialog(IGUIApplication
*app
, QWidget
*parent
= nullptr);
82 ~OptionsDialog() override
;
85 void showConnectionTab();
88 void adjustProxyOptions();
89 void on_buttonBox_accepted();
90 void on_buttonBox_rejected();
92 void enableApplyButton();
93 void toggleComboRatioLimitAct();
94 void changePage(QListWidgetItem
*, QListWidgetItem
*);
95 void loadSplitterState();
96 void handleWatchedFolderViewSelectionChanged();
97 void editWatchedFolderOptions(const QModelIndex
&index
);
98 void on_IpFilterRefreshBtn_clicked();
99 void handleIPFilterParsed(bool error
, int ruleCount
);
100 void on_banListButton_clicked();
101 void on_IPSubnetWhitelistButton_clicked();
102 void on_randomButton_clicked();
103 void on_addWatchedFolderButton_clicked();
104 void on_editWatchedFolderButton_clicked();
105 void on_removeWatchedFolderButton_clicked();
106 void setLocale(const QString
&localeStr
);
108 #ifndef DISABLE_WEBUI
109 void webUIHttpsCertChanged(const Path
&path
);
110 void webUIHttpsKeyChanged(const Path
&path
);
111 void on_registerDNSBtn_clicked();
115 void showEvent(QShowEvent
*e
) override
;
118 void saveOptions() const;
120 void loadBehaviorTabOptions();
121 void saveBehaviorTabOptions() const;
123 void loadDownloadsTabOptions();
124 void saveDownloadsTabOptions() const;
126 void loadConnectionTabOptions();
127 void saveConnectionTabOptions() const;
129 void loadSpeedTabOptions();
130 void saveSpeedTabOptions() const;
132 void loadBittorrentTabOptions();
133 void saveBittorrentTabOptions() const;
135 void loadRSSTabOptions();
136 void saveRSSTabOptions() const;
138 #ifndef DISABLE_WEBUI
139 void loadWebUITabOptions();
140 void saveWebUITabOptions() const;
141 #endif // DISABLE_WEBUI
144 void initializeLanguageCombo();
145 QString
getLocale() const;
146 bool isSplashScreenDisabled() const;
148 bool WinStartup() const;
151 bool preAllocateAllFiles() const;
152 bool useAdditionDialog() const;
153 bool addTorrentsInPause() const;
154 Path
getTorrentExportDir() const;
155 Path
getFinishedTorrentExportDir() const;
156 // Connection options
158 bool isUPnPEnabled() const;
159 // Bittorrent options
160 int getMaxConnections() const;
161 int getMaxConnectionsPerTorrent() const;
162 int getMaxUploads() const;
163 int getMaxUploadsPerTorrent() const;
164 bool isDHTEnabled() const;
165 bool isLSDEnabled() const;
166 int getEncryptionSetting() const;
167 qreal
getMaxRatio() const;
168 int getMaxSeedingMinutes() const;
170 bool isProxyEnabled() const;
171 QString
getProxyIp() const;
172 unsigned short getProxyPort() const;
173 QString
getProxyUsername() const;
174 QString
getProxyPassword() const;
175 Net::ProxyType
getProxyType() const;
177 bool isIPFilteringEnabled() const;
178 Path
getFilter() const;
180 bool isQueueingSystemEnabled() const;
181 int getMaxActiveDownloads() const;
182 int getMaxActiveUploads() const;
183 int getMaxActiveTorrents() const;
185 #ifndef DISABLE_WEBUI
186 bool isWebUiEnabled() const;
187 QString
webUiUsername() const;
188 QString
webUiPassword() const;
189 bool webUIAuthenticationOk();
190 bool isAlternativeWebUIPathValid();
195 Ui::OptionsDialog
*m_ui
= nullptr;
196 SettingValue
<QSize
> m_storeDialogSize
;
197 SettingValue
<QStringList
> m_storeHSplitterSize
;
198 SettingValue
<int> m_storeLastViewedPage
;
200 QPushButton
*m_applyButton
= nullptr;
202 AdvancedSettings
*m_advancedSettings
= nullptr;
204 bool m_refreshingIpFilter
= false;