summaryrefslogtreecommitdiffstats
path: root/src/hardware.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hardware.cpp')
-rw-r--r--src/hardware.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/src/hardware.cpp b/src/hardware.cpp
index 6be19a1..a07b3e5 100644
--- a/src/hardware.cpp
+++ b/src/hardware.cpp
@@ -28,8 +28,8 @@
#include <fcntl.h>
// include QT header
-#include <qtimer.h>
-#include <qdir.h>
+#include <tqtimer.h>
+#include <tqdir.h>
// include own header
#include "hardware.h"
@@ -61,8 +61,8 @@ HardwareInfo::HardwareInfo() {
primaryBatteriesLowLevel = 7;
primaryBatteriesCriticalLevel = 2;
- allUDIs = QStringList();
- consoleKitSession = QString();
+ allUDIs = TQStringList();
+ consoleKitSession = TQString();
BatteryList.setAutoDelete( true ); // the list owns the objects
primaryBatteries = new BatteryCollection(BAT_PRIMARY);
@@ -93,9 +93,9 @@ HardwareInfo::HardwareInfo() {
updatePrimaryBatteries();
// connect to signals
- connect(dbus_HAL, SIGNAL(msgReceived_withStringString( msg_type, QString, QString )),
- this, SLOT(processMessage( msg_type, QString, QString )));
- connect(dbus_HAL, SIGNAL(backFromSuspend(int)), this, SLOT(handleResumeSignal(int)));
+ connect(dbus_HAL, TQT_SIGNAL(msgReceived_withStringString( msg_type, TQString, TQString )),
+ this, TQT_SLOT(processMessage( msg_type, TQString, TQString )));
+ connect(dbus_HAL, TQT_SIGNAL(backFromSuspend(int)), this, TQT_SLOT(handleResumeSignal(int)));
kdDebugFuncOut(trace);
}
@@ -122,7 +122,7 @@ void HardwareInfo::reconnectDBUS() {
if (!_reconnect && !dbus_HAL->isConnectedToDBUS()) {
//reconnect failed
emit dbusRunning(DBUS_NOT_RUNNING);
- QTimer::singleShot(4000, this, SLOT(reconnectDBUS()));
+ TQTimer::singleShot(4000, this, TQT_SLOT(reconnectDBUS()));
} else if (!_reconnect && dbus_HAL->isConnectedToDBUS()) {
// reset everything, we are reconnected
dbus_terminated = false;
@@ -163,7 +163,7 @@ bool HardwareInfo::reinitHardwareInfos () {
update_info_cpufreq_policy_changed = true;
update_info_primBattery_changed = true;
- allUDIs = QStringList();
+ allUDIs = TQStringList();
BatteryList.clear();
primaryBatteries = new BatteryCollection(BAT_PRIMARY);
@@ -196,7 +196,7 @@ bool HardwareInfo::reinitHardwareInfos () {
* \param message the message
* \param value an optional message value as e.g. message string
*/
-void HardwareInfo::processMessage (msg_type type, QString message, QString value) {
+void HardwareInfo::processMessage (msg_type type, TQString message, TQString value) {
kdDebugFuncIn(trace);
switch(type) {
@@ -208,7 +208,7 @@ void HardwareInfo::processMessage (msg_type type, QString message, QString value
if ( message.startsWith("dbus.terminate")){
// TODO: addapt from pdaemon
dbus_terminated = true;
- QTimer::singleShot(4000, this, SLOT(reconnectDBUS()));
+ TQTimer::singleShot(4000, this, TQT_SLOT(reconnectDBUS()));
}
else if ( message.startsWith("hal.")) {
if ( message.startsWith("hal.terminate")) {
@@ -250,7 +250,7 @@ void HardwareInfo::processMessage (msg_type type, QString message, QString value
}
}
} else if (message.startsWith("DeviceRemoved")) {
- if (allUDIs.contains(value)) {
+ if (allUDIs.tqcontains(value)) {
if (checkIfHandleDevice(value, &_type)) {
switch (_type) {
case BATTERY:
@@ -276,19 +276,19 @@ void HardwareInfo::processMessage (msg_type type, QString message, QString value
}
break;
case HAL_PROPERTY_CHANGED:
- if (!message.isEmpty() && allUDIs.contains( message )) {
+ if (!message.isEmpty() && allUDIs.tqcontains( message )) {
if (value.startsWith( "ac_adapter.present" )) {
- QTimer::singleShot(50, this, SLOT(checkACAdapterState()));
+ TQTimer::singleShot(50, this, TQT_SLOT(checkACAdapterState()));
} else if (value.startsWith( "battery." )) {
// this is a battery event
updateBatteryValues(message, value);
} else if (value.startsWith( "button.state.value" )) {
if (message.startsWith( *udis["lidclose"] )) {
- QTimer::singleShot(50, this, SLOT(checkLidcloseState()));
+ TQTimer::singleShot(50, this, TQT_SLOT(checkLidcloseState()));
}
} else if (value.startsWith( "laptop_panel")) {
if (message.startsWith( *udis["laptop_panel"] )) {
- QTimer::singleShot(50, this, SLOT(checkBrightness()));
+ TQTimer::singleShot(50, this, TQT_SLOT(checkBrightness()));
}
}
// TODO: add needed code
@@ -302,18 +302,18 @@ void HardwareInfo::processMessage (msg_type type, QString message, QString value
if (message.startsWith("ButtonPressed")) {
kdDebug() << "ButtonPressed event from HAL: " << value << endl;
if (value.startsWith("lid")) {
- QTimer::singleShot(50, this, SLOT(checkLidcloseState()));
+ TQTimer::singleShot(50, this, TQT_SLOT(checkLidcloseState()));
} else if (value.startsWith("power")) {
- QTimer::singleShot(50, this, SLOT(emitPowerButtonPressed()));
+ TQTimer::singleShot(50, this, TQT_SLOT(emitPowerButtonPressed()));
} else if (value.startsWith("sleep") || value.startsWith("suspend")) {
- QTimer::singleShot(50, this, SLOT(emitSleepButtonPressed()));
+ TQTimer::singleShot(50, this, TQT_SLOT(emitSleepButtonPressed()));
} else if (value.startsWith("hibernate")) {
- QTimer::singleShot(50, this, SLOT(emitS2diskButtonPressed()));
+ TQTimer::singleShot(50, this, TQT_SLOT(emitS2diskButtonPressed()));
} else if (value.startsWith("brightness-")) {
if (!brightness_in_hardware && value.endsWith("-up"))
- QTimer::singleShot(50, this, SLOT(brightnessUpPressed()));
+ TQTimer::singleShot(50, this, TQT_SLOT(brightnessUpPressed()));
else if (!brightness_in_hardware && value.endsWith("-down"))
- QTimer::singleShot(50, this, SLOT(brightnessDownPressed()));
+ TQTimer::singleShot(50, this, TQT_SLOT(brightnessDownPressed()));
}
} else {
kdDebug() << "Unmonitored HAL_CONDITION: " << message << " : " << value << endl;
@@ -327,7 +327,7 @@ void HardwareInfo::processMessage (msg_type type, QString message, QString value
} else {
sessionIsActive = false;
}
- QTimer::singleShot(50, this, SLOT(emitSessionActiveState()));
+ TQTimer::singleShot(50, this, TQT_SLOT(emitSessionActiveState()));
} else {
if (trace)
kdDebug() << "CONSOLEKIT_SESSION_ACTIVE: not our session" << endl;
@@ -350,7 +350,7 @@ void HardwareInfo::processMessage (msg_type type, QString message, QString value
}
/*!
- * This SLOT is used to fetch the resume signal and multiplex. If needed some
+ * This TQT_SLOT is used to fetch the resume signal and multiplex. If needed some
* actions after resume, do this here.
* \param result integer with the result of the resume/suspend
*/
@@ -367,7 +367,7 @@ void HardwareInfo::handleResumeSignal (int result) {
emit resumed(result);
}
- calledSuspend = QTime();
+ calledSuspend = TQTime();
kdDebugFuncOut(trace);
}
@@ -429,23 +429,23 @@ bool HardwareInfo::checkConsoleKitSession () {
/*!
* This function check for a given UDI, if we should handle a device
- * \param _udi QString with the UDI of the device
+ * \param _udi TQString with the UDI of the device
* \param *type pointer to a integer to return the type of the device, see \ref device_type
* \return Boolean with info if we should handle the device.
* \retval true if we should handle
* \retval false if not
*/
-bool HardwareInfo::checkIfHandleDevice ( QString _udi, int *type) {
+bool HardwareInfo::checkIfHandleDevice ( TQString _udi, int *type) {
kdDebugFuncIn(trace);
- QStringList _cap;
+ TQStringList _cap;
bool ret = true;
if (dbus_HAL->halGetPropertyStringList( _udi, "info.capabilities", &_cap) && !_cap.isEmpty()) {
- if (_cap.contains("ac_adapter")) {
+ if (_cap.tqcontains("ac_adapter")) {
*type = BATTERY;
- } else if (_cap.contains("button")) {
- QString _val;
+ } else if (_cap.tqcontains("button")) {
+ TQString _val;
if (dbus_HAL->halGetPropertyString( _udi, "button.type", &_val)) {
if (_val.startsWith("lid")) {
*type = LID;
@@ -459,9 +459,9 @@ bool HardwareInfo::checkIfHandleDevice ( QString _udi, int *type) {
} else {
ret = false;
}
- } else if (_cap.contains("battery")) {
+ } else if (_cap.tqcontains("battery")) {
*type = BATTERY;
- } else if (_cap.contains("laptop_panel")) {
+ } else if (_cap.tqcontains("laptop_panel")) {
*type = LAPTOP_PANEL;
} else {
ret = false;
@@ -515,7 +515,7 @@ void HardwareInfo::setPrimaryBatteriesWarningLevel (int _warn, int _low, int _cr
void HardwareInfo::checkIsLaptop () {
kdDebugFuncIn(trace);
- QString ret;
+ TQString ret;
if (dbus_HAL->halGetPropertyString(HAL_COMPUTER_UDI, "system.formfactor", &ret)) {
@@ -537,7 +537,7 @@ void HardwareInfo::checkIsLaptop () {
void HardwareInfo::checkPowermanagement() {
kdDebugFuncIn(trace);
- QString ret;
+ TQString ret;
has_APM = false;
has_ACPI = false;
@@ -566,7 +566,7 @@ void HardwareInfo::checkPowermanagement() {
void HardwareInfo::checkSuspend() {
kdDebugFuncIn(trace);
- QStringList ret;
+ TQStringList ret;
bool _ret_b = false;
suspend_states = SuspendStates();
@@ -579,7 +579,7 @@ void HardwareInfo::checkSuspend() {
&_ret_b )) {
suspend_states.suspend2ram_can = _ret_b;
if (_ret_b) {
- if (ret.contains( "Suspend" )) {
+ if (ret.tqcontains( "Suspend" )) {
suspend_states.suspend2ram = true;
suspend_states.suspend2ram_allowed = dbus_HAL->isUserPrivileged(PRIV_SUSPEND,
HAL_COMPUTER_UDI);
@@ -600,7 +600,7 @@ void HardwareInfo::checkSuspend() {
&_ret_b )) {
suspend_states.suspend2disk_can = _ret_b;
if (_ret_b) {
- if (ret.contains( "Hibernate" )) {
+ if (ret.tqcontains( "Hibernate" )) {
suspend_states.suspend2disk = true;
suspend_states.suspend2disk_allowed =
dbus_HAL->isUserPrivileged(PRIV_HIBERNATE,
@@ -620,7 +620,7 @@ void HardwareInfo::checkSuspend() {
if (dbus_HAL->halGetPropertyBool( HAL_COMPUTER_UDI, "power_management.can_standby", &_ret_b )) {
suspend_states.standby_can = _ret_b;
if (_ret_b) {
- if (ret.contains( "Standby" )) {
+ if (ret.tqcontains( "Standby" )) {
suspend_states.standby = true;
suspend_states.standby_allowed = dbus_HAL->isUserPrivileged(PRIV_STANDBY,
HAL_COMPUTER_UDI);
@@ -720,7 +720,7 @@ cpufreq_type HardwareInfo::checkCurrentCPUFreqPolicy() {
void HardwareInfo::checkBrightness() {
kdDebugFuncIn(trace);
- QStringList devices;
+ TQStringList devices;
brightness = false;
currentBrightnessLevel = -1;
@@ -739,8 +739,8 @@ void HardwareInfo::checkBrightness() {
kdDebug() << "laptop_panel device found: " << devices.first() << endl;
// we should asume there is only one laptop panel device in the system
if (dbus_HAL->halGetPropertyInt(devices.first(), "laptop_panel.num_levels", &retval )) {
- udis.insert("laptop_panel", new QString( devices.first() ));
- if (!allUDIs.contains( devices.first() ))
+ udis.insert("laptop_panel", new TQString( devices.first() ));
+ if (!allUDIs.tqcontains( devices.first() ))
allUDIs.append( devices.first() );
if (retval > 1) {
@@ -798,17 +798,17 @@ void HardwareInfo::checkCurrentBrightness() {
bool HardwareInfo::intialiseHWInfo() {
kdDebugFuncIn(trace);
- QStringList ret;
+ TQStringList ret;
if (!dbus_HAL->isConnectedToDBUS() || !dbus_HAL->isConnectedToHAL())
return false;
if( dbus_HAL->halFindDeviceByCapability("ac_adapter", &ret)) {
// there should be normaly only one device, but let be sure
- for ( QStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
+ for ( TQStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
// we need a deep copy
- udis.insert("acadapter", new QString( *it ));
- if (!allUDIs.contains( *it ))
+ udis.insert("acadapter", new TQString( *it ));
+ if (!allUDIs.tqcontains( *it ))
allUDIs.append( *it );
checkACAdapterState();
}
@@ -818,10 +818,10 @@ bool HardwareInfo::intialiseHWInfo() {
if( dbus_HAL->halFindDeviceByString("button.type", "lid", &ret)) {
// there should be normaly only one device, but let be sure
- for ( QStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
+ for ( TQStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
// we need a deep copy
- udis.insert("lidclose", new QString( *it ));
- if (!allUDIs.contains( *it ))
+ udis.insert("lidclose", new TQString( *it ));
+ if (!allUDIs.tqcontains( *it ))
allUDIs.append( *it );
checkLidcloseState();
}
@@ -833,8 +833,8 @@ bool HardwareInfo::intialiseHWInfo() {
if( dbus_HAL->halFindDeviceByCapability("battery", &ret)) {
if (!ret.isEmpty()) {
// there should be normaly only one device, but let be sure
- for ( QStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
- if (!allUDIs.contains( *it ))
+ for ( TQStringList::iterator it = ret.begin(); it != ret.end(); ++it ) {
+ if (!allUDIs.tqcontains( *it ))
allUDIs.append( *it );
BatteryList.append( new Battery(dbus_HAL, *it) );
}
@@ -843,7 +843,7 @@ bool HardwareInfo::intialiseHWInfo() {
Battery *bat;
for (bat = BatteryList.first(); bat; bat = BatteryList.next() ) {
if (bat->getType() == BAT_PRIMARY) {
- connect(bat, SIGNAL(changedBattery()),this, SLOT(updatePrimaryBatteries()));
+ connect(bat, TQT_SIGNAL(changedBattery()),this, TQT_SLOT(updatePrimaryBatteries()));
}
}
}
@@ -854,7 +854,7 @@ bool HardwareInfo::intialiseHWInfo() {
}
/*!
- * The function/SLOT checks the state of the AC adapter.
+ * The function/TQT_SLOT checks the state of the AC adapter.
*/
void HardwareInfo::checkACAdapterState() {
kdDebugFuncIn(trace);
@@ -866,7 +866,7 @@ void HardwareInfo::checkACAdapterState() {
if (_state != acadapter) {
acadapter = _state;
update_info_ac_changed = true;
- emit ACStatus( acadapter );
+ emit ACtqStatus( acadapter );
} else {
update_info_ac_changed = false;
}
@@ -891,7 +891,7 @@ void HardwareInfo::checkLidcloseState() {
if (dbus_HAL->halGetPropertyBool(*udis["lidclose"] , "button.state.value", &_state )) {
if (_state != lidclose) {
lidclose = _state;
- emit lidcloseStatus( lidclose );
+ emit lidclosetqStatus( lidclose );
}
} else {
lidclose = false;
@@ -904,13 +904,13 @@ void HardwareInfo::checkLidcloseState() {
/*!
* This funtion is used to call a update of a battery value for a given
* UDI and the given changed property
- * \param udi QString with the UDI of the battery
- * \param property QString with the changed property
+ * \param udi TQString with the UDI of the battery
+ * \param property TQString with the changed property
*/
-void HardwareInfo::updateBatteryValues (QString udi, QString property) {
+void HardwareInfo::updateBatteryValues (TQString udi, TQString property) {
kdDebugFuncIn(trace);
- if (!udi.isEmpty() && allUDIs.contains( udi )) {
+ if (!udi.isEmpty() && allUDIs.tqcontains( udi )) {
// find effected battery object
Battery *bat;
for (bat = BatteryList.first(); bat; bat = BatteryList.next() ) {
@@ -937,10 +937,10 @@ void HardwareInfo::updatePrimaryBatteries () {
if (primaryBatteries->getNumBatteries() < 1) {
setPrimaryBatteriesWarningLevel();
primaryBatteries->refreshInfo( BatteryList );
- connect(primaryBatteries, SIGNAL(batteryChanged()), this,
- SLOT(setPrimaryBatteriesChanges()));
- connect(primaryBatteries, SIGNAL(batteryWarnState(int,int)), this,
- SLOT(emitBatteryWARNState(int,int)));
+ connect(primaryBatteries, TQT_SIGNAL(batteryChanged()), this,
+ TQT_SLOT(setPrimaryBatteriesChanges()));
+ connect(primaryBatteries, TQT_SIGNAL(batteryWarnState(int,int)), this,
+ TQT_SLOT(emitBatteryWARNState(int,int)));
} else {
setPrimaryBatteriesWarningLevel();
primaryBatteries->refreshInfo( BatteryList );
@@ -993,7 +993,7 @@ void HardwareInfo::emitBatteryWARNState (int type, int state) {
bool HardwareInfo::suspend( suspend_type suspend ) {
kdDebugFuncIn(trace);
- calledSuspend = QTime();
+ calledSuspend = TQTime();
if (dbus_HAL->isConnectedToDBUS() && dbus_HAL->isConnectedToHAL()) {
switch (suspend) {
@@ -1133,7 +1133,7 @@ bool HardwareInfo::setCPUFreq ( cpufreq_type cpufreq, int limit ) {
if (dbus_HAL->isConnectedToDBUS() && dbus_HAL->isConnectedToHAL()) {
dbus_bool_t consider = (dbus_bool_t) getAcAdapter();
- QStringList dynamic;
+ TQStringList dynamic;
if (checkCurrentCPUFreqPolicy() == cpufreq) {
if (cpufreq == DYNAMIC && !cpuFreqGovernor.startsWith("ondemand")) {
@@ -1155,7 +1155,7 @@ bool HardwareInfo::setCPUFreq ( cpufreq_type cpufreq, int limit ) {
case DYNAMIC:
dynamic << "ondemand" << "userspace" << "conservative";
- for (QStringList::Iterator it = dynamic.begin(); it != dynamic.end(); it++){
+ for (TQStringList::Iterator it = dynamic.begin(); it != dynamic.end(); it++){
kdDebug() << "Try to set dynamic CPUFreq to: " << *it << endl;
if (setCPUFreqGovernor((*it).latin1())) {
@@ -1604,9 +1604,9 @@ BatteryCollection* HardwareInfo::getPrimaryBatteries() const {
/*!
* The function return all batteries
- * \return QPtrList<Battery>
+ * \return TQPtrList<Battery>
*/
-QPtrList<Battery> HardwareInfo::getAllBatteries() const {
+TQPtrList<Battery> HardwareInfo::getAllBatteries() const {
return BatteryList;
}