Browse Source

Merge pull request #9752 from Piccirello/webui-autotmm

Add missing Preferences to WebUI
adaptive-webui-19844
Mike Tzou 6 years ago committed by GitHub
parent
commit
f32865b0c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/gui/optionsdialog.cpp
  2. 1
      src/gui/optionsdialog.h
  3. 2
      src/gui/optionsdialog.ui
  4. 81
      src/webui/api/appcontroller.cpp
  5. 2
      src/webui/api/torrentscontroller.cpp
  6. 24
      src/webui/www/private/css/style.css
  7. 130
      src/webui/www/private/download.html
  8. 688
      src/webui/www/private/preferences_content.html
  9. 89
      src/webui/www/private/scripts/download.js
  10. 4
      src/webui/www/private/shareratio.html
  11. 120
      src/webui/www/private/upload.html

17
src/gui/optionsdialog.cpp

@ -1250,6 +1250,10 @@ void OptionsDialog::on_buttonBox_accepted() @@ -1250,6 +1250,10 @@ void OptionsDialog::on_buttonBox_accepted()
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
return;
}
if (!isAlternativeWebUIPathValid()) {
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
return;
}
m_applyButton->setEnabled(false);
this->hide();
saveOptions();
@ -1269,6 +1273,10 @@ void OptionsDialog::applySettings(QAbstractButton *button) @@ -1269,6 +1273,10 @@ void OptionsDialog::applySettings(QAbstractButton *button)
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
return;
}
if (!isAlternativeWebUIPathValid()) {
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
return;
}
saveOptions();
}
}
@ -1751,6 +1759,15 @@ bool OptionsDialog::webUIAuthenticationOk() @@ -1751,6 +1759,15 @@ bool OptionsDialog::webUIAuthenticationOk()
return true;
}
bool OptionsDialog::isAlternativeWebUIPathValid()
{
if (m_ui->groupAltWebUI->isChecked() && m_ui->textWebUIRootFolder->selectedPath().trimmed().isEmpty()) {
QMessageBox::warning(this, tr("Location Error"), tr("The alternative Web UI files location cannot be blank."));
return false;
}
return true;
}
void OptionsDialog::on_banListButton_clicked()
{
// call dialog window

1
src/gui/optionsdialog.h

@ -172,6 +172,7 @@ private: @@ -172,6 +172,7 @@ private:
bool setSslCertificate(const QByteArray &cert);
bool schedTimesOk();
bool webUIAuthenticationOk();
bool isAlternativeWebUIPathValid();
QByteArray m_sslCert, m_sslKey;

2
src/gui/optionsdialog.ui

@ -941,7 +941,7 @@ @@ -941,7 +941,7 @@
<item row="3" column="0">
<widget class="QLabel" name="labelCategoryChanged">
<property name="text">
<string>When Category changed:</string>
<string>When Category Save Path changed:</string>
</property>
</widget>
</item>

81
src/webui/api/appcontroller.cpp

@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
#include "base/rss/rss_autodownloader.h"
#include "base/rss/rss_session.h"
#include "base/scanfoldersmodel.h"
#include "base/torrentfileguard.h"
#include "base/utils/fs.h"
#include "base/utils/net.h"
#include "base/utils/password.h"
@ -84,12 +85,23 @@ void AppController::preferencesAction() @@ -84,12 +85,23 @@ void AppController::preferencesAction()
QVariantMap data;
// Downloads
// Hard Disk
// When adding a torrent
data["create_subfolder_enabled"] = session->isCreateTorrentSubfolder();
data["start_paused_enabled"] = session->isAddTorrentPaused();
data["auto_delete_mode"] = static_cast<int>(TorrentFileGuard::autoDeleteMode());
data["preallocate_all"] = session->isPreallocationEnabled();
data["incomplete_files_ext"] = session->isAppendExtensionEnabled();
// Saving Management
data["auto_tmm_enabled"] = !session->isAutoTMMDisabledByDefault();
data["torrent_changed_tmm_enabled"] = !session->isDisableAutoTMMWhenCategoryChanged();
data["save_path_changed_tmm_enabled"] = !session->isDisableAutoTMMWhenDefaultSavePathChanged();
data["category_changed_tmm_enabled"] = !session->isDisableAutoTMMWhenCategorySavePathChanged();
data["save_path"] = Utils::Fs::toNativePath(session->defaultSavePath());
data["temp_path_enabled"] = session->isTempPathEnabled();
data["temp_path"] = Utils::Fs::toNativePath(session->tempPath());
data["preallocate_all"] = session->isPreallocationEnabled();
data["incomplete_files_ext"] = session->isAppendExtensionEnabled();
data["export_dir"] = Utils::Fs::toNativePath(session->torrentExportDirectory());
data["export_dir_fin"] = Utils::Fs::toNativePath(session->finishedTorrentExportDirectory());
// Automatically add torrents from
const QVariantHash dirs = pref->getScanDirs();
QVariantMap nativeDirs;
for (QVariantHash::const_iterator i = dirs.cbegin(), e = dirs.cend(); i != e; ++i) {
@ -99,10 +111,9 @@ void AppController::preferencesAction() @@ -99,10 +111,9 @@ void AppController::preferencesAction()
nativeDirs.insert(Utils::Fs::toNativePath(i.key()), Utils::Fs::toNativePath(i.value().toString()));
}
data["scan_dirs"] = nativeDirs;
data["export_dir"] = Utils::Fs::toNativePath(session->torrentExportDirectory());
data["export_dir_fin"] = Utils::Fs::toNativePath(session->finishedTorrentExportDirectory());
// Email notification upon download completion
data["mail_notification_enabled"] = pref->isMailNotificationEnabled();
data["mail_notification_sender"] = pref->getMailNotificationSender();
data["mail_notification_email"] = pref->getMailNotificationEmail();
data["mail_notification_smtp"] = pref->getMailNotificationSMTP();
data["mail_notification_ssl_enabled"] = pref->getMailNotificationSMTPSSL();
@ -153,6 +164,7 @@ void AppController::preferencesAction() @@ -153,6 +164,7 @@ void AppController::preferencesAction()
data["bittorrent_protocol"] = static_cast<int>(session->btProtocol());
data["limit_utp_rate"] = session->isUTPRateLimited();
data["limit_tcp_overhead"] = session->includeOverheadInLimits();
data["limit_lan_peers"] = !session->ignoreLimitsOnLAN();
// Scheduling
data["scheduler_enabled"] = session->isBandwidthSchedulerEnabled();
const QTime start_time = pref->getSchedulerStartTime();
@ -176,6 +188,9 @@ void AppController::preferencesAction() @@ -176,6 +188,9 @@ void AppController::preferencesAction()
data["max_active_torrents"] = session->maxActiveTorrents();
data["max_active_uploads"] = session->maxActiveUploads();
data["dont_count_slow_torrents"] = session->ignoreSlowTorrentsForQueueing();
data["slow_torrent_dl_rate_threshold"] = session->downloadRateForSlowTorrents();
data["slow_torrent_ul_rate_threshold"] = session->uploadRateForSlowTorrents();
data["slow_torrent_inactive_timer"] = session->slowTorrentsInactivityTimer();
// Share Ratio Limiting
data["max_ratio_enabled"] = (session->globalMaxRatio() >= 0.);
data["max_ratio"] = session->globalMaxRatio();
@ -205,6 +220,9 @@ void AppController::preferencesAction() @@ -205,6 +220,9 @@ void AppController::preferencesAction()
for (const Utils::Net::Subnet &subnet : asConst(pref->getWebUiAuthSubnetWhitelist()))
authSubnetWhitelistStringList << Utils::Net::subnetToString(subnet);
data["bypass_auth_subnet_whitelist"] = authSubnetWhitelistStringList.join("\n");
// Use alternative Web UI
data["alternative_webui_enabled"] = pref->isAltWebUiEnabled();
data["alternative_webui_path"] = pref->getWebUiRootFolder();
// Security
data["web_ui_clickjacking_protection_enabled"] = pref->isWebUiClickjackingProtectionEnabled();
data["web_ui_csrf_protection_enabled"] = pref->isWebUiCSRFProtectionEnabled();
@ -232,19 +250,42 @@ void AppController::setPreferencesAction() @@ -232,19 +250,42 @@ void AppController::setPreferencesAction()
Preferences *const pref = Preferences::instance();
auto session = BitTorrent::Session::instance();
const QVariantMap m = QJsonDocument::fromJson(params()["json"].toUtf8()).toVariant().toMap();
QVariantMap::ConstIterator it;
// Downloads
// Hard Disk
// When adding a torrent
if ((it = m.find(QLatin1String("create_subfolder_enabled"))) != m.constEnd())
session->setCreateTorrentSubfolder(it.value().toBool());
if ((it = m.find(QLatin1String("start_paused_enabled"))) != m.constEnd())
session->setAddTorrentPaused(it.value().toBool());
if ((it = m.find(QLatin1String("auto_delete_mode"))) != m.constEnd())
TorrentFileGuard::setAutoDeleteMode(static_cast<TorrentFileGuard::AutoDeleteMode>(it.value().toInt()));
if ((it = m.find(QLatin1String("preallocate_all"))) != m.constEnd())
session->setPreallocationEnabled(it.value().toBool());
if ((it = m.find(QLatin1String("incomplete_files_ext"))) != m.constEnd())
session->setAppendExtensionEnabled(it.value().toBool());
// Saving Management
if ((it = m.find(QLatin1String("auto_tmm_enabled"))) != m.constEnd())
session->setAutoTMMDisabledByDefault(!it.value().toBool());
if ((it = m.find(QLatin1String("torrent_changed_tmm_enabled"))) != m.constEnd())
session->setDisableAutoTMMWhenCategoryChanged(!it.value().toBool());
if ((it = m.find(QLatin1String("save_path_changed_tmm_enabled"))) != m.constEnd())
session->setDisableAutoTMMWhenDefaultSavePathChanged(!it.value().toBool());
if ((it = m.find(QLatin1String("category_changed_tmm_enabled"))) != m.constEnd())
session->setDisableAutoTMMWhenCategorySavePathChanged(!it.value().toBool());
if (m.contains("save_path"))
session->setDefaultSavePath(m["save_path"].toString());
if (m.contains("temp_path_enabled"))
session->setTempPathEnabled(m["temp_path_enabled"].toBool());
if (m.contains("temp_path"))
session->setTempPath(m["temp_path"].toString());
if (m.contains("preallocate_all"))
session->setPreallocationEnabled(m["preallocate_all"].toBool());
if (m.contains("incomplete_files_ext"))
session->setAppendExtensionEnabled(m["incomplete_files_ext"].toBool());
if ((it = m.find(QLatin1String("export_dir"))) != m.constEnd())
session->setTorrentExportDirectory(it.value().toString());
if ((it = m.find(QLatin1String("export_dir_fin"))) != m.constEnd())
session->setFinishedTorrentExportDirectory(it.value().toString());
// Automatically add torrents from
if (m.contains("scan_dirs")) {
const QVariantMap nativeDirs = m["scan_dirs"].toMap();
QVariantHash oldScanDirs = pref->getScanDirs();
@ -288,13 +329,11 @@ void AppController::setPreferencesAction() @@ -288,13 +329,11 @@ void AppController::setPreferencesAction()
}
pref->setScanDirs(scanDirs);
}
if (m.contains("export_dir"))
session->setTorrentExportDirectory(m["export_dir"].toString());
if (m.contains("export_dir_fin"))
session->setFinishedTorrentExportDirectory(m["export_dir_fin"].toString());
// Email notification upon download completion
if (m.contains("mail_notification_enabled"))
pref->setMailNotificationEnabled(m["mail_notification_enabled"].toBool());
if ((it = m.find(QLatin1String("mail_notification_sender"))) != m.constEnd())
pref->setMailNotificationSender(it.value().toString());
if (m.contains("mail_notification_email"))
pref->setMailNotificationEmail(m["mail_notification_email"].toString());
if (m.contains("mail_notification_smtp"))
@ -379,6 +418,8 @@ void AppController::setPreferencesAction() @@ -379,6 +418,8 @@ void AppController::setPreferencesAction()
session->setUTPRateLimited(m["limit_utp_rate"].toBool());
if (m.contains("limit_tcp_overhead"))
session->setIncludeOverheadInLimits(m["limit_tcp_overhead"].toBool());
if ((it = m.find(QLatin1String("limit_lan_peers"))) != m.constEnd())
session->setIgnoreLimitsOnLAN(!it.value().toBool());
// Scheduling
if (m.contains("scheduler_enabled"))
session->setBandwidthSchedulerEnabled(m["scheduler_enabled"].toBool());
@ -412,6 +453,12 @@ void AppController::setPreferencesAction() @@ -412,6 +453,12 @@ void AppController::setPreferencesAction()
session->setMaxActiveUploads(m["max_active_uploads"].toInt());
if (m.contains("dont_count_slow_torrents"))
session->setIgnoreSlowTorrentsForQueueing(m["dont_count_slow_torrents"].toBool());
if ((it = m.find(QLatin1String("slow_torrent_dl_rate_threshold"))) != m.constEnd())
session->setDownloadRateForSlowTorrents(it.value().toInt());
if ((it = m.find(QLatin1String("slow_torrent_ul_rate_threshold"))) != m.constEnd())
session->setUploadRateForSlowTorrents(it.value().toInt());
if ((it = m.find(QLatin1String("slow_torrent_inactive_timer"))) != m.constEnd())
session->setSlowTorrentsInactivityTimer(it.value().toInt());
// Share Ratio Limiting
if (m.contains("max_ratio_enabled")) {
if (m["max_ratio_enabled"].toBool())
@ -483,6 +530,11 @@ void AppController::setPreferencesAction() @@ -483,6 +530,11 @@ void AppController::setPreferencesAction()
// recognize new lines and commas as delimiters
pref->setWebUiAuthSubnetWhitelist(m["bypass_auth_subnet_whitelist"].toString().split(QRegularExpression("\n|,"), QString::SkipEmptyParts));
}
// Use alternative Web UI
if ((it = m.find(QLatin1String("alternative_webui_enabled"))) != m.constEnd())
pref->setAltWebUiEnabled(it.value().toBool());
if ((it = m.find(QLatin1String("alternative_webui_path"))) != m.constEnd())
pref->setWebUiRootFolder(it.value().toString());
// Security
if (m.contains("web_ui_clickjacking_protection_enabled"))
pref->setWebUiClickjackingProtectionEnabled(m["web_ui_clickjacking_protection_enabled"].toBool());
@ -505,7 +557,6 @@ void AppController::setPreferencesAction() @@ -505,7 +557,6 @@ void AppController::setPreferencesAction()
// Save preferences
pref->apply();
QVariantMap::ConstIterator it;
if ((it = m.find(QLatin1String("rss_refresh_interval"))) != m.constEnd())
RSS::Session::instance()->setRefreshInterval(it.value().toUInt());
if ((it = m.find(QLatin1String("rss_max_articles_per_feed"))) != m.constEnd())

