1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-28 15:34:16 +00:00

Use isEmpty() instead of size() for emptiness

This commit is contained in:
thalieht 2019-02-13 17:51:07 +02:00
parent d8cbc9266a
commit 400792d18e
6 changed files with 7 additions and 7 deletions

View File

@ -157,7 +157,7 @@ bool CookiesModel::insertRows(int row, int count, const QModelIndex &parent)
bool CookiesModel::removeRows(int row, int count, const QModelIndex &parent)
{
if ((m_cookies.size() == 0)
if ((m_cookies.isEmpty())
|| (row >= m_cookies.size())
|| ((row + count) > m_cookies.size()))
return false;

View File

@ -124,7 +124,7 @@ PreviewSelectDialog::~PreviewSelectDialog()
void PreviewSelectDialog::previewButtonClicked()
{
QModelIndexList selectedIndexes = previewList->selectionModel()->selectedRows(FILE_INDEX);
if (selectedIndexes.size() == 0) return;
if (selectedIndexes.isEmpty()) return;
// Flush data
m_torrent->flushCache();

View File

@ -150,7 +150,7 @@ void RSSWidget::displayRSSListMenu(const QPoint &pos)
m_feedListWidget->clearSelection();
QMenu myRSSListMenu(this);
QList<QTreeWidgetItem *> selectedItems = m_feedListWidget->selectedItems();
if (selectedItems.size() > 0) {
if (!selectedItems.isEmpty()) {
myRSSListMenu.addAction(m_ui->actionUpdate);
myRSSListMenu.addAction(m_ui->actionMarkItemsRead);
myRSSListMenu.addSeparator();

View File

@ -326,7 +326,7 @@ QVector<TagModelItem *> TagFilterModel::findItems(const QSet<QString> &tags)
TagModelItem *TagFilterModel::allTagsItem()
{
Q_ASSERT(m_tagItems.size() > 0);
Q_ASSERT(!m_tagItems.isEmpty());
return &m_tagItems[0];
}

View File

@ -485,7 +485,7 @@ void TrackerFiltersList::handleNewTorrent(BitTorrent::TorrentHandle *const torre
addItem(tracker.url(), hash);
//Check for trackerless torrent
if (trackers.size() == 0)
if (trackers.isEmpty())
addItem("", hash);
item(0)->setText(tr("All (%1)", "this is for the tracker filter").arg(++m_totalTorrents));
@ -499,7 +499,7 @@ void TrackerFiltersList::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *cons
removeItem(tracker.url(), hash);
//Check for trackerless torrent
if (trackers.size() == 0)
if (trackers.isEmpty())
removeItem("", hash);
item(0)->setText(tr("All (%1)", "this is for the tracker filter").arg(--m_totalTorrents));

View File

@ -878,7 +878,7 @@ void TransferListWidget::clearSelectionTags()
void TransferListWidget::displayListMenu(const QPoint&)
{
const QModelIndexList selectedIndexes = selectionModel()->selectedRows();
if (selectedIndexes.size() == 0) return;
if (selectedIndexes.isEmpty()) return;
// Create actions
QAction actionStart(GuiIconProvider::instance()->getIcon("media-playback-start"), tr("Resume", "Resume/start the torrent"), nullptr);