Browse Source

Use isEmpty() instead of size() for emptiness

adaptive-webui-19844
thalieht 6 years ago
parent
commit
400792d18e
  1. 2
      src/gui/cookiesmodel.cpp
  2. 2
      src/gui/previewselectdialog.cpp
  3. 2
      src/gui/rss/rsswidget.cpp
  4. 2
      src/gui/tagfiltermodel.cpp
  5. 4
      src/gui/transferlistfilterswidget.cpp
  6. 2
      src/gui/transferlistwidget.cpp

2
src/gui/cookiesmodel.cpp

@ -157,7 +157,7 @@ bool CookiesModel::insertRows(int row, int count, const QModelIndex &parent) @@ -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;

2
src/gui/previewselectdialog.cpp

@ -124,7 +124,7 @@ PreviewSelectDialog::~PreviewSelectDialog() @@ -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();

2
src/gui/rss/rsswidget.cpp

@ -150,7 +150,7 @@ void RSSWidget::displayRSSListMenu(const QPoint &pos) @@ -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();

2
src/gui/tagfiltermodel.cpp

@ -326,7 +326,7 @@ QVector<TagModelItem *> TagFilterModel::findItems(const QSet<QString> &tags) @@ -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];
}

4
src/gui/transferlistfilterswidget.cpp

@ -485,7 +485,7 @@ void TrackerFiltersList::handleNewTorrent(BitTorrent::TorrentHandle *const torre @@ -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 @@ -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));

2
src/gui/transferlistwidget.cpp

@ -878,7 +878,7 @@ void TransferListWidget::clearSelectionTags() @@ -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);

Loading…
Cancel
Save