Browse Source

Merge pull request #15562 from Chocobo1/precommit

GHA CI: Switch to pre-commit framework for checking file health
adaptive-webui-19844
Chocobo1 3 years ago committed by GitHub
parent
commit
3c948ef063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 68
      .github/workflows/check_translation_tag.py
  2. 7
      .github/workflows/ci_file_health.yaml
  3. 85
      .github/workflows/file_health.sh
  4. 55
      .pre-commit-config.yaml
  5. 18
      src/gui/mainwindow.cpp
  6. 2
      src/gui/mainwindow.h
  7. 34
      src/gui/optionsdialog.cpp
  8. 4
      src/gui/optionsdialog.h
  9. 16
      src/gui/optionsdialog.ui
  10. 6
      src/gui/search/searchwidget.cpp
  11. 10
      src/webui/www/private/views/preferences.html

68
.github/workflows/check_translation_tag.py

@ -0,0 +1,68 @@
#!/usr/bin/env python3
# A pre-commit hook for detecting problematic <translation> tags
# Copyright (C) 2021 Mike Tzou (Chocobo1)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# In addition, as a special exception, the copyright holders give permission to
# link this program with the OpenSSL project's "OpenSSL" library (or with
# modified versions of it that use the same license as the "OpenSSL" library),
# and distribute the linked executables. You must obey the GNU General Public
# License in all respects for all of the code used other than "OpenSSL". If you
# modify file(s), you may extend this exception to your version of the file(s),
# but you are not obligated to do so. If you do not wish to do so, delete this
# exception statement from your version.
from typing import Optional, Sequence
import argparse
import re
def main(argv: Optional[Sequence[str]] = None) -> int:
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='*', help='Filenames to check')
args = parser.parse_args(argv)
error_msg = ""
regex = re.compile(r"\s*</translation>")
for filename in args.filenames:
line_counter = 1
error_buffer = ""
with open(filename) as file:
try:
for line in file:
if (match := regex.match(line)) is not None:
error_buffer += str(f"Defect file: \"{filename}\"\n"
f"Line: {line_counter}\n"
f"Column span: {match.span()}\n"
f"Part: \"{match.group()}\"\n\n")
line_counter += 1
except UnicodeDecodeError as error:
# not a text file, skip
continue
error_msg += error_buffer
if len(error_msg) > 0:
print(error_msg)
return 1
return 0
if __name__ == '__main__':
exit(main())

7
.github/workflows/ci_file_health.yaml

@ -11,10 +11,7 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install tools - name: Install tools
run: | uses: actions/setup-python@v2
sudo apt update
sudo apt install zsh
- name: Check files - name: Check files
run: | uses: pre-commit/action@v2.0.3
./.github/workflows/file_health.sh

85
.github/workflows/file_health.sh

