Apply build fixes

pull/1/head
Timothy Pearson 11 years ago
parent 191c434271
commit ea3a9effca

@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.in by autoheader. */ /* config.h.in. Generated from configure.in by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define if you have the CoreAudio API */ /* Define if you have the CoreAudio API */
#undef HAVE_COREAUDIO #undef HAVE_COREAUDIO
@ -85,6 +88,10 @@
/* Define a safe value for MAXPATHLEN */ /* Define a safe value for MAXPATHLEN */
#undef KDEMAXPATHLEN #undef KDEMAXPATHLEN
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */ /* Name of package */
#undef PACKAGE #undef PACKAGE
@ -100,22 +107,25 @@
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
/* The size of a `char *', as computed by sizeof. */ /* The size of `char *', as computed by sizeof. */
#undef SIZEOF_CHAR_P #undef SIZEOF_CHAR_P
/* The size of a `int', as computed by sizeof. */ /* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT #undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */ /* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG #undef SIZEOF_LONG
/* The size of a `size_t', as computed by sizeof. */ /* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T #undef SIZEOF_SIZE_T
/* The size of a `unsigned long', as computed by sizeof. */ /* The size of `unsigned long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG #undef SIZEOF_UNSIGNED_LONG
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
@ -124,9 +134,17 @@
/* Version number of package */ /* Version number of package */
#undef VERSION #undef VERSION
/* Define to 1 if your processor stores words with the most significant byte /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
first (like Motorola and SPARC, unlike Intel and VAX). */ significant byte first (like Motorola and SPARC, unlike Intel). */
#undef WORDS_BIGENDIAN #if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* /*
* jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system

@ -43,7 +43,7 @@ ksensors_SOURCES = main.cpp ksensors.cpp aboutcfgdesign.ui \
systemcfg.cpp systemcfgdesign.ui uptimepanel.cpp systemcfg.cpp systemcfgdesign.ui uptimepanel.cpp
ksensors_LDFLAGS = $(KDE_RPATH) $(all_libraries) ksensors_LDFLAGS = $(KDE_RPATH) $(all_libraries)
ksensors_LDADD = $(LIB_KDEUI) $(LIB_KDECORE) -lsensors -lm ksensors_LDADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) -lsensors -lm
# this is where the desktop file will go # this is where the desktop file will go
shelldesktopdir = $(kde_appsdir)/Utilities shelldesktopdir = $(kde_appsdir)/Utilities

