- Now user can change DHT port in options

- Reworked options window a little
This commit is contained in:
Christophe Dumez 2006-10-24 11:28:32 +00:00
parent ee8bc5cdaf
commit f7140491cd
6 changed files with 436 additions and 251 deletions

View file

@ -2,10 +2,12 @@
- FEATURE: Based on Qt 4.2
- FEATURE: Brand new trayicon from Qt 4.2
- FEATURE: Added a torrent addition dialog
- FEATURE: Allow user to change DHT port
- I18N: Added Finnish translation
- BUGFIX: Made right click menu work for multiple selection in DL list
- COSMETIC: Replaced OSD messages by systray messages
- COSMETIC: Displaying save path in torrent properties window
- COSMETIC: Reworked options window a little
* Mon Oct 16 2006 - Christophe Dumez <chris@qbittorrent.org> - v0.7.1
- I18N: Updated French, Polish, Dutch, Swedish, Slovak translations

2
TODO
View file

@ -31,9 +31,7 @@
- Add upnp port forwarding support
- Add Visit qBittorrent website menu entry
- Add Report a bug in qBittorrent menu entry
- Popup when adding a torrent (Save path, select files in the torrent...)
- Display remaining HD space (check it before adding a new torrent?)
- Move novaUpdater to a Thread (probably use downloadThread) to prevent GUI freezing
- Allow user to choose DHT port
- Add button : delete from list and Hard drive
- Check if there is at least one file in selection (torrent properties)

View file

