2006-09-30 20:02:39 +04:00
|
|
|
/*
|
|
|
|
* Bittorrent Client using Qt4 and libtorrent.
|
2007-07-14 18:31:59 +04:00
|
|
|
* Copyright (C) 2006 Christophe Dumez
|
2006-09-30 20:02:39 +04:00
|
|
|
*
|
2007-07-14 18:31:59 +04:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-09-30 20:02:39 +04:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-14 18:31:59 +04:00
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
2009-04-05 21:00:55 +04:00
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
|
|
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
|
|
|
* and distribute the linked executables. You must obey the GNU General Public
|
|
|
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
|
|
|
* modify file(s), you may extend this exception to your version of the file(s),
|
|
|
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
|
|
|
* exception statement from your version.
|
|
|
|
*
|
2007-07-14 18:31:59 +04:00
|
|
|
* Contact : chris@qbittorrent.org
|
2006-09-30 20:02:39 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OPTIONS_IMP_H
|
|
|
|
#define OPTIONS_IMP_H
|
|
|
|
|
|
|
|
#include "ui_options.h"
|
2007-11-07 00:11:09 +03:00
|
|
|
|
|
|
|
// actions on double-click on torrents
|
2015-09-03 16:28:47 +03:00
|
|
|
enum DoubleClickAction
|
|
|
|
{
|
|
|
|
TOGGLE_PAUSE,
|
|
|
|
OPEN_DEST,
|
|
|
|
NO_ACTION
|
|
|
|
};
|
2007-11-07 00:11:09 +03:00
|
|
|
|
2010-01-31 18:11:15 +03:00
|
|
|
class AdvancedSettings;
|
2007-07-23 16:56:57 +04:00
|
|
|
|
2011-02-27 18:41:05 +03:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QCloseEvent;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2015-09-03 16:28:47 +03:00
|
|
|
class options_imp: public QDialog, private Ui_Preferences
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2010-12-12 22:37:59 +03:00
|
|
|
private:
|
2015-09-03 16:28:47 +03:00
|
|
|
enum Tabs
|
|
|
|
{
|
|
|
|
TAB_UI,
|
|
|
|
TAB_DOWNLOADS,
|
|
|
|
TAB_CONNECTION,
|
|
|
|
TAB_SPEED,
|
|
|
|
TAB_BITTORRENT,
|
|
|
|
TAB_WEBUI,
|
|
|
|
TAB_ADVANCED
|
|
|
|
};
|
2006-09-30 20:02:39 +04:00
|
|
|
|
2009-11-15 16:28:58 +03:00
|
|
|
public:
|
2015-09-03 16:28:47 +03:00
|
|
|
// Constructor / Destructor
|
|
|
|
options_imp(QWidget *parent = 0);
|
|
|
|
~options_imp();
|
2006-09-30 20:02:39 +04:00
|
|
|
|
2011-04-11 23:33:30 +04:00
|
|
|
public slots:
|
2015-09-03 16:28:47 +03:00
|
|
|
void showConnectionTab();
|
2011-04-11 23:33:30 +04:00
|
|
|
|
2011-04-11 21:21:16 +04:00
|
|
|
private slots:
|
2015-09-03 16:28:47 +03:00
|
|
|
void enableProxy(int comboIndex);
|
|
|
|
void on_buttonBox_accepted();
|
|
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
void on_buttonBox_rejected();
|
|
|
|
void applySettings(QAbstractButton* button);
|
|
|
|
void enableApplyButton();
|
|
|
|
void changePage(QListWidgetItem*, QListWidgetItem*);
|
|
|
|
void loadWindowState();
|
|
|
|
void saveWindowState() const;
|
|
|
|
void handleScanFolderViewSelectionChanged();
|
|
|
|
void on_IpFilterRefreshBtn_clicked();
|
|
|
|
void handleIPFilterParsed(bool error, int ruleCount);
|
|
|
|
void on_browseExportDirButton_clicked();
|
|
|
|
void on_browseExportDirFinButton_clicked();
|
|
|
|
void on_browseFilterButton_clicked();
|
|
|
|
void on_browseSaveDirButton_clicked();
|
|
|
|
void on_browseTempDirButton_clicked();
|
|
|
|
void on_randomButton_clicked();
|
|
|
|
void on_addScanFolderButton_clicked();
|
|
|
|
void on_removeScanFolderButton_clicked();
|
|
|
|
void on_btnWebUiCrt_clicked();
|
|
|
|
void on_btnWebUiKey_clicked();
|
|
|
|
void on_registerDNSBtn_clicked();
|
|
|
|
void setLocale(const QString &locale);
|
2010-11-20 18:59:17 +03:00
|
|
|
|
|
|
|
private:
|
2015-09-03 16:28:47 +03:00
|
|
|
// Methods
|
|
|
|
void saveOptions();
|
|
|
|
void loadOptions();
|
|
|
|
void initializeLanguageCombo();
|
|
|
|
static QString languageToLocalizedString(const QLocale &locale);
|
|
|
|
// General options
|
|
|
|
QString getLocale() const;
|
|
|
|
bool systrayIntegration() const;
|
|
|
|
bool minimizeToTray() const;
|
|
|
|
bool closeToTray() const;
|
|
|
|
bool startMinimized() const;
|
|
|
|
bool isSlashScreenDisabled() const;
|
|
|
|
bool preventFromSuspend() const;
|
2013-09-21 11:59:58 +04:00
|
|
|
#ifdef Q_OS_WIN
|
2015-09-03 16:28:47 +03:00
|
|
|
bool WinStartup() const;
|
2012-10-08 00:05:33 +04:00
|
|
|
#endif
|
2015-09-03 16:28:47 +03:00
|
|
|
// Downloads
|
|
|
|
bool preAllocateAllFiles() const;
|
|
|
|
bool useAdditionDialog() const;
|
|
|
|
bool addTorrentsInPause() const;
|
|
|
|
QString getTorrentExportDir() const;
|
|
|
|
QString getFinishedTorrentExportDir() const;
|
|
|
|
QString askForExportDir(const QString& currentExportPath);
|
|
|
|
int getActionOnDblClOnTorrentDl() const;
|
|
|
|
int getActionOnDblClOnTorrentFn() const;
|
|
|
|
// Connection options
|
|
|
|
int getPort() const;
|
|
|
|
bool isUPnPEnabled() const;
|
|
|
|
QPair<int, int> getGlobalBandwidthLimits() const;
|
|
|
|
QPair<int, int> getAltGlobalBandwidthLimits() const;
|
|
|
|
// Bittorrent options
|
|
|
|
int getMaxConnecs() const;
|
|
|
|
int getMaxConnecsPerTorrent() const;
|
|
|
|
int getMaxUploads() const;
|
|
|
|
int getMaxUploadsPerTorrent() const;
|
|
|
|
bool isDHTEnabled() const;
|
|
|
|
bool isLSDEnabled() const;
|
|
|
|
int getEncryptionSetting() const;
|
|
|
|
qreal getMaxRatio() const;
|
|
|
|
// Proxy options
|
|
|
|
bool isProxyEnabled() const;
|
|
|
|
bool isProxyAuthEnabled() const;
|
|
|
|
QString getProxyIp() const;
|
|
|
|
unsigned short getProxyPort() const;
|
|
|
|
QString getProxyUsername() const;
|
|
|
|
QString getProxyPassword() const;
|
|
|
|
int getProxyType() const;
|
|
|
|
// IP Filter
|
|
|
|
bool isFilteringEnabled() const;
|
|
|
|
QString getFilter() const;
|
|
|
|
bool m_refreshingIpFilter;
|
|
|
|
// Queueing system
|
|
|
|
bool isQueueingSystemEnabled() const;
|
|
|
|
int getMaxActiveDownloads() const;
|
|
|
|
int getMaxActiveUploads() const;
|
|
|
|
int getMaxActiveTorrents() const;
|
|
|
|
bool isWebUiEnabled() const;
|
|
|
|
quint16 webUiPort() const;
|
|
|
|
QString webUiUsername() const;
|
|
|
|
QString webUiPassword() const;
|
|
|
|
QSize sizeFittingScreen() const;
|
2006-09-30 20:02:39 +04:00
|
|
|
|
2011-06-05 20:08:30 +04:00
|
|
|
private:
|
2015-09-03 16:28:47 +03:00
|
|
|
void setSslKey(const QByteArray &key, bool interactive = true);
|
|
|
|
void setSslCertificate(const QByteArray &cert, bool interactive = true);
|
|
|
|
bool schedTimesOk();
|
2016-01-31 20:30:43 +03:00
|
|
|
bool webUIAuthenticationOk();
|
2011-06-05 20:08:30 +04:00
|
|
|
|
2010-11-20 18:59:17 +03:00
|
|
|
private:
|
2015-09-03 16:28:47 +03:00
|
|
|
QButtonGroup choiceLanguage;
|
|
|
|
QAbstractButton *applyButton;
|
|
|
|
AdvancedSettings *advancedSettings;
|
|
|
|
QList<QString> addedScanDirs;
|
2016-01-02 02:23:26 +03:00
|
|
|
QList<QString> removedScanDirs;
|
2015-09-03 16:28:47 +03:00
|
|
|
// SSL Cert / key
|
|
|
|
QByteArray m_sslCert, m_sslKey;
|
2006-09-30 20:02:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|