~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/dataengines/soliddevice/devicesignalmapper.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright (C) 2007 Christopher Blauvelt <cblauvelt@gmail.com>
 
3
 *
 
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
 
7
 *
 
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
 
12
 *
 
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.
 
17
 */
 
18
 
 
19
#include "devicesignalmapper.h"
 
20
 
 
21
DeviceSignalMapper::DeviceSignalMapper(QObject *parent) : QSignalMapper(parent)
 
22
{
 
23
}
 
24
 
 
25
DeviceSignalMapper::~DeviceSignalMapper()
 
26
{
 
27
}
 
28
 
 
29
void DeviceSignalMapper::setMapping(QObject* device, const QString &udi)
 
30
{
 
31
    signalmap[device] = udi;
 
32
}
 
33
 
 
34
AcAdapterSignalMapper::AcAdapterSignalMapper(QObject *parent) : DeviceSignalMapper(parent)
 
35
{
 
36
}
 
37
 
 
38
AcAdapterSignalMapper::~AcAdapterSignalMapper()
 
39
{
 
40
}
 
41
 
 
42
void AcAdapterSignalMapper::plugStateChanged(bool newState)
 
43
{
 
44
    emit(deviceChanged(signalmap[sender()], "Plugged In", newState));
 
45
}
 
46
 
 
47
 
 
48
ButtonSignalMapper::ButtonSignalMapper(QObject *parent) : DeviceSignalMapper(parent)
 
49
{
 
50
}
 
51
 
 
52
ButtonSignalMapper::~ButtonSignalMapper()
 
53
{
 
54
}
 
55
 
 
56
void ButtonSignalMapper::pressed(Solid::Button::ButtonType type)
 
57
{
 
58
    Q_UNUSED(type)
 
59
    emit(deviceChanged(signalmap[sender()], "Pressed", true));
 
60
}
 
61
 
 
62
BatterySignalMapper::BatterySignalMapper(QObject *parent) : DeviceSignalMapper(parent)
 
63
{
 
64
}
 
65
 
 
66
BatterySignalMapper::~BatterySignalMapper()
 
67
{
 
68
}
 
69
 
 
70
void BatterySignalMapper::chargePercentChanged(int value)
 
71
{
 
72
    emit(deviceChanged(signalmap[sender()], "Charge Percent", value));
 
73
}
 
74
 
 
75
void BatterySignalMapper::chargeStateChanged(int newState)
 
76
{
 
77
    QStringList chargestate;
 
78
    chargestate << "Fully Charged" << "Charging" << "Discharging";
 
79
    emit(deviceChanged(signalmap[sender()], "Charge State", chargestate.at(newState)));
 
80
}
 
81
 
 
82
void BatterySignalMapper::plugStateChanged(bool newState)
 
83
{
 
84
    emit(deviceChanged(signalmap[sender()], "Plugged In", newState));
 
85
}
 
86
 
 
87
StorageAccessSignalMapper::StorageAccessSignalMapper(QObject *parent) : DeviceSignalMapper(parent)
 
88
{
 
89
}
 
90
 
 
91
StorageAccessSignalMapper::~StorageAccessSignalMapper()
 
92
{
 
93
}
 
94
 
 
95
void StorageAccessSignalMapper::accessibilityChanged(bool accessible)
 
96
{
 
97
    emit(deviceChanged(signalmap[sender()], "Accessible", accessible));
 
98
}
 
99
 
 
100
#include "devicesignalmapper.moc"