Adjust some constexprs in linux platform code

This commit is contained in:
Ilya Fedin 2021-01-16 10:23:50 +04:00 committed by John Preston
parent 894d6028bd
commit 4348ddf938
2 changed files with 7 additions and 11 deletions

View file

@ -23,7 +23,6 @@ namespace Platform {
namespace internal { namespace internal {
namespace { namespace {
constexpr auto kDBusTimeout = 30000;
constexpr auto kService = "org.gnome.SettingsDaemon.MediaKeys"_cs; constexpr auto kService = "org.gnome.SettingsDaemon.MediaKeys"_cs;
constexpr auto kOldService = "org.gnome.SettingsDaemon"_cs; constexpr auto kOldService = "org.gnome.SettingsDaemon"_cs;
constexpr auto kMATEService = "org.mate.SettingsDaemon"_cs; constexpr auto kMATEService = "org.mate.SettingsDaemon"_cs;
@ -114,7 +113,7 @@ GSDMediaKeys::GSDMediaKeys() {
0), 0),
nullptr, nullptr,
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
kDBusTimeout, -1,
nullptr, nullptr,
&error); &error);
@ -160,7 +159,7 @@ GSDMediaKeys::~GSDMediaKeys() {
QCoreApplication::applicationName().toUtf8().constData()), QCoreApplication::applicationName().toUtf8().constData()),
nullptr, nullptr,
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
kDBusTimeout, -1,
nullptr, nullptr,
&error); &error);

View file

@ -37,13 +37,10 @@ namespace Platform {
namespace Notifications { namespace Notifications {
namespace { namespace {
constexpr auto kDBusTimeout = 30000;
constexpr auto kService = "org.freedesktop.Notifications"_cs; constexpr auto kService = "org.freedesktop.Notifications"_cs;
constexpr auto kObjectPath = "/org/freedesktop/Notifications"_cs; constexpr auto kObjectPath = "/org/freedesktop/Notifications"_cs;
constexpr auto kInterface = kService; constexpr auto kInterface = kService;
constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"_cs; constexpr auto kPropertiesInterface = "org.freedesktop.DBus.Properties"_cs;
constexpr auto kImageDataType = "(iiibii@ay)"_cs;
constexpr auto kNotifyArgsType = "(susssasa{sv}i)"_cs;
struct ServerInformation { struct ServerInformation {
QString name; QString name;
@ -143,7 +140,7 @@ void GetInhibitionSupported(Fn<void(bool)> callback) {
qsl("Get")); qsl("Get"));
message.setArguments({ message.setArguments({
qsl("org.freedesktop.Notifications"), kInterface.utf16(),
qsl("Inhibited") qsl("Inhibited")
}); });
@ -178,7 +175,7 @@ bool Inhibited() {
qsl("Get")); qsl("Get"));
message.setArguments({ message.setArguments({
qsl("org.freedesktop.Notifications"), kInterface.utf16(),
qsl("Inhibited") qsl("Inhibited")
}); });
@ -487,7 +484,7 @@ void NotificationData::show() {
kInterface.utf8(), kInterface.utf8(),
"Notify", "Notify",
g_variant_new( g_variant_new(
kNotifyArgsType.utf8(), "(susssasa{sv}i)",
AppName.utf8().constData(), AppName.utf8().constData(),
0, 0,
iconName.toUtf8().constData(), iconName.toUtf8().constData(),
@ -498,7 +495,7 @@ void NotificationData::show() {
-1), -1),
nullptr, nullptr,
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
kDBusTimeout, -1,
nullptr, nullptr,
notificationShown, notificationShown,
this); this);
@ -560,7 +557,7 @@ void NotificationData::setImage(const QString &imagePath) {
_image = QImage(imagePath).convertToFormat(QImage::Format_RGBA8888); _image = QImage(imagePath).convertToFormat(QImage::Format_RGBA8888);
_hints.emplace(_imageKey, g_variant_new( _hints.emplace(_imageKey, g_variant_new(
kImageDataType.utf8(), "(iiibii@ay)",
_image.width(), _image.width(),
_image.height(), _image.height(),
_image.bytesPerLine(), _image.bytesPerLine(),