2 * Copyright (C) 2007 Christopher Blauvelt <cblauvelt@gmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "devicesignalmapper.h"
21 DeviceSignalMapper::DeviceSignalMapper(QObject
*parent
) : QSignalMapper(parent
)
25 DeviceSignalMapper::~DeviceSignalMapper()
29 void DeviceSignalMapper::setMapping(QObject
* device
, const QString
&udi
)
31 signalmap
[device
] = udi
;
34 AcAdapterSignalMapper::AcAdapterSignalMapper(QObject
*parent
) : DeviceSignalMapper(parent
)
38 AcAdapterSignalMapper::~AcAdapterSignalMapper()
42 void AcAdapterSignalMapper::plugStateChanged(bool newState
)
44 emit(deviceChanged(signalmap
[sender()], "Plugged In", newState
));
48 ButtonSignalMapper::ButtonSignalMapper(QObject
*parent
) : DeviceSignalMapper(parent
)
52 ButtonSignalMapper::~ButtonSignalMapper()
56 void ButtonSignalMapper::pressed(Solid::Button::ButtonType type
)
59 emit(deviceChanged(signalmap
[sender()], "Pressed", true));
62 BatterySignalMapper::BatterySignalMapper(QObject
*parent
) : DeviceSignalMapper(parent
)
66 BatterySignalMapper::~BatterySignalMapper()
70 void BatterySignalMapper::chargePercentChanged(int value
)
72 emit(deviceChanged(signalmap
[sender()], "Charge Percent", value
));
75 void BatterySignalMapper::chargeStateChanged(int newState
)
77 QStringList chargestate
;
78 chargestate
<< "Fully Charged" << "Charging" << "Discharging";
79 emit(deviceChanged(signalmap
[sender()], "Charge State", chargestate
.at(newState
)));
82 void BatterySignalMapper::plugStateChanged(bool newState
)
84 emit(deviceChanged(signalmap
[sender()], "Plugged In", newState
));
87 StorageAccessSignalMapper::StorageAccessSignalMapper(QObject
*parent
) : DeviceSignalMapper(parent
)
91 StorageAccessSignalMapper::~StorageAccessSignalMapper()
95 void StorageAccessSignalMapper::accessibilityChanged(bool accessible
)
97 emit(deviceChanged(signalmap
[sender()], "Accessible", accessible
));
100 #include "devicesignalmapper.moc"