Add missing const
This commit is contained in:
@@ -86,10 +86,10 @@ void RadioParadiseService::GetChannelsReply(QNetworkReply *reply, const int task
|
||||
emit NewChannels();
|
||||
return;
|
||||
}
|
||||
QJsonArray array_channels = object[QLatin1String("channels")].toArray();
|
||||
const QJsonArray array_channels = object[QLatin1String("channels")].toArray();
|
||||
|
||||
RadioChannelList channels;
|
||||
for (const QJsonValueRef value_channel : array_channels) {
|
||||
for (const QJsonValue &value_channel : array_channels) {
|
||||
if (!value_channel.isObject()) continue;
|
||||
QJsonObject obj_channel = value_channel.toObject();
|
||||
if (!obj_channel.contains(QLatin1String("chan_name")) || !obj_channel.contains(QLatin1String("streams"))) {
|
||||
@@ -100,8 +100,8 @@ void RadioParadiseService::GetChannelsReply(QNetworkReply *reply, const int task
|
||||
if (!value_streams.isArray()) {
|
||||
continue;
|
||||
}
|
||||
QJsonArray array_streams = obj_channel[QLatin1String("streams")].toArray();
|
||||
for (const QJsonValueRef value_stream : array_streams) {
|
||||
const QJsonArray array_streams = obj_channel[QLatin1String("streams")].toArray();
|
||||
for (const QJsonValue &value_stream : array_streams) {
|
||||
if (!value_stream.isObject()) continue;
|
||||
QJsonObject obj_stream = value_stream.toObject();
|
||||
if (!obj_stream.contains(QLatin1String("label")) || !obj_stream.contains(QLatin1String("url"))) {
|
||||
|
||||
@@ -96,7 +96,7 @@ RadioService *RadioServices::ServiceBySource(const Song::Source source) const {
|
||||
|
||||
void RadioServices::ReloadSettings() {
|
||||
|
||||
QList<RadioService*> services = services_.values();
|
||||
const QList<RadioService*> services = services_.values();
|
||||
for (RadioService *service : services) {
|
||||
service->ReloadSettings();
|
||||
}
|
||||
@@ -116,7 +116,7 @@ void RadioServices::RefreshChannels() {
|
||||
model_->Reset();
|
||||
backend_->DeleteChannelsAsync();
|
||||
|
||||
QList<RadioService*> services = services_.values();
|
||||
const QList<RadioService*> services = services_.values();
|
||||
for (RadioService *service : services) {
|
||||
service->GetChannels();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMimeData>
|
||||
#include <QDesktopServices>
|
||||
@@ -154,7 +156,7 @@ void RadioView::Homepage() {
|
||||
}
|
||||
}
|
||||
|
||||
for (const QUrl &url : urls) {
|
||||
for (const QUrl &url : std::as_const(urls)) {
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
@@ -173,7 +175,7 @@ void RadioView::Donate() {
|
||||
}
|
||||
}
|
||||
|
||||
for (const QUrl &url : urls) {
|
||||
for (const QUrl &url : std::as_const(urls)) {
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
@@ -92,10 +94,10 @@ void SomaFMService::GetChannelsReply(QNetworkReply *reply, const int task_id) {
|
||||
emit NewChannels();
|
||||
return;
|
||||
}
|
||||
QJsonArray array_channels = object[QLatin1String("channels")].toArray();
|
||||
const QJsonArray array_channels = object[QLatin1String("channels")].toArray();
|
||||
|
||||
RadioChannelList channels;
|
||||
for (const QJsonValueRef value_channel : array_channels) {
|
||||
for (const QJsonValue &value_channel : array_channels) {
|
||||
if (!value_channel.isObject()) continue;
|
||||
QJsonObject obj_channel = value_channel.toObject();
|
||||
if (!obj_channel.contains(QLatin1String("title")) || !obj_channel.contains(QLatin1String("image"))) {
|
||||
@@ -103,8 +105,8 @@ void SomaFMService::GetChannelsReply(QNetworkReply *reply, const int task_id) {
|
||||
}
|
||||
QString name = obj_channel[QLatin1String("title")].toString();
|
||||
QString image = obj_channel[QLatin1String("image")].toString();
|
||||
QJsonArray playlists = obj_channel[QLatin1String("playlists")].toArray();
|
||||
for (const QJsonValueRef playlist : playlists) {
|
||||
const QJsonArray playlists = obj_channel[QLatin1String("playlists")].toArray();
|
||||
for (const QJsonValue &playlist : playlists) {
|
||||
if (!playlist.isObject()) continue;
|
||||
QJsonObject obj_playlist = playlist.toObject();
|
||||
if (!obj_playlist.contains(QLatin1String("url")) || !obj_playlist.contains(QLatin1String("quality"))) {
|
||||
@@ -129,7 +131,7 @@ void SomaFMService::GetChannelsReply(QNetworkReply *reply, const int task_id) {
|
||||
emit NewChannels();
|
||||
}
|
||||
else {
|
||||
for (const RadioChannel &channel : channels) {
|
||||
for (const RadioChannel &channel : std::as_const(channels)) {
|
||||
GetStreamUrl(task_id, channel);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user