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>
|
2007-11-07 00:11:09 +03: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
|
|
|
|
2007-11-07 00:11:09 +03:00
|
|
|
// actions on double-click on torrents
|
|
|
|
#define TOGGLE_PAUSE 0
|
2007-11-16 21:26:00 +03:00
|
|
|
#define OPEN_DEST 1
|
2007-11-07 00:11:09 +03:00
|
|
|
#define SHOW_PROPERTIES 2
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
using namespace libtorrent;
|
|
|
|
|
2007-07-23 16:56:57 +04:00
|
|
|
class QCloseEvent;
|
|
|
|
|
2007-11-07 00:11:09 +03:00
|
|
|
class options_imp : public QDialog, private Ui::Dialog {
|
2006-09-30 20:02:39 +04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
QButtonGroup choiceLanguage;
|
|
|
|
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;
|
2007-09-09 19:46:23 +04:00
|
|
|
unsigned int getRefreshInterval() const;
|
2007-09-08 21:07:29 +04:00
|
|
|
bool systrayIntegration() const;
|
|
|
|
bool minimizeToTray() const;
|
|
|
|
bool closeToTray() const;
|
2007-11-07 00:11:09 +03:00
|
|
|
bool startMinimized() const;
|
2007-09-08 21:07:29 +04:00
|
|
|
bool OSDEnabled() 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-11-07 00:11:09 +03:00
|
|
|
int getActionOnDblClOnTorrentDl() const;
|
|
|
|
int getActionOnDblClOnTorrentFn() 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;
|
2008-05-18 00:32:03 +04:00
|
|
|
QString getFilter() const;
|
2008-05-16 11:10:50 +04:00
|
|
|
bool isWebUiEnabled() const;
|
|
|
|
quint16 webUiPort() const;
|
|
|
|
QString webUiUsername() const;
|
|
|
|
QString webUiPassword() 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_browseScanDirButton_clicked();
|
|
|
|
void on_browseFilterButton_clicked();
|
|
|
|
void on_browseSaveDirButton_clicked();
|
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);
|
2008-05-16 11:10:50 +04:00
|
|
|
void enableWebUi(bool 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
|