@ -60,11 +60,11 @@ int i= str.find('(');
CpuPanel::CpuPanel(QWidget *parent, const char *name) : Panel(parent,name) CpuPanel::CpuPanel(QWidget *parent, const char *name) : Panel(parent,name)
{ {
sCpu= "Unknow"; sCpu= "Unknown";
getCpuInfoValue("model name",sCpu); getCpuInfoValue("model name",sCpu);
adjustString(sCpu,16); adjustString(sCpu,16);
sVendor= "Unknow"; sVendor= "Unknown";
getCpuInfoValue("vendor_id",sVendor); getCpuInfoValue("vendor_id",sVendor);
adjustString(sVendor,16); adjustString(sVendor,16);

@ -23,7 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <qstringlist.h> #include <qstringlist.h>
#include <klocale.h> #include <klocale.h>
#include <regex.h> #include <qregexp.h>
#include "sensor.h" #include "sensor.h"
#include "hdsensorslist.h" #include "hdsensorslist.h"
@ -44,28 +44,25 @@ HDSensorsList::HDSensorsList(QObject *parent, const char * name): SensorsList(pa
QStringList disks; QStringList disks;
if(!getDisks(disks)) return; if(!getDisks(disks)) return;
ProcessExec proc;
proc << "hddtemp" << "-q";
for(QStringList::Iterator it = disks.begin(); it != disks.end(); ++it ) { for(QStringList::Iterator it = disks.begin(); it != disks.end(); ++it ) {
ProcessExec proc;
proc << "hddtemp" << "-q";
proc << *it; proc << *it;
} if(proc.runAndWait()) {
double value;
if(proc.runAndWait()) { QString str;
double value; if(getDiskInfo(proc.getStdoutData(),str,value)) {
QString str; Sensor *sensor= new Sensor(this);
for(QStringList::Iterator it = disks.begin(); it != disks.end(); ++it ) { sensor->setType(Sensor::lmTemp);
if(getDiskInfo(proc.getStdoutData(),*it,str,value)) { sensor->setName(*it);
Sensor *sensor= new Sensor(this); sensor->setDescription(str);
sensor->setType(Sensor::lmTemp); sensor->setValueMax (40 , Sensor::dgCelsius);
sensor->setName(*it); sensor->setValueMin ( 0 , Sensor::dgCelsius);
sensor->setDescription(str); sensor->setValueIdeal(value, Sensor::dgCelsius);
sensor->setValueMax (40 , Sensor::dgCelsius); sensor->setValue (value, Sensor::dgCelsius);
sensor->setValueMin ( 0 , Sensor::dgCelsius); sensor->readConfig();
sensor->setValueIdeal(value, Sensor::dgCelsius); }
sensor->setValue (value, Sensor::dgCelsius); }
sensor->readConfig();
}
}
} }
} }
@ -90,50 +87,29 @@ void HDSensorsList::updateSensors()
if(params.count()>0) { if(params.count()>0) {
process= new ProcessExec; process= new ProcessExec;
#if ( KDE_VERSION_MAJOR >= 3 )
*process << "hddtemp" << "-q" << params; *process << "hddtemp" << "-q" << params;
#else
*process << "hddtemp" << "-q";
for (QStringList::Iterator it= params.begin(); it!=params.end(); ++it)
*process << *it;
#endif
connect( process, SIGNAL(processExited(KProcess *)), this, SLOT(slotProcessExited(KProcess *)) ); connect( process, SIGNAL(processExited(KProcess *)), this, SLOT(slotProcessExited(KProcess *)) );
process->run(); process->run();
} }
} }
void HDSensorsList::slotProcessExited(KProcess *) void HDSensorsList::slotProcessExited(KProcess *)
{ {
QObjectList *list= (QObjectList *)children(); QObjectList *list= (QObjectList *)children();
if(!list) return; if (!list) return;
char *buf= process->getStdoutData(); if (process->outputErrors())
qWarning("HddTemp Error:\n%s", process->getStdoutData().ascii());
if( process->outputErrors() ) { QStringList buf = QStringList::split(QChar('\n'), process->getStdoutData());
qWarning("HddTemp Error:\n%s", buf); for(QStringList::Iterator it = buf.begin(); it != buf.end(); ++it ) {
} for(Sensor *obj= (Sensor *)list->first(); obj!=0; obj= (Sensor *)list->next()) {
QRegExp rx(QString(obj->name()) + QString(":\\s+.+:\\s+(\\d+).*C"));
char *ptr; if (rx.search((*it)) > -1)
regex_t *preg; obj->setValue(rx.cap(1).toDouble(), Sensor::dgCelsius);
regmatch_t pmatch[1];
preg = (regex_t*) malloc(sizeof(regex_t));
regcomp(preg, ": [0-9]\\+.*C$", REG_NEWLINE);
for(Sensor *obj= (Sensor *)list->first(); obj!=0; obj= (Sensor *)list->next()) {
buf= strstr(buf,obj->name());
if(!buf) break;
if (regexec(preg, buf, 1, pmatch, 0) == 0)
{
ptr = buf + pmatch[0].rm_so + 2;
buf += pmatch[0].rm_eo;
obj->setValue(atof(ptr), Sensor::dgCelsius);
} }
} }
regfree(preg);
free(preg);
delete process; delete process;
process= 0; process= 0;
} }
@ -141,78 +117,49 @@ void HDSensorsList::slotProcessExited(KProcess *)
// *************** Static methods // *************** Static methods
bool HDSensorsList::getDiskInfo(const char *buf, QString disk, QString &name, double &value) bool HDSensorsList::getDiskInfo(const QString buf, QString &name, double &value)
{ {
regex_t *preg; QRegExp rx(":\\s+(.+):\\s+(\\d+).*C");
regmatch_t pmatch[1];
preg = (regex_t*) malloc(sizeof(regex_t)); if (rx.search(buf) > -1) {
bool ok;
// Take disk model name = rx.cap(1);
char reg_string[30]; value = rx.cap(2).toDouble(&ok);
snprintf(reg_string, sizeof(reg_string), "%s: .*: [0-9]", disk.latin1()); if (ok)
regcomp(preg, reg_string, REG_NEWLINE); return true;
if (regexec(preg, buf, 1, pmatch, 0) == 0) else
{ return false;
name="";
pmatch[0].rm_eo -= 3;
pmatch[0].rm_so += 10;
buf += pmatch[0].rm_so;
while (pmatch[0].rm_so < pmatch[0].rm_eo)
{
name += *buf;
buf++;
pmatch[0].rm_so++;
}
regfree(preg);
name= name.stripWhiteSpace();
if( name.length()>40 ) name= disk;
}
else
{
regfree(preg);
free(preg);
return false;
} }
else
// Take disk temperature
regcomp(preg, ": [0-9]\\+.*C$", REG_NEWLINE);
if (regexec(preg, buf, 1, pmatch, 0) == 0)
{
value= atof(buf + pmatch[0].rm_so + 2);
regfree(preg);
free(preg);
}
else
{
regfree(preg);
free(preg);
return false; return false;
}
return true;
} }
bool HDSensorsList::isHddTempInstalled() bool HDSensorsList::isHddTempInstalled()
{ {
ProcessExec proc; ProcessExec proc;
proc << "hddtemp" ; proc << "hddtemp" << "-v" ;
if(proc.runAndWait()) { if(proc.runAndWait()) {
if(strstr(proc.getStdoutData(),"ERROR")==0) return true; if(proc.getStdoutData().contains("ERROR")==0) return true;
qWarning("HddTemp Error:\n%s", proc.getStdoutData()); qWarning("HddTemp Error:\n%s", proc.getStdoutData().ascii());
} }
return false; return false;
} }
bool HDSensorsList::getDisks(QStringList &disks ) bool HDSensorsList::getDisks(QStringList &disks )
{ {
DIR *dir= opendir("/proc/ide"); DIR *dir;
if(!dir) return false;
/* Get a listing of the hard drives looking under sysfs first then falling back to /proc/ide */
if((dir = opendir ("/sys/block")) == NULL)
if ((dir = opendir ("/proc/ide")) == NULL)
return false;
QString str; QString str;
struct dirent *ptr; struct dirent *ptr;
while((ptr= readdir(dir))) { while((ptr= readdir(dir))) {
if(ptr->d_name[0]=='h' && ptr->d_name[1]=='d') { if((ptr->d_name[0]=='h' || ptr->d_name[0]=='s') && ptr->d_name[1]=='d') {
str.sprintf("/dev/hd%c",ptr->d_name[2]); str.sprintf("/dev/%s",ptr->d_name);
disks << str; disks << str;
} }
} }

@ -47,7 +47,7 @@ private:
static bool isHddTempInstalled(); static bool isHddTempInstalled();
static bool getDisks(QStringList &disks); static bool getDisks(QStringList &disks);
static bool getDiskInfo(const char *buf, QString disk, QString &name, double &value); static bool getDiskInfo(const QString buf, QString &name, double &value);
}; };
#endif #endif

