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

@@ -34,6 +34,7 @@
#include "core/shared_ptr.h"
#include "core/application.h"
#include "core/logging.h"
#include "core/settings.h"
#ifdef Q_OS_MACOS
# include "core/macsystemtrayicon.h"
#else
@@ -74,7 +75,7 @@ OSDBase::~OSDBase() {
void OSDBase::ReloadSettings() {
QSettings s;
Settings s;
s.beginGroup(kSettingsGroup);
behaviour_ = static_cast<OSDBase::Behaviour>(s.value("Behaviour", static_cast<int>(Behaviour::Native)).toInt());
timeout_msec_ = s.value("Timeout", 5000).toInt();
@@ -200,7 +201,7 @@ void OSDBase::Paused() {
else {
summary = last_song_.PrettyTitle();
if (!last_song_.artist().isEmpty()) {
summary.prepend(" - ");
summary.prepend(QStringLiteral(" - "));
summary.prepend(last_song_.artist());
}
if (behaviour_ == Behaviour::Pretty) {
@@ -245,7 +246,7 @@ void OSDBase::Stopped() {
else {
summary = last_song_.PrettyTitle();
if (!last_song_.artist().isEmpty()) {
summary.prepend(" - ");
summary.prepend(QStringLiteral(" - "));
summary.prepend(last_song_.artist());
}
if (behaviour_ == Behaviour::Pretty) {
@@ -385,7 +386,7 @@ QString OSDBase::ReplaceMessage(const MessageType type, const QString &message,
case Behaviour::Native:
#if defined(Q_OS_MACOS)
html_escaped = false;
newline = "\n";
newline = QStringLiteral("\n");
break;
#elif defined(HAVE_DBUS)
switch (type) {
@@ -394,7 +395,7 @@ QString OSDBase::ReplaceMessage(const MessageType type, const QString &message,
newline = QLatin1String("");
break;
}
case MessageType::Message: {
case MessageType::Message:{
html_escaped = true;
newline = QStringLiteral("<br />");
break;

View File

@@ -117,7 +117,7 @@ OSDDBus::~OSDDBus() = default;
void OSDDBus::Init() {
interface_ = make_unique<OrgFreedesktopNotificationsInterface>(OrgFreedesktopNotificationsInterface::staticInterfaceName(), "/org/freedesktop/Notifications", QDBusConnection::sessionBus());
interface_ = make_unique<OrgFreedesktopNotificationsInterface>(QString::fromUtf8(OrgFreedesktopNotificationsInterface::staticInterfaceName()), QStringLiteral("/org/freedesktop/Notifications"), QDBusConnection::sessionBus());
if (!interface_->isValid()) {
qLog(Warning) << "Error connecting to notifications service.";
}

View File

@@ -51,6 +51,8 @@
#include <QFlags>
#include <QtEvents>
#include "core/settings.h"
#ifdef HAVE_X11EXTRAS
# include <QX11Info>
#elif defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
@@ -232,12 +234,12 @@ bool OSDPretty::IsTransparencyAvailable() {
void OSDPretty::Load() {
QSettings s;
Settings s;
s.beginGroup(kSettingsGroup);
foreground_color_ = QColor(s.value("foreground_color", 0).toInt());
background_color_ = QColor(s.value("background_color", kPresetBlue).toInt());
background_opacity_ = s.value("background_opacity", 0.85).toFloat();
font_.fromString(s.value("font", "Verdana,9,-1,5,50,0,0,0,0,0").toString());
font_.fromString(s.value("font", QStringLiteral("Verdana,9,-1,5,50,0,0,0,0,0")).toString());
disable_duration_ = s.value("disable_duration", false).toBool();
#ifdef Q_OS_WIN
fading_enabled_ = s.value("fading", true).toBool();
@@ -245,7 +247,7 @@ void OSDPretty::Load() {
fading_enabled_ = s.value("fading", false).toBool();
#endif
if (s.contains("popup_screen")) {
if (s.contains(QStringLiteral("popup_screen"))) {
popup_screen_name_ = s.value("popup_screen").toString();
if (screens_.contains(popup_screen_name_)) {
popup_screen_ = screens_[popup_screen_name_];
@@ -261,7 +263,7 @@ void OSDPretty::Load() {
if (current_screen()) popup_screen_name_ = current_screen()->name();
}
if (s.contains("popup_pos")) {
if (s.contains(QStringLiteral("popup_pos"))) {
popup_pos_ = s.value("popup_pos").toPoint();
}
else {

View File

@@ -142,7 +142,7 @@ class OSDPretty : public QWidget {
Mode mode_;
// Settings loaded from QSettings
// Settings loaded from Settings
QColor foreground_color_;
QColor background_color_;
qreal background_opacity_;