mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 11:24:15 +00:00
Use range-based for loops
This commit is contained in:
parent
10e1c35998
commit
e92209475e
@ -1174,10 +1174,8 @@ QBitArray TorrentHandle::downloadingPieces() const
|
|||||||
std::vector<lt::partial_piece_info> queue;
|
std::vector<lt::partial_piece_info> queue;
|
||||||
m_nativeHandle.get_download_queue(queue);
|
m_nativeHandle.get_download_queue(queue);
|
||||||
|
|
||||||
std::vector<lt::partial_piece_info>::const_iterator it = queue.begin();
|
for (const lt::partial_piece_info &info : queue)
|
||||||
std::vector<lt::partial_piece_info>::const_iterator itend = queue.end();
|
result.setBit(info.piece_index);
|
||||||
for (; it != itend; ++it)
|
|
||||||
result.setBit(it->piece_index);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ void ScanFoldersModel::configure()
|
|||||||
{
|
{
|
||||||
const QVariantHash dirs = Preferences::instance()->getScanDirs();
|
const QVariantHash dirs = Preferences::instance()->getScanDirs();
|
||||||
|
|
||||||
for (QVariantHash::const_iterator i = dirs.begin(), e = dirs.end(); i != e; ++i) {
|
for (auto i = dirs.cbegin(); i != dirs.cend(); ++i) {
|
||||||
if (i.value().type() == QVariant::Int)
|
if (i.value().type() == QVariant::Int)
|
||||||
addPath(i.key(), static_cast<PathType>(i.value().toInt()), QString());
|
addPath(i.key(), static_cast<PathType>(i.value().toInt()), QString());
|
||||||
else
|
else
|
||||||
|
@ -69,9 +69,8 @@ void TorrentContentTreeView::keyPressEvent(QKeyEvent *event)
|
|||||||
|
|
||||||
const QModelIndexList selection = selectionModel()->selectedRows(TorrentContentModelItem::COL_NAME);
|
const QModelIndexList selection = selectionModel()->selectedRows(TorrentContentModelItem::COL_NAME);
|
||||||
|
|
||||||
for (QModelIndexList::const_iterator i = selection.begin(); i != selection.end(); ++i) {
|
for (const QModelIndex &index : selection) {
|
||||||
QModelIndex index = *i;
|
Q_ASSERT(index.column() == TorrentContentModelItem::COL_NAME);
|
||||||
Q_ASSERT(i->column() == TorrentContentModelItem::COL_NAME);
|
|
||||||
model()->setData(index, state, Qt::CheckStateRole);
|
model()->setData(index, state, Qt::CheckStateRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ void AppController::preferencesAction()
|
|||||||
// Automatically add torrents from
|
// Automatically add torrents from
|
||||||
const QVariantHash dirs = pref->getScanDirs();
|
const QVariantHash dirs = pref->getScanDirs();
|
||||||
QVariantMap nativeDirs;
|
QVariantMap nativeDirs;
|
||||||
for (QVariantHash::const_iterator i = dirs.cbegin(), e = dirs.cend(); i != e; ++i) {
|
for (auto i = dirs.cbegin(); i != dirs.cend(); ++i) {
|
||||||
if (i.value().type() == QVariant::Int)
|
if (i.value().type() == QVariant::Int)
|
||||||
nativeDirs.insert(Utils::Fs::toNativePath(i.key()), i.value().toInt());
|
nativeDirs.insert(Utils::Fs::toNativePath(i.key()), i.value().toInt());
|
||||||
else
|
else
|
||||||
@ -299,7 +299,7 @@ void AppController::setPreferencesAction()
|
|||||||
QVariantHash oldScanDirs = pref->getScanDirs();
|
QVariantHash oldScanDirs = pref->getScanDirs();
|
||||||
QVariantHash scanDirs;
|
QVariantHash scanDirs;
|
||||||
ScanFoldersModel *model = ScanFoldersModel::instance();
|
ScanFoldersModel *model = ScanFoldersModel::instance();
|
||||||
for (QVariantMap::const_iterator i = nativeDirs.cbegin(), e = nativeDirs.cend(); i != e; ++i) {
|
for (auto i = nativeDirs.cbegin(); i != nativeDirs.cend(); ++i) {
|
||||||
QString folder = Utils::Fs::fromNativePath(i.key());
|
QString folder = Utils::Fs::fromNativePath(i.key());
|
||||||
int downloadType;
|
int downloadType;
|
||||||
QString downloadPath;
|
QString downloadPath;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user