Use C++11 uniform initialization

This commit is contained in:
Chocobo1 2019-07-31 20:00:04 +08:00
parent bad588a749
commit 7f300b757f
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
4 changed files with 86 additions and 79 deletions

View file

@ -78,12 +78,13 @@ void LogController::mainAction()
|| (msg.type == Log::WARNING && isWarning)
|| (msg.type == Log::CRITICAL && isCritical)))
continue;
QVariantMap map;
map[KEY_LOG_ID] = msg.id;
map[KEY_LOG_TIMESTAMP] = msg.timestamp;
map[KEY_LOG_MSG_TYPE] = msg.type;
map[KEY_LOG_MSG_MESSAGE] = msg.message;
msgList.append(map);
msgList.append(QVariantMap {
{KEY_LOG_ID, msg.id},
{KEY_LOG_TIMESTAMP, msg.timestamp},
{KEY_LOG_MSG_TYPE, msg.type},
{KEY_LOG_MSG_MESSAGE, msg.message}
});
}
setResult(QJsonArray::fromVariantList(msgList));
@ -112,13 +113,13 @@ void LogController::peersAction()
QVariantList peerList;
for (const Log::Peer &peer : asConst(logger->getPeers(lastKnownId))) {
QVariantMap map;
map[KEY_LOG_ID] = peer.id;
map[KEY_LOG_TIMESTAMP] = peer.timestamp;
map[KEY_LOG_PEER_IP] = peer.ip;
map[KEY_LOG_PEER_BLOCKED] = peer.blocked;
map[KEY_LOG_PEER_REASON] = peer.reason;
peerList.append(map);
peerList.append(QVariantMap {
{KEY_LOG_ID, peer.id},
{KEY_LOG_TIMESTAMP, peer.timestamp},
{KEY_LOG_PEER_IP, peer.ip},
{KEY_LOG_PEER_BLOCKED, peer.blocked},
{KEY_LOG_PEER_REASON, peer.reason}
});
}
setResult(QJsonArray::fromVariantList(peerList));