File indexing completed on 2024-12-08 08:02:46

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "volumeosd.h"
0008 
0009 #include "osdservice.h"
0010 
0011 #define SERVICE QLatin1String("org.kde.plasmashell")
0012 #define PATH QLatin1String("/org/kde/osdService")
0013 #define CONNECTION QDBusConnection::sessionBus()
0014 
0015 VolumeOSD::VolumeOSD(QObject *parent)
0016     : QObject(parent)
0017 {
0018 }
0019 
0020 void VolumeOSD::show(int percent, int maximumPercent)
0021 {
0022     OsdServiceInterface osdService(SERVICE, PATH, CONNECTION);
0023     osdService.volumeChanged(percent, maximumPercent);
0024 }
0025 
0026 void VolumeOSD::showMicrophone(int percent)
0027 {
0028     OsdServiceInterface osdService(SERVICE, PATH, CONNECTION);
0029     osdService.microphoneVolumeChanged(percent);
0030 }
0031 
0032 void VolumeOSD::showText(const QString &iconName, const QString &text)
0033 {
0034     OsdServiceInterface osdService(SERVICE, PATH, CONNECTION);
0035     osdService.showText(iconName, text);
0036 }