|
Lines 31-36
Link Here
|
| 31 |
#include <sys/types.h> |
31 |
#include <sys/types.h> |
| 32 |
#include <unistd.h> |
32 |
#include <unistd.h> |
| 33 |
|
33 |
|
|
|
34 |
#include <algorithm> |
| 35 |
|
| 34 |
#include "generic_monitor.h" |
36 |
#include "generic_monitor.h" |
| 35 |
#include "kmilointerface.h" |
37 |
#include "kmilointerface.h" |
| 36 |
#include <tqmessagebox.h> |
38 |
#include <tqmessagebox.h> |
|
Lines 43-49
Link Here
|
| 43 |
using namespace KMilo; |
45 |
using namespace KMilo; |
| 44 |
|
46 |
|
| 45 |
GenericMonitor::GenericMonitor(TQObject *parent, const char *name, const TQStringList& args) |
47 |
GenericMonitor::GenericMonitor(TQObject *parent, const char *name, const TQStringList& args) |
| 46 |
: Monitor(parent, name, args) |
48 |
: Monitor(parent, name, args), tPowerSave(NULL) |
| 47 |
{ |
49 |
{ |
| 48 |
_poll = false; |
50 |
_poll = false; |
| 49 |
m_displayType = Monitor::None; |
51 |
m_displayType = Monitor::None; |
|
Lines 69-79
Link Here
|
| 69 |
|
71 |
|
| 70 |
bool GenericMonitor::init() |
72 |
bool GenericMonitor::init() |
| 71 |
{ |
73 |
{ |
| 72 |
TDEConfig config(CONFIG_FILE); |
74 |
config = new TDEConfig(CONFIG_FILE); |
| 73 |
reconfigure(&config); |
75 |
//TDEConfig config(CONFIG_FILE); |
|
|
76 |
reconfigure(config); |
| 74 |
|
77 |
|
| 75 |
//config = new TDEConfig("kmilodrc"); |
78 |
//config.setGroup("kubuntu"); |
| 76 |
config.setGroup("kubuntu"); |
|
|
| 77 |
|
79 |
|
| 78 |
if(!m_enabled) |
80 |
if(!m_enabled) |
| 79 |
return false; // exit early if we are not supposed to run |
81 |
return false; // exit early if we are not supposed to run |
|
Lines 95-103
Link Here
|
| 95 |
{ "FastVolumeDown", TQt::Key_VolumeDown, TQT_SLOT(fastVolumeDown()) }, |
97 |
{ "FastVolumeDown", TQt::Key_VolumeDown, TQT_SLOT(fastVolumeDown()) }, |
| 96 |
{ "SlowVolumeUp", TQt::CTRL+TQt::Key_VolumeUp, TQT_SLOT(slowVolumeUp()) }, |
98 |
{ "SlowVolumeUp", TQt::CTRL+TQt::Key_VolumeUp, TQT_SLOT(slowVolumeUp()) }, |
| 97 |
{ "SlowVolumeDown", TQt::CTRL+TQt::Key_VolumeDown, TQT_SLOT(slowVolumeDown()) }, |
99 |
{ "SlowVolumeDown", TQt::CTRL+TQt::Key_VolumeDown, TQT_SLOT(slowVolumeDown()) }, |
| 98 |
{ "Mute", TDEShortcut("XF86AudioMute"), TQT_SLOT(mute()) } |
100 |
{ "Mute", TDEShortcut("XF86AudioMute"), TQT_SLOT(mute()) }, |
|
|
101 |
{ "BrightnessUp", TDEShortcut("XF86MonBrightnessUp"), TQT_SLOT(brightnessUp()) }, |
| 102 |
{ "BrightnessDown", TDEShortcut("XF86MonBrightnessDown"), TQT_SLOT(brightnessDown()) } |
| 99 |
}; |
103 |
}; |
| 100 |
|
104 |
|
|
|
105 |
|
| 101 |
ga = new TDEGlobalAccel(this, "miloGenericAccel"); |
106 |
ga = new TDEGlobalAccel(this, "miloGenericAccel"); |
| 102 |
|
107 |
|
| 103 |
ShortcutInfo si; |
108 |
ShortcutInfo si; |
|
Lines 114-122
Link Here
|
| 114 |
ga->readSettings(); |
119 |
ga->readSettings(); |
| 115 |
ga->updateConnections(); |
120 |
ga->updateConnections(); |
| 116 |
|
121 |
|
| 117 |
kmixClient = new DCOPRef("kmix", "Mixer0"); |
122 |
kmixClient = new DCOPRef("kmix", "MixerMaster"); |
| 118 |
kmixWindow = new DCOPRef("kmix", "kmix-mainwindow#1"); |
123 |
kmixWindow = new DCOPRef("kmix", "kmix-mainwindow#1"); |
| 119 |
|
124 |
|
|
|
125 |
tPowerSave = new DCOPRef("tdepowersave", "tdepowersaveIface"); |
| 126 |
|
| 120 |
return true; |
127 |
return true; |
| 121 |
} |
128 |
} |
| 122 |
|
129 |
|
|
Lines 151-157
Link Here
|
| 151 |
|
158 |
|
| 152 |
if (!reply.isValid()) |
159 |
if (!reply.isValid()) |
| 153 |
{ |
160 |
{ |
| 154 |
kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop" |
161 |
kdDebug() << "KMilo: GenericMonitor could not access kmix/MixerMaster via dcop" |
| 155 |
<< endl; |
162 |
<< endl; |
| 156 |
_interface->displayText(i18n("It seems that KMix is not running.")); |
163 |
_interface->displayText(i18n("It seems that KMix is not running.")); |
| 157 |
|
164 |
|
|
Lines 196-202
Link Here
|
| 196 |
|
203 |
|
| 197 |
if (kmix_error) |
204 |
if (kmix_error) |
| 198 |
{ |
205 |
{ |
| 199 |
kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop" |
206 |
kdDebug() << "KMilo: GenericMonitor could not access kmix/MixerMaster via dcop" |
| 200 |
<< endl; |
207 |
<< endl; |
| 201 |
_interface->displayText(i18n("It seems that KMix is not running.")); |
208 |
_interface->displayText(i18n("It seems that KMix is not running.")); |
| 202 |
|
209 |
|
|
Lines 294-300
Link Here
|
| 294 |
|
301 |
|
| 295 |
if (kmix_error) |
302 |
if (kmix_error) |
| 296 |
{ |
303 |
{ |
| 297 |
kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop" |
304 |
kdDebug() << "KMilo: GenericMonitor could not access kmix/MixerMaster via dcop" |
| 298 |
<< endl; |
305 |
<< endl; |
| 299 |
_interface->displayText(i18n("It seems that KMix is not running.")); |
306 |
_interface->displayText(i18n("It seems that KMix is not running.")); |
| 300 |
|
307 |
|
|
Lines 325-330
Link Here
|
| 325 |
_interface->displayText(muteText); |
332 |
_interface->displayText(muteText); |
| 326 |
} |
333 |
} |
| 327 |
|
334 |
|
|
|
335 |
void GenericMonitor::brightnessUp() |
| 336 |
{ |
| 337 |
if(!tPowerSave) return; |
| 338 |
|
| 339 |
DCOPReply reply = tPowerSave->call("brightnessGet"); |
| 340 |
if(reply.isValid()) { |
| 341 |
int lev = 100+(int)reply; |
| 342 |
_interface->displayProgress(i18n("Brightness"), std::min(100,lev+5)); |
| 343 |
tPowerSave->send("do_brightnessUp", std::min(5,100-lev)); |
| 344 |
} |
| 345 |
} |
| 346 |
|
| 347 |
void GenericMonitor::brightnessDown() |
| 348 |
{ |
| 349 |
if(!tPowerSave) return; |
| 350 |
|
| 351 |
DCOPReply reply = tPowerSave->call("brightnessGet"); |
| 352 |
if(reply.isValid()) { |
| 353 |
int lev = 100+(int)reply; |
| 354 |
_interface->displayProgress(i18n("Brightness"), std::max(5,lev-5)); |
| 355 |
if((lev=std::min(5,lev-5)) > 0) tPowerSave->send("do_brightnessDown", lev); |
| 356 |
} |
| 357 |
} |
| 358 |
|
| 328 |
int GenericMonitor::progress() const |
359 |
int GenericMonitor::progress() const |
| 329 |
{ |
360 |
{ |
| 330 |
return m_progress; |
361 |
return m_progress; |