2
src/webui/api/torrentscontroller.cpp

@ -469,6 +469,7 @@ void TorrentsController::addAction() @@ -469,6 +469,7 @@ void TorrentsController::addAction()
const QString torrentName = params()["rename"].trimmed();
const int upLimit = params()["upLimit"].toInt();
const int dlLimit = params()["dlLimit"].toInt();
const TriStateBool autoTMM = parseTriStateBool(params()["autoTMM"]);
QList<QNetworkCookie> cookies;
if (!cookie.isEmpty()) {
@ -496,6 +497,7 @@ void TorrentsController::addAction() @@ -496,6 +497,7 @@ void TorrentsController::addAction()
params.name = torrentName;
params.uploadLimit = (upLimit > 0) ? upLimit : -1;
params.downloadLimit = (dlLimit > 0) ? dlLimit : -1;
params.useAutoTMM = autoTMM;
bool partialSuccess = false;
for (QString url : asConst(urls.split('\n'))) {

24
src/webui/www/private/css/style.css

@ -375,28 +375,8 @@ fieldset.settings label { @@ -375,28 +375,8 @@ fieldset.settings label {
padding: 2px;
}
fieldset.settings .leftLabelSmall {
width: 5em;
float: left;
text-align: right;
margin-right: 0.5em;
display: block;
}
fieldset.settings .leftLabelMedium {
width: 9em;
float: left;
text-align: right;
margin-right: 0.5em;
display: block;
}
fieldset.settings .leftLabelLarge {
width: 14em;
float: left;
text-align: right;
margin-right: 0.5em;
display: block;
fieldset.settings + div.formRow {
margin-top: 10px;
}
div.formRow {

130
src/webui/www/private/download.html

@ -18,52 +18,114 @@ @@ -18,52 +18,114 @@
<h2 class="vcenter">QBT_TR(Download Torrents from their URLs or Magnet links)QBT_TR[CONTEXT=HttpServer]</h2>
<textarea id="urls" rows="10" name="urls"></textarea>
<p>QBT_TR(Only one link per line)QBT_TR[CONTEXT=HttpServer]</p>
<fieldset class="settings" style="border: 0; text-align: left;">
<div class="formRow" style="margin-top: 6px;">
<label for="savepath" class="leftLabelLarge">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label>
<fieldset class="settings" style="border: 0; text-align: left; margin-top: 6px;">
<table style="margin: auto;">
<tr>
<td>
<label for="autoTMM">QBT_TR(Torrent Management Mode:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<select id="autoTMM" name="autoTMM" onchange="changeTMM(this)">
<option selected value="false">Manual</option>
<option value="true">Automatic</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="savepath">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="savepath" name="savepath" style="width: 16em;" />
</div>
<div class="formRow">
<label for="cookie" class="leftLabelLarge">QBT_TR(Cookie:)QBT_TR[CONTEXT=HttpServer]</label>
</td>
</tr>
<tr>
<td>
<label for="cookie">QBT_TR(Cookie:)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="cookie" name="cookie" style="width: 16em;" />
</div>
<div class="formRow">
<label for="rename" class="leftLabelLarge">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
</td>
</tr>
<tr>
<td>
<label for="rename">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="rename" name="rename" style="width: 16em;" />
</td>
</tr>
<tr>
<td>
<label for="category">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<div class="select-watched-folder-editable">
<select id="categorySelect" onchange="changeCategorySelect(this)">
<option selected value="\other"></option>
</select>
<input name="category" type="text" value="" />
</div>
<div class="formRow">
<label for="category" class="leftLabelLarge">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="text" id="category" name="category" style="width: 16em;" />
</div>
<div class="formRow">
<label for="start_torrent" class="leftLabelLarge">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="start_torrent">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="start_torrent" checked="checked" />
<input type="hidden" id="add_paused" name="paused" value="false" readonly />
</div>
<div class="formRow">
<label for="skip_checking" class="leftLabelLarge">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="skip_checking">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="skip_checking" name="skip_checking" value="true" />
</div>
<div class="formRow">
<label for="root_folder" class="leftLabelLarge">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="root_folder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked" />
</div>
<div class="formRow">
<label for="sequentialDownload" class="leftLabelLarge">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label>
</td>
</tr>
<tr>
<td>
<label for="sequentialDownload">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label>
</td>
<td>
<input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true" />
</div>
<div class="formRow">
<label for="firstLastPiecePrio" class="leftLabelLarge">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label>
</td>
</tr>
<tr>
<td>
<label for="firstLastPiecePrio">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label>
</td>
<td>
<input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true" />
</div>
<div class="formRow">
<label for="dlLimit" class="leftLabelLarge">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label>
</td>
</tr>
<tr>
<td>
<label for="dlLimit">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="dlLimit" name="dlLimit" style="width: 16em;" placeholder="Bytes/s" />
</div>
<div class="formRow">
<label for="upLimit" class="leftLabelLarge">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label>
</td>
</tr>
<tr>
<td>
<label for="upLimit">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="upLimit" name="upLimit" style="width: 16em;" placeholder="Bytes/s" />
</div>
</td>
</tr>
</table>
<div id="submitbutton" style="margin-top: 12px; text-align: center;">
<button type="submit" id="submitButton">QBT_TR(Download)QBT_TR[CONTEXT=downloadFromURL]</button>
</div>

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

@ -1,21 +1,120 @@ @@ -1,21 +1,120 @@
<div id="DownloadsTab" class="PrefTab">
<fieldset class="settings">
<legend>QBT_TR(Hard Disk)QBT_TR[CONTEXT=HttpServer]</legend>
<legend>QBT_TR(When adding a torrent)QBT_TR[CONTEXT=OptionsDialog]</legend>
<div class="formRow">
<label for="savepath_text">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label>
<input type="text" id="savepath_text" />
<input type="checkbox" id="createsubfolder_checkbox" />
<label for="createsubfolder_checkbox">QBT_TR(Create subfolder for torrents with multiple files)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="temppath_checkbox" onclick="updateTempDirEnabled();" />
<label for="temppath_checkbox">QBT_TR(Keep incomplete torrents in:)QBT_TR[CONTEXT=OptionsDialog]</label>
<input type="text" id="temppath_text" />
<input type="checkbox" id="dontstartdownloads_checkbox" />
<label for="dontstartauto_checkbox">QBT_TR(Do not start the download automatically)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="deletetorrentfileafter_checkbox" />
<label for="deletetorrentafter_checkbox">QBT_TR(Delete .torrent files afterwards)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
</fieldset>
<div class="formRow">
<input type="checkbox" id="preallocateall_checkbox" />
<label for="preallocateall_checkbox">QBT_TR(Pre-allocate disk space for all files)QBT_TR[CONTEXT=OptionsDialog]</label><br/>
<label for="preallocateall_checkbox">QBT_TR(Pre-allocate disk space for all files)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<span id="appendexttr">
<input type="checkbox" id="appendext_checkbox"/>
<label for="appendext_checkbox">QBT_TR(Append .!qB extension to incomplete files)QBT_TR[CONTEXT=OptionsDialog]</label>
</span><br/><br/> QBT_TR(Automatically add torrents from:)QBT_TR[CONTEXT=OptionsDialog]<br/>
</span>
</div>
<fieldset class="settings">
<legend>QBT_TR(Saving Management)QBT_TR[CONTEXT=HttpServer]</legend>
<table>
<tr>
<td>
<label>QBT_TR(Default Torrent Management Mode:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<select id="default_tmm_combobox">
<option value="false" selected>QBT_TR(Manual)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="true">QBT_TR(Automatic)QBT_TR[CONTEXT=OptionsDialog]</option>
</select>
</td>
</tr>
<tr>
<td>
<label>QBT_TR(When Torrent Category changed:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<select id="torrent_changed_tmm_combobox">
<option value="true">QBT_TR(Relocate torrent)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="false" selected>QBT_TR(Switch torrent to Manual Mode)QBT_TR[CONTEXT=OptionsDialog]</option>
</select>
</td>
</tr>
<tr>
<td>
<label>QBT_TR(When Default Save Path changed:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<select id="save_path_changed_tmm_combobox">
<option value="true">QBT_TR(Relocate affected torrents)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="false" selected>QBT_TR(Switch affected torrents to Manual Mode)QBT_TR[CONTEXT=OptionsDialog]</option>
</select>
</td>
</tr>
<tr>
<td>
<label>QBT_TR(When Category Save Path changed:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<select id="category_changed_tmm_combobox">
<option value="true">QBT_TR(Relocate affected torrents)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="false" selected>QBT_TR(Switch affected torrents to Manual Mode)QBT_TR[CONTEXT=OptionsDialog]</option>
</select>
</td>
</tr>
</table>
<table>
<tr>
<td>
<label for="savepath_text">QBT_TR(Default Save Path:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="savepath_text" />
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="temppath_checkbox" onclick="updateTempDirEnabled();" />
<label for="temppath_checkbox" >QBT_TR(Keep incomplete torrents in:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="temppath_text" />
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="exportdir_checkbox" onclick="updateExportDirEnabled();" />
<label for="exportdir_checkbox" >QBT_TR(Copy .torrent files to:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="exportdir_text" />
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="exportdirfin_checkbox" onclick="updateExportDirFinEnabled();" />
<label for="exportdirfin_checkbox" >QBT_TR(Copy .torrent files for finished downloads to:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="exportdirfin_text" />
</td>
</tr>
</table>
</fieldset>
<fieldset class="settings">
<legend>QBT_TR(Automatically add torrents from:)QBT_TR[CONTEXT=OptionsDialog]</legend>
<table id="watched_folders_tab" style="border: 1px solid black;">
<thead>
<tr>
@ -34,48 +133,83 @@ @@ -34,48 +133,83 @@
<option value="default_folder">QBT_TR(Default save location)QBT_TR[CONTEXT=ScanFoldersModel]</option>
<option value="other">QBT_TR(Other...)QBT_TR[CONTEXT=HttpServer]</option>
</select>
<input id="new_watch_folder_other_txt" type="text" value="QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]" onchange="changeWatchFolderText(this)" />
<input id="new_watch_folder_other_txt" type="text" value="QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]" hidden />
<img src="images/qbt-theme/list-add.svg" alt="Add" style="padding-left:170px;width:16px;cursor:pointer;" onclick="addWatchFolder();" />
</div>
</td>
</tr>
</tfoot>
</table><br/>
<input type="checkbox" id="exportdir_checkbox" onclick="updateExportDirEnabled();" />
<label for="exportdir_checkbox">QBT_TR(Copy .torrent files to:)QBT_TR[CONTEXT=OptionsDialog]</label>&nbsp;&nbsp;
<input type="text" id="exportdir_text" /><br/>
<input type="checkbox" id="exportdirfin_checkbox" onclick="updateExportDirFinEnabled();" />
<label for="exportdirfin_checkbox">QBT_TR(Copy .torrent files for finished downloads to:)QBT_TR[CONTEXT=OptionsDialog]</label>&nbsp;&nbsp;
<input type="text" id="exportdirfin_text" /><br/>
</table>
</fieldset>
<fieldset class="settings">
<legend><input type="checkbox" id="mail_notification_checkbox" onclick="updateMailNotification();" />
<label for="mail_notification_checkbox">QBT_TR(Email notification upon download completion)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<div class="formRow">
<label for="dest_email_txt" class="leftLabelMedium">QBT_TR(To:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="text" id="dest_email_txt" />
</div>
<div class="formRow">
<label for="smtp_server_txt" class="leftLabelMedium">QBT_TR(SMTP server:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="text" id="smtp_server_txt" />
</div>
<legend>
<input type="checkbox" id="mail_notification_checkbox" onclick="updateMailNotification();" />
<label for="mail_notification_checkbox">QBT_TR(Email notification upon download completion)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<table>
<tr>
<td>
<label for="src_email_txt">QBT_TR(From:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="src_email_txt" />
</td>
</tr>
<tr>
<td>
<label for="dest_email_txt">QBT_TR(To:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="dest_email_txt" />
</td>
</tr>
<tr>
<td>
<label for="smtp_server_txt">QBT_TR(SMTP server:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="smtp_server_txt" />
</td>
</tr>
</table>
<div class="formRow">
<input type="checkbox" id="mail_ssl_checkbox" /><label for="mail_ssl_checkbox">QBT_TR(This server requires a secure connection (SSL))QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<fieldset class="settings">
<legend><input type="checkbox" id="mail_auth_checkbox" onclick="updateMailAuthSettings();" /><label for="mail_auth_checkbox">QBT_TR(Authentication)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<div class="formRow">
<label for="mail_username_text" class="leftLabelMedium">QBT_TR(Username:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="text" id="mail_username_text" />
</div>
<div class="formRow">
<label for="mail_password_text" class="leftLabelMedium">QBT_TR(Password:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="password" id="mail_password_text" />
</div>
<legend>
<input type="checkbox" id="mail_auth_checkbox" onclick="updateMailAuthSettings();" />
<label for="mail_auth_checkbox">QBT_TR(Authentication)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<table>
<tr>
<td>
<label for="mail_username_text">QBT_TR(Username:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="mail_username_text" />
</td>
</tr>
<tr>
<td>
<label for="mail_password_text">QBT_TR(Password:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="password" id="mail_password_text" />
</td>
</tr>
</table>
</fieldset>
</fieldset>
<fieldset class="settings">
<legend><input type="checkbox" id="autorun_checkbox" onclick="updateAutoRun();" />
<label for="autorun_checkbox">QBT_TR(Run external program on torrent completion)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<input type="text" id="autorunProg_txt" style="width: 400px;" /><br/>
<legend>
<input type="checkbox" id="autorun_checkbox" onclick="updateAutoRun();" />
<label for="autorun_checkbox">QBT_TR(Run external program on torrent completion)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<div class="formRow">
<input type="text" id="autorunProg_txt" style="width: 400px;" />
</div>
<div style="font-style: italic;">QBT_TR(Supported parameters (case sensitive):)QBT_TR[CONTEXT=OptionsDialog]
<ul>
<li>QBT_TR(%N: Torrent name)QBT_TR[CONTEXT=OptionsDialog]</li>
@ -95,20 +229,29 @@ @@ -95,20 +229,29 @@
</div>
<div id="ConnectionTab" class="PrefTab invisible">
<div class="formRow">
<label>QBT_TR(Enabled protocol:)QBT_TR[CONTEXT=OptionsDialog]</label>
<select id="enable_protocol_combobox">
<option value="0" selected>QBT_TR(TCP and μTP)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="1">TCP</option>
<option value="2">μTP</option>
</select><br/>
</select>
</div>
<fieldset class="settings">
<legend>QBT_TR(Listening Port)QBT_TR[CONTEXT=OptionsDialog]</legend>
<div class="formRow">
<label for="port_value">QBT_TR(Port used for incoming connections:)QBT_TR[CONTEXT=OptionsDialog]</label>
<input type="text" id="port_value" style="width: 4em;" /><br/>
<input type="text" id="port_value" style="width: 4em;" />
<button style="margin-left: 1em;" onclick="generateRandomPort();">Random</button>
</div>
<div class="formRow">
<input type="checkbox" id="upnp_checkbox" />
<label for="upnp_checkbox">QBT_TR(Use UPnP / NAT-PMP port forwarding from my router)QBT_TR[CONTEXT=OptionsDialog]</label><br/>
<label for="upnp_checkbox">QBT_TR(Use UPnP / NAT-PMP port forwarding from my router)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="random_port_checkbox" />
<label for="random_port_checkbox">QBT_TR(Use different port on each startup)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
</fieldset>
<fieldset class="settings">
@ -147,23 +290,33 @@ @@ -147,23 +290,33 @@
<fieldset class="settings">
<legend>QBT_TR(Proxy Server)QBT_TR[CONTEXT=OptionsDialog]</legend>
<div class="formRow">
<label for="peer_proxy_type_select" class="leftLabelSmall">QBT_TR(Type:)QBT_TR[CONTEXT=OptionsDialog]</label>
<table>
<tr>
<td>
<label for="peer_proxy_type_select">QBT_TR(Type:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<select id="peer_proxy_type_select" onchange="updatePeerProxySettings();">
<option value="none">QBT_TR((None))QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="socks4">QBT_TR(SOCKS4)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="socks5">QBT_TR(SOCKS5)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="http">QBT_TR(HTTP)QBT_TR[CONTEXT=OptionsDialog]</option>
</select>
</div>
<div class="formRow">
<label for="peer_proxy_host_text" class="leftLabelSmall">QBT_TR(Host:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<label for="peer_proxy_host_text">QBT_TR(Host:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="peer_proxy_host_text" />
</div>
<div class="formRow">
<label for="peer_proxy_port_value" class="leftLabelSmall">QBT_TR(Port:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<label for="peer_proxy_port_value">QBT_TR(Port:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="peer_proxy_port_value" style="width: 4em;" />
</div>
</td>
</tr>
</table>
<div class="formRow">
<input type="checkbox" id="use_peer_proxy_checkbox" />
<label for="use_peer_proxy_checkbox">QBT_TR(Use proxy for peer connections)QBT_TR[CONTEXT=OptionsDialog]</label>
@ -177,26 +330,47 @@ @@ -177,26 +330,47 @@
<label for="proxy_only_for_torrents_checkbox">QBT_TR(Use proxy only for torrents)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<fieldset class="settings">
<legend><input type="checkbox" id="peer_proxy_auth_checkbox" onclick="updatePeerProxyAuthSettings();" />
<label for="peer_proxy_auth_checkbox">QBT_TR(Authentication)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<div class="formRow">
<label for="peer_proxy_username_text" class="leftLabelMedium">QBT_TR(Username:)QBT_TR[CONTEXT=OptionsDialog]</label>
<legend>
<input type="checkbox" id="peer_proxy_auth_checkbox" onclick="updatePeerProxyAuthSettings();" />
<label for="peer_proxy_auth_checkbox">QBT_TR(Authentication)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<table>
<tr>
<td>
<label for="peer_proxy_username_text">QBT_TR(Username:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="peer_proxy_username_text" />
</div>
<div class="formRow">
<label for="peer_proxy_password_text" class="leftLabelMedium">QBT_TR(Password:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="peer_proxy_password_text">QBT_TR(Password:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="password" id="peer_proxy_password_text" />
</td>
</tr>
</table>
<div class="formRow">
<span>Info: The password is saved unencrypted</span>
</div>
</fieldset>
</fieldset>
<fieldset class="settings">
<legend><input type="checkbox" id="ipfilter_enabled_checkbox" onclick="updateFilterSettings();" />
<label for="ipfilter_enabled_checkbox">QBT_TR(IP Filtering)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<legend>
<input type="checkbox" id="ipfilter_enabled_checkbox" onclick="updateFilterSettings();" />
<label for="ipfilter_enabled_checkbox">QBT_TR(IP Filtering)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<div class="formRow">
<label for="ipfilter_text">QBT_TR(Filter path (.dat, .p2p, .p2b):)QBT_TR[CONTEXT=OptionsDialog]</label>
<input type="text" id="ipfilter_text" /><br/>
<input type="text" id="ipfilter_text" />
</div>
<div class="formRow">
<input type="checkbox" id="ipfilter_trackers_checkbox" />
<label for="ipfilter_trackers_checkbox">QBT_TR(Apply to trackers)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<fieldset class="settings">
<legend>QBT_TR(Manually banned IP addresses...)QBT_TR[CONTEXT=OptionsDialog]</legend>
@ -211,6 +385,9 @@ @@ -211,6 +385,9 @@
<legend>QBT_TR(Global Rate Limits)QBT_TR[CONTEXT=OptionsDialog]</legend>
<table>
<tr>
<td rowspan="2">
<img alt="QBT_TR(Alternative speed limits)QBT_TR[CONTEXT=MainWindow]" src="images/slow_off.png">
</td>
<td><label for="up_limit_value">QBT_TR(Upload:)QBT_TR[CONTEXT=OptionsDialog]</label></td>
<td><input type="number" id="up_limit_value" style="width: 4em;" min="0" />&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td>
</tr>
@ -226,6 +403,9 @@ @@ -226,6 +403,9 @@
<legend>QBT_TR(Alternative Rate Limits)QBT_TR[CONTEXT=OptionsDialog]</legend>
<table>
<tr>
<td rowspan="2">
<img alt="QBT_TR(Alternative speed limits)QBT_TR[CONTEXT=MainWindow]" src="images/slow.png">
</td>
<td><label for="alt_up_limit_value">QBT_TR(Upload:)QBT_TR[CONTEXT=OptionsDialog]</label></td>
<td><input type="number" id="alt_up_limit_value" style="width: 4em;" min="0" />&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]</td>
</tr>
@ -237,12 +417,17 @@ @@ -237,12 +417,17 @@
<i>QBT_TR(0 means unlimited)QBT_TR[CONTEXT=OptionsDialog]</i>
<fieldset class="settings">
<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>
<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>
<div class="formRow">
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;" /> QBT_TR(To:)QBT_TR[CONTEXT=OptionsDialog]
<input type="text" id="schedule_to_hour" style="width: 1.5em;" />:<input type="text" id="schedule_to_min" style="width: 1.5em;" />
<br/> QBT_TR(When:)QBT_TR[CONTEXT=OptionsDialog]
</div>
<div class="formRow">
QBT_TR(When:)QBT_TR[CONTEXT=OptionsDialog]
<select id="schedule_freq_select">
<option value="0">QBT_TR(Every day)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="1">QBT_TR(Weekdays)QBT_TR[CONTEXT=OptionsDialog]</option>
@ -255,57 +440,119 @@ @@ -255,57 +440,119 @@
<option value="8">QBT_TR(Saturday)QBT_TR[CONTEXT=HttpServer]</option>
<option value="9">QBT_TR(Sunday)QBT_TR[CONTEXT=HttpServer]</option>
</select>
<br/>
</div>
</fieldset>
</fieldset>
<fieldset class="settings">
<legend>QBT_TR(Rate Limits Settings)QBT_TR[CONTEXT=OptionsDialog]</legend>
<div class="formRow">
<input type="checkbox" id="limit_utp_rate_checkbox" />
<label for="limit_utp_rate_checkbox">QBT_TR(Apply rate limit to µTP protocol)QBT_TR[CONTEXT=OptionsDialog]</label><br/>
<label for="limit_utp_rate_checkbox">QBT_TR(Apply rate limit to µTP protocol)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="limit_tcp_overhead_checkbox" />
<label for="limit_tcp_overhead_checkbox">QBT_TR(Apply rate limit to transport overhead)QBT_TR[CONTEXT=OptionsDialog]</label><br/>
<label for="limit_tcp_overhead_checkbox">QBT_TR(Apply rate limit to transport overhead)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="limit_lan_peers_checkbox" />
<label for="limit_lan_peers_checkbox">QBT_TR(Apply rate limit to peers on LAN)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
</fieldset>
</div>
<div id="BittorrentTab" class="PrefTab invisible">
<fieldset class="settings">
<legend>QBT_TR(Privacy)QBT_TR[CONTEXT=OptionsDialog]</legend>
<div class="formRow">
<input type="checkbox" id="dht_checkbox" />
<label for="dht_checkbox">QBT_TR(Enable DHT (decentralized network) to find more peers)QBT_TR[CONTEXT=OptionsDialog]</label><br/>
<label for="dht_checkbox">QBT_TR(Enable DHT (decentralized network) to find more peers)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="pex_checkbox" />
<label for="pex_checkbox">QBT_TR(Enable Peer Exchange (PeX) to find more peers)QBT_TR[CONTEXT=OptionsDialog]</label><br/>
<label for="pex_checkbox">QBT_TR(Enable Peer Exchange (PeX) to find more peers)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="lsd_checkbox" />
<label for="lsd_checkbox">QBT_TR(Enable Local Peer Discovery to find more peers)QBT_TR[CONTEXT=OptionsDialog]</label><br/>
<label for="lsd_checkbox">QBT_TR(Enable Local Peer Discovery to find more peers)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<label for="encryption_select">QBT_TR(Encryption mode:)QBT_TR[CONTEXT=OptionsDialog]</label>
<select id="encryption_select">
<option value="0">QBT_TR(Prefer encryption)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="1">QBT_TR(Require encryption)QBT_TR[CONTEXT=OptionsDialog]</option>
<option value="2">QBT_TR(Disable encryption)QBT_TR[CONTEXT=OptionsDialog]</option>
</select><br/>
</select>
</div>
<div class="formRow">
<input type="checkbox" id="anonymous_mode_checkbox" />
<label for="anonymous_mode_checkbox">QBT_TR(Enable anonymous mode)QBT_TR[CONTEXT=OptionsDialog] (<a target="_blank" href="https://github.com/qbittorrent/qBittorrent/wiki/Anonymous-Mode">QBT_TR(More information)QBT_TR[CONTEXT=HttpServer]</a>)</label><br/>
<label for="anonymous_mode_checkbox">QBT_TR(Enable anonymous mode)QBT_TR[CONTEXT=OptionsDialog] (<a target="_blank" href="https://github.com/qbittorrent/qBittorrent/wiki/Anonymous-Mode">QBT_TR(More information)QBT_TR[CONTEXT=HttpServer]</a>)</label>
</div>
</fieldset>
<fieldset class="settings">
<legend><input type="checkbox" id="queueing_checkbox" onclick="updateQueueingSystem();" />
<label for="queueing_checkbox">QBT_TR(Torrent Queueing)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<div class="formRow">
<label for="max_active_dl_value" style="margin-left: 20px;" class="leftLabelLarge">QBT_TR(Maximum active downloads:)QBT_TR[CONTEXT=OptionsDialog]</label>
<legend>
<input type="checkbox" id="queueing_checkbox" onclick="updateQueueingSystem();" />
<label for="queueing_checkbox">QBT_TR(Torrent Queueing)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<table>
<tr>
<td>
<label for="max_active_dl_value">QBT_TR(Maximum active downloads:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="max_active_dl_value" style="width: 4em;" />
</div>
<div class="formRow">
<label for="max_active_up_value" style="margin-left: 20px;" class="leftLabelLarge">QBT_TR(Maximum active uploads:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="max_active_up_value">QBT_TR(Maximum active uploads:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="max_active_up_value" style="width: 4em;" />
</div>
<div class="formRow">
<label for="max_active_to_value" style="margin-left: 20px;" class="leftLabelLarge">QBT_TR(Maximum active torrents:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="max_active_to_value">QBT_TR(Maximum active torrents:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="max_active_to_value" style="width: 4em;" />
</div>
<div class="formRow">
<input type="checkbox" id="dont_count_slow_torrents_checkbox" />
</td>
</tr>
</table>
<fieldset class="settings">
<legend>
<input type="checkbox" id="dont_count_slow_torrents_checkbox" onclick="updateSlowTorrentsSettings();" />
<label for="dont_count_slow_torrents_checkbox">QBT_TR(Do not count slow torrents in these limits)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
</legend>
<table>
<tr>
<td>
<label for="dl_rate_threshold">QBT_TR(Download rate threshold:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="dl_rate_threshold" style="width: 4em;" />&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]
</td>
</tr>
<tr>
<td>
<label for="ul_rate_threshold">QBT_TR(Upload rate threshold:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="ul_rate_threshold" style="width: 4em;" />&nbsp;&nbsp;QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]
</td>
</tr>
<tr>
<td>
<label for="torrent_inactive_timer">QBT_TR(Torrent inactivity timer:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="torrent_inactive_timer" style="width: 4em;" />&nbsp;&nbsp;QBT_TR(seconds)QBT_TR[CONTEXT=OptionsDialog]
</td>
</tr>
</table>
</fieldset>
</fieldset>
<fieldset class="settings">
@ -343,8 +590,10 @@ @@ -343,8 +590,10 @@
</fieldset>
<fieldset class="settings">
<legend><input type="checkbox" id="add_trackers_checkbox" onclick="updateAddTrackersEnabled();" />
<label for="add_trackers_checkbox">QBT_TR(Automatically add these trackers to new downloads:)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<legend>
<input type="checkbox" id="add_trackers_checkbox" onclick="updateAddTrackersEnabled();" />
<label for="add_trackers_checkbox">QBT_TR(Automatically add these trackers to new downloads:)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<textarea id="add_trackers_textarea" rows="5" cols="70"></textarea>
</fieldset>
</div>
@ -409,33 +658,68 @@ @@ -409,33 +658,68 @@
<fieldset class="settings">
<legend>QBT_TR(Web User Interface (Remote control))QBT_TR[CONTEXT=OptionsDialog]</legend>
<label class="leftLabelMedium" for="webui_address_value">QBT_TR(IP address:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="text" id="webui_address_value" />
<label for="webui_port_value" style="margin-left: 10px;">QBT_TR(Port:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="text" id="webui_port_value" style="width: 4em;" /><br/>
<table>
<tr>
<td>
<label for="webui_address_value">QBT_TR(IP address:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="webui_address_value" />
<label for="webui_port_value" style="margin-left: 10px;">QBT_TR(Port:)QBT_TR[CONTEXT=OptionsDialog]</label>
<input type="text" id="webui_port_value" style="width: 4em;" />
</td>
</tr>
</table>
<div class="formRow">
<input type="checkbox" id="webui_upnp_checkbox" />
<label for="webui_upnp_checkbox">QBT_TR(Use UPnP / NAT-PMP to forward the port from my router)QBT_TR[CONTEXT=OptionsDialog]</label><br/>
<label for="webui_upnp_checkbox">QBT_TR(Use UPnP / NAT-PMP to forward the port from my router)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<fieldset class="settings">
<legend><input type="checkbox" id="use_https_checkbox" onclick="updateHttpsSettings();" />
<label for="use_https_checkbox">QBT_TR(Use HTTPS instead of HTTP)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<div class="formRow">
<label class="leftLabelSmall" for="ssl_key_textarea">QBT_TR(Key:)QBT_TR[CONTEXT=OptionsDialog]</label>
<legend>
<input type="checkbox" id="use_https_checkbox" onclick="updateHttpsSettings();" />
<label for="use_https_checkbox">QBT_TR(Use HTTPS instead of HTTP)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<table>
<tr>
<td>
<label for="ssl_key_textarea">QBT_TR(Key:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<textarea id="ssl_key_textarea" rows="5" cols="70"></textarea>
</div>
<div class="formRow">
<label class="leftLabelSmall" for="ssl_cert_textarea">QBT_TR(Certificate:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="ssl_cert_textarea">QBT_TR(Certificate:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<textarea id="ssl_cert_textarea" rows="5" cols="70"></textarea>
</div>
</td>
</tr>
</table>
<div style="padding-left: 10px;"><a target="_blank" href="https://httpd.apache.org/docs/current/ssl/ssl_faq.html#aboutcerts">QBT_TR(Information about certificates)QBT_TR[CONTEXT=HttpServer]</a></div>
</fieldset>
<fieldset class="settings">
<legend>QBT_TR(Authentication)QBT_TR[CONTEXT=OptionsDialog]</legend>
<div class="formRow">
<label for="webui_username_text" class="leftLabelSmall">QBT_TR(Username:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="text" id="webui_username_text" />
</div>
<div class="formRow">
<label for="webui_password_text" class="leftLabelSmall">QBT_TR(Password:)QBT_TR[CONTEXT=OptionsDialog]</label>
<table>
<tr>
<td>
<label for="webui_username_text">QBT_TR(Username:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="webui_username_text" />
</td>
</tr>
<tr>
<td>
<label for="webui_password_text">QBT_TR(Password:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="password" id="webui_password_text" placeholder="QBT_TR(Change current password)QBT_TR[CONTEXT=OptionsDialog]" />
</div>
</td>
</tr>
</table>
<div class="formRow">
<input type="checkbox" id="bypass_local_auth_checkbox" />
<label for="bypass_local_auth_checkbox">QBT_TR(Bypass authentication for clients on localhost)QBT_TR[CONTEXT=OptionsDialog]</label>
@ -449,6 +733,15 @@ @@ -449,6 +733,15 @@
</div>
</fieldset>
<fieldset class="settings">
<legend><input type="checkbox" id="use_alt_webui_checkbox" onclick="updateAlternativeWebUISettings();" />
<label for="use_alt_webui_checkbox">QBT_TR(Use alternative Web UI)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<div class="formRow">
<label for="webui_files_location_textarea">QBT_TR(Files location:)QBT_TR[CONTEXT=OptionsDialog]</label>
<input type="text" id="webui_files_location_textarea" />
</div>
</fieldset>
<fieldset class="settings">
<legend>QBT_TR(Security)QBT_TR[CONTEXT=OptionsDialog]</legend>
<div class="formRow">
@ -465,36 +758,60 @@ @@ -465,36 +758,60 @@
<input type="checkbox" id="host_header_validation_checkbox" onclick="updateHostHeaderValidationSettings();" />
<label for="host_header_validation_checkbox">QBT_TR(Enable Host header validation)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<div class="formRow">
<label class="leftLabelMedium" for="webui_domain_textarea">QBT_TR(Server domains:)QBT_TR[CONTEXT=OptionsDialog]</label>
<table>
<tr>
<td>
<label for="webui_domain_textarea">QBT_TR(Server domains:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<textarea id="webui_domain_textarea" rows="1" cols="60"></textarea>
</div>
</td>
</tr>
</table>
</fieldset>
</fieldset>
</fieldset>
<fieldset class="settings">
<legend><input type="checkbox" id="use_dyndns_checkbox" onclick="updateDynDnsSettings();" />
<label for="use_dyndns_checkbox">QBT_TR(Update my dynamic domain name)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
<legend>
<input type="checkbox" id="use_dyndns_checkbox" onclick="updateDynDnsSettings();" />
<label for="use_dyndns_checkbox">QBT_TR(Update my dynamic domain name)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend>
<select id="dyndns_select">
<option value="0">DynDNS</option>
<option value="1">NO-IP</option>
</select>
<input type="button" value="QBT_TR(Register)QBT_TR[CONTEXT=OptionsDialog]" onclick="registerDynDns();" /><br/><br/>
<div class="formRow">
<label for="dyndns_domain_text" class="leftLabelMedium">QBT_TR(Domain name:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="text" id="dyndns_domain_text" />
</div>
<div class="formRow">
<label for="dyndns_username_text" class="leftLabelMedium">QBT_TR(Username:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="text" id="dyndns_username_text" />
</div>
<div class="formRow">
<label for="dyndns_password_text" class="leftLabelMedium">QBT_TR(Password:)QBT_TR[CONTEXT=OptionsDialog]</label><input type="password" id="dyndns_password_text" />
</div>
<input type="button" value="QBT_TR(Register)QBT_TR[CONTEXT=OptionsDialog]" onclick="registerDynDns();" />
<table style="margin-top: 10px;">
<tr>
<td>
<label for="dyndns_domain_text">QBT_TR(Domain name:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="dyndns_domain_text" />
</td>
</tr>
<tr>
<td>
<label for="dyndns_username_text">QBT_TR(Username:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="dyndns_username_text" />
</td>
</tr>
<tr>
<td>
<label for="dyndns_password_text">QBT_TR(Password:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="password" id="dyndns_password_text" />
</td>
</tr>
</table>
</fieldset>
</div>
<br/>
<div style="text-align: center;"><input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" onclick="applyPreferences();" /></div>
<div style="text-align: center; margin-top: 1em;"><input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" onclick="applyPreferences();" /></div>
<script>
// Downloads tab
@ -527,33 +844,31 @@ @@ -527,33 +844,31 @@
changeWatchFolderSelect = function(item) {
if (item.value == "other") {
item.nextElementSibling.hidden = false;
item.nextElementSibling.value = 'QBT_TR(Type folder here)QBT_TR[CONTEXT=HttpServer]';
item.nextElementSibling.select();
}
else {
item.nextElementSibling.hidden = true;
var text = item.options[item.selectedIndex].innerHTML;
item.nextElementSibling.value = text;
}
};
changeWatchFolderText = function(item) {
item.previousElementSibling.value = 'other';
};
pushWatchFolder = function(pos, folder, sel, other) {
var myinput = "<input id='text_watch_" + pos + "' type='text' value='" + folder + "'>";
var disableInput = (sel != "other");
var mycb = "<div class='select-watched-folder-editable'>"
+ "<select id ='cb_watch_" + pos + "' onchange='changeWatchFolderSelect(this)'>"
+ "<option value='watch_folder'>QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]</option>"
+ "<option value='default_folder'>QBT_TR(Default save location)QBT_TR[CONTEXT=ScanFoldersModel]</option>"
+ "<option value='other'>QBT_TR(Other...)QBT_TR[CONTEXT=HttpServer]</option>"
+ "</select>"
+ "<input id='cb_watch_txt_" + pos + "' type='text' "
+ "onchange='changeWatchFolderText(this)' /></div>";
+ "<input id='cb_watch_txt_" + pos + "' type='text' " + (disableInput ? "hidden " : "") + "/></div>";
WatchedFoldersTable.push([myinput, mycb]);
$('cb_watch_' + pos).setProperty('value', sel);
if (sel != "other") {
if (disableInput) {
var elt = $('cb_watch_' + pos);
other = elt.options[elt.selectedIndex].innerHTML;
}
@ -592,6 +907,7 @@ @@ -592,6 +907,7 @@
updateMailNotification = function() {
var isMailNotificationEnabled = $('mail_notification_checkbox').getProperty('checked');
$('src_email_txt').setProperty('disabled', !isMailNotificationEnabled);
$('dest_email_txt').setProperty('disabled', !isMailNotificationEnabled);
$('smtp_server_txt').setProperty('disabled', !isMailNotificationEnabled);
$('mail_ssl_checkbox').setProperty('disabled', !isMailNotificationEnabled);
@ -697,6 +1013,14 @@ @@ -697,6 +1013,14 @@
$('max_active_up_value').setProperty('disabled', !isQueueingEnabled);
$('max_active_to_value').setProperty('disabled', !isQueueingEnabled);
$('dont_count_slow_torrents_checkbox').setProperty('disabled', !isQueueingEnabled);
updateSlowTorrentsSettings();
};
updateSlowTorrentsSettings = function() {
var isDontCountSlowTorrentsEnabled = (!$('dont_count_slow_torrents_checkbox').getProperty('disabled')) && $('dont_count_slow_torrents_checkbox').getProperty('checked');
$('dl_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
$('ul_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
$('torrent_inactive_timer').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
};
updateMaxRatioTimeEnabled = function() {
@ -726,6 +1050,11 @@ @@ -726,6 +1050,11 @@
$('bypass_auth_subnet_whitelist_textarea').setProperty('disabled', !isBypassAuthSubnetWhitelistEnabled);
};
updateAlternativeWebUISettings = function() {
var isUseAlternativeWebUIEnabled = $('use_alt_webui_checkbox').getProperty('checked');
$('webui_files_location_textarea').setProperty('disabled', !isUseAlternativeWebUIEnabled);
};
updateHostHeaderValidationSettings = function() {
var isHostHeaderValidationEnabled = $('host_header_validation_checkbox').getProperty('checked');
$('webui_domain_textarea').setProperty('disabled', !isHostHeaderValidationEnabled);
@ -748,6 +1077,13 @@ @@ -748,6 +1077,13 @@
}
};
generateRandomPort = function() {
var min = 1024;
var max = 65535;
var port = Math.floor(Math.random() * (max - min + 1) + min);
$('port_value').setProperty('value', port);
};
time_padding = function(val) {
var ret = val.toString();
if (ret.length == 1)
@ -767,26 +1103,23 @@ @@ -767,26 +1103,23 @@
onSuccess: function(pref) {
if (pref) {
// Downloads tab
// Hard Disk
// When adding a torrent
$('createsubfolder_checkbox').setProperty('checked', pref.create_subfolder_enabled);
$('dontstartdownloads_checkbox').setProperty('checked', pref.start_paused_enabled);
$('deletetorrentfileafter_checkbox').setProperty('checked', pref.auto_delete_mode);
$('preallocateall_checkbox').setProperty('checked', pref.preallocate_all);
$('appendext_checkbox').setProperty('checked', pref.incomplete_files_ext);
// Saving Managmenet
$('default_tmm_combobox').setProperty('value', pref.auto_tmm_enabled);
$('torrent_changed_tmm_combobox').setProperty('value', pref.torrent_changed_tmm_enabled);
$('save_path_changed_tmm_combobox').setProperty('value', pref.save_path_changed_tmm_enabled);
$('category_changed_tmm_combobox').setProperty('value', pref.category_changed_tmm_enabled);
$('savepath_text').setProperty('value', pref.save_path);
$('temppath_checkbox').setProperty('checked', pref.temp_path_enabled);
$('temppath_text').setProperty('value', pref.temp_path);
updateTempDirEnabled();
$('preallocateall_checkbox').setProperty('checked', pref.preallocate_all);
$('appendext_checkbox').setProperty('checked', pref.incomplete_files_ext);
var i = 0;
for (var folder in pref.scan_dirs) {
var sel;
var other = "";
if (typeof pref.scan_dirs[folder] == "string") {
other = pref.scan_dirs[folder];
sel = "other";
}
else {
sel = (pref.scan_dirs[folder] == 0) ? "watch_folder" : "default_folder";
}
pushWatchFolder(i++, folder, sel, other);
}
if (pref.export_dir != '') {
$('exportdir_checkbox').setProperty('checked', true);
$('exportdir_text').setProperty('value', pref.export_dir);
@ -806,8 +1139,24 @@ @@ -806,8 +1139,24 @@
}
updateExportDirFinEnabled();
// Automatically add torrents from
var i = 0;
for (var folder in pref.scan_dirs) {
var sel;
var other = "";
if (typeof pref.scan_dirs[folder] == "string") {
other = pref.scan_dirs[folder];
sel = "other";
}
else {
sel = (pref.scan_dirs[folder] == 0) ? "watch_folder" : "default_folder";
}
pushWatchFolder(i++, folder, sel, other);
}
// Email notification upon download completion
$('mail_notification_checkbox').setProperty('checked', pref.mail_notification_enabled);
$('src_email_txt').setProperty('value', pref.mail_notification_sender);
$('dest_email_txt').setProperty('value', pref.mail_notification_email);
$('smtp_server_txt').setProperty('value', pref.mail_notification_smtp);
$('mail_ssl_checkbox').setProperty('checked', pref.mail_notification_ssl_enabled);
@ -916,6 +1265,7 @@ @@ -916,6 +1265,7 @@
$('enable_protocol_combobox').setProperty('value', pref.bittorrent_protocol);
$('limit_utp_rate_checkbox').setProperty('checked', pref.limit_utp_rate);
$('limit_tcp_overhead_checkbox').setProperty('checked', pref.limit_tcp_overhead);
$('limit_lan_peers_checkbox').setProperty('checked', pref.limit_lan_peers);
// Scheduling
$('limit_sheduling_checkbox').setProperty('checked', pref.scheduler_enabled);
@ -941,6 +1291,9 @@ @@ -941,6 +1291,9 @@
$('max_active_up_value').setProperty('value', pref.max_active_uploads.toInt());
$('max_active_to_value').setProperty('value', pref.max_active_torrents.toInt());
$('dont_count_slow_torrents_checkbox').setProperty('checked', pref.dont_count_slow_torrents);
$('dl_rate_threshold').setProperty('value', pref.slow_torrent_dl_rate_threshold.toInt());
$('ul_rate_threshold').setProperty('value', pref.slow_torrent_ul_rate_threshold.toInt());
$('torrent_inactive_timer').setProperty('value', pref.slow_torrent_inactive_timer.toInt());
updateQueueingSystem();
// Share Limiting
@ -986,6 +1339,11 @@ @@ -986,6 +1339,11 @@
$('bypass_auth_subnet_whitelist_textarea').setProperty('value', pref.bypass_auth_subnet_whitelist);
updateBypasssAuthSettings();
// Use alternative Web UI
$('use_alt_webui_checkbox').setProperty('checked', pref.alternative_webui_enabled);
$('webui_files_location_textarea').setProperty('value', pref.alternative_webui_path);
updateAlternativeWebUISettings();
// Security
$('clickjacking_protection_checkbox').setProperty('checked', pref.web_ui_clickjacking_protection_enabled);
$('csrf_protection_checkbox').setProperty('checked', pref.web_ui_csrf_protection_enabled);
@ -1008,13 +1366,22 @@ @@ -1008,13 +1366,22 @@
var settings = new Hash();
// Validate form data
// Downloads tab
// Hard Disk
// When adding a torrent
settings.set('create_subfolder_enabled', $('createsubfolder_checkbox').getProperty('checked'));
settings.set('start_paused_enabled', $('dontstartdownloads_checkbox').getProperty('checked'));
settings.set('auto_delete_mode', $('deletetorrentfileafter_checkbox').getProperty('checked'));
settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked'));
settings.set('incomplete_files_ext', $('appendext_checkbox').getProperty('checked'));
// Saving Management
settings.set('auto_tmm_enabled', $('default_tmm_combobox').getProperty('value'));
settings.set('torrent_changed_tmm_enabled', $('torrent_changed_tmm_combobox').getProperty('value'));
settings.set('save_path_changed_tmm_enabled', $('save_path_changed_tmm_combobox').getProperty('value'));
settings.set('category_changed_tmm_enabled', $('category_changed_tmm_combobox').getProperty('value'));
settings.set('save_path', $('savepath_text').getProperty('value'));
settings.set('temp_path_enabled', $('temppath_checkbox').getProperty('checked'));
settings.set('temp_path', $('temppath_text').getProperty('value'));
settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked'));
settings.set('incomplete_files_ext', $('appendext_checkbox').getProperty('checked'));
settings.set('scan_dirs', getWatchedFolders());
if ($('exportdir_checkbox').getProperty('checked'))
settings.set('export_dir', $('exportdir_text').getProperty('value'));
else
@ -1024,8 +1391,12 @@ @@ -1024,8 +1391,12 @@
else
settings.set('export_dir_fin', '');
// Automatically add torrents from
settings.set('scan_dirs', getWatchedFolders());
// Email notification upon download completion
settings.set('mail_notification_enabled', $('mail_notification_checkbox').getProperty('checked'));
settings.set('mail_notification_sender', $('src_email_txt').getProperty('value'));
settings.set('mail_notification_email', $('dest_email_txt').getProperty('value'));
settings.set('mail_notification_smtp', $('smtp_server_txt').getProperty('value'));
settings.set('mail_notification_ssl_enabled', $('mail_ssl_checkbox').getProperty('checked'));
@ -1165,6 +1536,7 @@ @@ -1165,6 +1536,7 @@
settings.set('bittorrent_protocol', $('enable_protocol_combobox').getProperty('value'));
settings.set('limit_utp_rate', $('limit_utp_rate_checkbox').getProperty('checked'));
settings.set('limit_tcp_overhead', $('limit_tcp_overhead_checkbox').getProperty('checked'));
settings.set('limit_lan_peers', $('limit_lan_peers_checkbox').getProperty('checked'));
// Scheduler
var scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked');
@ -1207,6 +1579,24 @@ @@ -1207,6 +1579,24 @@
}
settings.set('max_active_torrents', max_active_torrents);
settings.set('dont_count_slow_torrents', $('dont_count_slow_torrents_checkbox').getProperty('checked'));
var dl_rate_threshold = $('dl_rate_threshold').getProperty('value').toInt();
if (isNaN(dl_rate_threshold) || (dl_rate_threshold < 1)) {
alert("QBT_TR(Download rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
return;
}
settings.set('slow_torrent_dl_rate_threshold', dl_rate_threshold);
var ul_rate_threshold = $('ul_rate_threshold').getProperty('value').toInt();
if (isNaN(ul_rate_threshold) || (ul_rate_threshold < 1)) {
alert("QBT_TR(Upload rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
return;
}
settings.set('slow_torrent_ul_rate_threshold', ul_rate_threshold);
var torrent_inactive_timer = $('torrent_inactive_timer').getProperty('value').toInt();
if (isNaN(torrent_inactive_timer) || (torrent_inactive_timer < 1)) {
alert("QBT_TR(Torrent inactivity timer must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
return;
}
settings.set('slow_torrent_inactive_timer', torrent_inactive_timer);
}
// Share Ratio Limiting
@ -1276,6 +1666,16 @@ @@ -1276,6 +1666,16 @@
settings.set('bypass_auth_subnet_whitelist_enabled', $('bypass_auth_subnet_whitelist_checkbox').getProperty('checked'));
settings.set('bypass_auth_subnet_whitelist', $('bypass_auth_subnet_whitelist_textarea').getProperty('value'));
// Use alternative Web UI
var alternative_webui_enabled = $('use_alt_webui_checkbox').getProperty('checked');
var webui_files_location_textarea = $('webui_files_location_textarea').getProperty('value');
if (alternative_webui_enabled && (webui_files_location_textarea.trim() === "")) {
alert("QBT_TR(The alternative Web UI files location cannot be blank.)QBT_TR[CONTEXT=OptionsDialog]");
return;
}
settings.set('alternative_webui_enabled', alternative_webui_enabled);
settings.set('alternative_webui_path', webui_files_location_textarea);
settings.set('web_ui_clickjacking_protection_enabled', $('clickjacking_protection_checkbox').getProperty('checked'));
settings.set('web_ui_csrf_protection_enabled', $('csrf_protection_checkbox').getProperty('checked'));
settings.set('web_ui_host_header_validation_enabled', $('host_header_validation_checkbox').getProperty('checked'));

89
src/webui/www/private/scripts/download.js

@ -21,22 +21,97 @@ @@ -21,22 +21,97 @@
* THE SOFTWARE.
*/
getSavePath = function() {
new Request({
url: 'api/v2/app/defaultSavePath',
var categories = {};
var defaultSavePath = "";
getCategories = function() {
new Request.JSON({
url: 'api/v2/torrents/categories',
noCache: true,
method: 'get',
onSuccess: function(data) {
if (data) {
categories = data;
for (var i in data) {
var category = data[i];
var option = new Element("option");
option.set('value', category.name);
option.set('html', category.name);
$('categorySelect').appendChild(option);
}
}
}
}).send();
};
getPreferences = function() {
new Request.JSON({
url: 'api/v2/app/preferences',
method: 'get',
noCache: true,
onFailure: function() {
alert("Could not contact qBittorrent");
},
onSuccess: function(data) {
if (data) {
$('savepath').setProperty('value', data);
onSuccess: function(pref) {
if (pref) {
defaultSavePath = pref.save_path;
$('savepath').setProperty('value', defaultSavePath);
$('root_folder').checked = pref.create_subfolder_enabled;
$('start_torrent').checked = !pref.start_paused_enabled;
if (pref.auto_tmm_enabled == 1) {
$('autoTMM').selectedIndex = 1;
$('savepath').disabled = true;
}
else {
$('autoTMM').selectedIndex = 0;
}
}
}
}).send();
};
changeCategorySelect = function(item) {
if (item.value == "\\other") {
item.nextElementSibling.hidden = false;
item.nextElementSibling.value = "";
item.nextElementSibling.select();
if ($('autotmm').selectedIndex == 1)
$('savepath').value = defaultSavePath;
}
else {
item.nextElementSibling.hidden = true;
var text = item.options[item.selectedIndex].innerHTML;
item.nextElementSibling.value = text;
if ($('autotmm').selectedIndex == 1) {
var categoryName = item.value;
var category = categories[categoryName];
var savePath = defaultSavePath;
if (category !== undefined)
savePath = (category['savePath'] !== "") ? category['savePath'] : (defaultSavePath + categoryName);
$('savepath').value = savePath;
}
}
};
changeTMM = function(item) {
if (item.selectedIndex == 1) {
$('savepath').disabled = true;
var categorySelect = $('categorySelect');
var categoryName = categorySelect.options[categorySelect.selectedIndex].value;
var category = categories[categoryName];
$('savepath').value = (category === undefined) ? "" : category['savePath'];
}
else {
$('savepath').disabled = false;
$('savepath').value = defaultSavePath;
}
};
$(window).addEventListener("load", function() {
getSavePath();
getPreferences();
getCategories();
});

4
src/webui/www/private/shareratio.html

@ -150,12 +150,12 @@ @@ -150,12 +150,12 @@
<div style="margin-left: 40px; margin-bottom: 5px;">
<input type="checkbox" id="setRatio" class="shareLimitInput" onclick="enableInputBoxes()" />
<label for="setRatio" class="leftLabelLarge">QBT_TR(ratio)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
<label for="setRatio">QBT_TR(ratio)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
<input type="number" id="ratio" value="0.00" step=".01" min="0" max="9999" class="shareLimitInput" />
</div>
<div style="margin-left: 40px; margin-bottom: 5px;">
<input type="checkbox" id="setMinutes" class="shareLimitInput" onclick="enableInputBoxes()" />
<label for="setMinutes" class="leftLabelLarge">QBT_TR(minutes)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
<label for="setMinutes">QBT_TR(minutes)QBT_TR[CONTEXT=UpDownRatioDialog]</label>
<input type="number" id="minutes" value="0" step="1" min="0" max="525600" class="shareLimitInput" />
</div>
<div style="text-align: center; padding-top: 10px;">

120
src/webui/www/private/upload.html

@ -16,48 +16,106 @@ @@ -16,48 +16,106 @@
<div style="margin-top: 25px; display: inline-block; border: 1px solid lightgrey; border-radius: 4px;">
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />
</div>
<fieldset class="settings" style="border: 0; text-align: left;">
<div class="formRow" style="margin-top: 12px;">
<label for="savepath" class="leftLabelLarge">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label>
<fieldset class="settings" style="border: 0; text-align: left; margin-top: 12px;">
<table style="margin: auto;">
<tr>
<td>
<label for="autoTMM">QBT_TR(Torrent Management Mode:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<select id="autoTMM" name="autoTMM" onchange="changeTMM(this)">
<option selected value="false">Manual</option>
<option value="true">Automatic</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="savepath">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="savepath" name="savepath" style="width: 16em;" />
</div>
<div class="formRow">
<label for="rename" class="leftLabelLarge">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
</td>
</tr>
<tr>
<td>
<label for="rename">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="rename" name="rename" style="width: 16em;" />
</td>
</tr>
<tr>
<td>
<label for="category">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<div class="select-watched-folder-editable">
<select id="categorySelect" onchange="changeCategorySelect(this)">
<option selected value="\other"></option>
</select>
<input name="category" type="text" value="" />
</div>
<div class="formRow">
<label for="category" class="leftLabelLarge">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<input type="text" id="category" name="category" style="width: 16em;" />
</div>
<div class="formRow">
<label for="start_torrent" class="leftLabelLarge">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="start_torrent">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="start_torrent" checked="checked" />
<input type="hidden" id="add_paused" name="paused" value="false" readonly />
</div>
<div class="formRow">
<label for="skip_checking" class="leftLabelLarge">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="skip_checking">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="skip_checking" name="skip_checking" value="true" />
</div>
<div class="formRow">
<label for="root_folder" class="leftLabelLarge">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
</tr>
<tr>
<td>
<label for="root_folder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked" />
</div>
<div class="formRow">
<label for="sequentialDownload" class="leftLabelLarge">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label>
</td>
</tr>
<tr>
<td>
<label for="sequentialDownload">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label>
</td>
<td>
<input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true" />
</div>
<div class="formRow">
<label for="firstLastPiecePrio" class="leftLabelLarge">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label>
</td>
</tr>
<tr>
<td>
<label for="firstLastPiecePrio">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label>
</td>
<td>
<input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true" />
</div>
<div class="formRow">
<label for="dlLimit" class="leftLabelLarge">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label>
</td>
</tr>
<tr>
<td>
<label for="dlLimit">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="dlLimit" name="dlLimit" style="width: 16em;" placeholder="Bytes/s" />
</div>
<div class="formRow">
<label for="upLimit" class="leftLabelLarge">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label>
</td>
</tr>
<tr>
<td>
<label for="upLimit">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label>
</td>
<td>
<input type="text" id="upLimit" name="upLimit" style="width: 16em;" placeholder="Bytes/s" />
</div>
</td>
</tr>
</table>
<div id="submitbutton" style="margin-top: 30px; text-align: center;">
<button type="submit" style="font-size: 1em;">QBT_TR(Upload Torrents)QBT_TR[CONTEXT=HttpServer]</button>
</div>

Loading…
Cancel
Save