@ -1,85 +0,0 @@
#!/usr/bin/env zsh
set -o nounset
# Assumption: file names don't contain `:` (for the `cut` invocation).
# Safe to assume, as such a character in a filename would cause trouble on Windows, a platform we support
# any regression turn this non-zero
regressions=0
# exclusions (these are just grep extended regular expressions to match against paths relative to the root of the repository)
exclusions_nonutf8='(.*(7z|gif|ic(ns|o)|png|qm|zip))'
exclusions_bom='src/base/unicodestrings.h'
exclusions_tw='(*.ts)|src/webui/www/private/scripts/lib/*'
exclusions_trailing_newline='configure'
exclusions_no_lf='(*.ts)|(.*svg)|compile_commands.json|src/webui/www/private/scripts/lib/*'
echo -e "\n*** Detect files not encoded in UTF-8 ***\n"
find . -path ./build -prune -false -o -path ./.git -prune -false -o -type f -exec file --mime {} \; | sort \
| grep -v -e "charset=us-ascii" -e "charset=utf-8" | cut -d ":" -f 1 \
| grep -E -v -e "${exclusions_nonutf8}" \
| tee >(echo -e "--> Files not encoded in UTF-8: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "\n*** Detect files encoded in UTF-8 with BOM ***\n"
grep --exclude-dir={.git,build} -rIl $'\xEF\xBB\xBF' | sort \
| grep -E -v -e "${exclusions_bom}" \
| tee >(echo -e "--> Files encoded in UTF-8 with BOM: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "\n*** Detect usage of CR byte ***\n"
grep --exclude-dir={.git,build} -rIlU $'\x0D' | sort \
| tee >(echo -e "--> Usage of CR byte: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "\n*** Detect trailing whitespace in lines ***\n"
grep --exclude-dir={.git,build} -rIl "[[:blank:]]$" | sort \
| grep -E -v -e "${exclusions_tw}" \
| tee >(echo -e "--> Trailing whitespace in lines: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0';
regressions=$((regressions+$?))
echo -e "\n*** Detect too many trailing newlines ***\n"
find . -path ./build -prune -false -o -path ./.git -prune -false -o -type f -exec file --mime {} \; | sort \
| grep -e "charset=us-ascii" -e "charset=utf-8" | cut -d ":" -f 1 \
| grep -E -v -e "${exclusions_trailing_newline}" \
| xargs -L1 -I my_input bash -c 'test "$(tail -q -c2 "my_input" | hexdump -C | grep "0a 0a")" && echo "my_input"' \
| tee >(echo -e "--> Too many trailing newlines: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "\n*** Detect no trailing newline ***\n"
find . -path ./build -prune -false -o -path ./.git -prune -false -o -type f -exec file --mime {} \; | sort \
| grep -e "charset=us-ascii" -e "charset=utf-8" | cut -d ":" -f 1 \
| grep -E -v -e "${exclusions_no_lf}" \
| xargs -L1 -I my_input bash -c 'test "$(tail -q -c1 "my_input" | hexdump -C | grep "0a")" || echo "my_input"' \
| tee >(echo -e "--> No trailing newline: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
echo -e "\n*** Detect translation closing tag in new line ***\n"
grep --exclude-dir={.git,build} -nri "^</translation>" | sort \
| cut -d ":" -f 1,2 \
| tee >(echo -e "--> Translation closing tag in new line: found" "$(wc -l < /dev/stdin)" "regression(s)\n") \
| xargs -I my_input -0 bash -c 'echo "my_input"; test "$(echo -n "my_input" | wc -l)" -eq 0'
regressions=$((regressions+$?))
if [ "$regressions" -ne 0 ]; then
regressions=1
echo "\nFile health regressions found. Please fix them (or add them as exclusions)."
else
echo "All OK, no file health regressions found."
fi
exit $regressions;

55
.pre-commit-config.yaml

@ -0,0 +1,55 @@
repos:
- repo: local
hooks:
- id: check-translation-tag
name: Check newline characters in <translation> tag
entry: .github/workflows/check_translation_tag.py
language: script
types_or:
- ts
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.0.1
hooks:
- id: check-json
name: Check JSON files
- id: check-yaml
name: Check YAML files
- id: fix-byte-order-marker
name: Check file encoding (UTF-8 without BOM)
exclude: |
(?x)^(
src/base/unicodestrings.h
)$
- id: mixed-line-ending
name: Check line ending character (LF)
args: ["--fix=lf"]
exclude: |
(?x)^(
compile_commands.json |
src/webui/www/private/scripts/lib/.*
)$
- id: end-of-file-fixer
name: Check trailing newlines
exclude: |
(?x)^(
compile_commands.json |
configure |
src/webui/www/private/scripts/lib/.*
)$
exclude_types:
- svg
- ts
- id: trailing-whitespace
name: Check trailing whitespaces
exclude: |
(?x)^(
src/webui/www/private/scripts/lib/.*
)$
exclude_types:
- ts

18
src/gui/mainwindow.cpp

@ -415,7 +415,7 @@ MainWindow::MainWindow(QWidget *parent)
hide(); hide();
if (!pref->minimizeToTrayNotified()) if (!pref->minimizeToTrayNotified())
{ {
showNotificationBaloon(tr("qBittorrent is minimized to tray"), tr("This behavior can be changed in the settings. You won't be reminded again.")); showNotificationBalloon(tr("qBittorrent is minimized to tray"), tr("This behavior can be changed in the settings. You won't be reminded again."));
pref->setMinimizeToTrayNotified(true); pref->setMinimizeToTrayNotified(true);
} }
} }
@ -857,26 +857,26 @@ void MainWindow::balloonClicked()
void MainWindow::addTorrentFailed(const QString &error) const void MainWindow::addTorrentFailed(const QString &error) const
{ {
showNotificationBaloon(tr("Error"), tr("Failed to add torrent: %1").arg(error)); showNotificationBalloon(tr("Error"), tr("Failed to add torrent: %1").arg(error));
} }
// called when a torrent was added // called when a torrent was added
void MainWindow::torrentNew(BitTorrent::Torrent *const torrent) const void MainWindow::torrentNew(BitTorrent::Torrent *const torrent) const
{ {
if (isTorrentAddedNotificationsEnabled()) if (isTorrentAddedNotificationsEnabled())
showNotificationBaloon(tr("Torrent added"), tr("'%1' was added.", "e.g: xxx.avi was added.").arg(torrent->name())); showNotificationBalloon(tr("Torrent added"), tr("'%1' was added.", "e.g: xxx.avi was added.").arg(torrent->name()));
} }
// called when a torrent has finished // called when a torrent has finished
void MainWindow::finishedTorrent(BitTorrent::Torrent *const torrent) const void MainWindow::finishedTorrent(BitTorrent::Torrent *const torrent) const
{ {
showNotificationBaloon(tr("Download completed"), tr("'%1' has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(torrent->name())); showNotificationBalloon(tr("Download completed"), tr("'%1' has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(torrent->name()));
} }
// Notification when disk is full // Notification when disk is full
void MainWindow::fullDiskError(BitTorrent::Torrent *const torrent, const QString &msg) const void MainWindow::fullDiskError(BitTorrent::Torrent *const torrent, const QString &msg) const
{ {
showNotificationBaloon(tr("I/O Error", "i.e: Input/Output Error") showNotificationBalloon(tr("I/O Error", "i.e: Input/Output Error")
, tr("An I/O error occurred for torrent '%1'.\n Reason: %2" , tr("An I/O error occurred for torrent '%1'.\n Reason: %2"
, "e.g: An error occurred for torrent 'xxx.avi'.\n Reason: disk is full.").arg(torrent->name(), msg)); , "e.g: An error occurred for torrent 'xxx.avi'.\n Reason: disk is full.").arg(torrent->name(), msg));
} }
@ -993,7 +993,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(BitTorrent::Torrent *co
void MainWindow::handleDownloadFromUrlFailure(const QString &url, const QString &reason) const void MainWindow::handleDownloadFromUrlFailure(const QString &url, const QString &reason) const
{ {
// Display a message box // Display a message box
showNotificationBaloon(tr("URL download error") showNotificationBalloon(tr("URL download error")
, tr("Couldn't download file at URL '%1', reason: %2.").arg(url, reason)); , tr("Couldn't download file at URL '%1', reason: %2.").arg(url, reason));
} }
@ -1203,7 +1203,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
QTimer::singleShot(0, this, &QWidget::hide); QTimer::singleShot(0, this, &QWidget::hide);
if (!pref->closeToTrayNotified()) if (!pref->closeToTrayNotified())
{ {
showNotificationBaloon(tr("qBittorrent is closed to tray"), tr("This behavior can be changed in the settings. You won't be reminded again.")); showNotificationBalloon(tr("qBittorrent is closed to tray"), tr("This behavior can be changed in the settings. You won't be reminded again."));
pref->setCloseToTrayNotified(true); pref->setCloseToTrayNotified(true);
} }
return; return;
@ -1303,7 +1303,7 @@ bool MainWindow::event(QEvent *e)
QTimer::singleShot(0, this, &QWidget::hide); QTimer::singleShot(0, this, &QWidget::hide);
if (!pref->minimizeToTrayNotified()) if (!pref->minimizeToTrayNotified())
{ {
showNotificationBaloon(tr("qBittorrent is minimized to tray"), tr("This behavior can be changed in the settings. You won't be reminded again.")); showNotificationBalloon(tr("qBittorrent is minimized to tray"), tr("This behavior can be changed in the settings. You won't be reminded again."));
pref->setMinimizeToTrayNotified(true); pref->setMinimizeToTrayNotified(true);
} }
return true; return true;
@ -1666,7 +1666,7 @@ void MainWindow::reloadTorrentStats(const QVector<BitTorrent::Torrent *> &torren
} }
} }
void MainWindow::showNotificationBaloon(const QString &title, const QString &msg) const void MainWindow::showNotificationBalloon(const QString &title, const QString &msg) const
{ {
if (!isNotificationsEnabled()) if (!isNotificationsEnabled())
return; return;

2
src/gui/mainwindow.h

@ -105,7 +105,7 @@ public:
void activate(); void activate();
void cleanup(); void cleanup();
void showNotificationBaloon(const QString &title, const QString &msg) const; void showNotificationBalloon(const QString &title, const QString &msg) const;
private slots: private slots:
void showFilterContextMenu(const QPoint &); void showFilterContextMenu(const QPoint &);

34
src/gui/optionsdialog.cpp

@ -421,8 +421,8 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(m_ui->checkLimitTransportOverhead, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkLimitTransportOverhead, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkLimitLocalPeerRate, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkLimitLocalPeerRate, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
// Bittorrent tab // Bittorrent tab
connect(m_ui->checkMaxConnecs, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkMaxConnections, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxConnecsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkMaxConnectionsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxUploads, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkMaxUploads, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkMaxUploadsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkMaxUploadsPerTorrent, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->spinMaxConnec, qSpinBoxValueChanged, this, &ThisType::enableApplyButton); connect(m_ui->spinMaxConnec, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
@ -446,7 +446,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
connect(m_ui->comboProxyType, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton); connect(m_ui->comboProxyType, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
connect(m_ui->textProxyIP, &QLineEdit::textChanged, this, &ThisType::enableApplyButton); connect(m_ui->textProxyIP, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
connect(m_ui->spinProxyPort, qSpinBoxValueChanged, this, &ThisType::enableApplyButton); connect(m_ui->spinProxyPort, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
connect(m_ui->checkProxyPeerConnecs, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkProxyPeerConnections, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->isProxyOnlyForTorrents, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->isProxyOnlyForTorrents, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkProxyAuth, &QGroupBox::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkProxyAuth, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->textProxyUsername, &QLineEdit::textChanged, this, &ThisType::enableApplyButton); connect(m_ui->textProxyUsername, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
@ -796,12 +796,12 @@ void OptionsDialog::saveOptions()
proxyConfigManager->setProxyOnlyForTorrents(m_ui->isProxyOnlyForTorrents->isChecked()); proxyConfigManager->setProxyOnlyForTorrents(m_ui->isProxyOnlyForTorrents->isChecked());
proxyConfigManager->setProxyConfiguration(proxyConf); proxyConfigManager->setProxyConfiguration(proxyConf);
session->setProxyPeerConnectionsEnabled(m_ui->checkProxyPeerConnecs->isChecked()); session->setProxyPeerConnectionsEnabled(m_ui->checkProxyPeerConnections->isChecked());
// End Connection preferences // End Connection preferences
// Bittorrent preferences // Bittorrent preferences
session->setMaxConnections(getMaxConnecs()); session->setMaxConnections(getMaxConnections());
session->setMaxConnectionsPerTorrent(getMaxConnecsPerTorrent()); session->setMaxConnectionsPerTorrent(getMaxConnectionsPerTorrent());
session->setMaxUploads(getMaxUploads()); session->setMaxUploads(getMaxUploads());
session->setMaxUploadsPerTorrent(getMaxUploadsPerTorrent()); session->setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
session->setDHTEnabled(isDHTEnabled()); session->setDHTEnabled(isDHTEnabled());
@ -1076,28 +1076,28 @@ void OptionsDialog::loadOptions()
if (intValue > 0) if (intValue > 0)
{ {
// enable // enable
m_ui->checkMaxConnecs->setChecked(true); m_ui->checkMaxConnections->setChecked(true);
m_ui->spinMaxConnec->setEnabled(true); m_ui->spinMaxConnec->setEnabled(true);
m_ui->spinMaxConnec->setValue(intValue); m_ui->spinMaxConnec->setValue(intValue);
} }
else else
{ {
// disable // disable
m_ui->checkMaxConnecs->setChecked(false); m_ui->checkMaxConnections->setChecked(false);
m_ui->spinMaxConnec->setEnabled(false); m_ui->spinMaxConnec->setEnabled(false);
} }
intValue = session->maxConnectionsPerTorrent(); intValue = session->maxConnectionsPerTorrent();
if (intValue > 0) if (intValue > 0)
{ {
// enable // enable
m_ui->checkMaxConnecsPerTorrent->setChecked(true); m_ui->checkMaxConnectionsPerTorrent->setChecked(true);
m_ui->spinMaxConnecPerTorrent->setEnabled(true); m_ui->spinMaxConnecPerTorrent->setEnabled(true);
m_ui->spinMaxConnecPerTorrent->setValue(intValue); m_ui->spinMaxConnecPerTorrent->setValue(intValue);
} }
else else
{ {
// disable // disable
m_ui->checkMaxConnecsPerTorrent->setChecked(false); m_ui->checkMaxConnectionsPerTorrent->setChecked(false);
m_ui->spinMaxConnecPerTorrent->setEnabled(false); m_ui->spinMaxConnecPerTorrent->setEnabled(false);
} }
intValue = session->maxUploads(); intValue = session->maxUploads();
@ -1162,7 +1162,7 @@ void OptionsDialog::loadOptions()
m_ui->textProxyUsername->setText(proxyConf.username); m_ui->textProxyUsername->setText(proxyConf.username);
m_ui->textProxyPassword->setText(proxyConf.password); m_ui->textProxyPassword->setText(proxyConf.password);
m_ui->checkProxyPeerConnecs->setChecked(session->isProxyPeerConnectionsEnabled()); m_ui->checkProxyPeerConnections->setChecked(session->isProxyPeerConnectionsEnabled());
m_ui->isProxyOnlyForTorrents->setChecked(proxyConfigManager->isProxyOnlyForTorrents()); m_ui->isProxyOnlyForTorrents->setChecked(proxyConfigManager->isProxyOnlyForTorrents());
enableProxy(m_ui->comboProxyType->currentIndex()); enableProxy(m_ui->comboProxyType->currentIndex());
@ -1382,17 +1382,17 @@ int OptionsDialog::getMaxSeedingMinutes() const
} }
// Return max connections number // Return max connections number
int OptionsDialog::getMaxConnecs() const int OptionsDialog::getMaxConnections() const
{ {
if (!m_ui->checkMaxConnecs->isChecked()) if (!m_ui->checkMaxConnections->isChecked())
return -1; return -1;
return m_ui->spinMaxConnec->value(); return m_ui->spinMaxConnec->value();
} }
int OptionsDialog::getMaxConnecsPerTorrent() const int OptionsDialog::getMaxConnectionsPerTorrent() const
{ {
if (!m_ui->checkMaxConnecsPerTorrent->isChecked()) if (!m_ui->checkMaxConnectionsPerTorrent->isChecked())
return -1; return -1;
return m_ui->spinMaxConnecPerTorrent->value(); return m_ui->spinMaxConnecPerTorrent->value();
@ -1498,7 +1498,7 @@ void OptionsDialog::enableProxy(const int index)
m_ui->textProxyIP->setEnabled(true); m_ui->textProxyIP->setEnabled(true);
m_ui->lblProxyPort->setEnabled(true); m_ui->lblProxyPort->setEnabled(true);
m_ui->spinProxyPort->setEnabled(true); m_ui->spinProxyPort->setEnabled(true);
m_ui->checkProxyPeerConnecs->setEnabled(true); m_ui->checkProxyPeerConnections->setEnabled(true);
if (index >= 2) if (index >= 2)
{ // SOCKS5 or HTTP { // SOCKS5 or HTTP
m_ui->checkProxyAuth->setEnabled(true); m_ui->checkProxyAuth->setEnabled(true);
@ -1518,7 +1518,7 @@ void OptionsDialog::enableProxy(const int index)
m_ui->textProxyIP->setEnabled(false); m_ui->textProxyIP->setEnabled(false);
m_ui->lblProxyPort->setEnabled(false); m_ui->lblProxyPort->setEnabled(false);
m_ui->spinProxyPort->setEnabled(false); m_ui->spinProxyPort->setEnabled(false);
m_ui->checkProxyPeerConnecs->setEnabled(false); m_ui->checkProxyPeerConnections->setEnabled(false);
m_ui->isProxyOnlyForTorrents->setEnabled(false); m_ui->isProxyOnlyForTorrents->setEnabled(false);
m_ui->checkProxyAuth->setEnabled(false); m_ui->checkProxyAuth->setEnabled(false);
} }

4
src/gui/optionsdialog.h

@ -144,8 +144,8 @@ private:
int getPort() const; int getPort() const;
bool isUPnPEnabled() const; bool isUPnPEnabled() const;
// Bittorrent options // Bittorrent options
int getMaxConnecs() const; int getMaxConnections() const;
int getMaxConnecsPerTorrent() const; int getMaxConnectionsPerTorrent() const;
int getMaxUploads() const; int getMaxUploads() const;
int getMaxUploadsPerTorrent() const; int getMaxUploadsPerTorrent() const;
bool isDHTEnabled() const; bool isDHTEnabled() const;

16
src/gui/optionsdialog.ui

@ -1525,7 +1525,7 @@ Manual: Various torrent properties (e.g. save path) must be assigned manually</s
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QCheckBox" name="checkMaxConnecsPerTorrent"> <widget class="QCheckBox" name="checkMaxConnectionsPerTorrent">
<property name="text"> <property name="text">
<string>Maximum number of connections per torrent:</string> <string>Maximum number of connections per torrent:</string>
</property> </property>
@ -1535,7 +1535,7 @@ Manual: Various torrent properties (e.g. save path) must be assigned manually</s
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QCheckBox" name="checkMaxConnecs"> <widget class="QCheckBox" name="checkMaxConnections">
<property name="text"> <property name="text">
<string>Global maximum number of connections:</string> <string>Global maximum number of connections:</string>
</property> </property>
@ -1701,7 +1701,7 @@ Manual: Various torrent properties (e.g. save path) must be assigned manually</s
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkProxyPeerConnecs"> <widget class="QCheckBox" name="checkProxyPeerConnections">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -3502,9 +3502,9 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
<tabstop>lineEditAutoRun</tabstop> <tabstop>lineEditAutoRun</tabstop>
<tabstop>scrollArea_3</tabstop> <tabstop>scrollArea_3</tabstop>
<tabstop>randomButton</tabstop> <tabstop>randomButton</tabstop>
<tabstop>checkMaxConnecs</tabstop> <tabstop>checkMaxConnections</tabstop>
<tabstop>spinMaxConnec</tabstop> <tabstop>spinMaxConnec</tabstop>
<tabstop>checkMaxConnecsPerTorrent</tabstop> <tabstop>checkMaxConnectionsPerTorrent</tabstop>
<tabstop>spinMaxConnecPerTorrent</tabstop> <tabstop>spinMaxConnecPerTorrent</tabstop>
<tabstop>checkMaxUploadsPerTorrent</tabstop> <tabstop>checkMaxUploadsPerTorrent</tabstop>
<tabstop>spinMaxUploadsPerTorrent</tabstop> <tabstop>spinMaxUploadsPerTorrent</tabstop>
@ -3513,7 +3513,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
<tabstop>comboProxyType</tabstop> <tabstop>comboProxyType</tabstop>
<tabstop>textProxyIP</tabstop> <tabstop>textProxyIP</tabstop>
<tabstop>spinProxyPort</tabstop> <tabstop>spinProxyPort</tabstop>
<tabstop>checkProxyPeerConnecs</tabstop> <tabstop>checkProxyPeerConnections</tabstop>
<tabstop>isProxyOnlyForTorrents</tabstop> <tabstop>isProxyOnlyForTorrents</tabstop>
<tabstop>checkProxyAuth</tabstop> <tabstop>checkProxyAuth</tabstop>
<tabstop>textProxyUsername</tabstop> <tabstop>textProxyUsername</tabstop>
@ -3558,7 +3558,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
<sender>checkMaxConnecs</sender> <sender>checkMaxConnections</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>spinMaxConnec</receiver> <receiver>spinMaxConnec</receiver>
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
@ -3574,7 +3574,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>checkMaxConnecsPerTorrent</sender> <sender>checkMaxConnectionsPerTorrent</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>spinMaxConnecPerTorrent</receiver> <receiver>spinMaxConnecPerTorrent</receiver>
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>

6
src/gui/search/searchwidget.cpp

@ -304,7 +304,7 @@ void SearchWidget::on_searchButton_clicked()
{ {
if (!Utils::ForeignApps::pythonInfo().isValid()) if (!Utils::ForeignApps::pythonInfo().isValid())
{ {
m_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Please install Python to use the Search Engine.")); m_mainWindow->showNotificationBalloon(tr("Search Engine"), tr("Please install Python to use the Search Engine."));
return; return;
} }
@ -373,9 +373,9 @@ void SearchWidget::tabStatusChanged(QWidget *tab)
if (m_mainWindow->isNotificationsEnabled() && (m_mainWindow->currentTabWidget() != this)) if (m_mainWindow->isNotificationsEnabled() && (m_mainWindow->currentTabWidget() != this))
{ {
if (m_activeSearchTab->status() == SearchJobWidget::Status::Error) if (m_activeSearchTab->status() == SearchJobWidget::Status::Error)
m_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has failed")); m_mainWindow->showNotificationBalloon(tr("Search Engine"), tr("Search has failed"));
else else
m_mainWindow->showNotificationBaloon(tr("Search Engine"), tr("Search has finished")); m_mainWindow->showNotificationBalloon(tr("Search Engine"), tr("Search has finished"));
} }
m_activeSearchTab = nullptr; m_activeSearchTab = nullptr;

10
src/webui/www/private/views/preferences.html

@ -400,8 +400,8 @@
<fieldset class="settings"> <fieldset class="settings">
<legend> <legend>
<input type="checkbox" id="limit_sheduling_checkbox" onclick="qBittorrent.Preferences.updateSchedulingEnabled();" /> <input type="checkbox" id="limitSchedulingCheckbox" onclick="qBittorrent.Preferences.updateSchedulingEnabled();" />
<label for="limit_sheduling_checkbox">QBT_TR(Schedule the use of alternative rate limits)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="limitSchedulingCheckbox">QBT_TR(Schedule the use of alternative rate limits)QBT_TR[CONTEXT=OptionsDialog]</label>
</legend> </legend>
<div class="formRow"> <div class="formRow">
QBT_TR(From:)QBT_TR[CONTEXT=OptionsDialog] QBT_TR(From:)QBT_TR[CONTEXT=OptionsDialog]
@ -1457,7 +1457,7 @@
// Speed tab // Speed tab
const updateSchedulingEnabled = function() { const updateSchedulingEnabled = function() {
const isLimitSchedulingEnabled = $('limit_sheduling_checkbox').getProperty('checked'); const isLimitSchedulingEnabled = $('limitSchedulingCheckbox').getProperty('checked');
$('schedule_from_hour').setProperty('disabled', !isLimitSchedulingEnabled); $('schedule_from_hour').setProperty('disabled', !isLimitSchedulingEnabled);
$('schedule_from_min').setProperty('disabled', !isLimitSchedulingEnabled); $('schedule_from_min').setProperty('disabled', !isLimitSchedulingEnabled);
$('schedule_to_hour').setProperty('disabled', !isLimitSchedulingEnabled); $('schedule_to_hour').setProperty('disabled', !isLimitSchedulingEnabled);
@ -1797,7 +1797,7 @@
$('limit_lan_peers_checkbox').setProperty('checked', pref.limit_lan_peers); $('limit_lan_peers_checkbox').setProperty('checked', pref.limit_lan_peers);
// Scheduling // Scheduling
$('limit_sheduling_checkbox').setProperty('checked', pref.scheduler_enabled); $('limitSchedulingCheckbox').setProperty('checked', pref.scheduler_enabled);
$('schedule_from_hour').setProperty('value', time_padding(pref.schedule_from_hour)); $('schedule_from_hour').setProperty('value', time_padding(pref.schedule_from_hour));
$('schedule_from_min').setProperty('value', time_padding(pref.schedule_from_min)); $('schedule_from_min').setProperty('value', time_padding(pref.schedule_from_min));
$('schedule_to_hour').setProperty('value', time_padding(pref.schedule_to_hour)); $('schedule_to_hour').setProperty('value', time_padding(pref.schedule_to_hour));
@ -2142,7 +2142,7 @@
settings.set('limit_lan_peers', $('limit_lan_peers_checkbox').getProperty('checked')); settings.set('limit_lan_peers', $('limit_lan_peers_checkbox').getProperty('checked'));
// Scheduler // Scheduler
const scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked'); const scheduling_enabled = $('limitSchedulingCheckbox').getProperty('checked');
settings.set('scheduler_enabled', scheduling_enabled); settings.set('scheduler_enabled', scheduling_enabled);
if (scheduling_enabled) { if (scheduling_enabled) {
settings.set('schedule_from_hour', $('schedule_from_hour').getProperty('value').toInt()); settings.set('schedule_from_hour', $('schedule_from_hour').getProperty('value').toInt());

Loading…
Cancel
Save