@ -1,24 +1,16 @@
[Desktop Entry] [Desktop Entry]
Encoding=UTF-8 Encoding=UTF-8
Name=ksensors Name=KSensors
Name[xx]=xxksensorsxx
Exec=ksensors Exec=ksensors
Icon=ksensors Icon=ksensors
Type=Application Type=Application
Comment=A simple KDE Application Comment=A nice lmsensors frontend for KDE
Comment[ca]=Una simple aplicació KDE Comment[cs]=Pěkné rozhraní pro lmsemsors v KDE
Comment[da]=Et simpelt KDE program Comment[de]=Ein benutzerfreundliches lmsensors Frontend für KDE
Comment[de]=Eine einfache KDE-Anwendung Comment[es]=Un agradable lmsensors frontend para KDE
Comment[el]=Μια απλή εφαρμογή του KDE Comment[fr]=Un frontend sympatique pour lm-sensors et KDE
Comment[es]=Una aplicación de KDE sencilla Comment[he]=היישום KSensors -תוכנית קידמה יפה של KDE עבור lmsensors
Comment[et]=Lihtne KDE rakendus Comment[nb]=Ett behagelig lmsensors-grensesnitt for KDE
Comment[fr]=Une application simple pour KDE. Comment[nl]=Een gebruiksvriendelijke interface voor KDE
Comment[hu]=Egyszerű KDE-alkalmazás Comment[pl]=Ładny frondend lmsensors dla KDE
Comment[it]=Una semplice applicazione KDE Comment[sv]=Ett trevligt gränssnitt mot lmsensors för KDE
Comment[pt]=Uma aplicação KDE simples
Comment[pt_BR]=Um simples Aplicativo do KDE
Comment[ru]=Простое приложение KDE
Comment[sl]=Preprost program za KDE
Comment[sr]=Проста KDE-ова апликација
Comment[sv]=Ett enkelt KDE-program
Comment[xx]=xxA simple KDE Applicationxx

