Plasma5Support

devicesignalmapper.cpp
1/*
2 SPDX-FileCopyrightText: 2007 Christopher Blauvelt <cblauvelt@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-only
5*/
6
7#include "devicesignalmapper.h"
8
9DeviceSignalMapper::DeviceSignalMapper(QObject *parent)
10 : QSignalMapper(parent)
11{
12}
13
14DeviceSignalMapper::~DeviceSignalMapper()
15{
16}
17
18void DeviceSignalMapper::setMapping(QObject *device, const QString &udi)
19{
20 signalmap[device] = udi;
21}
22
23BatterySignalMapper::BatterySignalMapper(QObject *parent)
24 : DeviceSignalMapper(parent)
25{
26}
27
28BatterySignalMapper::~BatterySignalMapper()
29{
30}
31
32void BatterySignalMapper::chargePercentChanged(int value)
33{
34 Q_EMIT deviceChanged(signalmap[sender()], QStringLiteral("Charge Percent"), value);
35}
36
37void BatterySignalMapper::chargeStateChanged(int newState)
38{
39 QStringList chargestate;
40 chargestate << QStringLiteral("Fully Charged") << QStringLiteral("Charging") << QStringLiteral("Discharging");
41 Q_EMIT deviceChanged(signalmap[sender()], QStringLiteral("Charge State"), chargestate.at(newState));
42}
43
44void BatterySignalMapper::presentStateChanged(bool newState)
45{
46 Q_EMIT deviceChanged(signalmap[sender()], QStringLiteral("Plugged In"), newState);
47}
48
49StorageAccessSignalMapper::StorageAccessSignalMapper(QObject *parent)
50 : DeviceSignalMapper(parent)
51{
52}
53
54StorageAccessSignalMapper::~StorageAccessSignalMapper()
55{
56}
57
58void StorageAccessSignalMapper::accessibilityChanged(bool accessible)
59{
60 Q_EMIT deviceChanged(signalmap[sender()], QStringLiteral("Accessible"), accessible);
61}
const_reference at(qsizetype i) const const
Q_EMITQ_EMIT
QObject * sender() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.