Browse Source

- Fixed an exception with latest libtorrent/asio on startup (filepath check)

- Added an option to toggle the Peer eXchange (PeX) state
adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
f017d29359
  1. 1
      TODO
  2. 12
      src/GUI.cpp
  3. 22
      src/options.ui
  4. 14
      src/options_imp.cpp
  5. 1
      src/options_imp.h

1
TODO

@ -36,7 +36,6 @@ @@ -36,7 +36,6 @@
// In v0.9.0
- Wait for libtorrent v0.12 official release
- Add an option to disable Peer Exchange (PeX)
- Move deletion from hard drive to a thread to avoid GUI freezing
- Should create options dialog only when needed to save up some memory
- Download from RSS feeds

12
src/GUI.cpp

@ -66,7 +66,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){ @@ -66,7 +66,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
QCoreApplication::setApplicationName("qBittorrent");
readSettings();
s = new session(fingerprint("qB", VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, 0));
//s = new session(fingerprint("AZ", 2, 5, 0, 0)); //Azureus fingerprint
// Setting icons
this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent32.png")));
actionOpen->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/open.png")));
@ -124,14 +124,11 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){ @@ -124,14 +124,11 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
connect(timerScan, SIGNAL(timeout()), this, SLOT(scanDirectory()));
// Set severity level of libtorrent session
s->set_severity_level(alert::info);
// To avoid some exceptions
fs::path::default_name_check(fs::no_check);
// DHT (Trackerless)
DHTEnabled = false;
// Configure BT session according to options
configureSession();
s->add_extension(&create_metadata_plugin);
s->add_extension(&create_ut_pex_plugin);
// download thread
downloader = new downloadThread(this);
connect(downloader, SIGNAL(downloadFinished(QString, QString, int, QString)), this, SLOT(processDownloadedFile(QString, QString, int, QString)));
@ -1585,6 +1582,12 @@ void GUI::configureSession(){ @@ -1585,6 +1582,12 @@ void GUI::configureSession(){
qDebug("Disabling DHT Support");
}
}
if(!options->isPeXDisabled()){
qDebug("Enabling Peer eXchange (PeX)");
s->add_extension(&create_ut_pex_plugin);
}else{
qDebug("Peer eXchange (PeX) disabled");
}
int dht_port = options->getDHTPort();
if(dht_port >= 1000){
struct dht_settings DHTSettings;
@ -1610,7 +1613,6 @@ void GUI::configureSession(){ @@ -1610,7 +1613,6 @@ void GUI::configureSession(){
}
}
proxySettings.user_agent = "qBittorrent "VERSION;
//proxySettings.user_agent = "Azureus";
s->set_settings(proxySettings);
// Scan dir stuff
if(options->getScanDir().isNull()){

22
src/options.ui

@ -505,7 +505,7 @@ @@ -505,7 +505,7 @@
<item>
<widget class="QCheckBox" name="disableDHT" >
<property name="text" >
<string>Disable DHT (Trackerless) support</string>
<string>Disable DHT (Trackerless)</string>
</property>
</widget>
</item>
@ -573,6 +573,13 @@ @@ -573,6 +573,13 @@
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disablePeX" >
<property name="text" >
<string>Disable Peer eXchange (PeX)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -633,19 +640,6 @@ @@ -633,19 +640,6 @@
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3" >

14
src/options_imp.cpp

@ -123,6 +123,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -123,6 +123,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(enableScan_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(disableMaxConnec, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(disableDHT, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(disablePeX, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(spin_dht_port, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
// Language
connect(combo_i18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
@ -169,6 +170,7 @@ void options_imp::saveOptions(){ @@ -169,6 +170,7 @@ void options_imp::saveOptions(){
settings.setValue("PortRangeMax", getPorts().second);
settings.setValue("ShareRatio", getRatio());
settings.setValue("DHTPort", getDHTPort());
settings.setValue("PeXState", isPeXDisabled());
settings.setValue("ScanDir", getScanDir());
// End Main options
settings.endGroup();
@ -244,6 +246,7 @@ bool options_imp::isFilteringEnabled() const{ @@ -244,6 +246,7 @@ bool options_imp::isFilteringEnabled() const{
void options_imp::loadOptions(){
int value;
float floatValue;
bool boolValue;
QString strValue;
QSettings settings("qBittorrent", "qBittorrent");
// Check if min port < max port
@ -301,6 +304,14 @@ void options_imp::loadOptions(){ @@ -301,6 +304,14 @@ void options_imp::loadOptions(){
}
spin_dht_port->setValue(value);
}
boolValue = settings.value("PeXState", 0).toBool();
if(value){
// Pex disabled
disablePeX->setChecked(true);
}else{
// PeX enabled
disablePeX->setChecked(false);
}
strValue = settings.value("ScanDir", QString()).toString();
if(!strValue.isEmpty()){
enableScan_checkBox->setChecked(true);
@ -434,6 +445,9 @@ bool options_imp::isDHTEnabled() const{ @@ -434,6 +445,9 @@ bool options_imp::isDHTEnabled() const{
return !disableDHT->isChecked();
}
bool options_imp::isPeXDisabled() const{
return disablePeX->isChecked();
}
// Return Download & Upload limits
// [download,upload]
QPair<int,int> options_imp::getLimits() const{

1
src/options_imp.h

@ -52,6 +52,7 @@ class options_imp : public QDialog, private Ui::Dialog{ @@ -52,6 +52,7 @@ class options_imp : public QDialog, private Ui::Dialog{
QString getScanDir() const;
bool isDHTEnabled() const;
int getDHTPort() const;
bool isPeXDisabled() const;
// Filter Settings
bool isFilteringEnabled() const;
ip_filter getFilter() const;

Loading…
Cancel
Save