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.
29 #ifndef OPTIONSDIALOG_H
30 #define OPTIONSDIALOG_H
32 #include <QButtonGroup>
35 class QAbstractButton
;
37 class QListWidgetItem
;
38 class AdvancedSettings
;
40 // actions on double-click on torrents
41 enum DoubleClickAction
58 class OptionsDialog
: public QDialog
61 using ThisType
= OptionsDialog
;
82 // Constructor / Destructor
83 OptionsDialog(QWidget
*parent
= nullptr);
87 void showConnectionTab();
90 void enableForceProxy(bool enable
);
91 void enableProxy(int index
);
92 void on_buttonBox_accepted();
93 void closeEvent(QCloseEvent
*e
) override
;
94 void on_buttonBox_rejected();
95 void applySettings(QAbstractButton
*button
);
96 void enableApplyButton();
97 void toggleComboRatioLimitAct();
98 void changePage(QListWidgetItem
*, QListWidgetItem
*);
99 void loadWindowState();
100 void loadSplitterState();
101 void saveWindowState() const;
102 void handleScanFolderViewSelectionChanged();
103 void on_IpFilterRefreshBtn_clicked();
104 void handleIPFilterParsed(bool error
, int ruleCount
);
105 void on_banListButton_clicked();
106 void on_IPSubnetWhitelistButton_clicked();
107 void on_randomButton_clicked();
108 void on_addScanFolderButton_clicked();
109 void on_removeScanFolderButton_clicked();
110 void on_registerDNSBtn_clicked();
111 void setLocale(const QString
&localeStr
);
112 void webUIHttpsCertChanged(const QString
&path
, ShowError showError
);
113 void webUIHttpsKeyChanged(const QString
&path
, ShowError showError
);
119 void initializeLanguageCombo();
120 static QString
languageToLocalizedString(const QLocale
&locale
);
122 QString
getLocale() const;
124 bool systrayIntegration() const;
125 bool minimizeToTray() const;
126 bool closeToTray() const;
128 bool startMinimized() const;
129 bool isSplashScreenDisabled() const;
131 bool WinStartup() const;
134 bool preAllocateAllFiles() const;
135 bool useAdditionDialog() const;
136 bool addTorrentsInPause() const;
137 QString
getTorrentExportDir() const;
138 QString
getFinishedTorrentExportDir() const;
139 QString
askForExportDir(const QString
¤tExportPath
);
140 int getActionOnDblClOnTorrentDl() const;
141 int getActionOnDblClOnTorrentFn() const;
142 // Connection options
144 bool isUPnPEnabled() const;
145 // Bittorrent options
146 int getMaxConnecs() const;
147 int getMaxConnecsPerTorrent() const;
148 int getMaxUploads() const;
149 int getMaxUploadsPerTorrent() const;
150 bool isDHTEnabled() const;
151 bool isLSDEnabled() const;
152 int getEncryptionSetting() const;
153 qreal
getMaxRatio() const;
154 int getMaxSeedingMinutes() const;
156 bool isProxyEnabled() const;
157 bool isProxyAuthEnabled() const;
158 QString
getProxyIp() const;
159 unsigned short getProxyPort() const;
160 QString
getProxyUsername() const;
161 QString
getProxyPassword() const;
162 Net::ProxyType
getProxyType() const;
164 bool isIPFilteringEnabled() const;
165 QString
getFilter() const;
166 bool m_refreshingIpFilter
;
168 bool isQueueingSystemEnabled() const;
169 int getMaxActiveDownloads() const;
170 int getMaxActiveUploads() const;
171 int getMaxActiveTorrents() const;
173 bool isWebUiEnabled() const;
174 QString
webUiUsername() const;
175 QString
webUiPassword() const;
176 bool webUIAuthenticationOk();
177 bool isAlternativeWebUIPathValid();
181 Ui::OptionsDialog
*m_ui
;
182 QAbstractButton
*m_applyButton
;
183 AdvancedSettings
*m_advancedSettings
;
184 QList
<QString
> m_addedScanDirs
;
185 QList
<QString
> m_removedScanDirs
;
188 #endif // OPTIONSDIALOG_H