Use C++11 for syntax

This commit is contained in:
Luca Beltrame 2013-12-24 10:25:43 +01:00
parent 244b930185
commit 92af974894
2 changed files with 7 additions and 6 deletions

View file

@ -325,7 +325,7 @@ namespace Danbooru {
m_currentPosts = postList.length(); m_currentPosts = postList.length();
Q_FOREACH(const QVariant& element, postList) { for (auto element: postList) {
QVariantMap map = element.toMap(); QVariantMap map = element.toMap();
@ -405,6 +405,7 @@ namespace Danbooru {
SLOT(downloadThumbnail(KJob*))); SLOT(downloadThumbnail(KJob*)));
} }
} }
} }
@ -437,7 +438,7 @@ namespace Danbooru {
return; return;
} }
Q_FOREACH(const QVariant& element, tagList) { for (auto element: tagList) {
QVariantMap map = element.toMap(); QVariantMap map = element.toMap();
DanbooruTag* tag = new DanbooruTag(map); DanbooruTag* tag = new DanbooruTag(map);
Q_EMIT(tagDownloaded(tag)); Q_EMIT(tagDownloaded(tag));
@ -485,7 +486,7 @@ namespace Danbooru {
continue; continue;
} }
Q_FOREACH(const QVariant& tag, tags) { for (auto tag: tags) {
// We get the first element in the list, the second is // We get the first element in the list, the second is
// the ID which is useless (no API methods in Danbooru) // the ID which is useless (no API methods in Danbooru)
QString tagName = tag.toList()[0].toString(); QString tagName = tag.toList()[0].toString();
@ -522,7 +523,7 @@ namespace Danbooru {
return; return;
} }
Q_FOREACH(const QVariant& element, poolList) { for (auto element: poolList) {
QVariantMap map = element.toMap(); QVariantMap map = element.toMap();
DanbooruPool* pool = new DanbooruPool(map); DanbooruPool* pool = new DanbooruPool(map);

View file

@ -25,7 +25,7 @@
// Qt // Qt
#include <qjson/parser.h> #include <qjson/parser.h>
#include <QtXml/QXmlStreamReader> #include <QXmlStreamReader>
// KDE // KDE
@ -137,7 +137,7 @@ namespace Danbooru {
// qDebug() << attributes; // qDebug() << attributes;
Q_FOREACH(const QXmlStreamAttribute& attribute, attributes) { for (auto attribute: attributes) {
values.insert(attribute.name().toString(), values.insert(attribute.name().toString(),
attribute.value().toString()); attribute.value().toString());
} }