Port to QStringLiteral operator
This commit is contained in:
@@ -175,10 +175,10 @@ void OSDBase::ShowPlaying(const Song &song, const QUrl &cover_url, const QImage
|
||||
if (html_escaped) message = message.toHtmlEscaped();
|
||||
|
||||
if (show_art_) {
|
||||
ShowMessage(summary, message, QStringLiteral("notification-audio-play"), image);
|
||||
ShowMessage(summary, message, u"notification-audio-play"_s, image);
|
||||
}
|
||||
else {
|
||||
ShowMessage(summary, message, QStringLiteral("notification-audio-play"), QImage());
|
||||
ShowMessage(summary, message, u"notification-audio-play"_s, QImage());
|
||||
}
|
||||
|
||||
// Reload the saved settings if they were changed for preview
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "notification.h"
|
||||
|
||||
using std::make_unique;
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const QImage &image) {
|
||||
|
||||
@@ -117,7 +118,7 @@ OSDDBus::~OSDDBus() = default;
|
||||
|
||||
void OSDDBus::Init() {
|
||||
|
||||
interface_ = make_unique<OrgFreedesktopNotificationsInterface>(QString::fromUtf8(OrgFreedesktopNotificationsInterface::staticInterfaceName()), QStringLiteral("/org/freedesktop/Notifications"), QDBusConnection::sessionBus());
|
||||
interface_ = make_unique<OrgFreedesktopNotificationsInterface>(QString::fromUtf8(OrgFreedesktopNotificationsInterface::staticInterfaceName()), u"/org/freedesktop/Notifications"_s, QDBusConnection::sessionBus());
|
||||
if (!interface_->isValid()) {
|
||||
qLog(Warning) << "Error connecting to notifications service.";
|
||||
}
|
||||
@@ -145,22 +146,22 @@ void OSDDBus::ShowMessageNative(const QString &summary, const QString &message,
|
||||
|
||||
QVariantMap hints;
|
||||
QString summary_stripped = summary;
|
||||
static const QRegularExpression regex_illegal_characters(QStringLiteral("[&\"<>]"));
|
||||
static const QRegularExpression regex_illegal_characters(u"[&\"<>]"_s);
|
||||
summary_stripped = summary_stripped.remove(regex_illegal_characters).simplified();
|
||||
|
||||
if (!image.isNull()) {
|
||||
if (version_ >= QVersionNumber(1, 2)) {
|
||||
hints[QStringLiteral("image-data")] = QVariant(image);
|
||||
hints[u"image-data"_s] = QVariant(image);
|
||||
}
|
||||
else if (version_ >= QVersionNumber(1, 1)) {
|
||||
hints[QStringLiteral("image_data")] = QVariant(image);
|
||||
hints[u"image_data"_s] = QVariant(image);
|
||||
}
|
||||
else {
|
||||
hints[QStringLiteral("icon_data")] = QVariant(image);
|
||||
hints[u"icon_data"_s] = QVariant(image);
|
||||
}
|
||||
}
|
||||
|
||||
hints[QStringLiteral("transient")] = QVariant(true);
|
||||
hints[u"transient"_s] = QVariant(true);
|
||||
|
||||
quint64 id = 0;
|
||||
if (last_notification_time_.secsTo(QDateTime::currentDateTime()) * 1000 < timeout_msec()) {
|
||||
|
||||
@@ -60,8 +60,6 @@
|
||||
#include "osdpretty.h"
|
||||
#include "ui_osdpretty.h"
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
@@ -71,6 +69,7 @@ using namespace Qt::Literals::StringLiterals;
|
||||
#endif
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
const char *OSDPretty::kSettingsGroup = "OSDPretty";
|
||||
|
||||
@@ -134,14 +133,14 @@ OSDPretty::OSDPretty(Mode mode, QWidget *parent)
|
||||
QObject::connect(fader_, &QTimeLine::finished, this, &OSDPretty::FaderFinished);
|
||||
|
||||
// Load the show edges and corners
|
||||
QImage shadow_edge(QStringLiteral(":/pictures/osd_shadow_edge.png"));
|
||||
QImage shadow_corner(QStringLiteral(":/pictures/osd_shadow_corner.png"));
|
||||
QImage shadow_edge(u":/pictures/osd_shadow_edge.png"_s);
|
||||
QImage shadow_corner(u":/pictures/osd_shadow_corner.png"_s);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
QTransform rotation = QTransform().rotate(90 * i);
|
||||
shadow_edge_[i] = QPixmap::fromImage(shadow_edge.transformed(rotation));
|
||||
shadow_corner_[i] = QPixmap::fromImage(shadow_corner.transformed(rotation));
|
||||
}
|
||||
background_ = QPixmap(QStringLiteral(":/pictures/osd_background.png"));
|
||||
background_ = QPixmap(u":/pictures/osd_background.png"_s);
|
||||
|
||||
// Set the margins to allow for the drop shadow
|
||||
QBoxLayout *l = qobject_cast<QBoxLayout*>(layout());
|
||||
@@ -237,7 +236,7 @@ void OSDPretty::Load() {
|
||||
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", QStringLiteral("Verdana,9,-1,5,50,0,0,0,0,0")).toString());
|
||||
font_.fromString(s.value("font", u"Verdana,9,-1,5,50,0,0,0,0,0"_s).toString());
|
||||
disable_duration_ = s.value("disable_duration", false).toBool();
|
||||
#ifdef Q_OS_WIN
|
||||
fading_enabled_ = s.value("fading", true).toBool();
|
||||
|
||||
Reference in New Issue
Block a user