kmilo
thinkpad.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _THINKPAD_H_
00029 #define _THINKPAD_H_
00030
00031 #include <fcntl.h>
00032 #include <unistd.h>
00033
00034 #include <kapplication.h>
00035
00036 #include "monitor.h"
00037
00038 class QDBusInterface;
00039 namespace KMilo {
00040
00041 const int defaultVolumeStep = 14;
00042
00043
00044
00045
00046 typedef struct {
00047 unsigned int thinkpad_toggle;
00048 unsigned int zoom_toggle;
00049 unsigned int display_toggle;
00050 unsigned int home_toggle;
00051 unsigned int search_toggle;
00052 unsigned int mail_toggle;
00053 unsigned int favorites_toggle;
00054 unsigned int reload_toggle;
00055 unsigned int abort_toggle;
00056 unsigned int backward_toggle;
00057 unsigned int forward_toggle;
00058 unsigned int fn_toggle;
00059 unsigned int thinklight_toggle;
00060 unsigned int hibernate_toggle;
00061 unsigned int display_state;
00062 unsigned int expand_toggle;
00063 unsigned int brightness_level;
00064 unsigned int brightness_toggle;
00065 unsigned int volume_level;
00066 unsigned int volume_toggle;
00067 unsigned int mute_toggle;
00068 unsigned int ac_state;
00069 unsigned int powermgt_ac;
00070 unsigned int powermgt_battery;
00071 unsigned int wireless_toggle;
00072 unsigned int bluetooth_toggle;
00073 } thinkpad_state_struct;
00074
00083 class ThinkPadMonitor: public KMilo::Monitor {
00084 public:
00085 ThinkPadMonitor(QObject *parent, const QVariantList&);
00086 virtual ~ThinkPadMonitor();
00087
00092 virtual bool init();
00093
00098 virtual DisplayType poll();
00099
00105 virtual int progress() const;
00106
00111 virtual QString message() const;
00112 protected:
00117 virtual void reconfigure(KConfig*);
00118 private:
00122 bool getNvramState(thinkpad_state_struct* thinkpad_state);
00123
00127 void setNvramVolume();
00128
00132 void clearStruct(thinkpad_state_struct& thinkpad_state);
00133
00138 void showToggleMessage(QString onMessage, QString offMessage, bool state);
00139
00143 int m_progress;
00144
00148 QString m_nvramFile;
00149
00154 bool m_softwareVolume;
00155
00159 bool m_run;
00160
00165 int m_volumeStep;
00166
00170 QString m_buttonThinkpad;
00171
00175 QString m_buttonHome;
00176
00180 QString m_buttonSearch;
00181
00185 QString m_buttonMail;
00186
00190 QString m_buttonZoom;
00191
00195 void setVolume(int volume);
00196 bool retrieveVolume();
00197 int m_volume, m_oldVolume;
00198
00199 thinkpad_state_struct thinkpad_state;
00200 thinkpad_state_struct last_thinkpad_state;
00201 QDBusInterface *kmixAdaptor;
00202 QDBusInterface *kmixWindowAdaptor;
00203 };
00204
00205 }
00206
00207 #endif