2006-09-30 20:02:39 +04:00
|
|
|
/*
|
|
|
|
* Bittorrent Client using Qt4 and libtorrent.
|
|
|
|
* Copyright (C) 2006 Christophe Dumez
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OPTIONS_IMP_H
|
|
|
|
#define OPTIONS_IMP_H
|
|
|
|
|
2007-03-19 17:31:08 +03:00
|
|
|
#include <QCloseEvent>
|
2006-09-30 20:02:39 +04:00
|
|
|
#include "ui_options.h"
|
2007-03-05 20:35:38 +03:00
|
|
|
#include <libtorrent/session.hpp>
|
|
|
|
#include <libtorrent/ip_filter.hpp>
|
2006-10-13 00:28:48 +04:00
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
using namespace libtorrent;
|
|
|
|
|
|
|
|
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();
|
2006-09-30 20:02:39 +04:00
|
|
|
// Main options
|
|
|
|
std::pair<unsigned short, unsigned short> getPorts() const;
|
|
|
|
QPair<int,int> getLimits() const;
|
|
|
|
float getRatio() const;
|
|
|
|
int getMaxConnec() const;
|
|
|
|
QString getScanDir() const;
|
|
|
|
bool isDHTEnabled() const;
|
2006-10-24 15:28:32 +04:00
|
|
|
int getDHTPort() const;
|
2007-03-28 01:08:07 +04:00
|
|
|
#ifndef NO_UPNP
|
|
|
|
bool isUPnPEnabled() const;
|
|
|
|
int getUPnPPort() const;
|
|
|
|
#endif
|
2007-02-19 17:18:59 +03:00
|
|
|
bool isPeXDisabled() const;
|
2006-09-30 20:02:39 +04:00
|
|
|
// Filter Settings
|
|
|
|
bool isFilteringEnabled() const;
|
|
|
|
ip_filter getFilter() const;
|
|
|
|
// Proxy settings
|
|
|
|
bool isProxyEnabled() const;
|
|
|
|
bool isProxyAuthEnabled() const;
|
|
|
|
QString getProxyIp() const;
|
|
|
|
unsigned short getProxyPort() const;
|
|
|
|
QString getProxyUsername() const;
|
|
|
|
QString getProxyPassword() const;
|
|
|
|
// Language Settings
|
|
|
|
QString getLocale() const;
|
|
|
|
// Misc Settings
|
2006-10-24 15:28:32 +04:00
|
|
|
bool useAdditionDialog() const;
|
|
|
|
QString getSavePath() const;
|
2006-09-30 20:02:39 +04:00
|
|
|
bool getGoToSysTrayOnMinimizingWindow() const;
|
2007-02-24 22:23:10 +03:00
|
|
|
bool getGoToSysTrayOnExitingWindow() const;
|
2006-09-30 20:02:39 +04:00
|
|
|
bool getConfirmOnExit() const;
|
|
|
|
QString getPreviewProgram() const;
|
|
|
|
bool getUseOSDAlways() const;
|
|
|
|
bool getUseOSDWhenHiddenOnly() const;
|
2007-03-28 12:05:37 +04:00
|
|
|
QString getStyle() const;
|
2007-03-29 23:54:45 +04:00
|
|
|
bool useSystrayIntegration() const;
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
protected slots:
|
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);
|
2006-09-30 20:02:39 +04:00
|
|
|
void on_addFilterRange_clicked();
|
|
|
|
void on_delFilterRange_clicked();
|
|
|
|
void on_browse_button_scan_clicked();
|
|
|
|
void on_browsePreview_clicked();
|
|
|
|
void on_filterBrowse_clicked();
|
|
|
|
void disableDownload(int checkBoxValue);
|
2006-10-24 15:28:32 +04:00
|
|
|
void disableDHTGroup(int checkBoxValue);
|
2007-03-28 12:05:37 +04:00
|
|
|
#ifndef NO_UPNP
|
|
|
|
void disableUPnPGroup(int checkBoxValue);
|
|
|
|
#endif
|
2006-09-30 20:02:39 +04:00
|
|
|
void disableMaxConnecLimit(int);
|
|
|
|
void enableFilter(int checkBoxValue);
|
|
|
|
void disableUpload(int checkBoxValue);
|
|
|
|
void disableShareRatio(int checkBoxValue);
|
|
|
|
void enableProxy(int checkBoxValue);
|
|
|
|
void enableProxyAuth(int checkBoxValue);
|
|
|
|
void enableDirScan(int checkBoxValue);
|
|
|
|
void on_browse_button_clicked();
|
|
|
|
void processFilterFile(const QString& filePath=QString());
|
|
|
|
void enableApplyButton();
|
|
|
|
void checkPortsLogic();
|
2006-10-24 15:28:32 +04:00
|
|
|
void enableSavePath(int checkBoxValue);
|
2007-03-29 23:54:45 +04:00
|
|
|
void setStyle(QString style);
|
|
|
|
void systrayDisabled(int val);
|
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-03-10 21:14:53 +03:00
|
|
|
void status_changed(const QString&, bool) const;
|
|
|
|
void exitWithCancel();
|
2006-09-30 20:02:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|