1 /***************************************************************************
2 * Copyright (C) 2008 by Dario Freddi <drf@kdemod.ath.cx> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18 ***************************************************************************/
20 #ifndef POWERDEVILDAEMON_H
21 #define POWERDEVILDAEMON_H
23 #include <kdedmodule.h>
24 #include <solid/control/powermanager.h>
25 #include <solid/battery.h>
26 #include <KComponentData>
27 #include <QStringList>
30 #include "AbstractSystemPoller.h"
34 class PollSystemLoader
;
35 class SuspensionLockHandler
;
37 class OrgFreedesktopScreenSaverInterface
;
38 class OrgKdeKSMServerInterfaceInterface
;
39 class OrgKdeScreensaverInterface
;
41 class KDE_EXPORT PowerDevilDaemon
: public KDEDModule
44 Q_CLASSINFO("D-Bus Interface", "org.kde.PowerDevil")
47 PowerDevilDaemon(QObject
*parent
, const QList
<QVariant
>&);
48 virtual ~PowerDevilDaemon();
52 void emitWarningNotification(const QString
&evid
, const QString
&message
= QString(),
53 const char *slot
= 0, const QString
&iconname
= "dialog-warning");
54 void emitNotification(const QString
&evid
, const QString
&message
= QString(),
55 const char *slot
= 0, const QString
&iconname
= "dialog-ok-apply");
56 void setProfile(const QString
& profile
);
57 void reloadAndStream();
60 void setGovernor(int governor
);
61 void suspend(int method
);
62 void setPowersavingScheme(const QString
&scheme
);
63 void setBrightness(int value
);
66 void setUpPollingSystem();
72 QVariantMap
getSupportedGovernors();
73 QStringList
getSupportedSchemes();
74 QVariantMap
getSupportedSuspendMethods();
75 QVariantMap
getSupportedPollingSystems();
77 SuspensionLockHandler
*lockHandler();
80 void acAdapterStateChanged(int state
, bool forced
= false);
81 void batteryChargePercentChanged(int percent
, const QString
&udi
);
83 void decreaseBrightness();
84 void increaseBrightness();
86 void shutdown(bool automated
= false);
87 void shutdownDialog();
88 void suspendJobResult(KJob
* job
);
89 void suspendToDisk(bool automated
= false);
90 void suspendToRam(bool automated
= false);
91 void standby(bool automated
= false);
93 void shutdownNotification(bool automated
= false);
94 void suspendToDiskNotification(bool automated
= false);
95 void suspendToRamNotification(bool automated
= false);
96 void standbyNotification(bool automated
= false);
98 void buttonPressed(int but
);
101 void resumeFromIdle();
103 void reloadProfile(int state
= -1);
104 QString
profile() const;
106 void setBatteryPercent(int newpercent
);
107 void setACPlugged(bool newplugged
);
108 void setCurrentProfile(const QString
&profile
);
109 void setAvailableProfiles(const QStringList
&aProfiles
);
111 bool toggleCompositing(bool enabled
);
117 void emitCriticalNotification(const QString
&evid
, const QString
&message
= QString(),
118 const char *slot
= 0, const QString
&iconname
= "dialog-error");
120 void batteryRemainingTimeChanged(int time
);
123 void lidClosed(int code
, const QString
&action
);
124 void errorTriggered(const QString
&error
);
126 void stateChanged(int, bool);
127 void profileChanged(const QString
&, const QStringList
&);
132 KConfigGroup
*getCurrentProfile(bool forcereload
= false);
135 void setUpNextTimeout(int idle
, int minDimEvent
);
137 void profileFirstLoad();
139 void restoreDefaultProfiles();
141 bool loadPollingSystem(AbstractSystemPoller::PollingType type
);
143 bool recacheBatteryPointer(bool force
= false);
160 DimThreeQuarters
= 4,
169 #endif /*POWERDEVILDAEMON_H*/