mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 00:47:21 -06:00
Don't use 'else' after return/break
This commit is contained in:
@@ -758,9 +758,8 @@ void MainWindow::tabChanged(int newTab)
|
||||
m_searchFilterAction->setVisible(true);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
m_searchFilterAction->setVisible(false);
|
||||
}
|
||||
m_searchFilterAction->setVisible(false);
|
||||
|
||||
if (m_tabs->currentWidget() == m_searchWidget) {
|
||||
qDebug("Changed tab to search engine, giving focus to search input");
|
||||
m_searchWidget->giveFocusToSearchInput();
|
||||
|
||||
@@ -1209,32 +1209,32 @@ int OptionsDialog::getMaxConnecs() const
|
||||
{
|
||||
if (!m_ui->checkMaxConnecs->isChecked())
|
||||
return -1;
|
||||
else
|
||||
return m_ui->spinMaxConnec->value();
|
||||
|
||||
return m_ui->spinMaxConnec->value();
|
||||
}
|
||||
|
||||
int OptionsDialog::getMaxConnecsPerTorrent() const
|
||||
{
|
||||
if (!m_ui->checkMaxConnecsPerTorrent->isChecked())
|
||||
return -1;
|
||||
else
|
||||
return m_ui->spinMaxConnecPerTorrent->value();
|
||||
|
||||
return m_ui->spinMaxConnecPerTorrent->value();
|
||||
}
|
||||
|
||||
int OptionsDialog::getMaxUploads() const
|
||||
{
|
||||
if (!m_ui->checkMaxUploads->isChecked())
|
||||
return -1;
|
||||
else
|
||||
return m_ui->spinMaxUploads->value();
|
||||
|
||||
return m_ui->spinMaxUploads->value();
|
||||
}
|
||||
|
||||
int OptionsDialog::getMaxUploadsPerTorrent() const
|
||||
{
|
||||
if (!m_ui->checkMaxUploadsPerTorrent->isChecked())
|
||||
return -1;
|
||||
else
|
||||
return m_ui->spinMaxUploadsPerTorrent->value();
|
||||
|
||||
return m_ui->spinMaxUploadsPerTorrent->value();
|
||||
}
|
||||
|
||||
void OptionsDialog::on_buttonBox_accepted()
|
||||
@@ -1645,7 +1645,7 @@ QString OptionsDialog::languageToLocalizedString(const QLocale &locale)
|
||||
case QLocale::English: {
|
||||
if (locale.country() == QLocale::Australia)
|
||||
return QString::fromUtf8(C_LOCALE_ENGLISH_AUSTRALIA);
|
||||
else if (locale.country() == QLocale::UnitedKingdom)
|
||||
if (locale.country() == QLocale::UnitedKingdom)
|
||||
return QString::fromUtf8(C_LOCALE_ENGLISH_UNITEDKINGDOM);
|
||||
return QString::fromUtf8(C_LOCALE_ENGLISH);
|
||||
}
|
||||
|
||||
@@ -147,9 +147,8 @@ bool PiecesBar::event(QEvent *e)
|
||||
showToolTip(static_cast<QHelpEvent *>(e));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return base::event(e);
|
||||
}
|
||||
|
||||
return base::event(e);
|
||||
}
|
||||
|
||||
void PiecesBar::enterEvent(QEvent *e)
|
||||
|
||||
@@ -96,12 +96,11 @@ bool TorrentContentFilterModel::lessThan(const QModelIndex &left, const QModelIn
|
||||
const QString strR = right.data().toString();
|
||||
return Utils::String::naturalLessThan<Qt::CaseInsensitive>(strL, strR);
|
||||
}
|
||||
else if ((leftType == TorrentContentModelItem::FolderType) && (sortOrder() == Qt::AscendingOrder)) {
|
||||
if ((leftType == TorrentContentModelItem::FolderType) && (sortOrder() == Qt::AscendingOrder)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return QSortFilterProxyModel::lessThan(left, right);
|
||||
@@ -136,8 +135,7 @@ bool TorrentContentFilterModel::hasFiltered(const QModelIndex &folder) const
|
||||
if (m_model->hasChildren(childIndex)) {
|
||||
if (hasFiltered(childIndex))
|
||||
return true;
|
||||
else
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
name = childIndex.data().toString();
|
||||
if (name.contains(filterRegExp()))
|
||||
|
||||
@@ -287,8 +287,8 @@ int TorrentContentModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return static_cast<TorrentContentModelItem*>(parent.internalPointer())->columnCount();
|
||||
else
|
||||
return m_rootItem->columnCount();
|
||||
|
||||
return m_rootItem->columnCount();
|
||||
}
|
||||
|
||||
bool TorrentContentModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
@@ -361,8 +361,8 @@ QVariant TorrentContentModel::data(const QModelIndex &index, int role) const
|
||||
if ((index.column() == TorrentContentModelItem::COL_NAME) && (role == Qt::DecorationRole)) {
|
||||
if (item->itemType() == TorrentContentModelItem::FolderType)
|
||||
return getDirectoryIcon();
|
||||
else
|
||||
return m_fileIconProvider->icon(QFileInfo(item->name()));
|
||||
|
||||
return m_fileIconProvider->icon(QFileInfo(item->name()));
|
||||
}
|
||||
|
||||
if ((index.column() == TorrentContentModelItem::COL_NAME) && (role == Qt::CheckStateRole)) {
|
||||
|
||||
@@ -543,12 +543,12 @@ QStringList TrackerFiltersList::getHashes(int row)
|
||||
{
|
||||
if (row == 1)
|
||||
return m_trackers.value("");
|
||||
else if (row == 2)
|
||||
if (row == 2)
|
||||
return m_errors.keys();
|
||||
else if (row == 3)
|
||||
if (row == 3)
|
||||
return m_warnings.keys();
|
||||
else
|
||||
return m_trackers.value(trackerFromRow(row));
|
||||
|
||||
return m_trackers.value(trackerFromRow(row));
|
||||
}
|
||||
|
||||
TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferListWidget *transferList)
|
||||
|
||||
@@ -160,8 +160,8 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
|
||||
const bool isAscendingOrder = (sortOrder() == Qt::AscendingOrder);
|
||||
if (isSeedingL)
|
||||
return !isAscendingOrder;
|
||||
else
|
||||
return isAscendingOrder;
|
||||
|
||||
return isAscendingOrder;
|
||||
}
|
||||
|
||||
const qlonglong etaL = left.data().toLongLong();
|
||||
@@ -171,15 +171,14 @@ bool TransferListSortModel::lessThan(const QModelIndex &left, const QModelIndex
|
||||
if (isInvalidL && isInvalidR) {
|
||||
if (isSeedingL) // Both seeding
|
||||
return dateLessThan(TransferListModel::TR_SEED_DATE, left, right, true);
|
||||
else
|
||||
return (prioL < prioR);
|
||||
|
||||
return (prioL < prioR);
|
||||
}
|
||||
else if (!isInvalidL && !isInvalidR) {
|
||||
if (!isInvalidL && !isInvalidR) {
|
||||
return (etaL < etaR);
|
||||
}
|
||||
else {
|
||||
return !isInvalidL;
|
||||
}
|
||||
|
||||
return !isInvalidL;
|
||||
}
|
||||
|
||||
case TransferListModel::TR_LAST_ACTIVITY: {
|
||||
@@ -221,8 +220,8 @@ bool TransferListSortModel::lowerPositionThan(const QModelIndex &left, const QMo
|
||||
if ((queueL > 0) || (queueR > 0)) {
|
||||
if ((queueL > 0) && (queueR > 0))
|
||||
return queueL < queueR;
|
||||
else
|
||||
return queueL != 0;
|
||||
|
||||
return queueL != 0;
|
||||
}
|
||||
|
||||
// Sort according to TR_SEED_DATE
|
||||
|
||||
Reference in New Issue
Block a user