Convert all foreach() to range-based for()

This commit is contained in:
thalieht 2018-11-18 20:40:37 +02:00
parent d668a4fe6d
commit 6b1d26d555
64 changed files with 326 additions and 292 deletions

View file

@ -30,6 +30,7 @@
#include <QJsonArray>
#include "base/global.h"
#include "base/logger.h"
#include "base/utils/string.h"
@ -71,7 +72,7 @@ void LogController::mainAction()
Logger *const logger = Logger::instance();
QVariantList msgList;
foreach (const Log::Msg &msg, logger->getMessages(lastKnownId)) {
for (const Log::Msg &msg : copyAsConst(logger->getMessages(lastKnownId))) {
if (!((msg.type == Log::NORMAL && isNormal)
|| (msg.type == Log::INFO && isInfo)
|| (msg.type == Log::WARNING && isWarning)
@ -110,7 +111,7 @@ void LogController::peersAction()
Logger *const logger = Logger::instance();
QVariantList peerList;
foreach (const Log::Peer &peer, logger->getPeers(lastKnownId)) {
for (const Log::Peer &peer : copyAsConst(logger->getPeers(lastKnownId))) {
QVariantMap map;
map[KEY_LOG_ID] = peer.id;
map[KEY_LOG_TIMESTAMP] = peer.timestamp;