File indexing completed on 2024-04-28 16:55:12
0001 /******************************************************************* 0002 * brightnessosdwidget.cpp 0003 * adapted from kdemultimedia/kmix/osdwidget.cpp 0004 * Copyright 2009 Aurélien Gâteau <agateau@kde.org> 0005 * Copyright 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com> 0006 * Copyright 2009 Christian Esken <christian.esken@arcor.de> 0007 * Copyright 2010 Felix Geyer <debfx-kde@fobos.de> 0008 * Copyright 2015 Kai Uwe Broulik <kde@privat.broulik.de> 0009 * 0010 * This program is free software; you can redistribute it and/or 0011 * modify it under the terms of the GNU General Public License as 0012 * published by the Free Software Foundation; either version 2 of 0013 * the License, or (at your option) any later version. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU General Public License for more details. 0019 * 0020 * You should have received a copy of the GNU General Public License 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 * 0023 ******************************************************************/ 0024 0025 #include "brightnessosdwidget.h" 0026 0027 #include <QDBusInterface> 0028 #include <QDBusPendingCall> 0029 0030 namespace BrightnessOSDWidget 0031 { 0032 0033 void show(int percentage, PowerDevil::BackendInterface::BrightnessControlType type) 0034 { 0035 QString method; 0036 if (type == PowerDevil::BackendInterface::Keyboard) { 0037 method = QLatin1String("keyboardBrightnessChanged"); 0038 } else { 0039 method = QLatin1String("brightnessChanged"); 0040 } 0041 0042 QDBusMessage msg = QDBusMessage::createMethodCall( 0043 QStringLiteral("org.kde.plasmashell"), 0044 QStringLiteral("/org/kde/osdService"), 0045 QStringLiteral("org.kde.osdService"), 0046 method 0047 ); 0048 0049 msg << percentage; 0050 0051 QDBusConnection::sessionBus().asyncCall(msg); 0052 } 0053 0054 }