Port to QStringLiteral operator

This commit is contained in:
Jonas Kvinge
2024-10-20 06:38:55 +02:00
parent 722035913e
commit ef9ef63f02
202 changed files with 2036 additions and 1889 deletions

View File

@@ -31,7 +31,9 @@
#include "alsadevicefinder.h"
#include "enginedevice.h"
AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder(QStringLiteral("alsa"), { QStringLiteral("alsa"), QStringLiteral("alsasink") }) {}
using namespace Qt::Literals::StringLiterals;
AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder(u"alsa"_s, { u"alsa"_s, u"alsasink"_s }) {}
EngineDeviceList AlsaDeviceFinder::ListDevices() {

View File

@@ -28,7 +28,9 @@
#include "alsapcmdevicefinder.h"
#include "enginedevice.h"
AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder(QStringLiteral("alsa"), { QStringLiteral("alsa"), QStringLiteral("alsasink") }) {}
using namespace Qt::Literals::StringLiterals;
AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder(u"alsa"_s, { u"alsa"_s, u"alsasink"_s }) {}
EngineDeviceList AlsaPCMDeviceFinder::ListDevices() {

View File

@@ -28,7 +28,9 @@
#include "enginedevice.h"
#include "core/logging.h"
AsioDeviceFinder::AsioDeviceFinder() : DeviceFinder(QStringLiteral("asio"), { QStringLiteral("asiosink") }) {}
using namespace Qt::Literals::StringLiterals;
AsioDeviceFinder::AsioDeviceFinder() : DeviceFinder(u"asio"_s, { u"asiosink"_s }) {}
EngineDeviceList AsioDeviceFinder::ListDevices() {

View File

@@ -39,6 +39,8 @@
#include "core/logging.h"
#include "core/signalchecker.h"
using namespace Qt::Literals::StringLiterals;
#ifndef u_int32_t
using u_int32_t = unsigned int;
#endif
@@ -80,11 +82,11 @@ QString Chromaprinter::CreateFingerprint() {
return QString();
}
GstElement *src = CreateElement(QStringLiteral("filesrc"), pipeline);
GstElement *decode = CreateElement(QStringLiteral("decodebin"), pipeline);
GstElement *convert = CreateElement(QStringLiteral("audioconvert"), pipeline);
GstElement *resample = CreateElement(QStringLiteral("audioresample"), pipeline);
GstElement *sink = CreateElement(QStringLiteral("appsink"), pipeline);
GstElement *src = CreateElement(u"filesrc"_s, pipeline);
GstElement *decode = CreateElement(u"decodebin"_s, pipeline);
GstElement *convert = CreateElement(u"audioconvert"_s, pipeline);
GstElement *resample = CreateElement(u"audioresample"_s, pipeline);
GstElement *sink = CreateElement(u"appsink"_s, pipeline);
if (!src || !decode || !convert || !resample || !sink) {
gst_object_unref(pipeline);

View File

@@ -395,11 +395,11 @@ std::optional<EBUR128Measures> EBUR128AnalysisImpl::Compute(const Song &song) {
return std::nullopt;
}
GstElement *src = CreateElement(QStringLiteral("filesrc"), pipeline);
GstElement *decode = CreateElement(QStringLiteral("decodebin"), pipeline);
GstElement *convert = CreateElement(QStringLiteral("audioconvert"), pipeline);
GstElement *queue = CreateElement(QStringLiteral("queue2"), pipeline);
GstElement *sink = CreateElement(QStringLiteral("appsink"), pipeline);
GstElement *src = CreateElement(u"filesrc"_s, pipeline);
GstElement *decode = CreateElement(u"decodebin"_s, pipeline);
GstElement *convert = CreateElement(u"audioconvert"_s, pipeline);
GstElement *queue = CreateElement(u"queue2"_s, pipeline);
GstElement *sink = CreateElement(u"appsink"_s, pipeline);
if (!src || !decode || !convert || !queue || !sink) {
gst_object_unref(pipeline);

View File

@@ -94,9 +94,9 @@ EngineBase::Type EngineBase::TypeFromName(const QString &name) {
QString EngineBase::Name(const Type type) {
switch (type) {
case Type::GStreamer: return QStringLiteral("gstreamer");
case Type::GStreamer: return u"gstreamer"_s;
case Type::None:
default: return QStringLiteral("None");
default: return u"None"_s;
}
}
@@ -104,9 +104,9 @@ QString EngineBase::Name(const Type type) {
QString EngineBase::Description(const Type type) {
switch (type) {
case Type::GStreamer: return QStringLiteral("GStreamer");
case Type::GStreamer: return u"GStreamer"_s;
case Type::None:
default: return QStringLiteral("None");
default: return u"None"_s;
}
}
@@ -207,7 +207,7 @@ void EngineBase::ReloadSettings() {
bool http2_enabled = s.value("http2", false).toBool();
if (http2_enabled != http2_enabled_) {
http2_enabled_ = http2_enabled;
Utilities::SetEnv("SOUP_FORCE_HTTP1", http2_enabled_ ? ""_L1 : QStringLiteral("1"));
Utilities::SetEnv("SOUP_FORCE_HTTP1", http2_enabled_ ? ""_L1 : u"1"_s);
qLog(Debug) << "SOUP_FORCE_HTTP1:" << (http2_enabled_ ? "OFF" : "ON");
}

View File

@@ -26,27 +26,27 @@ EngineDevice::EngineDevice() : card(0), device(0) {}
QString EngineDevice::GuessIconName() const {
if (description.contains("mcintosh"_L1, Qt::CaseInsensitive)) {
return QStringLiteral("mcintosh");
return u"mcintosh"_s;
}
if (description.contains("electrocompaniet"_L1, Qt::CaseInsensitive)) {
return QStringLiteral("electrocompaniet");
return u"electrocompaniet"_s;
}
if (description.contains("intel"_L1, Qt::CaseInsensitive)) {
return QStringLiteral("intel");
return u"intel"_s;
}
if (description.contains("realtek"_L1, Qt::CaseInsensitive)) {
return QStringLiteral("realtek");
return u"realtek"_s;
}
if (description.contains("nvidia"_L1, Qt::CaseInsensitive)) {
return QStringLiteral("nvidia");
return u"nvidia"_s;
}
if (description.contains("headset"_L1, Qt::CaseInsensitive)) {
return QStringLiteral("headset");
return u"headset"_s;
}
if (description.contains("pulseaudio"_L1, Qt::CaseInsensitive)) {
return QStringLiteral("pulseaudio");
return u"pulseaudio"_s;
}
return QStringLiteral("soundcard");
return u"soundcard"_s;
}

View File

@@ -189,7 +189,7 @@ void GstEngine::StartPreloading(const QUrl &media_url, const QUrl &stream_url, c
if (current_pipeline_) {
current_pipeline_->PrepareNextUrl(media_url, stream_url, gst_url, beginning_nanosec, force_stop_at_end ? end_nanosec : 0);
// Add request to discover the stream
if (discoverer_ && media_url.scheme() != QStringLiteral("spotify")) {
if (discoverer_ && media_url.scheme() != u"spotify"_s) {
if (!gst_discoverer_discover_uri_async(discoverer_, gst_url.constData())) {
qLog(Error) << "Failed to start stream discovery for" << gst_url;
}
@@ -258,7 +258,7 @@ bool GstEngine::Load(const QUrl &media_url, const QUrl &stream_url, const Engine
}
// Add request to discover the stream
if (discoverer_ && media_url.scheme() != QStringLiteral("spotify")) {
if (discoverer_ && media_url.scheme() != u"spotify"_s) {
if (!gst_discoverer_discover_uri_async(discoverer_, gst_url.constData())) {
qLog(Error) << "Failed to start stream discovery for" << gst_url;
}
@@ -1162,12 +1162,12 @@ void GstEngine::StreamDiscoveryFinished(GstDiscoverer *discoverer, gpointer self
QString GstEngine::GSTdiscovererErrorMessage(GstDiscovererResult result) {
switch (result) {
case GST_DISCOVERER_URI_INVALID: return QStringLiteral("The URI is invalid");
case GST_DISCOVERER_TIMEOUT: return QStringLiteral("The discovery timed-out");
case GST_DISCOVERER_BUSY: return QStringLiteral("The discoverer was already discovering a file");
case GST_DISCOVERER_MISSING_PLUGINS: return QStringLiteral("Some plugins are missing for full discovery");
case GST_DISCOVERER_URI_INVALID: return u"The URI is invalid"_s;
case GST_DISCOVERER_TIMEOUT: return u"The discovery timed-out"_s;
case GST_DISCOVERER_BUSY: return u"The discoverer was already discovering a file"_s;
case GST_DISCOVERER_MISSING_PLUGINS: return u"Some plugins are missing for full discovery"_s;
case GST_DISCOVERER_ERROR:
default: return QStringLiteral("An error happened and the GError is set");
default: return u"An error happened and the GError is set"_s;
}
}

View File

@@ -286,17 +286,17 @@ QString GstEnginePipeline::GstStateText(const GstState state) {
switch (state) {
case GST_STATE_VOID_PENDING:
return QStringLiteral("Pending");
return u"Pending"_s;
case GST_STATE_NULL:
return QStringLiteral("Null");
return u"Null"_s;
case GST_STATE_READY:
return QStringLiteral("Ready");
return u"Ready"_s;
case GST_STATE_PAUSED:
return QStringLiteral("Paused");
return u"Paused"_s;
case GST_STATE_PLAYING:
return QStringLiteral("Playing");
return u"Playing"_s;
default:
return QStringLiteral("Unknown");
return u"Unknown"_s;
}
}
@@ -424,10 +424,10 @@ bool GstEnginePipeline::InitFromUrl(const QUrl &media_url, const QUrl &stream_ur
guint version_major = 0, version_minor = 0, version_micro = 0, version_nano = 0;
gst_plugins_base_version(&version_major, &version_minor, &version_micro, &version_nano);
if (QVersionNumber::compare(QVersionNumber(static_cast<int>(version_major), static_cast<int>(version_minor)), QVersionNumber(1, 24)) >= 0) {
pipeline_ = CreateElement(QStringLiteral("playbin3"), QStringLiteral("pipeline"), nullptr, error);
pipeline_ = CreateElement(u"playbin3"_s, u"pipeline"_s, nullptr, error);
}
else {
pipeline_ = CreateElement(QStringLiteral("playbin"), QStringLiteral("pipeline"), nullptr, error);
pipeline_ = CreateElement(u"playbin"_s, u"pipeline"_s, nullptr, error);
}
if (!pipeline_) return false;
@@ -602,31 +602,31 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Create all the other elements
audioqueue_ = CreateElement(QStringLiteral("queue2"), QStringLiteral("audioqueue"), audiobin_, error);
audioqueue_ = CreateElement(u"queue2"_s, u"audioqueue"_s, audiobin_, error);
if (!audioqueue_) {
return false;
}
audioqueueconverter_ = CreateElement(QStringLiteral("audioconvert"), QStringLiteral("audioqueueconverter"), audiobin_, error);
audioqueueconverter_ = CreateElement(u"audioconvert"_s, u"audioqueueconverter"_s, audiobin_, error);
if (!audioqueueconverter_) {
return false;
}
GstElement *audiosinkconverter = CreateElement(QStringLiteral("audioconvert"), QStringLiteral("audiosinkconverter"), audiobin_, error);
GstElement *audiosinkconverter = CreateElement(u"audioconvert"_s, u"audiosinkconverter"_s, audiobin_, error);
if (!audiosinkconverter) {
return false;
}
// Create the volume element if it's enabled.
if (volume_enabled_ && !volume_) {
volume_sw_ = CreateElement(QStringLiteral("volume"), QStringLiteral("volume_sw"), audiobin_, error);
volume_sw_ = CreateElement(u"volume"_s, u"volume_sw"_s, audiobin_, error);
if (!volume_sw_) {
return false;
}
}
if (fading_enabled_) {
volume_fading_ = CreateElement(QStringLiteral("volume"), QStringLiteral("volume_fading"), audiobin_, error);
volume_fading_ = CreateElement(u"volume"_s, u"volume_fading"_s, audiobin_, error);
if (!volume_fading_) {
return false;
}
@@ -637,7 +637,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Create the stereo balancer elements if it's enabled.
if (stereo_balancer_enabled_) {
audiopanorama_ = CreateElement(QStringLiteral("audiopanorama"), QStringLiteral("audiopanorama"), audiobin_, error);
audiopanorama_ = CreateElement(u"audiopanorama"_s, u"audiopanorama"_s, audiobin_, error);
if (!audiopanorama_) {
return false;
}
@@ -647,11 +647,11 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Create the equalizer elements if it's enabled.
if (eq_enabled_) {
equalizer_preamp_ = CreateElement(QStringLiteral("volume"), QStringLiteral("equalizer_preamp"), audiobin_, error);
equalizer_preamp_ = CreateElement(u"volume"_s, u"equalizer_preamp"_s, audiobin_, error);
if (!equalizer_preamp_) {
return false;
}
equalizer_ = CreateElement(QStringLiteral("equalizer-nbands"), QStringLiteral("equalizer_nbands"), audiobin_, error);
equalizer_ = CreateElement(u"equalizer-nbands"_s, u"equalizer_nbands"_s, audiobin_, error);
if (!equalizer_) {
return false;
}
@@ -701,15 +701,15 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
GstElement *rglimiter = nullptr;
GstElement *rgconverter = nullptr;
if (rg_enabled_) {
rgvolume = CreateElement(QStringLiteral("rgvolume"), QStringLiteral("rgvolume"), audiobin_, error);
rgvolume = CreateElement(u"rgvolume"_s, u"rgvolume"_s, audiobin_, error);
if (!rgvolume) {
return false;
}
rglimiter = CreateElement(QStringLiteral("rglimiter"), QStringLiteral("rglimiter"), audiobin_, error);
rglimiter = CreateElement(u"rglimiter"_s, u"rglimiter"_s, audiobin_, error);
if (!rglimiter) {
return false;
}
rgconverter = CreateElement(QStringLiteral("audioconvert"), QStringLiteral("rgconverter"), audiobin_, error);
rgconverter = CreateElement(u"audioconvert"_s, u"rgconverter"_s, audiobin_, error);
if (!rgconverter) {
return false;
}
@@ -723,7 +723,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Create the EBU R 128 loudness normalization volume element if enabled.
if (ebur128_loudness_normalization_) {
volume_ebur128_ = CreateElement(QStringLiteral("volume"), QStringLiteral("ebur128_volume"), audiobin_, error);
volume_ebur128_ = CreateElement(u"volume"_s, u"ebur128_volume"_s, audiobin_, error);
if (!volume_ebur128_) {
return false;
}
@@ -735,7 +735,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
GstElement *bs2b = nullptr;
if (bs2b_enabled_) {
bs2b = CreateElement(QStringLiteral("bs2b"), QStringLiteral("bs2b"), audiobin_, error);
bs2b = CreateElement(u"bs2b"_s, u"bs2b"_s, audiobin_, error);
if (!bs2b) {
return false;
}
@@ -781,7 +781,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
// Link all elements
if (!gst_element_link(audioqueue_, audioqueueconverter_)) {
error = QStringLiteral("Failed to link audio queue to audio queue converter.");
error = u"Failed to link audio queue to audio queue converter."_s;
return false;
}
@@ -1568,7 +1568,7 @@ void GstEnginePipeline::TagMessageReceived(GstMessage *msg) {
if (!engine_metadata.title.isEmpty() && engine_metadata.artist.isEmpty() && engine_metadata.album.isEmpty()) {
QStringList title_splitted;
if (engine_metadata.title.contains(" - "_L1)) {
title_splitted = engine_metadata.title.split(QStringLiteral(" - "));
title_splitted = engine_metadata.title.split(u" - "_s);
}
else if (engine_metadata.title.contains(u'~')) {
title_splitted = engine_metadata.title.split(u'~');

View File

@@ -65,7 +65,7 @@ std::unique_ptr<T> GetProperty(const AudioDeviceID &device_id, const AudioObject
} // namespace
MacOsDeviceFinder::MacOsDeviceFinder() : DeviceFinder(QStringLiteral("osxaudio"), { QStringLiteral("osxaudio"), QStringLiteral("osx"), QStringLiteral("osxaudiosink") }) {}
MacOsDeviceFinder::MacOsDeviceFinder() : DeviceFinder(u"osxaudio"_s, { u"osxaudio"_s, u"osx"_s, u"osxaudiosink"_s }) {}
EngineDeviceList MacOsDeviceFinder::ListDevices() {

View File

@@ -36,12 +36,14 @@
#include "enginedevice.h"
#include "core/logging.h"
using namespace Qt::Literals::StringLiterals;
#ifdef _MSC_VER
DEFINE_GUID(IID_IMMDeviceEnumerator, 0xa95664d2, 0x9614, 0x4f35, 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6);
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xbcde0395, 0xe52f, 0x467c, 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e);
#endif
MMDeviceFinder::MMDeviceFinder() : DeviceFinder(QStringLiteral("mmdevice"), { QStringLiteral("wasapisink") }) {}
MMDeviceFinder::MMDeviceFinder() : DeviceFinder(u"mmdevice"_s, { u"wasapisink"_s }) {}
EngineDeviceList MMDeviceFinder::ListDevices() {

View File

@@ -33,7 +33,9 @@
#include "pulsedevicefinder.h"
#include "enginedevice.h"
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder(QStringLiteral("pulseaudio"), { QStringLiteral("pulseaudio"), QStringLiteral("pulse"), QStringLiteral("pulsesink") }), mainloop_(nullptr), context_(nullptr) {}
using namespace Qt::Literals::StringLiterals;
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder(u"pulseaudio"_s, { u"pulseaudio"_s, u"pulse"_s, u"pulsesink"_s }), mainloop_(nullptr), context_(nullptr) {}
bool PulseDeviceFinder::Initialize() {

View File

@@ -45,7 +45,7 @@ using namespace ABI::Windows::Devices::Enumeration;
using namespace Qt::Literals::StringLiterals;
UWPDeviceFinder::UWPDeviceFinder() : DeviceFinder(QStringLiteral("uwpdevice"), { QStringLiteral("wasapi2sink") }) {}
UWPDeviceFinder::UWPDeviceFinder() : DeviceFinder(u"uwpdevice"_s, { u"wasapi2sink"_s }) {}
namespace {