Disable automatic conversions from 8-bit strings

This commit is contained in:
Jonas Kvinge
2024-04-11 02:56:01 +02:00
parent 58944993b8
commit 0c6872b352
310 changed files with 2501 additions and 2332 deletions

View File

@@ -28,7 +28,7 @@ Song RadioChannel::ToSong() const {
Song song(source);
song.set_valid(true);
song.set_filetype(Song::FileType::Stream);
song.set_title(Song::DescriptionForSource(source) + " " + name);
song.set_title(Song::DescriptionForSource(source) + QLatin1Char(' ') + name);
song.set_url(url);
return song;

View File

@@ -181,7 +181,7 @@ void RadioModel::AddChannels(const RadioChannelList &channels) {
RadioItem *item = new RadioItem(RadioItem::Type_Channel, container);
item->source = channel.source;
item->display_text = channel.name;
item->sort_text = SortText(Song::TextForSource(channel.source) + " - " + channel.name);
item->sort_text = SortText(Song::TextForSource(channel.source) + QStringLiteral(" - ") + channel.name);
item->channel = channel;
item->lazy_loaded = true;
items_ << item;
@@ -258,7 +258,7 @@ QString RadioModel::ChannelIconPixmapCacheKey(const QModelIndex &idx) const {
idx_copy = idx_copy.parent();
}
return path.join('/');
return path.join(QLatin1Char('/'));
}

View File

@@ -32,7 +32,9 @@
#include "radioparadiseservice.h"
#include "radiochannel.h"
const char *RadioParadiseService::kApiChannelsUrl = "https://api.radioparadise.com/api/list_streams";
namespace {
constexpr char kApiChannelsUrl[] = "https://api.radioparadise.com/api/list_streams";
}
RadioParadiseService::RadioParadiseService(Application *app, SharedPtr<NetworkAccessManager> network, QObject *parent)
: RadioService(Song::Source::RadioParadise, QStringLiteral("Radio Paradise"), IconLoader::Load(QStringLiteral("radioparadise")), app, network, parent) {}
@@ -57,7 +59,7 @@ void RadioParadiseService::GetChannels() {
Abort();
QUrl url(kApiChannelsUrl);
QUrl url(QString::fromLatin1(kApiChannelsUrl));
QNetworkRequest req(url);
QNetworkReply *reply = network_->get(req);
replies_ << reply;
@@ -108,11 +110,11 @@ void RadioParadiseService::GetChannelsReply(QNetworkReply *reply, const int task
QString label = obj_stream[QStringLiteral("label")].toString();
QString url = obj_stream[QStringLiteral("url")].toString();
if (!url.contains(QRegularExpression(QStringLiteral("^[0-9a-zA-Z]*:\\/\\/"), QRegularExpression::CaseInsensitiveOption))) {
url.prepend("https://");
url.prepend(QStringLiteral("https://"));
}
RadioChannel channel;
channel.source = source_;
channel.name = name + " - " + label;
channel.name = name + QStringLiteral(" - ") + label;
channel.url.setUrl(url);
channels << channel;
}

View File

@@ -48,7 +48,6 @@ class RadioParadiseService : public RadioService {
void GetChannelsReply(QNetworkReply *reply, const int task_id);
private:
static const char *kApiChannelsUrl;
QList<QNetworkReply*> replies_;
RadioChannelList channels_;
};

View File

@@ -22,6 +22,7 @@
#include <QToolButton>
#include "core/iconloader.h"
#include "core/settings.h"
#include "settings/appearancesettingspage.h"
#include "radioviewcontainer.h"
#include "ui_radioviewcontainer.h"
@@ -44,7 +45,7 @@ RadioViewContainer::~RadioViewContainer() { delete ui_; }
void RadioViewContainer::ReloadSettings() {
QSettings s;
Settings s;
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
int iconsize = s.value(AppearanceSettingsPage::kIconSizeLeftPanelButtons, 22).toInt();
s.endGroup();

View File

@@ -34,7 +34,9 @@
#include "somafmservice.h"
#include "radiochannel.h"
const char *SomaFMService::kApiChannelsUrl = "https://somafm.com/channels.json";
namespace {
constexpr char kApiChannelsUrl[] = "https://somafm.com/channels.json";
}
SomaFMService::SomaFMService(Application *app, SharedPtr<NetworkAccessManager> network, QObject *parent)
: RadioService(Song::Source::SomaFM, QStringLiteral("SomaFM"), IconLoader::Load(QStringLiteral("somafm")), app, network, parent) {}
@@ -63,7 +65,7 @@ void SomaFMService::GetChannels() {
Abort();
QUrl url(kApiChannelsUrl);
QUrl url(QString::fromLatin1(kApiChannelsUrl));
QNetworkRequest req(url);
QNetworkReply *reply = network_->get(req);
replies_ << reply;
@@ -110,13 +112,13 @@ void SomaFMService::GetChannelsReply(QNetworkReply *reply, const int task_id) {
}
RadioChannel channel;
QString quality = obj_playlist[QStringLiteral("quality")].toString();
if (quality != "highest") continue;
if (quality != QStringLiteral("highest")) continue;
channel.source = source_;
channel.name = name;
channel.url.setUrl(obj_playlist[QStringLiteral("url")].toString());
channel.thumbnail_url.setUrl(image);
if (obj_playlist.contains(QStringLiteral("format"))) {
channel.name.append(" " + obj_playlist[QStringLiteral("format")].toString().toUpper());
channel.name.append(QLatin1Char(' ') + obj_playlist[QStringLiteral("format")].toString().toUpper());
}
channels << channel;
}

View File

@@ -53,7 +53,6 @@ class SomaFMService : public RadioService {
void GetStreamUrlsReply(QNetworkReply *reply, const int task_id, RadioChannel channel);
private:
static const char *kApiChannelsUrl;
QList<QNetworkReply*> replies_;
RadioChannelList channels_;
};