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.
|
|
|
|
*
|
|
|
|
* 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-03-05 20:35:38 +03:00
|
|
|
#include <libtorrent/ip_filter.hpp>
|
2006-10-13 00:28:48 +04:00
|
|
|
|
2007-09-08 21:07:29 +04:00
|
|
|
#define HTTP 1
|
|
|
|
#define SOCKS5 2
|
|
|
|
#define HTTP_PW 3
|
|
|
|
#define SOCKS5_PW 4
|
2007-05-14 00:02:30 +04:00
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
using namespace libtorrent;
|
|
|
|
|
2007-07-23 16:56:57 +04:00
|
|
|
class QCloseEvent;
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
class options_imp : public QDialog, private Ui::Dialog{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
QButtonGroup choiceLanguage;
|
|
|
|
ip_filter filter;
|
|
|
|
QStringList locales;
|
2007-04-11 22:19:20 +04:00
|
|
|
QAbstractButton *applyButton;
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
public:
|
2007-03-10 21:14:53 +03:00
|
|
|
// Contructor / Destructor
|
2006-09-30 20:02:39 +04:00
|
|
|
options_imp(QWidget *parent=0);
|
2007-03-10 21:14:53 +03:00
|
|
|
~options_imp();
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
// Methods
|
2006-11-14 23:26:32 +03:00
|
|
|
void saveOptions();
|
|
|
|
void loadOptions();
|
2007-09-08 21:07:29 +04:00
|
|
|
// General options
|
|
|
|
QString getLocale() const;
|
|
|
|
int getStyle() const;
|
|
|
|
bool confirmOnExit() const;
|
|
|
|
bool speedInTitleBar() const;
|
|
|
|
bool systrayIntegration() const;
|
|
|
|
bool minimizeToTray() const;
|
|
|
|
bool closeToTray() const;
|
|
|
|
bool OSDEnabled() const;
|
|
|
|
QString getPreviewProgram() const;
|
|
|
|
// Downloads
|
|
|
|
QString getSavePath() const;
|
|
|
|
bool preAllocateAllFiles() const;
|
|
|
|
bool useAdditionDialog() const;
|
|
|
|
bool addTorrentsInPause() const;
|
|
|
|
bool isDirScanEnabled() const;
|
2006-09-30 20:02:39 +04:00
|
|
|
QString getScanDir() const;
|
2007-09-08 21:07:29 +04:00
|
|
|
// Connection options
|
|
|
|
std::pair<unsigned short, unsigned short> getPorts() const;
|
|
|
|
bool isUPnPEnabled() const;
|
|
|
|
bool isNATPMPEnabled() const;
|
|
|
|
QPair<int,int> getGlobalBandwidthLimits() const;
|
2006-09-30 20:02:39 +04:00
|
|
|
bool isProxyEnabled() const;
|
|
|
|
bool isProxyAuthEnabled() const;
|
|
|
|
QString getProxyIp() const;
|
|
|
|
unsigned short getProxyPort() const;
|
|
|
|
QString getProxyUsername() const;
|
|
|
|
QString getProxyPassword() const;
|
2007-09-08 21:07:29 +04:00
|
|
|
int getProxyType() const;
|
2007-05-14 00:02:30 +04:00
|
|
|
bool useProxyForTrackers() const;
|
|
|
|
bool useProxyForPeers() const;
|
|
|
|
bool useProxyForWebseeds() const;
|
|
|
|
bool useProxyForDHT() const;
|
2007-09-08 21:07:29 +04:00
|
|
|
// Bittorrent options
|
|
|
|
int getMaxConnecs() const;
|
|
|
|
int getMaxConnecsPerTorrent() const;
|
|
|
|
int getMaxUploadsPerTorrent() const;
|
|
|
|
bool isDHTEnabled() const;
|
|
|
|
bool isPeXEnabled() const;
|
|
|
|
bool isLSDEnabled() const;
|
|
|
|
int getEncryptionSetting() const;
|
|
|
|
float getDesiredRatio() const;
|
|
|
|
float getDeleteRatio() const;
|
|
|
|
// IP Filter
|
|
|
|
bool isFilteringEnabled() const;
|
|
|
|
ip_filter getFilter() const;
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
protected slots:
|
2007-09-08 21:07:29 +04:00
|
|
|
void enableUploadLimit(int checkBoxValue);
|
|
|
|
void enableDownloadLimit(int checkBoxValue);
|
|
|
|
void enableDirScan(int checkBoxValue);
|
|
|
|
void enableProxy(int comboIndex);
|
|
|
|
void enableProxyAuth(int checkBoxValue);
|
|
|
|
void enableMaxConnecsLimit(int);
|
|
|
|
void enableMaxConnecsLimitPerTorrent(int checkBoxValue);
|
|
|
|
void enableMaxUploadsLimitPerTorrent(int checkBoxValue);
|
|
|
|
void enableShareRatio(int checkBoxValue);
|
|
|
|
void enableDeleteRatio(int checkBoxValue);
|
|
|
|
void enableFilter(int checkBoxValue);
|
|
|
|
void setStyle(int style);
|
2007-04-11 22:19:20 +04:00
|
|
|
void on_buttonBox_accepted();
|
2007-03-19 17:31:08 +03:00
|
|
|
void closeEvent(QCloseEvent *e);
|
2007-04-11 22:19:20 +04:00
|
|
|
void on_buttonBox_rejected();
|
|
|
|
void applySettings(QAbstractButton* button);
|
2007-09-08 21:07:29 +04:00
|
|
|
void on_addFilterRangeButton_clicked();
|
|
|
|
void on_delFilterRangeButton_clicked();
|
|
|
|
void on_browseScanDirButton_clicked();
|
|
|
|
void on_browsePreviewButton_clicked();
|
|
|
|
void on_browseFilterButton_clicked();
|
|
|
|
void on_browseSaveDirButton_clicked();
|
2007-07-22 13:47:27 +04:00
|
|
|
void processFilterFile(QString filePath=QString());
|
2006-09-30 20:02:39 +04:00
|
|
|
void enableApplyButton();
|
|
|
|
void checkPortsLogic();
|
2007-09-08 21:07:29 +04:00
|
|
|
void enableSystrayOptions();
|
|
|
|
void disableSystrayOptions();
|
|
|
|
void setSystrayOptionsState(int checkBoxValue);
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setLocale(QString locale);
|
2007-03-29 22:43:04 +04:00
|
|
|
void useStyle();
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
signals:
|
2007-07-22 13:47:27 +04:00
|
|
|
void status_changed(QString, bool) const;
|
2007-03-10 21:14:53 +03:00
|
|
|
void exitWithCancel();
|
2006-09-30 20:02:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|