@ -30,25 +30,74 @@ LMSensor::LMSensor(SensorsList *parent): Sensor(parent)
LMSensor::~LMSensor(){ LMSensor::~LMSensor(){
} }
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
bool LMSensor::init(const sensors_feature_data **data, int *nr1,int *nr2) bool LMSensor::init(const sensors_feature_data **data, int *nr1,int *nr2)
#else
bool LMSensor::init(const sensors_feature **data, int *nr1, int *nr2)
#endif
{ {
double min,max; double min,max;
const sensors_chip_name *chip_name= getChipName(); const sensors_chip_name *chip_name= getChipName();
const char* main_name = (*data)->name;
feature= (*data)->number;
char *label = NULL;
QString uniqueSensorName;
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
uniqueSensorName.sprintf("%s_%d_%d.%s", chip_name->prefix, chip_name->bus, chip_name->addr, main_name);
#else
uniqueSensorName.sprintf("%s_%d_%d.%s", chip_name->prefix, chip_name->bus.nr, chip_name->addr, main_name);
#endif
setName(uniqueSensorName.latin1());
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
bool min_found=false;
bool max_found=false;
while( (*data= sensors_get_all_features(*chip_name, nr1, nr2)) && (*data)->mapping!=SENSORS_NO_MAPPING) {
int len = strlen((*data)->name);
const char *postfix = (*data)->name + len - 4;
if (len < 5)
continue;
if((!strcmp(postfix, "_min") || !strcmp(postfix, "_low")) &&
!sensors_get_feature(*chip_name, (*data)->number, &valMin))
min_found=true;
if(!strcmp(postfix, "_max") &&
!sensors_get_feature(*chip_name, (*data)->number, &valMax)) {
max_found=true;
continue;
}
postfix--;
if((!strcmp(postfix, "_over") || !strcmp(postfix, "_high")) &&
!sensors_get_feature(*chip_name, (*data)->number, &valMax))
max_found=true;
}
double newVal;
if ((sensors_get_ignored(*chip_name, feature) != 1) || (sensors_get_feature(*chip_name, feature, &newVal) != 0)) {
return false;
}
if (strstr((*data)->name, "temp")) if (strstr(main_name, "temp"))
{ {
setType(lmTemp); setType(lmTemp);
max= 65; max= 65;
min= 0; min= 0;
} }
else if (strstr((*data)->name, "fan")) else if (strstr(main_name, "fan"))
{ {
setType(lmFan); setType(lmFan);
max= 10000; max= 10000;
min= 3000; min= 3000;
} }
else if (strstr(main_name, "alarm") || strstr(main_name, "sensor") || strstr(main_name, "vrm"))
{
return false;
}
else else
{ {
setType(lmVoltage); setType(lmVoltage);
@ -56,47 +105,129 @@ double min,max;
min= -16; min= -16;
} }
feature= (*data)->number; sensors_get_label(*chip_name,feature,&label);
if (label)
{
setDescription(QString(label));
delete label;
label = NULL;
}
else
{
setDescription(uniqueSensorName.latin1());
}
if(min_found)
min = valMin;
if(max_found)
max = valMax;
QString str; #else /* libsensors4 code */
str.sprintf("%s.%s", chip_name->prefix, (*data)->name );
setName( str.latin1() );
char *label; const sensors_subfeature *sub_feature;
sensors_get_label(*chip_name,feature,&label); const sensors_feature *feature_data = *data;
setDescription(QString(label));
/* Move to next feature for the loop in LMSensorsChip::createSensors() */
*data = sensors_get_features(chip_name, nr1);
switch(feature_data->type)
{
case SENSORS_FEATURE_IN:
sub_feature = sensors_get_subfeature(chip_name, feature_data,
SENSORS_SUBFEATURE_IN_INPUT);
bool valid= false; if (!sub_feature)
while( (*data= sensors_get_all_features(*chip_name, nr1, nr2)) && (*data)->mapping!=SENSORS_NO_MAPPING) { return false;
str= (*data)->name;
if(str.find("_min")>=0 || str.find("_low")>=0) { feature = sub_feature->number;
sensors_get_feature(*chip_name, (*data)->number, &valMin);
valid= true; if (!(sub_feature = sensors_get_subfeature(chip_name, feature_data,
} else SENSORS_SUBFEATURE_IN_MIN)) ||
if(str.find("_max")>=0 || str.find("_over")>=0 || str.find("_high")>=0) { sensors_get_value(chip_name, sub_feature->number, &min))
sensors_get_feature(*chip_name, (*data)->number, &valMax); min = -16;
valid= true;
} if (!(sub_feature = sensors_get_subfeature(chip_name, feature_data,
} SENSORS_SUBFEATURE_IN_MAX)) ||
sensors_get_value(chip_name, sub_feature->number, &max))
max = 16;
setType(lmVoltage);
break;
case SENSORS_FEATURE_FAN:
sub_feature = sensors_get_subfeature(chip_name, feature_data,
SENSORS_SUBFEATURE_FAN_INPUT);
if (!sub_feature)
return false;
feature = sub_feature->number;
if (!(sub_feature = sensors_get_subfeature(chip_name, feature_data,
SENSORS_SUBFEATURE_FAN_MIN)) ||
sensors_get_value(chip_name, sub_feature->number, &min))
min = 3000;
max = 10000;
setType(lmFan);
break;
case SENSORS_FEATURE_TEMP:
sub_feature = sensors_get_subfeature(chip_name, feature_data,
SENSORS_SUBFEATURE_TEMP_INPUT);
if (!sub_feature)
return false;
if(valid) { feature = sub_feature->number;
double newVal;
valid= (sensors_get_feature(*chip_name, feature, &newVal)==0); if (!(sub_feature = sensors_get_subfeature(chip_name, feature_data,
if(valid) { SENSORS_SUBFEATURE_TEMP_MIN)) ||
if(min>max) { sensors_get_value(chip_name, sub_feature->number, &min))
double pivot= valMin; min = 0;
min= max;
max= pivot; if ((!(sub_feature = sensors_get_subfeature(chip_name, feature_data,
} SENSORS_SUBFEATURE_TEMP_MAX)) &&
setValueMax(max,dgCelsius); !(sub_feature = sensors_get_subfeature(chip_name, feature_data,
setValueMin(min,dgCelsius); SENSORS_SUBFEATURE_TEMP_CRIT))) ||
setValue((max+min)/2,dgCelsius); sensors_get_value(chip_name, sub_feature->number, &max))
readConfig(); max = 65;
updateValue();
setValueIdeal(getValue()); setType(lmTemp);
} break;
default:
return false;
}
label = sensors_get_label(chip_name, feature_data);
if (label)
{
setDescription(QString(label));
delete label;
label = NULL;
}
else
setDescription( uniqueSensorName.latin1() );
#endif /* libsensors3 / libsensors4 code */
if(min>max) {
double pivot= min;
min= max;
max= pivot;
} }
return valid;
setValueMax(max,dgCelsius);
setValueMin(min,dgCelsius);
readConfig();
updateValue();
setValueIdeal(getValue());
return true;
} }
void LMSensor::updateValue() void LMSensor::updateValue()
@ -108,7 +239,11 @@ double LMSensor::readSensorValue()
{ {
double newVal; double newVal;
const sensors_chip_name *chip_name= getChipName(); const sensors_chip_name *chip_name= getChipName();
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
sensors_get_feature(*chip_name, feature, &newVal); sensors_get_feature(*chip_name, feature, &newVal);
#else
sensors_get_value(chip_name, feature, &newVal);
#endif
return newVal; return newVal;
} }

