mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06:00
Improve coding style
This commit is contained in:
@@ -64,18 +64,21 @@ BanListOptionsDialog::~BanListOptionsDialog()
|
||||
|
||||
void BanListOptionsDialog::on_buttonBox_accepted()
|
||||
{
|
||||
if (m_modified) {
|
||||
if (m_modified)
|
||||
{
|
||||
// save to session
|
||||
QStringList IPList;
|
||||
// Operate on the m_sortFilter to grab the strings in sorted order
|
||||
for (int i = 0; i < m_sortFilter->rowCount(); ++i) {
|
||||
for (int i = 0; i < m_sortFilter->rowCount(); ++i)
|
||||
{
|
||||
QModelIndex index = m_sortFilter->index(i, 0);
|
||||
IPList << index.data().toString();
|
||||
}
|
||||
BitTorrent::Session::instance()->setBannedIPs(IPList);
|
||||
QDialog::accept();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
QDialog::reject();
|
||||
}
|
||||
}
|
||||
@@ -83,7 +86,8 @@ void BanListOptionsDialog::on_buttonBox_accepted()
|
||||
void BanListOptionsDialog::on_buttonBanIP_clicked()
|
||||
{
|
||||
QString ip = m_ui->txtIP->text();
|
||||
if (!Utils::Net::isValidIP(ip)) {
|
||||
if (!Utils::Net::isValidIP(ip))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The entered IP address is invalid."));
|
||||
return;
|
||||
}
|
||||
@@ -91,9 +95,11 @@ void BanListOptionsDialog::on_buttonBanIP_clicked()
|
||||
// QHostAddress::toString() result format follows RFC5952;
|
||||
// thus we avoid duplicate entries pointing to the same address
|
||||
ip = QHostAddress(ip).toString();
|
||||
for (int i = 0; i < m_sortFilter->rowCount(); ++i) {
|
||||
for (int i = 0; i < m_sortFilter->rowCount(); ++i)
|
||||
{
|
||||
QModelIndex index = m_sortFilter->index(i, 0);
|
||||
if (ip == index.data().toString()) {
|
||||
if (ip == index.data().toString())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The entered IP is already banned."));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user