Browse Source

Still improving program options

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
a993b2b3f1
  1. 28
      src/options_imp.cpp
  2. 3
      src/options_imp.h
  3. 269
      src/ui/options.ui

28
src/options_imp.cpp

@ -164,15 +164,12 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// Connection tab // Connection tab
connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableUploadLimit(bool))); connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableUploadLimit(bool)));
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableDownloadLimit(bool))); connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableDownloadLimit(bool)));
connect(check_schedule, SIGNAL(toggled(bool)), this, SLOT(enableSchedulerFields(bool)));
// Bittorrent tab // Bittorrent tab
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimit(bool))); connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimit(bool)));
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimitPerTorrent(bool))); connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimitPerTorrent(bool)));
connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool))); connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool)));
connect(checkRatioLimit, SIGNAL(toggled(bool)), this, SLOT(enableShareRatio(bool))); connect(checkRatioLimit, SIGNAL(toggled(bool)), this, SLOT(enableShareRatio(bool)));
connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableDeleteRatio(bool))); connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableDeleteRatio(bool)));
connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableDHTSettings(bool)));
connect(checkDifferentDHTPort, SIGNAL(toggled(bool)), this, SLOT(enableDHTPortSettings(bool)));
connect(comboPeerID, SIGNAL(currentIndexChanged(int)), this, SLOT(enableSpoofingSettings(int))); connect(comboPeerID, SIGNAL(currentIndexChanged(int)), this, SLOT(enableSpoofingSettings(int)));
// Proxy tab // Proxy tab
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)),this, SLOT(enableHTTPProxy(int))); connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)),this, SLOT(enableHTTPProxy(int)));
@ -683,7 +680,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
spinDownloadLimitAlt->setValue(Preferences::getAltGlobalDownloadLimit()); spinDownloadLimitAlt->setValue(Preferences::getAltGlobalDownloadLimit());
// Scheduler // Scheduler
check_schedule->setChecked(Preferences::isSchedulerEnabled()); check_schedule->setChecked(Preferences::isSchedulerEnabled());
enableSchedulerFields(check_schedule->isChecked());
schedule_from->setTime(Preferences::getSchedulerStartTime()); schedule_from->setTime(Preferences::getSchedulerStartTime());
schedule_to->setTime(Preferences::getSchedulerEndTime()); schedule_to->setTime(Preferences::getSchedulerEndTime());
schedule_days->setCurrentIndex((int)Preferences::getSchedulerDays()); schedule_days->setCurrentIndex((int)Preferences::getSchedulerDays());
@ -771,9 +767,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
spinMaxUploadsPerTorrent->setEnabled(false); spinMaxUploadsPerTorrent->setEnabled(false);
} }
checkDHT->setChecked(Preferences::isDHTEnabled()); checkDHT->setChecked(Preferences::isDHTEnabled());
enableDHTSettings(checkDHT->isChecked());
checkDifferentDHTPort->setChecked(!Preferences::isDHTPortSameAsBT()); checkDifferentDHTPort->setChecked(!Preferences::isDHTPortSameAsBT());
enableDHTPortSettings(checkDifferentDHTPort->isChecked());
spinDHTPort->setValue(Preferences::getDHTPort()); spinDHTPort->setValue(Preferences::getDHTPort());
checkPeX->setChecked(Preferences::isPeXEnabled()); checkPeX->setChecked(Preferences::isPeXEnabled());
checkLSD->setChecked(Preferences::isLSDEnabled()); checkLSD->setChecked(Preferences::isLSDEnabled());
@ -1104,12 +1098,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
return checkAdditionDialog->isChecked(); return checkAdditionDialog->isChecked();
} }
void options_imp::enableSchedulerFields(bool checked) {
schedule_from->setEnabled(checked);
schedule_to->setEnabled(checked);
schedule_days->setEnabled(checked);
}
void options_imp::enableMaxConnecsLimit(bool checked){ void options_imp::enableMaxConnecsLimit(bool checked){
spinMaxConnec->setEnabled(checked); spinMaxConnec->setEnabled(checked);
} }
@ -1166,22 +1154,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
spinRatio->setEnabled(checked); spinRatio->setEnabled(checked);
} }
void options_imp::enableDHTPortSettings(bool checked) {
spinDHTPort->setEnabled(checked);
dh_port_lbl->setEnabled(checked);
}
void options_imp::enableDHTSettings(bool checked) {
if(checked){
checkDifferentDHTPort->setEnabled(true);
enableDHTPortSettings(checkDifferentDHTPort->isChecked());
}else{
checkDifferentDHTPort->setEnabled(false);
enableDHTPortSettings(false);
}
}
void options_imp::enableDeleteRatio(bool checked){ void options_imp::enableDeleteRatio(bool checked){
spinMaxRatio->setEnabled(checked); spinMaxRatio->setEnabled(checked);
} }

