Commit 68e50387 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Port away from Qt's foreach

GIT_SILENT
parent 1345312e
......@@ -42,7 +42,8 @@ add_definitions(
-DQT_NO_CAST_FROM_ASCII
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
-DQT_NO_SIGNALS_SLOTS_KEYWORDS
-DQT_NO_KEYWORDS
-DQT_NO_FOREACH
-DQT_USE_QSTRINGBUILDER
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
-DQT_STRICT_ITERATORS
......
......@@ -44,8 +44,7 @@ namespace KCDDB
void
Cache::store(const TrackOffsetList& offsetList, const CDInfoList& list, const Config& c)
{
foreach( const CDInfo &info, list )
{
for (const CDInfo &info : list) {
store(offsetList, info, c);
}
}
......@@ -58,11 +57,10 @@ namespace KCDDB
// Some entries from freedb could contain several discids separated
// by a ','. Store for each discid, but replace the discid line
// so it doesn't happen again.
QStringList discids = discid.split(QLatin1Char( ',' ));
const QStringList discids = discid.split(QLatin1Char( ',' ));
if (discids.count() > 2)
{
foreach(const QString &newid, discids)
{
for (const QString &newid : discids) {
CDInfo newInfo = info;
newInfo.set(QLatin1String( "discid" ), newid);
store(offsetList, newInfo, c);
......
......@@ -116,8 +116,7 @@ namespace KCDDB
for (QStringList::const_iterator cddbCacheDir = cddbCacheDirs.constBegin();
cddbCacheDir != cddbCacheDirs.constEnd(); ++cddbCacheDir)
{
foreach(const QString &category, categories)
{
for (const QString &category : qAsConst(categories)) {
QFile f( *cddbCacheDir + QLatin1Char( '/' ) + category + QLatin1Char( '/' ) + trackOffsetListToId(offsetList) );
if ( f.exists() && f.open(QIODevice::ReadOnly) )
{
......
......@@ -84,12 +84,11 @@ AsyncCDDBLookupTest::slotFinished(Result r)
m_result = r;
qDebug() << "AsyncCDDBLookupTest::slotResult: Got " << KCDDB::resultToString(r);
CDInfoList l = client_->lookupResponse();
const CDInfoList l = client_->lookupResponse();
qDebug() << "AsyncCDDBLookupTest::slotResult: Item count: " << l.count();
foreach(const CDInfo &i, l)
{
for (const CDInfo &i : l) {
if (i.get(QString::fromUtf8("discid")) == QString::fromUtf8("a1107d0a") && i.get(Category) == QString::fromUtf8("jazz"))
{
qDebug() << "Found the CD";
......
......@@ -85,12 +85,11 @@ AsyncHTTPLookupTest::slotFinished(Result r)
m_result = r;
qDebug() << "AsyncHTTPLookupTest::slotFinished: Got " << KCDDB::resultToString(r);
CDInfoList l = client_->lookupResponse();
const CDInfoList l = client_->lookupResponse();
qDebug() << "AsyncHTTPLookupTest::slotFinished: Item count: " << l.count();
foreach(const CDInfo &i, l)
{
for(const CDInfo &i : l) {
if (i.get(QString::fromUtf8("discid")) == QVariant(QString::fromUtf8("a1107d0a")) && i.get(Category) == QVariant(QString::fromUtf8("jazz")))
{
qDebug() << "Found the CD";
......
......@@ -52,9 +52,8 @@ bool CacheTest::verify(const QString& source, const QString& discid, const CDInf
{
Cache::store(m_list, info, m_client->config());
CDInfoList results = Cache::lookup(m_list, m_client->config());
foreach(const CDInfo &newInfo, results)
{
const CDInfoList results = Cache::lookup(m_list, m_client->config());
for (const CDInfo &newInfo : results) {
if (newInfo.get(QString::fromUtf8("source")) == source && newInfo.get(QString::fromUtf8("discid")).toString() == discid)
{
if (newInfo.get(Artist) != m_info.get(Artist))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment