Browse Source

Merge pull request #7894 from Piccirello/auto-management

Disable options when Force Proxy is enabled
adaptive-webui-19844
Mike Tzou 7 years ago committed by GitHub
parent
commit
050af8a793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/gui/optionsdlg.cpp
  2. 1
      src/gui/optionsdlg.h
  3. 14
      src/gui/optionsdlg.ui
  4. 363
      src/webui/www/private/preferences_content.html

11
src/gui/optionsdlg.cpp

@ -192,6 +192,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
void (QComboBox::*qComboBoxCurrentIndexChanged)(int) = &QComboBox::currentIndexChanged; void (QComboBox::*qComboBoxCurrentIndexChanged)(int) = &QComboBox::currentIndexChanged;
void (QSpinBox::*qSpinBoxValueChanged)(int) = &QSpinBox::valueChanged; void (QSpinBox::*qSpinBoxValueChanged)(int) = &QSpinBox::valueChanged;
connect(m_ui->checkForceProxy, &QAbstractButton::toggled, this, &ThisType::enableForceProxy);
connect(m_ui->comboProxyType, qComboBoxCurrentIndexChanged, this, &ThisType::enableProxy); connect(m_ui->comboProxyType, qComboBoxCurrentIndexChanged, this, &ThisType::enableProxy);
connect(m_ui->checkRandomPort, &QAbstractButton::toggled, m_ui->spinPort, &ThisType::setDisabled); connect(m_ui->checkRandomPort, &QAbstractButton::toggled, m_ui->spinPort, &ThisType::setDisabled);
@ -962,6 +963,7 @@ void OptionsDialog::loadOptions()
m_ui->checkProxyPeerConnecs->setChecked(session->isProxyPeerConnectionsEnabled()); m_ui->checkProxyPeerConnecs->setChecked(session->isProxyPeerConnectionsEnabled());
m_ui->checkForceProxy->setChecked(session->isForceProxyEnabled()); m_ui->checkForceProxy->setChecked(session->isForceProxyEnabled());
enableForceProxy(session->isForceProxyEnabled());
m_ui->isProxyOnlyForTorrents->setChecked(proxyConfigManager->isProxyOnlyForTorrents()); m_ui->isProxyOnlyForTorrents->setChecked(proxyConfigManager->isProxyOnlyForTorrents());
enableProxy(m_ui->comboProxyType->currentIndex()); enableProxy(m_ui->comboProxyType->currentIndex());
@ -1317,6 +1319,13 @@ void OptionsDialog::toggleComboRatioLimitAct()
m_ui->comboRatioLimitAct->setEnabled(m_ui->checkMaxRatio->isChecked() || m_ui->checkMaxSeedingMinutes->isChecked()); m_ui->comboRatioLimitAct->setEnabled(m_ui->checkMaxRatio->isChecked() || m_ui->checkMaxSeedingMinutes->isChecked());
} }
void OptionsDialog::enableForceProxy(bool enable)
{
m_ui->checkUPnP->setEnabled(!enable);
m_ui->checkDHT->setEnabled(!enable);
m_ui->checkLSD->setEnabled(!enable);
}
void OptionsDialog::enableProxy(int index) void OptionsDialog::enableProxy(int index)
{ {
if (index) { if (index) {
@ -1337,6 +1346,7 @@ void OptionsDialog::enableProxy(int index)
m_ui->isProxyOnlyForTorrents->setEnabled(false); m_ui->isProxyOnlyForTorrents->setEnabled(false);
m_ui->isProxyOnlyForTorrents->setChecked(true); m_ui->isProxyOnlyForTorrents->setChecked(true);
} }
enableForceProxy(m_ui->checkForceProxy->isChecked());
} }
else { else {
//disable //disable
@ -1349,6 +1359,7 @@ void OptionsDialog::enableProxy(int index)
m_ui->isProxyOnlyForTorrents->setEnabled(false); m_ui->isProxyOnlyForTorrents->setEnabled(false);
m_ui->checkProxyAuth->setEnabled(false); m_ui->checkProxyAuth->setEnabled(false);
m_ui->checkProxyAuth->setChecked(false); m_ui->checkProxyAuth->setChecked(false);
enableForceProxy(false);
} }
} }

1
src/gui/optionsdlg.h

@ -84,6 +84,7 @@ public slots:
void showConnectionTab(); void showConnectionTab();
private slots: private slots:
void enableForceProxy(bool enable);
void enableProxy(int index); void enableProxy(int index);
void on_buttonBox_accepted(); void on_buttonBox_accepted();
void closeEvent(QCloseEvent *e); void closeEvent(QCloseEvent *e);

