diff options
-rw-r--r-- | config.h.in | 34 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/cpupanel.cpp | 4 | ||||
-rw-r--r-- | src/hdsensorslist.cpp | 155 | ||||
-rw-r--r-- | src/hdsensorslist.h | 2 | ||||
-rw-r--r-- | src/ksensors.desktop | 30 | ||||
-rw-r--r-- | src/lmsensor.cpp | 217 | ||||
-rw-r--r-- | src/lmsensor.h | 4 | ||||
-rw-r--r-- | src/lmsensors.cpp | 17 | ||||
-rw-r--r-- | src/lmsensors.h | 4 | ||||
-rw-r--r-- | src/lmsensorscfg.cpp | 2 | ||||
-rw-r--r-- | src/lmsensorscfgdesign.ui | 22 | ||||
-rw-r--r-- | src/lmsensorschip.cpp | 7 | ||||
-rw-r--r-- | src/palettecfg.cpp | 6 | ||||
-rw-r--r-- | src/processexec.cpp | 9 | ||||
-rw-r--r-- | src/processexec.h | 11 | ||||
-rw-r--r-- | src/sensorslist.h | 2 | ||||
-rw-r--r-- | src/sounds/Makefile.am | 6 |
18 files changed, 313 insertions, 221 deletions
diff --git a/config.h.in b/config.h.in index 86555c9..2ecd3ce 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,8 @@ /* 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 */ #undef HAVE_COREAUDIO @@ -85,6 +88,10 @@ /* Define a safe value for MAXPATHLEN */ #undef KDEMAXPATHLEN +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + /* Name of package */ #undef PACKAGE @@ -100,22 +107,25 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of a `char *', as computed by sizeof. */ +/* The size of `char *', as computed by sizeof. */ #undef SIZEOF_CHAR_P -/* The size of a `int', as computed by sizeof. */ +/* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT -/* The size of a `long', as computed by sizeof. */ +/* The size of `long', as computed by sizeof. */ #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 -/* The size of a `unsigned long', as computed by sizeof. */ +/* The size of `unsigned long', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_LONG /* Define to 1 if you have the ANSI C header files. */ @@ -124,9 +134,17 @@ /* Version number of package */ #undef VERSION -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#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 diff --git a/src/Makefile.am b/src/Makefile.am index 63c262d..85896d5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -43,7 +43,7 @@ ksensors_SOURCES = main.cpp ksensors.cpp aboutcfgdesign.ui \ systemcfg.cpp systemcfgdesign.ui uptimepanel.cpp 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 shelldesktopdir = $(kde_appsdir)/Utilities diff --git a/src/cpupanel.cpp b/src/cpupanel.cpp index 54b1165..2eca1e5 100644 --- a/src/cpupanel.cpp +++ b/src/cpupanel.cpp @@ -60,11 +60,11 @@ int i= str.find('('); CpuPanel::CpuPanel(QWidget *parent, const char *name) : Panel(parent,name) { - sCpu= "Unknow"; + sCpu= "Unknown"; getCpuInfoValue("model name",sCpu); adjustString(sCpu,16); - sVendor= "Unknow"; + sVendor= "Unknown"; getCpuInfoValue("vendor_id",sVendor); adjustString(sVendor,16); diff --git a/src/hdsensorslist.cpp b/src/hdsensorslist.cpp index 3f9c704..8cbfa13 100644 --- a/src/hdsensorslist.cpp +++ b/src/hdsensorslist.cpp @@ -23,7 +23,7 @@ #include <stdlib.h> #include <qstringlist.h> #include <klocale.h> -#include <regex.h> +#include <qregexp.h> #include "sensor.h" #include "hdsensorslist.h" @@ -44,28 +44,25 @@ HDSensorsList::HDSensorsList(QObject *parent, const char * name): SensorsList(pa QStringList disks; if(!getDisks(disks)) return; - ProcessExec proc; - proc << "hddtemp" << "-q"; for(QStringList::Iterator it = disks.begin(); it != disks.end(); ++it ) { + ProcessExec proc; + proc << "hddtemp" << "-q"; proc << *it; - } - - if(proc.runAndWait()) { - double value; - QString str; - for(QStringList::Iterator it = disks.begin(); it != disks.end(); ++it ) { - if(getDiskInfo(proc.getStdoutData(),*it,str,value)) { - Sensor *sensor= new Sensor(this); - sensor->setType(Sensor::lmTemp); - sensor->setName(*it); - sensor->setDescription(str); - sensor->setValueMax (40 , Sensor::dgCelsius); - sensor->setValueMin ( 0 , Sensor::dgCelsius); - sensor->setValueIdeal(value, Sensor::dgCelsius); - sensor->setValue (value, Sensor::dgCelsius); - sensor->readConfig(); - } - } + if(proc.runAndWait()) { + double value; + QString str; + if(getDiskInfo(proc.getStdoutData(),str,value)) { + Sensor *sensor= new Sensor(this); + sensor->setType(Sensor::lmTemp); + sensor->setName(*it); + sensor->setDescription(str); + sensor->setValueMax (40 , Sensor::dgCelsius); + sensor->setValueMin ( 0 , Sensor::dgCelsius); + sensor->setValueIdeal(value, Sensor::dgCelsius); + sensor->setValue (value, Sensor::dgCelsius); + sensor->readConfig(); + } + } } } @@ -90,50 +87,29 @@ void HDSensorsList::updateSensors() if(params.count()>0) { process= new ProcessExec; -#if ( KDE_VERSION_MAJOR >= 3 ) *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 *)) ); process->run(); } } - void HDSensorsList::slotProcessExited(KProcess *) { 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() ) { - qWarning("HddTemp Error:\n%s", buf); - } - - char *ptr; - regex_t *preg; - 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); + QStringList buf = QStringList::split(QChar('\n'), process->getStdoutData()); + 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")); + if (rx.search((*it)) > -1) + obj->setValue(rx.cap(1).toDouble(), Sensor::dgCelsius); } } - regfree(preg); - free(preg); - delete process; process= 0; } @@ -141,78 +117,49 @@ void HDSensorsList::slotProcessExited(KProcess *) // *************** 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; - regmatch_t pmatch[1]; - preg = (regex_t*) malloc(sizeof(regex_t)); - - // Take disk model - char reg_string[30]; - snprintf(reg_string, sizeof(reg_string), "%s: .*: [0-9]", disk.latin1()); - regcomp(preg, reg_string, REG_NEWLINE); - if (regexec(preg, buf, 1, pmatch, 0) == 0) - { - 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; + QRegExp rx(":\\s+(.+):\\s+(\\d+).*C"); + + if (rx.search(buf) > -1) { + bool ok; + name = rx.cap(1); + value = rx.cap(2).toDouble(&ok); + if (ok) + return true; + else + return false; } - - // 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); + else return false; - } - return true; } bool HDSensorsList::isHddTempInstalled() { -ProcessExec proc; + ProcessExec proc; - proc << "hddtemp" ; + proc << "hddtemp" << "-v" ; if(proc.runAndWait()) { - if(strstr(proc.getStdoutData(),"ERROR")==0) return true; - qWarning("HddTemp Error:\n%s", proc.getStdoutData()); + if(proc.getStdoutData().contains("ERROR")==0) return true; + qWarning("HddTemp Error:\n%s", proc.getStdoutData().ascii()); } return false; } bool HDSensorsList::getDisks(QStringList &disks ) { - DIR *dir= opendir("/proc/ide"); - if(!dir) return false; + DIR *dir; + + /* 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; struct dirent *ptr; while((ptr= readdir(dir))) { - if(ptr->d_name[0]=='h' && ptr->d_name[1]=='d') { - str.sprintf("/dev/hd%c",ptr->d_name[2]); + if((ptr->d_name[0]=='h' || ptr->d_name[0]=='s') && ptr->d_name[1]=='d') { + str.sprintf("/dev/%s",ptr->d_name); disks << str; } } diff --git a/src/hdsensorslist.h b/src/hdsensorslist.h index 5662858..fff3015 100644 --- a/src/hdsensorslist.h +++ b/src/hdsensorslist.h @@ -47,7 +47,7 @@ private: static bool isHddTempInstalled(); 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 diff --git a/src/ksensors.desktop b/src/ksensors.desktop index 9e58b7d..3fb39e2 100644 --- a/src/ksensors.desktop +++ b/src/ksensors.desktop @@ -1,24 +1,16 @@ [Desktop Entry] Encoding=UTF-8 -Name=ksensors -Name[xx]=xxksensorsxx +Name=KSensors Exec=ksensors Icon=ksensors Type=Application -Comment=A simple KDE Application -Comment[ca]=Una simple aplicació KDE -Comment[da]=Et simpelt KDE program -Comment[de]=Eine einfache KDE-Anwendung -Comment[el]=Μια απλή εφαρμογή του KDE -Comment[es]=Una aplicación de KDE sencilla -Comment[et]=Lihtne KDE rakendus -Comment[fr]=Une application simple pour KDE. -Comment[hu]=Egyszerű KDE-alkalmazás -Comment[it]=Una semplice applicazione 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 +Comment=A nice lmsensors frontend for KDE +Comment[cs]=Pěkné rozhraní pro lmsemsors v KDE +Comment[de]=Ein benutzerfreundliches lmsensors Frontend für KDE +Comment[es]=Un agradable lmsensors frontend para KDE +Comment[fr]=Un frontend sympatique pour lm-sensors et KDE +Comment[he]=היישום KSensors -תוכנית קידמה יפה של KDE עבור lmsensors +Comment[nb]=Ett behagelig lmsensors-grensesnitt for KDE +Comment[nl]=Een gebruiksvriendelijke interface voor KDE +Comment[pl]=Ładny frondend lmsensors dla KDE +Comment[sv]=Ett trevligt gränssnitt mot lmsensors för KDE diff --git a/src/lmsensor.cpp b/src/lmsensor.cpp index 89a79c3..6214eb2 100644 --- a/src/lmsensor.cpp +++ b/src/lmsensor.cpp @@ -30,25 +30,74 @@ LMSensor::LMSensor(SensorsList *parent): Sensor(parent) LMSensor::~LMSensor(){ } - +#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */ 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 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); max= 65; min= 0; } - else if (strstr((*data)->name, "fan")) + else if (strstr(main_name, "fan")) { setType(lmFan); max= 10000; min= 3000; } + else if (strstr(main_name, "alarm") || strstr(main_name, "sensor") || strstr(main_name, "vrm")) + { + return false; + } else { setType(lmVoltage); @@ -56,47 +105,129 @@ double min,max; 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; - str.sprintf("%s.%s", chip_name->prefix, (*data)->name ); - setName( str.latin1() ); +#else /* libsensors4 code */ - char *label; - sensors_get_label(*chip_name,feature,&label); - setDescription(QString(label)); + const sensors_subfeature *sub_feature; + const sensors_feature *feature_data = *data; + + /* 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; - while( (*data= sensors_get_all_features(*chip_name, nr1, nr2)) && (*data)->mapping!=SENSORS_NO_MAPPING) { - str= (*data)->name; - if(str.find("_min")>=0 || str.find("_low")>=0) { - sensors_get_feature(*chip_name, (*data)->number, &valMin); - valid= true; - } else - if(str.find("_max")>=0 || str.find("_over")>=0 || str.find("_high")>=0) { - sensors_get_feature(*chip_name, (*data)->number, &valMax); - valid= true; - } - } + if (!sub_feature) + return false; + + feature = sub_feature->number; + + if (!(sub_feature = sensors_get_subfeature(chip_name, feature_data, + SENSORS_SUBFEATURE_IN_MIN)) || + sensors_get_value(chip_name, sub_feature->number, &min)) + min = -16; + + 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) { - double newVal; - valid= (sensors_get_feature(*chip_name, feature, &newVal)==0); - if(valid) { - if(min>max) { - double pivot= valMin; - min= max; - max= pivot; - } - setValueMax(max,dgCelsius); - setValueMin(min,dgCelsius); - setValue((max+min)/2,dgCelsius); - readConfig(); - updateValue(); - setValueIdeal(getValue()); - } + feature = sub_feature->number; + + if (!(sub_feature = sensors_get_subfeature(chip_name, feature_data, + SENSORS_SUBFEATURE_TEMP_MIN)) || + sensors_get_value(chip_name, sub_feature->number, &min)) + min = 0; + + if ((!(sub_feature = sensors_get_subfeature(chip_name, feature_data, + SENSORS_SUBFEATURE_TEMP_MAX)) && + !(sub_feature = sensors_get_subfeature(chip_name, feature_data, + SENSORS_SUBFEATURE_TEMP_CRIT))) || + sensors_get_value(chip_name, sub_feature->number, &max)) + max = 65; + + 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() @@ -108,7 +239,11 @@ double LMSensor::readSensorValue() { double newVal; const sensors_chip_name *chip_name= getChipName(); +#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */ sensors_get_feature(*chip_name, feature, &newVal); +#else + sensors_get_value(chip_name, feature, &newVal); +#endif return newVal; } diff --git a/src/lmsensor.h b/src/lmsensor.h index 704f2fe..87250e0 100644 --- a/src/lmsensor.h +++ b/src/lmsensor.h @@ -51,7 +51,11 @@ protected: double calculateIdealValue(); +#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */ 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(); private: diff --git a/src/lmsensors.cpp b/src/lmsensors.cpp index 73b8253..073d172 100644 --- a/src/lmsensors.cpp +++ b/src/lmsensors.cpp @@ -45,17 +45,23 @@ LMSensors::~LMSensors() bool LMSensors::initSensors() { +#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */ FILE *fp=fopen("/etc/sensors.conf","r"); if(!fp) { qWarning("KSensors error: /etc/sensors.conf not found !"); return false; } +#else + FILE *fp=NULL; +#endif int err= sensors_init(fp); if(err) { qWarning("KSensors error: sensors_init fail, error code %d",err); return false; } +#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */ fclose(fp); +#endif return true; } @@ -63,12 +69,19 @@ void LMSensors::createLMSensors() { const sensors_chip_name *chip_name; int err= 0; +#if SENSORS_API_VERSION < 0x400 /* libsensor 3 code */ while( (chip_name= sensors_get_detected_chips(&err)) ) + { if( existSensor(chip_name,"temp") || existSensor(chip_name,"fan") ) { (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() @@ -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 nr1,nr2; @@ -91,10 +105,13 @@ const sensors_feature_data *sensor_data; nr1=nr2= 0; while( (sensor_data= sensors_get_all_features(*chip_name, &nr1, &nr2)) ) + { if( strstr(sensor_data->name,sensor_name) ) return sensor_data->number; + } return 0; } +#endif void LMSensors::setMonitorized(bool enable) { diff --git a/src/lmsensors.h b/src/lmsensors.h index c6fb1e7..50c20ea 100644 --- a/src/lmsensors.h +++ b/src/lmsensors.h @@ -19,7 +19,7 @@ #define LMSENSORS_H #include <qobject.h> -#include <qobjcoll.h> +#include <qobjectlist.h> #include <kconfig.h> #include <qstringlist.h> @@ -65,7 +65,9 @@ private: void createI8KSensors(); 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); +#endif }; #endif diff --git a/src/lmsensorscfg.cpp b/src/lmsensorscfg.cpp index 42c8dc2..0aab99c 100644 --- a/src/lmsensorscfg.cpp +++ b/src/lmsensorscfg.cpp @@ -29,7 +29,7 @@ #include <qgroupbox.h> #include <qradiobutton.h> #include <qpushbutton.h> -#include <qobjcoll.h> +#include <qobjectlist.h> #include <qtabwidget.h> #include <qcombobox.h> #include <qspinbox.h> diff --git a/src/lmsensorscfgdesign.ui b/src/lmsensorscfgdesign.ui index deed61d..d452b78 100644 --- a/src/lmsensorscfgdesign.ui +++ b/src/lmsensorscfgdesign.ui @@ -748,29 +748,13 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel"> + <widget class="QButtonGroup"> <property name="name"> - <cstring>TextLabel1_3_2_2_2_2</cstring> + <cstring>ButtonGroup9</cstring> </property> - <property name="text"> + <property name="title"> <string>On reach alarm value:</string> </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> <property name="name"> <cstring>unnamed</cstring> diff --git a/src/lmsensorschip.cpp b/src/lmsensorschip.cpp index 1a15493..d78a0a9 100644 --- a/src/lmsensorschip.cpp +++ b/src/lmsensorschip.cpp @@ -50,10 +50,15 @@ const sensors_chip_name *LMSensorsChip::getChipName() void LMSensorsChip::createSensors() { if(!chip_name) return; - const sensors_feature_data *data; int nr1= 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); +#else + const sensors_feature *data; + data= sensors_get_features(chip_name, &nr1); +#endif while(data) { LMSensor *sensor= new LMSensor(this); if( !sensor->init(&data,&nr1,&nr2) ) diff --git a/src/palettecfg.cpp b/src/palettecfg.cpp index 9196712..18e9d34 100644 --- a/src/palettecfg.cpp +++ b/src/palettecfg.cpp @@ -82,13 +82,7 @@ void PaletteCfg::setPanelPalette(const QPalette &pal, bool updateColorButton) { labelTitle->unsetPalette(); framePanel->setPalette(pal); -#if ( KDE_VERSION_MAJOR >= 3 ) 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()); } diff --git a/src/processexec.cpp b/src/processexec.cpp index a6137c0..ac2825c 100644 --- a/src/processexec.cpp +++ b/src/processexec.cpp @@ -37,17 +37,12 @@ bool ProcessExec::run() bool ProcessExec::runAndWait() { clearData(); - return start(Block,Communication(Stdout|Stderr)); + return start(Block,Communication(Stdout | Stderr)); } void ProcessExec::slotReceivedStdout(KProcess *proc, char *buf, int len) { - if(bufLen+len>=bufMax) len= bufMax-bufLen; - if(len) { - memcpy(buffer+bufLen,buf,len); - bufLen+= len; - buffer[bufLen]=0; - } + buffer = QString(buf); } void ProcessExec::slotReceivedStderr(KProcess *proc, char *buf, int len) diff --git a/src/processexec.h b/src/processexec.h index 81c694e..e259ca5 100644 --- a/src/processexec.h +++ b/src/processexec.h @@ -33,11 +33,11 @@ public: bool run(); bool runAndWait(); - bool outputErrors() { return fErrors; }; + bool outputErrors() { return fErrors; }; - inline char *getStdoutData() { return buffer; }; - inline int getStdoutDataLen() { return bufLen; } - inline void clearData() { bufLen= 0; buffer[0]= 0; fErrors= false; }; + inline QString getStdoutData() { return buffer; }; + inline unsigned int getStdoutDataLen() { return buffer.length(); } + inline void clearData() { buffer.truncate(0); fErrors= false; }; protected slots: @@ -47,8 +47,7 @@ protected slots: private: static const int bufMax= 1023; - char buffer[bufMax+1]; - int bufLen; + QString buffer; bool fErrors; }; diff --git a/src/sensorslist.h b/src/sensorslist.h index 2742879..a2dc7ec 100644 --- a/src/sensorslist.h +++ b/src/sensorslist.h @@ -19,7 +19,7 @@ #define SENSORSLIST_H #include <qobject.h> -#include <qobjcoll.h> +#include <qobjectlist.h> #include <kconfig.h> #include <qstringlist.h> diff --git a/src/sounds/Makefile.am b/src/sounds/Makefile.am index 3662e47..64a40e5 100644 --- a/src/sounds/Makefile.am +++ b/src/sounds/Makefile.am @@ -5,9 +5,9 @@ INCLUDES = $(all_includes) EXTRA_DIST = ksensors_alert.wav install-data-local: - $(mkinstalldirs) $(kde_datadir)/sounds - $(INSTALL_DATA) $(srcdir)/ksensors_alert.wav $(kde_datadir)/sounds/ksensors_alert.wav + $(mkinstalldirs) $(kde_sounddir) + $(INSTALL_DATA) $(srcdir)/ksensors_alert.wav $(kde_sounddir)/ksensors_alert.wav uninstall-local: - -rm -f $(kde_datadir)/sounds/ksensors_alert.wav + rm -f $(kde_sounddir)/ksensors_alert.wav ####### kdevelop will overwrite this part!!! (end)############ |