Changeset View
Changeset View
Standalone View
Standalone View
dataengines/mpris2/playercontrol.cpp
Context not available. | |||||
89 | m_container = 0; | 89 | m_container = 0; | ||
---|---|---|---|---|---|
90 | } | 90 | } | ||
91 | 91 | | |||
92 | void PlayerControl::changeVolume(double delta, bool showOSD) { | ||||
93 | const double volume = playerInterface()->volume(); | ||||
94 | const double newVolume = qBound(0.0, volume + delta, qMax(volume, 1.0)); | ||||
95 | playerInterface()->setVolume(newVolume); | ||||
96 | | ||||
97 | if (showOSD) { | ||||
98 | const auto& data = m_container->data(); | ||||
99 | | ||||
100 | QDBusMessage msg = QDBusMessage::createMethodCall( | ||||
101 | QStringLiteral("org.kde.plasmashell"), | ||||
102 | QStringLiteral("/org/kde/osdService"), | ||||
103 | QStringLiteral("org.kde.osdService"), | ||||
104 | QStringLiteral("mediaPlayerVolumeChanged") | ||||
105 | ); | ||||
106 | | ||||
107 | msg.setArguments({ | ||||
108 | (int)(100 * newVolume), | ||||
109 | data.value("Identity", ""), | ||||
110 | data.value("Desktop Icon Name", "") | ||||
111 | }); | ||||
112 | | ||||
113 | QDBusConnection::sessionBus().asyncCall(msg); | ||||
114 | } | ||||
115 | } | ||||
116 | | ||||
92 | Plasma::ServiceJob* PlayerControl::createJob(const QString& operation, | 117 | Plasma::ServiceJob* PlayerControl::createJob(const QString& operation, | ||
93 | QMap<QString,QVariant>& parameters) | 118 | QMap<QString,QVariant>& parameters) | ||
94 | { | 119 | { | ||
Context not available. |