14
src/gui/optionsdlg.ui

@ -1580,6 +1580,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="forceProxyHorizontalLayout">
<item> <item>
<widget class="QCheckBox" name="checkForceProxy"> <widget class="QCheckBox" name="checkForceProxy">
<property name="text"> <property name="text">
@ -1590,6 +1592,18 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="labelForceProxy">
<property name="text">
<string>(&lt;a href=&quot;https://github.com/qbittorrent/qBittorrent/wiki/Disable-connections-not-supported-by-proxies&quot;&gt;More information&lt;/a&gt;)</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QCheckBox" name="isProxyOnlyForTorrents"> <widget class="QCheckBox" name="isProxyOnlyForTorrents">
<property name="toolTip"> <property name="toolTip">

363
src/webui/www/private/preferences_content.html

@ -109,28 +109,28 @@
<table> <table>
<tr> <tr>
<td> <td>
<input type="checkbox" id="max_connec_checkbox" onClick="updateMaxConnecEnabled();"/> <input type="checkbox" id="max_connec_checkbox" onclick="updateMaxConnecEnabled();"/>
<label for="max_connec_checkbox">QBT_TR(Global maximum number of connections:)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="max_connec_checkbox">QBT_TR(Global maximum number of connections:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td><input type="text" id="max_connec_value" style="width: 4em;"/></td> <td><input type="text" id="max_connec_value" style="width: 4em;"/></td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="checkbox" id="max_connec_per_torrent_checkbox" onClick="updateMaxConnecPerTorrentEnabled();"/> <input type="checkbox" id="max_connec_per_torrent_checkbox" onclick="updateMaxConnecPerTorrentEnabled();"/>
<label for="max_connec_per_torrent_checkbox">QBT_TR(Maximum number of connections per torrent:)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="max_connec_per_torrent_checkbox">QBT_TR(Maximum number of connections per torrent:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td><input type="text" id="max_connec_per_torrent_value" style="width: 4em;"/></td> <td><input type="text" id="max_connec_per_torrent_value" style="width: 4em;"/></td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="checkbox" id="max_uploads_checkbox" onClick="updateMaxUploadsEnabled();"/> <input type="checkbox" id="max_uploads_checkbox" onclick="updateMaxUploadsEnabled();"/>
<label for="max_uploads_checkbox">QBT_TR(Global maximum number of upload slots:)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="max_uploads_checkbox">QBT_TR(Global maximum number of upload slots:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td><input type="text" id="max_uploads_value" style="width: 4em;"/></td> <td><input type="text" id="max_uploads_value" style="width: 4em;"/></td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="checkbox" id="max_uploads_per_torrent_checkbox" onClick="updateMaxUploadsPerTorrentEnabled();"/> <input type="checkbox" id="max_uploads_per_torrent_checkbox" onclick="updateMaxUploadsPerTorrentEnabled();"/>
<label for="max_uploads_per_torrent_checkbox">QBT_TR(Maximum number of upload slots per torrent:)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="max_uploads_per_torrent_checkbox">QBT_TR(Maximum number of upload slots per torrent:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td><input type="text" id="max_uploads_per_torrent_value" style="width: 4em;"/></td> <td><input type="text" id="max_uploads_per_torrent_value" style="width: 4em;"/></td>
@ -162,8 +162,8 @@
<label for="use_peer_proxy_checkbox">QBT_TR(Use proxy for peer connections)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="use_peer_proxy_checkbox">QBT_TR(Use proxy for peer connections)QBT_TR[CONTEXT=OptionsDialog]</label>
</div> </div>
<div class="formRow"> <div class="formRow">
<input type="checkbox" id="force_proxy_checkbox"/> <input type="checkbox" id="force_proxy_checkbox" onclick="updateForceProxySettings();"/>
<label for="force_proxy_checkbox">QBT_TR(Disable connections not supported by proxies)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="force_proxy_checkbox">QBT_TR(Disable connections not supported by proxies)QBT_TR[CONTEXT=OptionsDialog] (<a target="_blank" href="https://github.com/qbittorrent/qBittorrent/wiki/Disable-connections-not-supported-by-proxies">QBT_TR(More information)QBT_TR[CONTEXT=HttpServer]</a>)</label>
</div> </div>
<div class="formRow"> <div class="formRow">
<input type="checkbox" id="proxy_only_for_torrents_checkbox"/> <input type="checkbox" id="proxy_only_for_torrents_checkbox"/>
@ -205,14 +205,14 @@
<table> <table>
<tr> <tr>
<td> <td>
<input type="checkbox" id="up_limit_checkbox" onClick="updateUpLimitEnabled();"/> <input type="checkbox" id="up_limit_checkbox" onclick="updateUpLimitEnabled();"/>
<label for ="up_limit_checkbox">QBT_TR(Upload:)QBT_TR[CONTEXT=OptionsDialog]</label> <label for ="up_limit_checkbox">QBT_TR(Upload:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td><input type="text" id="up_limit_value" style="width: 4em;"/>&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td> <td><input type="text" id="up_limit_value" style="width: 4em;"/>&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="checkbox" id="dl_limit_checkbox" onClick="updateDlLimitEnabled();"/> <input type="checkbox" id="dl_limit_checkbox" onclick="updateDlLimitEnabled();"/>
<label for="dl_limit_checkbox">QBT_TR(Download:)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="dl_limit_checkbox">QBT_TR(Download:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td><input type="text" id="dl_limit_value" style="width: 4em;"/>&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td> <td><input type="text" id="dl_limit_value" style="width: 4em;"/>&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td>
@ -225,14 +225,14 @@
<table> <table>
<tr> <tr>
<td> <td>
<input type="checkbox" id="alt_up_limit_checkbox" onClick="updateAltUpLimitEnabled();"/> <input type="checkbox" id="alt_up_limit_checkbox" onclick="updateAltUpLimitEnabled();"/>
<label for ="alt_up_limit_checkbox">QBT_TR(Upload:)QBT_TR[CONTEXT=OptionsDialog]</label> <label for ="alt_up_limit_checkbox">QBT_TR(Upload:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td><input type="text" id="alt_up_limit_value" style="width: 4em;"/>&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td> <td><input type="text" id="alt_up_limit_value" style="width: 4em;"/>&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="checkbox" id="alt_dl_limit_checkbox" onClick="updateAltDlLimitEnabled();"/> <input type="checkbox" id="alt_dl_limit_checkbox" onclick="updateAltDlLimitEnabled();"/>
<label for="alt_dl_limit_checkbox">QBT_TR(Download:)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="alt_dl_limit_checkbox">QBT_TR(Download:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td><input type="text" id="alt_dl_limit_value" style="width: 4em;"/>&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td> <td><input type="text" id="alt_dl_limit_value" style="width: 4em;"/>&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td>
@ -240,7 +240,7 @@
</table> </table>
<fieldset class="settings"> <fieldset class="settings">
<legend><input type="checkbox" id="limit_sheduling_checkbox" onClick="updateSchedulingEnabled();"/> <legend><input type="checkbox" id="limit_sheduling_checkbox" onclick="updateSchedulingEnabled();"/>
<label for="limit_sheduling_checkbox">QBT_TR(Schedule the use of alternative rate limits)QBT_TR[CONTEXT=OptionsDialog]</label></legend> <label for="limit_sheduling_checkbox">QBT_TR(Schedule the use of alternative rate limits)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
QBT_TR(From:)QBT_TR[CONTEXT=OptionsDialog] QBT_TR(From:)QBT_TR[CONTEXT=OptionsDialog]
<input type="text" id="schedule_from_hour" style="width: 1.5em;"/>:<input type="text" id="schedule_from_min" style="width: 1.5em;"/> <input type="text" id="schedule_from_hour" style="width: 1.5em;"/>:<input type="text" id="schedule_from_min" style="width: 1.5em;"/>
@ -318,7 +318,7 @@
<table> <table>
<tr> <tr>
<td> <td>
<input type="checkbox" id="max_ratio_checkbox" onClick="updateMaxRatioTimeEnabled();"/> <input type="checkbox" id="max_ratio_checkbox" onclick="updateMaxRatioTimeEnabled();"/>
<label for="max_ratio_checkbox">QBT_TR(Seed torrents until their ratio reaches)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="max_ratio_checkbox">QBT_TR(Seed torrents until their ratio reaches)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td> <td>
@ -326,7 +326,7 @@
</td> </td>
<tr> <tr>
<td> <td>
<input type="checkbox" id="max_seeding_time_checkbox" onClick="updateMaxRatioTimeEnabled();"/> <input type="checkbox" id="max_seeding_time_checkbox" onclick="updateMaxRatioTimeEnabled();"/>
<label for="max_seeding_time_checkbox">QBT_TR(Seed torrents until their seeding time reaches)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="max_seeding_time_checkbox">QBT_TR(Seed torrents until their seeding time reaches)QBT_TR[CONTEXT=OptionsDialog]</label>
</td> </td>
<td> <td>
@ -483,12 +483,9 @@
var WatchedFoldersTable = new HtmlTable($("watched_folders_tab")); var WatchedFoldersTable = new HtmlTable($("watched_folders_tab"));
updateTempDirEnabled = function() { updateTempDirEnabled = function() {
if($('temppath_checkbox').getProperty('checked')) { var isTempDirEnabled = $('temppath_checkbox').getProperty('checked');
$('temppath_text').setProperty('disabled', false); $('temppath_text').setProperty('disabled', !isTempDirEnabled);
} else { };
$('temppath_text').setProperty('disabled', true);
}
}
addWatchFolder = function() { addWatchFolder = function() {
var new_folder = $('new_watch_folder_txt').getProperty('value').trim(); var new_folder = $('new_watch_folder_txt').getProperty('value').trim();
@ -508,7 +505,7 @@ addWatchFolder = function() {
elt.setProperty('value', 'watch_folder'); elt.setProperty('value', 'watch_folder');
var text = elt.options[elt.selectedIndex].innerHTML; var text = elt.options[elt.selectedIndex].innerHTML;
$('new_watch_folder_other_txt').setProperty('value', text); $('new_watch_folder_other_txt').setProperty('value', text);
} };
changeWatchFolderSelect = function(item) { changeWatchFolderSelect = function(item) {
if (item.value == "other") { if (item.value == "other") {
@ -518,11 +515,11 @@ changeWatchFolderSelect = function(item) {
var text = item.options[item.selectedIndex].innerHTML; var text = item.options[item.selectedIndex].innerHTML;
item.nextElementSibling.value = text; item.nextElementSibling.value = text;
} }
} };
changeWatchFolderText = function(item) { changeWatchFolderText = function(item) {
item.previousElementSibling.value = 'other'; item.previousElementSibling.value = 'other';
} };
pushWatchFolder = function(pos, folder, sel, other) { pushWatchFolder = function(pos, folder, sel, other) {
var myinput = "<input id='text_watch_"+ pos +"' type='text' value='" + folder + "'>"; var myinput = "<input id='text_watch_"+ pos +"' type='text' value='" + folder + "'>";
@ -542,7 +539,7 @@ pushWatchFolder = function(pos, folder, sel, other) {
other = elt.options[elt.selectedIndex].innerHTML; other = elt.options[elt.selectedIndex].innerHTML;
} }
$('cb_watch_txt_'+ pos).setProperty('value', other); $('cb_watch_txt_'+ pos).setProperty('value', other);
} };
getWatchedFolders = function() { getWatchedFolders = function() {
var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length; var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
@ -561,260 +558,181 @@ getWatchedFolders = function() {
} }
} }
return folders; return folders;
} };
updateExportDirEnabled = function() { updateExportDirEnabled = function() {
if($('exportdir_checkbox').getProperty('checked')) { var isExportDirEnabled = $('exportdir_checkbox').getProperty('checked');
$('exportdir_text').setProperty('disabled', false); $('exportdir_text').setProperty('disabled', !isExportDirEnabled);
} else { };
$('exportdir_text').setProperty('disabled', true);
}
}
updateExportDirFinEnabled = function() { updateExportDirFinEnabled = function() {
if($('exportdirfin_checkbox').getProperty('checked')) { var isExportDirFinEnabled = $('exportdirfin_checkbox').getProperty('checked');
$('exportdirfin_text').setProperty('disabled', false); $('exportdirfin_text').setProperty('disabled', !isExportDirFinEnabled);
} else { };
$('exportdirfin_text').setProperty('disabled', true);
}
}
updateMailNotification = function() { updateMailNotification = function() {
if($('mail_notification_checkbox').getProperty('checked')) { var isMailNotificationEnabled = $('mail_notification_checkbox').getProperty('checked');
$('dest_email_txt').setProperty('disabled', false); $('dest_email_txt').setProperty('disabled', !isMailNotificationEnabled);
$('smtp_server_txt').setProperty('disabled', false); $('smtp_server_txt').setProperty('disabled', !isMailNotificationEnabled);
$('mail_auth_checkbox').setProperty('disabled', false); $('mail_ssl_checkbox').setProperty('disabled', !isMailNotificationEnabled);
$('mail_ssl_checkbox').setProperty('disabled', false); $('mail_auth_checkbox').setProperty('disabled', !isMailNotificationEnabled);
} else {
$('dest_email_txt').setProperty('disabled', true); if(!isMailNotificationEnabled) {
$('smtp_server_txt').setProperty('disabled', true); $('mail_auth_checkbox').setProperty('checked', !isMailNotificationEnabled);
$('mail_ssl_checkbox').setProperty('disabled', true);
$('mail_auth_checkbox').setProperty('disabled', true);
$('mail_auth_checkbox').setProperty('checked', false);
updateMailAuthSettings(); updateMailAuthSettings();
} }
} };
updateMailAuthSettings = function() { updateMailAuthSettings = function() {
if($('mail_auth_checkbox').getProperty('checked')) { var isMailAuthEnabled = $('mail_auth_checkbox').getProperty('checked');
$('mail_username_text').setProperty('disabled', false); $('mail_username_text').setProperty('disabled', !isMailAuthEnabled);
$('mail_password_text').setProperty('disabled', false); $('mail_password_text').setProperty('disabled', !isMailAuthEnabled);
} else { };
$('mail_username_text').setProperty('disabled', true);
$('mail_password_text').setProperty('disabled', true);
}
}
updateAutoRun = function() { updateAutoRun = function() {
if($('autorun_checkbox').getProperty('checked')) { var isAutoRunEnabled = $('autorun_checkbox').getProperty('checked');
$('autorunProg_txt').setProperty('disabled', false); $('autorunProg_txt').setProperty('disabled', !isAutoRunEnabled);
} else { };
$('autorunProg_txt').setProperty('disabled', true);
}
}
// Connection tab // Connection tab
updateMaxConnecEnabled = function() { updateMaxConnecEnabled = function() {
if($('max_connec_checkbox').getProperty('checked')) { var isMaxConnecEnabled = $('max_connec_checkbox').getProperty('checked');
$('max_connec_value').setProperty('disabled', false); $('max_connec_value').setProperty('disabled', !isMaxConnecEnabled);
} else { };
$('max_connec_value').setProperty('disabled', true);
}
}
updateMaxConnecPerTorrentEnabled = function() { updateMaxConnecPerTorrentEnabled = function() {
if($('max_connec_per_torrent_checkbox').getProperty('checked')) { var isMaxConnecPerTorrentEnabled = $('max_connec_per_torrent_checkbox').getProperty('checked');
$('max_connec_per_torrent_value').setProperty('disabled', false); $('max_connec_per_torrent_value').setProperty('disabled', !isMaxConnecPerTorrentEnabled);
} else { };
$('max_connec_per_torrent_value').setProperty('disabled', true);
}
}
updateMaxUploadsEnabled = function() { updateMaxUploadsEnabled = function() {
if($('max_uploads_checkbox').getProperty('checked')) { var isMaxUploadsEnabled = $('max_uploads_checkbox').getProperty('checked');
$('max_uploads_value').setProperty('disabled', false); $('max_uploads_value').setProperty('disabled', !isMaxUploadsEnabled);
} else { };
$('max_uploads_value').setProperty('disabled', true);
}
}
updateMaxUploadsPerTorrentEnabled = function() { updateMaxUploadsPerTorrentEnabled = function() {
if($('max_uploads_per_torrent_checkbox').getProperty('checked')) { var isMaxUploadsPerTorrentEnabled = $('max_uploads_per_torrent_checkbox').getProperty('checked');
$('max_uploads_per_torrent_value').setProperty('disabled', false); $('max_uploads_per_torrent_value').setProperty('disabled', !isMaxUploadsPerTorrentEnabled);
} else { };
$('max_uploads_per_torrent_value').setProperty('disabled', true);
}
}
updatePeerProxySettings = function() { updatePeerProxySettings = function() {
if($('peer_proxy_type_select').getProperty('value') != "none") { var isPeerProxyTypeSelected = $('peer_proxy_type_select').getProperty('value') != "none";
$('peer_proxy_host_text').setProperty('disabled', false); $('peer_proxy_host_text').setProperty('disabled', !isPeerProxyTypeSelected);
$('peer_proxy_port_value').setProperty('disabled', false); $('peer_proxy_port_value').setProperty('disabled', !isPeerProxyTypeSelected);
$('use_peer_proxy_checkbox').setProperty('disabled', false); $('use_peer_proxy_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
$('force_proxy_checkbox').setProperty('disabled', false); $('force_proxy_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
$('proxy_only_for_torrents_checkbox').setProperty('disabled', false); $('proxy_only_for_torrents_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
if($('peer_proxy_type_select').getProperty('value') != "socks5") {
$('peer_proxy_auth_checkbox').setProperty('checked', false); if(isPeerProxyTypeSelected) {
$('peer_proxy_auth_checkbox').setProperty('disabled', true); var isPeerProxyTypeSocks5 = $('peer_proxy_type_select').getProperty('value') == "socks5";
$('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyTypeSocks5);
if(!isPeerProxyTypeSocks5) {
$('peer_proxy_auth_checkbox').setProperty('checked', isPeerProxyTypeSocks5);
updatePeerProxyAuthSettings(); updatePeerProxyAuthSettings();
} else {
$('peer_proxy_auth_checkbox').setProperty('disabled', false);
} }
} else { } else {
$('peer_proxy_host_text').setProperty('disabled', true); $('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
$('peer_proxy_port_value').setProperty('disabled', true); $('peer_proxy_auth_checkbox').setProperty('checked', isPeerProxyTypeSelected);
$('use_peer_proxy_checkbox').setProperty('disabled', true);
$('force_proxy_checkbox').setProperty('disabled', true);
$('proxy_only_for_torrents_checkbox').setProperty('disabled', true);
$('peer_proxy_auth_checkbox').setProperty('disabled', true);
$('peer_proxy_auth_checkbox').setProperty('checked', false);
updatePeerProxyAuthSettings(); updatePeerProxyAuthSettings();
} }
}
updateForceProxySettings();
};
updateForceProxySettings = function() {
var isForceProxyEnabled = (!$('force_proxy_checkbox').getProperty('disabled')) && ($('force_proxy_checkbox').getProperty('checked'));
$('upnp_checkbox').setProperty('disabled', isForceProxyEnabled);
$('dht_checkbox').setProperty('disabled', isForceProxyEnabled);
$('lsd_checkbox').setProperty('disabled', isForceProxyEnabled);
};
updatePeerProxyAuthSettings = function() { updatePeerProxyAuthSettings = function() {
if($('peer_proxy_auth_checkbox').getProperty('checked')) { var isPeerProxyAuthEnabled = $('peer_proxy_auth_checkbox').getProperty('checked');
$('peer_proxy_username_text').setProperty('disabled', false); $('peer_proxy_username_text').setProperty('disabled', !isPeerProxyAuthEnabled);
$('peer_proxy_password_text').setProperty('disabled', false); $('peer_proxy_password_text').setProperty('disabled', !isPeerProxyAuthEnabled);
} else { };
$('peer_proxy_username_text').setProperty('disabled', true);
$('peer_proxy_password_text').setProperty('disabled', true);
}
}
updateFilterSettings = function() { updateFilterSettings = function() {
if($('ipfilter_enabled_checkbox').getProperty('checked')) { var isIPFilterEnabled = $('ipfilter_enabled_checkbox').getProperty('checked');
$('ipfilter_text').setProperty('disabled', false); $('ipfilter_text').setProperty('disabled', !isIPFilterEnabled);
$('ipfilter_trackers_checkbox').setProperty('disabled', false); $('ipfilter_trackers_checkbox').setProperty('disabled', !isIPFilterEnabled);
$('banned_IPs_textarea').setProperty('disabled', false); $('banned_IPs_textarea').setProperty('disabled', !isIPFilterEnabled);
} else { };
$('ipfilter_text').setProperty('disabled', true);
$('ipfilter_trackers_checkbox').setProperty('disabled', true);
$('banned_IPs_textarea').setProperty('disabled', true);
}
}
// Speed tab // Speed tab
updateUpLimitEnabled = function() { updateUpLimitEnabled = function() {
if($('up_limit_checkbox').getProperty('checked')) { var isUpLimitEnabled = $('up_limit_checkbox').getProperty('checked');
$('up_limit_value').setProperty('disabled', false); $('up_limit_value').setProperty('disabled', !isUpLimitEnabled);
} else { };
$('up_limit_value').setProperty('disabled', true);
}
}
updateDlLimitEnabled = function() { updateDlLimitEnabled = function() {
if($('dl_limit_checkbox').getProperty('checked')) { var isDlLimitEnabled = $('dl_limit_checkbox').getProperty('checked');
$('dl_limit_value').setProperty('disabled', false); $('dl_limit_value').setProperty('disabled', !isDlLimitEnabled);
} else { };
$('dl_limit_value').setProperty('disabled', true);
}
}
updateAltUpLimitEnabled = function() { updateAltUpLimitEnabled = function() {
if($('alt_up_limit_checkbox').getProperty('checked')) { var isAltUpLimitEnabled = $('alt_up_limit_checkbox').getProperty('checked');
$('alt_up_limit_value').setProperty('disabled', false); $('alt_up_limit_value').setProperty('disabled', !isAltUpLimitEnabled);
} else { };
$('alt_up_limit_value').setProperty('disabled', true);
}
}
updateAltDlLimitEnabled = function() { updateAltDlLimitEnabled = function() {
if($('alt_dl_limit_checkbox').getProperty('checked')) { var isAltDlLimitEnabled = $('alt_dl_limit_checkbox').getProperty('checked');
$('alt_dl_limit_value').setProperty('disabled', false); $('alt_dl_limit_value').setProperty('disabled', !isAltDlLimitEnabled);
} else { };
$('alt_dl_limit_value').setProperty('disabled', true);
}
}
updateSchedulingEnabled = function() { updateSchedulingEnabled = function() {
if($('limit_sheduling_checkbox').getProperty('checked')) { var isLimitSchedulingEnabled = $('limit_sheduling_checkbox').getProperty('checked');
$('schedule_from_hour').setProperty('disabled', false); $('schedule_from_hour').setProperty('disabled', !isLimitSchedulingEnabled);
$('schedule_from_min').setProperty('disabled', false); $('schedule_from_min').setProperty('disabled', !isLimitSchedulingEnabled);
$('schedule_to_hour').setProperty('disabled', false); $('schedule_to_hour').setProperty('disabled', !isLimitSchedulingEnabled);
$('schedule_to_min').setProperty('disabled', false); $('schedule_to_min').setProperty('disabled', !isLimitSchedulingEnabled);
$('schedule_freq_select').setProperty('disabled', false); $('schedule_freq_select').setProperty('disabled', !isLimitSchedulingEnabled);
} else { };
$('schedule_from_hour').setProperty('disabled', true);
$('schedule_from_min').setProperty('disabled', true);
$('schedule_to_hour').setProperty('disabled', true);
$('schedule_to_min').setProperty('disabled', true);
$('schedule_freq_select').setProperty('disabled', true);
}
}
// Bittorrent tab // Bittorrent tab
updateQueueingSystem = function() { updateQueueingSystem = function() {
if($('queueing_checkbox').getProperty('checked')) { var isQueueingEnabled = $('queueing_checkbox').getProperty('checked');
$('max_active_dl_value').setProperty('disabled', false); $('max_active_dl_value').setProperty('disabled', !isQueueingEnabled);
$('max_active_up_value').setProperty('disabled', false); $('max_active_up_value').setProperty('disabled', !isQueueingEnabled);
$('max_active_to_value').setProperty('disabled', false); $('max_active_to_value').setProperty('disabled', !isQueueingEnabled);
$('dont_count_slow_torrents_checkbox').setProperty('disabled', false); $('dont_count_slow_torrents_checkbox').setProperty('disabled', !isQueueingEnabled);
} else { };
$('max_active_dl_value').setProperty('disabled', true);
$('max_active_up_value').setProperty('disabled', true);
$('max_active_to_value').setProperty('disabled', true);
$('dont_count_slow_torrents_checkbox').setProperty('disabled', true);
}
}
updateMaxRatioTimeEnabled = function() { updateMaxRatioTimeEnabled = function() {
if($('max_ratio_checkbox').getProperty('checked')) { var isMaxRatioEnabled = $('max_ratio_checkbox').getProperty('checked');
$('max_ratio_value').setProperty('disabled', false); $('max_ratio_value').setProperty('disabled', !isMaxRatioEnabled);
} else {
$('max_ratio_value').setProperty('disabled', true); var isMaxSeedingTimeEnabled = $('max_seeding_time_checkbox').getProperty('checked');
} $('max_seeding_time_value').setProperty('disabled', !isMaxSeedingTimeEnabled);
if($('max_seeding_time_checkbox').getProperty('checked')) {
$('max_seeding_time_value').setProperty('disabled', false); $('max_ratio_act').setProperty('disabled', !(isMaxRatioEnabled || isMaxSeedingTimeEnabled));
} else { };
$('max_seeding_time_value').setProperty('disabled', true);
}
if($('max_ratio_checkbox').getProperty('checked') || $('max_seeding_time_checkbox').getProperty('checked')) {
$('max_ratio_act').setProperty('disabled', false);
} else {
$('max_ratio_act').setProperty('disabled', true);
}
}
updateAddTrackersEnabled = function() { updateAddTrackersEnabled = function() {
if($('add_trackers_checkbox').getProperty('checked')) { var isAddTrackersEnabled = $('add_trackers_checkbox').getProperty('checked');
$('add_trackers_textarea').setProperty('disabled', false); $('add_trackers_textarea').setProperty('disabled', !isAddTrackersEnabled);
} else { };
$('add_trackers_textarea').setProperty('disabled', true);
}
}
// Web UI tab // Web UI tab
updateHttpsSettings = function() { updateHttpsSettings = function() {
if($('use_https_checkbox').getProperty('checked')) { var isAddTrackersEnabled = $('use_https_checkbox').getProperty('checked');
$('ssl_key_textarea').setProperty('disabled', false); $('ssl_key_textarea').setProperty('disabled', !isAddTrackersEnabled);
$('ssl_cert_textarea').setProperty('disabled', false); $('ssl_cert_textarea').setProperty('disabled', !isAddTrackersEnabled);
} else { };
$('ssl_key_textarea').setProperty('disabled', true);
$('ssl_cert_textarea').setProperty('disabled', true);
}
}
updateBypasssAuthSettings = function() { updateBypasssAuthSettings = function() {
if ($('bypass_auth_subnet_whitelist_checkbox').getProperty('checked')) var isBypassAuthSubnetWhitelistEnabled = $('bypass_auth_subnet_whitelist_checkbox').getProperty('checked');
$('bypass_auth_subnet_whitelist_textarea').setProperty('disabled', false); $('bypass_auth_subnet_whitelist_textarea').setProperty('disabled', !isBypassAuthSubnetWhitelistEnabled);
else
$('bypass_auth_subnet_whitelist_textarea').setProperty('disabled', true);
}; };
updateDynDnsSettings = function() { updateDynDnsSettings = function() {
if($('use_dyndns_checkbox').getProperty('checked')) { var isDynDnsEnabled = $('use_dyndns_checkbox').getProperty('checked');
$('dyndns_select').setProperty('disabled', false); $('dyndns_select').setProperty('disabled', !isDynDnsEnabled);
$('dyndns_domain_text').setProperty('disabled', false); $('dyndns_domain_text').setProperty('disabled', !isDynDnsEnabled);
$('dyndns_username_text').setProperty('disabled', false); $('dyndns_username_text').setProperty('disabled', !isDynDnsEnabled);
$('dyndns_password_text').setProperty('disabled', false); $('dyndns_password_text').setProperty('disabled', !isDynDnsEnabled);
} else { };
$('dyndns_select').setProperty('disabled', true);
$('dyndns_domain_text').setProperty('disabled', true);
$('dyndns_username_text').setProperty('disabled', true);
$('dyndns_password_text').setProperty('disabled', true);
}
}
registerDynDns = function() { registerDynDns = function() {
if($('dyndns_select').getProperty('value').toInt() == 1) { if($('dyndns_select').getProperty('value').toInt() == 1) {
@ -822,14 +740,14 @@ registerDynDns = function() {
} else { } else {
window.open("https://www.dyndns.com/account/services/hosts/add.html", "DynDNS Registration"); window.open("https://www.dyndns.com/account/services/hosts/add.html", "DynDNS Registration");
} }
} };
time_padding = function(val) { time_padding = function(val) {
ret = val.toString(); ret = val.toString();
if(ret.length == 1) if(ret.length == 1)
ret = '0' + ret ret = '0' + ret;
return ret; return ret;
} };
loadPreferences = function() { loadPreferences = function() {
var url = 'api/v2/app/preferences'; var url = 'api/v2/app/preferences';
@ -962,6 +880,7 @@ loadPreferences = function() {
$('peer_proxy_port_value').setProperty('value', pref.proxy_port); $('peer_proxy_port_value').setProperty('value', pref.proxy_port);
$('use_peer_proxy_checkbox').setProperty('checked', pref.proxy_peer_connections); $('use_peer_proxy_checkbox').setProperty('checked', pref.proxy_peer_connections);
$('force_proxy_checkbox').setProperty('checked', pref.force_proxy); $('force_proxy_checkbox').setProperty('checked', pref.force_proxy);
updateForceProxySettings();
$('proxy_only_for_torrents_checkbox').setProperty('checked', pref.proxy_torrents_only); $('proxy_only_for_torrents_checkbox').setProperty('checked', pref.proxy_torrents_only);
$('peer_proxy_auth_checkbox').setProperty('checked', pref.proxy_auth_enabled); $('peer_proxy_auth_checkbox').setProperty('checked', pref.proxy_auth_enabled);
updatePeerProxyAuthSettings(); updatePeerProxyAuthSettings();

Loading…
Cancel
Save