@ -51,7 +51,11 @@ protected:
double calculateIdealValue(); double calculateIdealValue();
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
bool init(const sensors_feature_data **data, int *nr1,int *nr2); bool init(const sensors_feature_data **data, int *nr1,int *nr2);
#else
bool init(const sensors_feature **data, int *nr1,int *nr2);
#endif
const sensors_chip_name *getChipName(); const sensors_chip_name *getChipName();
private: private:

@ -45,17 +45,23 @@ LMSensors::~LMSensors()
bool LMSensors::initSensors() bool LMSensors::initSensors()
{ {
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
FILE *fp=fopen("/etc/sensors.conf","r"); FILE *fp=fopen("/etc/sensors.conf","r");
if(!fp) { if(!fp) {
qWarning("KSensors error: /etc/sensors.conf not found !"); qWarning("KSensors error: /etc/sensors.conf not found !");
return false; return false;
} }
#else
FILE *fp=NULL;
#endif
int err= sensors_init(fp); int err= sensors_init(fp);
if(err) { if(err) {
qWarning("KSensors error: sensors_init fail, error code %d",err); qWarning("KSensors error: sensors_init fail, error code %d",err);
return false; return false;
} }
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
fclose(fp); fclose(fp);
#endif
return true; return true;
} }
@ -63,12 +69,19 @@ void LMSensors::createLMSensors()
{ {
const sensors_chip_name *chip_name; const sensors_chip_name *chip_name;
int err= 0; int err= 0;
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
while( (chip_name= sensors_get_detected_chips(&err)) ) while( (chip_name= sensors_get_detected_chips(&err)) )
{
if( existSensor(chip_name,"temp") || if( existSensor(chip_name,"temp") ||
existSensor(chip_name,"fan") ) existSensor(chip_name,"fan") )
{ {
(void)new LMSensorsChip(chip_name,this); (void)new LMSensorsChip(chip_name,this);
} }
}
#else
while( (chip_name= sensors_get_detected_chips(NULL, &err)) )
(void)new LMSensorsChip(chip_name,this);
#endif
} }
void LMSensors::createHDSensors() void LMSensors::createHDSensors()
@ -84,6 +97,7 @@ void LMSensors::createI8KSensors()
} }
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
int LMSensors::existSensor(const sensors_chip_name *chip_name,const char *sensor_name) int LMSensors::existSensor(const sensors_chip_name *chip_name,const char *sensor_name)
{ {
int nr1,nr2; int nr1,nr2;
@ -91,10 +105,13 @@ const sensors_feature_data *sensor_data;
nr1=nr2= 0; nr1=nr2= 0;
while( (sensor_data= sensors_get_all_features(*chip_name, &nr1, &nr2)) ) while( (sensor_data= sensors_get_all_features(*chip_name, &nr1, &nr2)) )
{
if( strstr(sensor_data->name,sensor_name) ) if( strstr(sensor_data->name,sensor_name) )
return sensor_data->number; return sensor_data->number;
}
return 0; return 0;
} }
#endif
void LMSensors::setMonitorized(bool enable) void LMSensors::setMonitorized(bool enable)
{ {

@ -19,7 +19,7 @@
#define LMSENSORS_H #define LMSENSORS_H
#include <qobject.h> #include <qobject.h>
#include <qobjcoll.h> #include <qobjectlist.h>
#include <kconfig.h> #include <kconfig.h>
#include <qstringlist.h> #include <qstringlist.h>
@ -65,7 +65,9 @@ private:
void createI8KSensors(); void createI8KSensors();
void childEvent ( QChildEvent *e ); void childEvent ( QChildEvent *e );
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
static int existSensor(const sensors_chip_name *chip_name,const char *sensor_name); static int existSensor(const sensors_chip_name *chip_name,const char *sensor_name);
#endif
}; };
#endif #endif

