Browse Source

- Now user can change DHT port in options

- Reworked options window a little
adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
f7140491cd
  1. 2
      Changelog
  2. 2
      TODO
  3. 7
      src/GUI.cpp
  4. 588
      src/options.ui
  5. 62
      src/options_imp.cpp
  6. 6
      src/options_imp.h

2
Changelog

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

2
TODO

@ -31,9 +31,7 @@
- Add upnp port forwarding support - Add upnp port forwarding support
- Add Visit qBittorrent website menu entry - Add Visit qBittorrent website menu entry
- Add Report a bug in qBittorrent 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?) - Display remaining HD space (check it before adding a new torrent?)
- Move novaUpdater to a Thread (probably use downloadThread) to prevent GUI freezing - 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 - Add button : delete from list and Hard drive
- Check if there is at least one file in selection (torrent properties) - Check if there is at least one file in selection (torrent properties)

7
src/GUI.cpp

@ -1690,6 +1690,13 @@ void GUI::configureSession(){
qDebug("Disabling DHT Support"); 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 // Apply filtering settings
if(options->isFilteringEnabled()){ if(options->isFilteringEnabled()){
qDebug("Ip Filter enabled"); qDebug("Ip Filter enabled");

588
src/options.ui

@ -6,7 +6,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>506</width> <width>506</width>
<height>490</height> <height>491</height>
</rect> </rect>
</property> </property>
<property name="minimumSize" > <property name="minimumSize" >
@ -75,50 +75,6 @@
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </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> <item>
<widget class="QGroupBox" name="groupBox" > <widget class="QGroupBox" name="groupBox" >
<property name="minimumSize" > <property name="minimumSize" >
@ -200,13 +156,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="lblDHT" >
<property name="text" >
<string>DHT (Trackerless):</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -423,7 +372,7 @@
<item> <item>
<widget class="QSpinBox" name="spin_port_min" > <widget class="QSpinBox" name="spin_port_min" >
<property name="maximum" > <property name="maximum" >
<number>60000</number> <number>65525</number>
</property> </property>
<property name="minimum" > <property name="minimum" >
<number>1000</number> <number>1000</number>
@ -549,17 +498,81 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QCheckBox" name="disableDHT" >
<property name="text" >
<string>Disable DHT (Trackerless) support</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
</item> </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> </layout>
</widget> </widget>
</item> </item>
@ -620,6 +633,127 @@
</item> </item>
</layout> </layout>
</item> </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> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_4" > <widget class="QWidget" name="tab_4" >
@ -1007,224 +1141,212 @@
<attribute name="title" > <attribute name="title" >
<string>Misc</string> <string>Misc</string>
</attribute> </attribute>
<widget class="QGroupBox" name="groupBox_2" > <layout class="QVBoxLayout" >
<property name="geometry" > <property name="margin" >
<rect> <number>9</number>
<x>0</x>
<y>0</y>
<width>452</width>
<height>66</height>
</rect>
</property> </property>
<property name="title" > <property name="spacing" >
<string>Localization</string> <number>6</number>
</property> </property>
<layout class="QVBoxLayout" > <item>
<property name="margin" > <widget class="QCheckBox" name="checkAdditionDialog" >
<number>9</number> <property name="text" >
</property> <string>Display a torrent addition dialog everytime I add a torrent</string>
<property name="spacing" > </property>
<number>6</number> <property name="checked" >
</property> <bool>true</bool>
<item> </property>
<layout class="QHBoxLayout" > </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" > <property name="margin" >
<number>0</number> <number>9</number>
</property> </property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="lbl_icon_i18n" > <layout class="QHBoxLayout" >
<property name="text" > <property name="margin" >
<string/> <number>0</number>
</property> </property>
</widget> <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>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3" >
<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> <item>
<widget class="QLabel" name="lbl_i18n" > <widget class="QCheckBox" name="confirmExit_checkBox" >
<property name="text" > <property name="text" >
<string>Language:</string> <string>Ask for confirmation on exit</string>
</property>
<property name="checked" >
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="combo_i18n" > <widget class="QCheckBox" name="clearFinished_checkBox" >
<property name="minimumSize" > <property name="text" >
<size> <string>Automatically clear finished downloads</string>
<width>300</width>
<height>25</height>
</size>
</property> </property>
<property name="sizeAdjustPolicy" > <property name="checked" >
<enum>QComboBox::AdjustToContents</enum> <bool>true</bool>
</property>
<property name="modelColumn" >
<number>0</number>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer> <widget class="QCheckBox" name="check_goToSysTray" >
<property name="orientation" > <property name="text" >
<enum>Qt::Horizontal</enum> <string>Go to systray when minimizing window</string>
</property> </property>
<property name="sizeHint" > <property name="checked" >
<size> <bool>true</bool>
<width>40</width>
<height>20</height>
</size>
</property> </property>
</spacer> </widget>
</item> </item>
</layout> </layout>
</item> </widget>
</layout> </item>
</widget> <item>
<widget class="QGroupBox" name="groupBox_3" > <widget class="QGroupBox" name="groupBox_4" >
<property name="geometry" > <property name="title" >
<rect> <string>Preview program</string>
<x>9</x> </property>
<y>81</y> <layout class="QVBoxLayout" >
<width>466</width> <property name="margin" >
<height>95</height> <number>9</number>
</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>
<property name="checked" > <property name="spacing" >
<bool>true</bool> <number>6</number>
</property> </property>
</widget> <item>
</item> <layout class="QHBoxLayout" >
</layout> <property name="margin" >
</widget> <number>0</number>
<widget class="QGroupBox" name="groupBox_4" > </property>
<property name="geometry" > <property name="spacing" >
<rect> <number>6</number>
<x>10</x> </property>
<y>180</y> <item>
<width>461</width> <widget class="QLabel" name="lbl_preview" >
<height>67</height> <property name="text" >
</rect> <string>Audio/Video player:</string>
</property> </property>
<property name="title" > </widget>
<string>Preview program</string> </item>
</property> <item>
<layout class="QVBoxLayout" > <widget class="QLineEdit" name="preview_program" />
<property name="margin" > </item>
<number>9</number> <item>
</property> <widget class="QToolButton" name="browsePreview" >
<property name="spacing" > <property name="text" >
<number>6</number> <string>...</string>
</property> </property>
<item> </widget>
<layout class="QHBoxLayout" > </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" > <property name="margin" >
<number>0</number> <number>9</number>
</property> </property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="lbl_preview" > <widget class="QRadioButton" name="alwaysOSD" >
<property name="text" > <property name="text" >
<string>Audio/Video player:</string> <string>Always display systray messages</string>
</property>
<property name="checked" >
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="preview_program" /> <widget class="QRadioButton" name="someOSD" >
<property name="text" >
<string>Display systray messages only when window is hidden</string>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="browsePreview" > <widget class="QRadioButton" name="neverOSD" >
<property name="text" > <property name="text" >
<string>...</string> <string>Never display systray messages</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </widget>
</layout> </item>
</widget> </layout>
<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>
</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>
</widget> </widget>
</widget> </widget>
</item> </item>

62
src/options_imp.cpp

@ -34,9 +34,10 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
setupUi(this); setupUi(this);
// Setting icons // Setting icons
tabWidget->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/systemtray.png"))); tabWidget->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/systemtray.png")));
tabWidget->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/filter.png"))); tabWidget->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/locale.png")));
tabWidget->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/proxy.png"))); tabWidget->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/filter.png")));
tabWidget->setTabIcon(3, QIcon(QString::fromUtf8(":/Icons/style.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"))); lbl_icon_i18n->setPixmap(QPixmap(QString::fromUtf8(":/Icons/locale.png")));
addFilterRange->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png"))); addFilterRange->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
delFilterRange->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.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 signals / slots
connect(disableUPLimit, SIGNAL(stateChanged(int)), this, SLOT(disableUpload(int))); connect(disableUPLimit, SIGNAL(stateChanged(int)), this, SLOT(disableUpload(int)));
connect(disableDLLimit, SIGNAL(stateChanged(int)), this, SLOT(disableDownload(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(disableRatio, SIGNAL(stateChanged(int)), this, SLOT(disableShareRatio(int)));
connect(activateFilter, SIGNAL(stateChanged(int)), this, SLOT(enableFilter(int))); connect(activateFilter, SIGNAL(stateChanged(int)), this, SLOT(enableFilter(int)));
connect(enableProxy_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableProxy(int))); connect(enableProxy_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableProxy(int)));
connect(enableProxyAuth_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableProxyAuth(int))); connect(enableProxyAuth_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableProxyAuth(int)));
connect(enableScan_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int))); connect(enableScan_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableDirScan(int)));
connect(disableMaxConnec, SIGNAL(stateChanged(int)), this, SLOT(disableMaxConnecLimit(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 // Apply button is activated when a value is changed
// Main // Main
connect(txt_savePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(spin_download, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(spin_download, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spin_upload, 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())); 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(enableScan_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(disableMaxConnec, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(disableMaxConnec, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(disableDHT, 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 // IPFilter
connect(activateFilter, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(activateFilter, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(filterFile, SIGNAL(textChanged(QString)), 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_username, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(proxy_password, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(proxy_password, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
// Misc Settings // 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(check_goToSysTray, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(clearFinished_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(clearFinished_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(confirmExit_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"); optionValue = doc.createTextNode("1");
} }
tag.appendChild(optionValue); tag.appendChild(optionValue);
tag = doc.createElement("DHTPort");
root.appendChild(tag);
optionValue = doc.createTextNode(misc::toString(getDHTPort()).c_str());
tag.appendChild(optionValue);
if(scanDir->isEnabled()){ if(scanDir->isEnabled()){
tag = doc.createElement("scan_dir"); tag = doc.createElement("scan_dir");
root.appendChild(tag); root.appendChild(tag);
@ -405,8 +415,18 @@ bool options_imp::loadOptions(){
if(!tag.isNull()){ if(!tag.isNull()){
if(tag.text().toInt() == 0){ if(tag.text().toInt() == 0){
disableDHT->setChecked(true); disableDHT->setChecked(true);
groupDHT->setEnabled(false);
}else{ }else{
disableDHT->setChecked(false); 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(); 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()); 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 options_imp::getPreviewProgram() const{
QString preview_txt = preview_program->text(); QString preview_txt = preview_program->text();
preview_txt.trimmed(); 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){ void options_imp::disableMaxConnecLimit(int checkBoxValue){
if(checkBoxValue==2){ if(checkBoxValue==2){
//Disable //Disable

6
src/options_imp.h

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

Loading…
Cancel
Save