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();
91 void enableApplyButton();
92 void toggleComboRatioLimitAct();
93 void changePage(QListWidgetItem
*, QListWidgetItem
*);
94 void loadSplitterState();
95 void handleWatchedFolderViewSelectionChanged();
96 void editWatchedFolderOptions(const QModelIndex
&index
);
97 void on_IpFilterRefreshBtn_clicked();
98 void handleIPFilterParsed(bool error
, int ruleCount
);
99 void on_banListButton_clicked();
100 void on_IPSubnetWhitelistButton_clicked();
101 void on_randomButton_clicked();
102 void on_addWatchedFolderButton_clicked();
103 void on_editWatchedFolderButton_clicked();
104 void on_removeWatchedFolderButton_clicked();
105 void setLocale(const QString
&localeStr
);
107 #ifndef DISABLE_WEBUI
108 void webUIHttpsCertChanged(const Path
&path
);
109 void webUIHttpsKeyChanged(const Path
&path
);
110 void on_registerDNSBtn_clicked();
114 void showEvent(QShowEvent
*e
) override
;
117 bool applySettings();
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;
169 int getMaxInactiveSeedingMinutes() const;
171 bool isProxyEnabled() const;
172 QString
getProxyIp() const;
173 unsigned short getProxyPort() const;
174 QString
getProxyUsername() const;
175 QString
getProxyPassword() const;
176 Net::ProxyType
getProxyType() const;
178 bool isIPFilteringEnabled() const;
179 Path
getFilter() const;
181 bool isQueueingSystemEnabled() const;
182 int getMaxActiveDownloads() const;
183 int getMaxActiveUploads() const;
184 int getMaxActiveTorrents() const;
186 #ifndef DISABLE_WEBUI
187 bool isWebUIEnabled() const;
188 QString
webUIUsername() const;
189 QString
webUIPassword() const;
190 bool webUIAuthenticationOk();
191 bool isAlternativeWebUIPathValid();
196 Ui::OptionsDialog
*m_ui
= nullptr;
197 SettingValue
<QSize
> m_storeDialogSize
;
198 SettingValue
<QStringList
> m_storeHSplitterSize
;
199 SettingValue
<int> m_storeLastViewedPage
;
201 QPushButton
*m_applyButton
= nullptr;
203 AdvancedSettings
*m_advancedSettings
= nullptr;
205 bool m_refreshingIpFilter
= false;