3
src/options_imp.h

@ -137,13 +137,10 @@ protected slots:
void enableMaxConnecsLimit(bool checked); void enableMaxConnecsLimit(bool checked);
void enableMaxConnecsLimitPerTorrent(bool checked); void enableMaxConnecsLimitPerTorrent(bool checked);
void enableMaxUploadsLimitPerTorrent(bool checked); void enableMaxUploadsLimitPerTorrent(bool checked);
void enableSchedulerFields(bool checked);
void enableShareRatio(bool checked); void enableShareRatio(bool checked);
void enableDeleteRatio(bool checked); void enableDeleteRatio(bool checked);
void enableFilter(bool checked); void enableFilter(bool checked);
void enableRSS(bool checked); void enableRSS(bool checked);
void enableDHTSettings(bool checked);
void enableDHTPortSettings(bool checked);
void enableSpoofingSettings(int index); void enableSpoofingSettings(int index);
void setStyle(QString style); void setStyle(QString style);
void on_buttonBox_accepted(); void on_buttonBox_accepted();

269
src/ui/options.ui

@ -1006,8 +1006,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>447</width> <width>524</width>
<height>288</height> <height>398</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_28"> <layout class="QVBoxLayout" name="verticalLayout_28">
@ -1251,8 +1251,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>364</width> <width>524</width>
<height>328</height> <height>406</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_33"> <layout class="QVBoxLayout" name="verticalLayout_33">
@ -1261,10 +1261,8 @@ QGroupBox {
<property name="title"> <property name="title">
<string>Global speed limits</string> <string>Global speed limits</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_18"> <layout class="QGridLayout" name="gridLayout_7">
<item> <item row="0" column="0">
<layout class="QHBoxLayout" name="_3">
<item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string notr="true"/> <string notr="true"/>
@ -1274,16 +1272,10 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<layout class="QVBoxLayout" name="_5"> <layout class="QGridLayout" name="gridLayout_6">
<item> <item row="0" column="0">
<widget class="QCheckBox" name="checkUploadLimit"> <widget class="QCheckBox" name="checkUploadLimit">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Upload:</string> <string>Upload:</string>
</property> </property>
@ -1292,36 +1284,11 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QCheckBox" name="checkDownloadLimit">
<property name="minimumSize">
<size>
<width>0</width>
<height>37</height>
</size>
</property>
<property name="text">
<string>Download:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="_18">
<item>
<layout class="QHBoxLayout" name="_19">
<item>
<widget class="QSpinBox" name="spinUploadLimit"> <widget class="QSpinBox" name="spinUploadLimit">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>27</height>
</size>
</property>
<property name="suffix"> <property name="suffix">
<string/> <string/>
</property> </property>
@ -1336,28 +1303,25 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="2">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
<string>KiB/s</string> <string>KiB/s</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="1" column="0">
<widget class="QCheckBox" name="checkDownloadLimit">
<property name="text">
<string>Download:</string>
</property>
</widget>
</item> </item>
<item> <item row="1" column="1">
<layout class="QHBoxLayout" name="_20">
<item>
<widget class="QSpinBox" name="spinDownloadLimit"> <widget class="QSpinBox" name="spinDownloadLimit">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>27</height>
</size>
</property>
<property name="suffix"> <property name="suffix">
<string/> <string/>
</property> </property>
@ -1372,7 +1336,7 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="2">
<widget class="QLabel" name="label_13"> <widget class="QLabel" name="label_13">
<property name="text"> <property name="text">
<string>KiB/s</string> <string>KiB/s</string>
@ -1381,24 +1345,20 @@ QGroupBox {
</item> </item>
</layout> </layout>
</item> </item>
</layout> <item row="0" column="2">
</item>
<item>
<spacer> <spacer>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>200</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
@ -1406,10 +1366,10 @@ QGroupBox {
<property name="title"> <property name="title">
<string>Alternative global speed limits</string> <string>Alternative global speed limits</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_32"> <layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item> <item>
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<widget class="QLabel" name="label_16"> <widget class="QLabel" name="label_16">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -1434,27 +1394,16 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_31"> <layout class="QGridLayout" name="gridLayout_8">
<item> <item row="0" column="0">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>Upload:</string> <string>Upload:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Download:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_30">
<item>
<widget class="QSpinBox" name="spinUploadLimitAlt"> <widget class="QSpinBox" name="spinUploadLimitAlt">
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
@ -1467,7 +1416,21 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="2">
<widget class="QLabel" name="label_14">
<property name="text">
<string>KiB/s</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Download:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinDownloadLimitAlt"> <widget class="QSpinBox" name="spinDownloadLimitAlt">
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
@ -1480,18 +1443,7 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="1" column="2">
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_29">
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>KiB/s</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_15">
<property name="text"> <property name="text">
<string>KiB/s</string> <string>KiB/s</string>
@ -1500,35 +1452,53 @@ QGroupBox {
</item> </item>
</layout> </layout>
</item> </item>
<item> <item row="0" column="2">
<spacer name="horizontalSpacer_8"> <spacer name="horizontalSpacer_8">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>222</width>
<height>20</height> <height>59</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QGroupBox" name="check_schedule">
<property name="styleSheet">
<string notr="true">QGroupBox::title {
font-weight: normal;
margin-left: 0px;
}
QGroupBox {
border-width: 0;
}</string>
</property>
<property name="title">
<string>Schedule alternative speed limits</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_13"> <layout class="QHBoxLayout" name="horizontalLayout_13">
<item> <item>
<widget class="QCheckBox" name="check_schedule"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Scheduled times:</string> <string extracomment="from (time1 to time2)">from</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTimeEdit" name="schedule_from"> <widget class="QTimeEdit" name="schedule_from">
<property name="enabled">
<bool>false</bool>
</property>
<property name="displayFormat"> <property name="displayFormat">
<string notr="true">hh:mm</string> <string notr="true">hh:mm</string>
</property> </property>
@ -1556,9 +1526,6 @@ QGroupBox {
</item> </item>
<item> <item>
<widget class="QTimeEdit" name="schedule_to"> <widget class="QTimeEdit" name="schedule_to">
<property name="enabled">
<bool>false</bool>
</property>
<property name="displayFormat"> <property name="displayFormat">
<string notr="true">hh:mm</string> <string notr="true">hh:mm</string>
</property> </property>
@ -1591,15 +1558,12 @@ QGroupBox {
<item> <item>
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_18">
<property name="text"> <property name="text">
<string>On days:</string> <string>When:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="schedule_days"> <widget class="QComboBox" name="schedule_days">
<property name="enabled">
<bool>false</bool>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>Every day</string> <string>Every day</string>
@ -1635,6 +1599,9 @@ QGroupBox {
</layout> </layout>
</widget> </widget>
</item> </item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -1643,7 +1610,7 @@ QGroupBox {
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>58</height> <height>40</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -1666,8 +1633,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>459</width> <width>524</width>
<height>407</height> <height>406</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_20"> <layout class="QVBoxLayout" name="verticalLayout_20">
@ -1678,48 +1645,54 @@ QGroupBox {
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_14"> <layout class="QVBoxLayout" name="verticalLayout_14">
<item> <item>
<widget class="QCheckBox" name="checkDHT"> <widget class="QGroupBox" name="checkDHT">
<property name="text"> <property name="styleSheet">
<string notr="true">QGroupBox::title {
font-weight: normal;
margin-left: 0px;
}
QGroupBox {
border-width: 0;
}</string>
</property>
<property name="title">
<string>Enable DHT network (decentralized)</string> <string>Enable DHT network (decentralized)</string>
</property> </property>
<property name="checked"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> <layout class="QVBoxLayout" name="verticalLayout_18">
</item> <property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QCheckBox" name="checkDifferentDHTPort"> <widget class="QGroupBox" name="checkDifferentDHTPort">
<property name="text"> <property name="styleSheet">
<string notr="true">QGroupBox::title {
font-weight: normal;
margin-left: 0px;
}
QGroupBox {
border-width: 0;
}</string>
</property>
<property name="title">
<string>Use a different port for DHT and Bittorrent</string> <string>Use a different port for DHT and Bittorrent</string>
</property> </property>
<property name="checked"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> <property name="checked">
</item> <bool>false</bool>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <layout class="QVBoxLayout" name="verticalLayout_17">
<size> <property name="bottomMargin">
<width>13</width> <number>0</number>
<height>20</height>
</size>
</property> </property>
</spacer> <item>
</item> <layout class="QHBoxLayout" name="horizontalLayout_8">
<item> <item>
<widget class="QLabel" name="dh_port_lbl"> <widget class="QLabel" name="dh_port_lbl">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>DHT port:</string> <string>DHT port:</string>
</property> </property>
@ -1727,9 +1700,6 @@ QGroupBox {
</item> </item>
<item> <item>
<widget class="QSpinBox" name="spinDHTPort"> <widget class="QSpinBox" name="spinDHTPort">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
</property> </property>
@ -1756,8 +1726,17 @@ QGroupBox {
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkPeX"> <widget class="QCheckBox" name="checkPeX">
<property name="toolTip">
<string>Exchange peers without compatible Bittorrent clients (µTorrent, Vuze, ...)</string>
</property>
<property name="text"> <property name="text">
<string>Enable Peer Exchange / PeX (requires restart)</string> <string>Enable Peer Exchange / PeX (requires restart)</string>
</property> </property>
@ -1768,6 +1747,9 @@ QGroupBox {
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkLSD"> <widget class="QCheckBox" name="checkLSD">
<property name="toolTip">
<string>Look for peers on your local network</string>
</property>
<property name="text"> <property name="text">
<string>Enable Local Peer Discovery</string> <string>Enable Local Peer Discovery</string>
</property> </property>
@ -1781,7 +1763,7 @@ QGroupBox {
<item> <item>
<widget class="QLabel" name="lbl_encryption"> <widget class="QLabel" name="lbl_encryption">
<property name="text"> <property name="text">
<string>Encryption:</string> <string>Protocol encryption:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -3014,7 +2996,6 @@ QGroupBox {
<tabstop>spinPort</tabstop> <tabstop>spinPort</tabstop>
<tabstop>checkUPnP</tabstop> <tabstop>checkUPnP</tabstop>
<tabstop>checkNATPMP</tabstop> <tabstop>checkNATPMP</tabstop>
<tabstop>checkDHT</tabstop>
<tabstop>checkLSD</tabstop> <tabstop>checkLSD</tabstop>
<tabstop>comboEncryption</tabstop> <tabstop>comboEncryption</tabstop>
<tabstop>checkRatioLimit</tabstop> <tabstop>checkRatioLimit</tabstop>

Loading…
Cancel
Save