@ -29,7 +29,7 @@
#include <qgroupbox.h> #include <qgroupbox.h>
#include <qradiobutton.h> #include <qradiobutton.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qobjcoll.h> #include <qobjectlist.h>
#include <qtabwidget.h> #include <qtabwidget.h>
#include <qcombobox.h> #include <qcombobox.h>
#include <qspinbox.h> #include <qspinbox.h>

@ -748,29 +748,13 @@
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="QLabel"> <widget class="QButtonGroup">
<property name="name"> <property name="name">
<cstring>TextLabel1_3_2_2_2_2</cstring> <cstring>ButtonGroup9</cstring>
</property> </property>
<property name="text"> <property name="title">
<string>On reach alarm value:</string> <string>On reach alarm value:</string>
</property> </property>
</widget>
<widget class="QFrame">
<property name="name">
<cstring>Frame11_2_2_2</cstring>
</property>
<property name="frameShape">
<enum>HLine</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout9</cstring>
</property>
<grid> <grid>
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>unnamed</cstring>

@ -50,10 +50,15 @@ const sensors_chip_name *LMSensorsChip::getChipName()
void LMSensorsChip::createSensors() void LMSensorsChip::createSensors()
{ {
if(!chip_name) return; if(!chip_name) return;
const sensors_feature_data *data;
int nr1= 0; int nr1= 0;
int nr2= 0; int nr2= 0;
#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */
const sensors_feature_data *data;
data= sensors_get_all_features(*chip_name, &nr1, &nr2); data= sensors_get_all_features(*chip_name, &nr1, &nr2);
#else
const sensors_feature *data;
data= sensors_get_features(chip_name, &nr1);
#endif
while(data) { while(data) {
LMSensor *sensor= new LMSensor(this); LMSensor *sensor= new LMSensor(this);
if( !sensor->init(&data,&nr1,&nr2) ) if( !sensor->init(&data,&nr1,&nr2) )

@ -82,13 +82,7 @@ void PaletteCfg::setPanelPalette(const QPalette &pal, bool updateColorButton)
{ {
labelTitle->unsetPalette(); labelTitle->unsetPalette();
framePanel->setPalette(pal); framePanel->setPalette(pal);
#if ( KDE_VERSION_MAJOR >= 3 )
labelTitle->setPaletteForegroundColor(pal.active().text()); labelTitle->setPaletteForegroundColor(pal.active().text());
#else
QPalette p= labelTitle->palette();
p.setColor(QColorGroup::Foreground,pal.active().text());
labelTitle->setPalette(p);
#endif
if(updateColorButton) slotComboSelected(comboSelect->currentItem()); if(updateColorButton) slotComboSelected(comboSelect->currentItem());
} }

@ -37,17 +37,12 @@ bool ProcessExec::run()
bool ProcessExec::runAndWait() bool ProcessExec::runAndWait()
{ {
clearData(); clearData();
return start(Block,Communication(Stdout|Stderr)); return start(Block,Communication(Stdout | Stderr));
} }
void ProcessExec::slotReceivedStdout(KProcess *proc, char *buf, int len) void ProcessExec::slotReceivedStdout(KProcess *proc, char *buf, int len)
{ {
if(bufLen+len>=bufMax) len= bufMax-bufLen; buffer = QString(buf);
if(len) {
memcpy(buffer+bufLen,buf,len);
bufLen+= len;
buffer[bufLen]=0;
}
} }
void ProcessExec::slotReceivedStderr(KProcess *proc, char *buf, int len) void ProcessExec::slotReceivedStderr(KProcess *proc, char *buf, int len)

@ -33,11 +33,11 @@ public:
bool run(); bool run();
bool runAndWait(); bool runAndWait();
bool outputErrors() { return fErrors; }; bool outputErrors() { return fErrors; };
inline char *getStdoutData() { return buffer; }; inline QString getStdoutData() { return buffer; };
inline int getStdoutDataLen() { return bufLen; } inline unsigned int getStdoutDataLen() { return buffer.length(); }
inline void clearData() { bufLen= 0; buffer[0]= 0; fErrors= false; }; inline void clearData() { buffer.truncate(0); fErrors= false; };
protected slots: protected slots:
@ -47,8 +47,7 @@ protected slots:
private: private:
static const int bufMax= 1023; static const int bufMax= 1023;
char buffer[bufMax+1]; QString buffer;
int bufLen;
bool fErrors; bool fErrors;
}; };

@ -19,7 +19,7 @@
#define SENSORSLIST_H #define SENSORSLIST_H
#include <qobject.h> #include <qobject.h>
#include <qobjcoll.h> #include <qobjectlist.h>
#include <kconfig.h> #include <kconfig.h>
#include <qstringlist.h> #include <qstringlist.h>

@ -5,9 +5,9 @@ INCLUDES = $(all_includes)
EXTRA_DIST = ksensors_alert.wav EXTRA_DIST = ksensors_alert.wav
install-data-local: install-data-local:
$(mkinstalldirs) $(kde_datadir)/sounds $(mkinstalldirs) $(kde_sounddir)
$(INSTALL_DATA) $(srcdir)/ksensors_alert.wav $(kde_datadir)/sounds/ksensors_alert.wav $(INSTALL_DATA) $(srcdir)/ksensors_alert.wav $(kde_sounddir)/ksensors_alert.wav
uninstall-local: uninstall-local:
-rm -f $(kde_datadir)/sounds/ksensors_alert.wav rm -f $(kde_sounddir)/ksensors_alert.wav
####### kdevelop will overwrite this part!!! (end)############ ####### kdevelop will overwrite this part!!! (end)############

Loading…
Cancel
Save