@ -1690,6 +1690,13 @@ void GUI::configureSession(){
qDebug("Disabling DHT Support");
}
}
int dht_port = options->getDHTPort();
if(dht_port >= 1000){
struct dht_settings DHTSettings;
DHTSettings.service_port = dht_port;
s->set_dht_settings(DHTSettings);
qDebug("Set DHT Port to %d", dht_port);
}
// Apply filtering settings
if(options->isFilteringEnabled()){
qDebug("Ip Filter enabled");

View file

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>506</width>
<height>490</height>
<height>491</height>
</rect>
</property>
<property name="minimumSize" >
@ -75,50 +75,6 @@
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lbl_savePath" >
<property name="text" >
<string>Save Path:</string>
</property>
<property name="buddy" >
<cstring>proxy_username</cstring>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLineEdit" name="txt_savePath" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="browse_button" >
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="minimumSize" >
@ -200,13 +156,6 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDHT" >
<property name="text" >
<string>DHT (Trackerless):</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -423,7 +372,7 @@
<item>
<widget class="QSpinBox" name="spin_port_min" >
<property name="maximum" >
<number>60000</number>
<number>65525</number>
</property>
<property name="minimum" >
<number>1000</number>
@ -549,17 +498,81 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="disableDHT" >
<property name="text" >
<string>Disable DHT (Trackerless) support</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="disableDHT" >
<property name="text" >
<string>Disable DHT (Trackerless) support</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupDHT" >
<property name="title" >
<string>DHT configuration</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="dhtPort_lbl" >
<property name="text" >
<string>DHT port:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spin_dht_port" >
<property name="minimumSize" >
<size>
<width>6</width>
<height>0</height>
</size>
</property>
<property name="maximum" >
<number>65525</number>
</property>
<property name="minimum" >
<number>1000</number>
</property>
<property name="value" >
<number>6881</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
@ -620,6 +633,127 @@
</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" >
<attribute name="title" >
<string>Language</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Localization</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lbl_icon_i18n" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_i18n" >
<property name="text" >
<string>Language:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_i18n" >
<property name="minimumSize" >
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="sizeAdjustPolicy" >
<enum>QComboBox::AdjustToContents</enum>
</property>
<property name="modelColumn" >
<number>0</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_i18n_info" >
<property name="text" >
<string>&lt;b>Note:&lt;/b> Changes will be applied after qBittorrent is restarted.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>&lt;b>Translators note:&lt;/b> If qBittorrent is not available in your language, &lt;br/>and if you would like to translate it in your mother tongue, &lt;br/>please contact me (chris@qbittorrent.org).</string>
</property>
</widget>
</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_4" >
@ -1007,224 +1141,212 @@
<attribute name="title" >
<string>Misc</string>
</attribute>
<widget class="QGroupBox" name="groupBox_2" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>452</width>
<height>66</height>
</rect>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="title" >
<string>Localization</string>
<property name="spacing" >
<number>6</number>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QCheckBox" name="checkAdditionDialog" >
<property name="text" >
<string>Display a torrent addition dialog everytime I add a torrent</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupSavePath" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="title" >
<string>Default save path</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lbl_icon_i18n" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_i18n" >
<property name="text" >
<string>Language:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo_i18n" >
<property name="minimumSize" >
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="sizeAdjustPolicy" >
<enum>QComboBox::AdjustToContents</enum>
</property>
<property name="modelColumn" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<property name="spacing" >
<number>6</number>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<item>
<widget class="QLabel" name="lbl_savePath" >
<property name="text" >
<string>Save Path:</string>
</property>
<property name="buddy" >
<cstring>proxy_username</cstring>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLineEdit" name="txt_savePath" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="browse_button" >
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox_3" >
<property name="geometry" >
<rect>
<x>9</x>
<y>81</y>
<width>466</width>
<height>95</height>
</rect>
</property>
<property name="title" >
<string>Behaviour</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="confirmExit_checkBox" >
<property name="text" >
<string>Ask for confirmation on exit</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="clearFinished_checkBox" >
<property name="text" >
<string>Automatically clear finished downloads</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="check_goToSysTray" >
<property name="text" >
<string>Go to systray when minimizing window</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox_4" >
<property name="geometry" >
<rect>
<x>10</x>
<y>180</y>
<width>461</width>
<height>67</height>
</rect>
</property>
<property name="title" >
<string>Preview program</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<string>Behaviour</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lbl_preview" >
<widget class="QCheckBox" name="confirmExit_checkBox" >
<property name="text" >
<string>Audio/Video player:</string>
<string>Ask for confirmation on exit</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="preview_program" />
<widget class="QCheckBox" name="clearFinished_checkBox" >
<property name="text" >
<string>Automatically clear finished downloads</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="browsePreview" >
<widget class="QCheckBox" name="check_goToSysTray" >
<property name="text" >
<string>...</string>
<string>Go to systray when minimizing window</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupOSD" >
<property name="geometry" >
<rect>
<x>10</x>
<y>250</y>
<width>466</width>
<height>100</height>
</rect>
</property>
<property name="title" >
<string>Systray Messages</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="alwaysOSD" >
<property name="text" >
<string>Always display systray messages</string>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<string>Preview program</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="checked" >
<bool>true</bool>
<property name="spacing" >
<number>6</number>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="someOSD" >
<property name="text" >
<string>Display systray messages only when window is hidden</string>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="lbl_preview" >
<property name="text" >
<string>Audio/Video player:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="preview_program" />
</item>
<item>
<widget class="QToolButton" name="browsePreview" >
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupOSD" >
<property name="title" >
<string>Systray Messages</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="neverOSD" >
<property name="text" >
<string>Never display systray messages</string>
<property name="spacing" >
<number>6</number>
</property>
</widget>
</item>
</layout>
</widget>
<item>
<widget class="QRadioButton" name="alwaysOSD" >
<property name="text" >
<string>Always display systray messages</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="someOSD" >
<property name="text" >
<string>Display systray messages only when window is hidden</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="neverOSD" >
<property name="text" >
<string>Never display systray messages</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>

View file

@ -34,9 +34,10 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
setupUi(this);
// Setting icons
tabWidget->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/systemtray.png")));
tabWidget->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/filter.png")));
tabWidget->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/proxy.png")));
tabWidget->setTabIcon(3, QIcon(QString::fromUtf8(":/Icons/style.png")));
tabWidget->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/locale.png")));
tabWidget->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/filter.png")));
tabWidget->setTabIcon(3, QIcon(QString::fromUtf8(":/Icons/proxy.png")));
tabWidget->setTabIcon(4, QIcon(QString::fromUtf8(":/Icons/style.png")));
lbl_icon_i18n->setPixmap(QPixmap(QString::fromUtf8(":/Icons/locale.png")));
addFilterRange->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
delFilterRange->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
@ -105,15 +106,16 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// Connect signals / slots
connect(disableUPLimit, SIGNAL(stateChanged(int)), this, SLOT(disableUpload(int)));
connect(disableDLLimit, SIGNAL(stateChanged(int)), this, SLOT(disableDownload(int)));
connect(disableDHT, SIGNAL(stateChanged(int)), this, SLOT(disableDHTGroup(int)));
connect(disableRatio, SIGNAL(stateChanged(int)), this, SLOT(disableShareRatio(int)));
connect(activateFilter, SIGNAL(stateChanged(int)), this, SLOT(enableFilter(int)));
connect(enableProxy_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableProxy(int)));
connect(enableProxyAuth_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableProxyAuth(int)));
connect(enableScan_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int)));
connect(disableMaxConnec, SIGNAL(stateChanged(int)), this, SLOT(disableMaxConnecLimit(int)));
connect(checkAdditionDialog, SIGNAL(stateChanged(int)), this, SLOT(enableSavePath(int)));
// Apply button is activated when a value is changed
// Main
connect(txt_savePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(spin_download, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spin_upload, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spin_port_min, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
@ -127,6 +129,9 @@ 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(spin_dht_port, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
// Language
connect(combo_i18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
// IPFilter
connect(activateFilter, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(filterFile, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
@ -138,7 +143,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(proxy_username, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(proxy_password, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
// Misc Settings
connect(combo_i18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(checkAdditionDialog, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(txt_savePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(check_goToSysTray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(clearFinished_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(confirmExit_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
@ -227,6 +233,10 @@ bool options_imp::saveOptions(){
optionValue = doc.createTextNode("1");
}
tag.appendChild(optionValue);
tag = doc.createElement("DHTPort");
root.appendChild(tag);
optionValue = doc.createTextNode(misc::toString(getDHTPort()).c_str());
tag.appendChild(optionValue);
if(scanDir->isEnabled()){
tag = doc.createElement("scan_dir");
root.appendChild(tag);
@ -405,8 +415,18 @@ bool options_imp::loadOptions(){
if(!tag.isNull()){
if(tag.text().toInt() == 0){
disableDHT->setChecked(true);
groupDHT->setEnabled(false);
}else{
disableDHT->setChecked(false);
groupDHT->setEnabled(true);
}
}
tag = root.firstChildElement("DHTPort");
if(!tag.isNull()){
if(tag.text().toInt() < 1000){
spin_dht_port->setValue(6881);
}else{
spin_dht_port->setValue(tag.text().toInt());
}
}
tmp = root.firstChildElement("max_connec").text().toInt();
@ -510,6 +530,14 @@ std::pair<unsigned short, unsigned short> options_imp::getPorts() const{
return std::make_pair(this->spin_port_min->value(), this->spin_port_min->value());
}
int options_imp::getDHTPort() const{
if(isDHTEnabled()){
return spin_dht_port->value();
}else{
return -1;
}
}
QString options_imp::getPreviewProgram() const{
QString preview_txt = preview_program->text();
preview_txt.trimmed();
@ -611,6 +639,30 @@ void options_imp::disableDownload(int checkBoxValue){
}
}
void options_imp::disableDHTGroup(int checkBoxValue){
if(checkBoxValue==2){
//Disable
groupDHT->setEnabled(false);
}else{
//enable
groupDHT->setEnabled(true);
}
}
void options_imp::enableSavePath(int checkBoxValue){
if(checkBoxValue==2){
//enable
groupSavePath->setEnabled(false);
}else{
//disable
groupSavePath->setEnabled(true);
}
}
bool options_imp::useAdditionDialog() const{
return checkAdditionDialog->isChecked();
}
void options_imp::disableMaxConnecLimit(int checkBoxValue){
if(checkBoxValue==2){
//Disable

View file

@ -46,12 +46,12 @@ class options_imp : public QDialog, private Ui::Dialog{
bool loadOptions();
// Main options
std::pair<unsigned short, unsigned short> getPorts() const;
QString getSavePath() const;
QPair<int,int> getLimits() const;
float getRatio() const;
int getMaxConnec() const;
QString getScanDir() const;
bool isDHTEnabled() const;
int getDHTPort() const;
// Filter Settings
bool isFilteringEnabled() const;
ip_filter getFilter() const;
@ -66,6 +66,8 @@ class options_imp : public QDialog, private Ui::Dialog{
QString getLocale() const;
QTranslator translator;
// Misc Settings
bool useAdditionDialog() const;
QString getSavePath() const;
bool getClearFinishedOnExit() const;
bool getGoToSysTrayOnMinimizingWindow() const;
bool getConfirmOnExit() const;
@ -84,6 +86,7 @@ class options_imp : public QDialog, private Ui::Dialog{
void on_browsePreview_clicked();
void on_filterBrowse_clicked();
void disableDownload(int checkBoxValue);
void disableDHTGroup(int checkBoxValue);
void disableMaxConnecLimit(int);
void enableFilter(int checkBoxValue);
void disableUpload(int checkBoxValue);
@ -95,6 +98,7 @@ class options_imp : public QDialog, private Ui::Dialog{
void processFilterFile(const QString& filePath=QString());
void enableApplyButton();
void checkPortsLogic();
void enableSavePath(int checkBoxValue);
public slots:
void setLocale(QString locale);