Updated to use new standalone tdehw library.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/5/head
Slávek Banko 4 years ago
parent d7fce8ee6a
commit dc16d7e588
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -43,6 +43,7 @@ tde_setup_paths( )
option( WITH_ALL_OPTIONS "Enable all optional support" OFF ) option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} ) option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
option( WITH_TDEHWLIB "Enable TDE hardware library support" ${WITH_ALL_OPTIONS} )
option( WITH_NVCONTROL "Build with NVidia control support" ${WITH_ALL_OPTIONS} ) option( WITH_NVCONTROL "Build with NVidia control support" ${WITH_ALL_OPTIONS} )

@ -25,6 +25,26 @@ if( WITH_GCC_VISIBILITY )
endif( WITH_GCC_VISIBILITY ) endif( WITH_GCC_VISIBILITY )
##### check for tdehwlib
if( WITH_TDEHWLIB )
tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" )
check_cxx_source_compiles( "
#include <kdemacros.h>
#ifndef __TDE_HAVE_TDEHWLIB
#error tdecore is not build with tdehwlib
#endif
int main() { return 0; } "
HAVE_TDEHWLIB
)
tde_restore( CMAKE_REQUIRED_INCLUDES )
if( NOT HAVE_TDEHWLIB )
tde_message_fatal( "tdehwlib is required, but not built in tdecore" )
endif( NOT HAVE_TDEHWLIB )
set( TDEHW_LIBRARIES "tdehw-shared" )
endif( )
##### check for NVidia support ##### check for NVidia support
if( WITH_NVCONTROL ) if( WITH_NVCONTROL )

@ -7,5 +7,8 @@
significant byte first (like Motorola and SPARC, unlike Intel). */ significant byte first (like Motorola and SPARC, unlike Intel). */
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@ #cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
/* Defined if tdelibs are built with tdehw library */
#cmakedefine HAVE_TDEHWLIB @HAVE_TDEHWLIB@
/* Defined if you have <NVCtrlLib.h> header */ /* Defined if you have <NVCtrlLib.h> header */
#cmakedefine HAVE_NVCONTROL @HAVE_NVCONTROL@ #cmakedefine HAVE_NVCONTROL @HAVE_NVCONTROL@

@ -42,6 +42,7 @@ tde_add_library( sources STATIC_PIC AUTOMOC
uptimesrc.cpp uptimesrc.cpp
LINK LINK
tdecore-shared tdecore-shared
${TDEHW_LIBRARIES}
${NVCONTROL_LIBRARIES} ${NVCONTROL_LIBRARIES}
${XEXT_LIBRARIES} ${XEXT_LIBRARIES}
) )

@ -22,7 +22,7 @@
#include <tdelocale.h> #include <tdelocale.h>
#include <kdebug.h> #include <kdebug.h>
#ifdef __TDE_HAVE_TDEHWLIB #ifdef HAVE_TDEWHLIB
#include <tdehardwaredevices.h> #include <tdehardwaredevices.h>
#endif #endif
@ -31,7 +31,7 @@ BatterySrc::BatterySrc(TQWidget* inParent, TQString inUDI):
mTrigger(this, 5000), mTrigger(this, 5000),
mUDI(inUDI), mUDI(inUDI),
mHardwareDevices(NULL){ mHardwareDevices(NULL){
#ifdef __TDE_HAVE_TDEHWLIB #ifdef HAVE_TDEHWLIB
mHardwareDevices = TDEGlobal::hardwareDevices(); mHardwareDevices = TDEGlobal::hardwareDevices();
TDEGenericDevice* hwdevice = mHardwareDevices->findByUniqueID(inUDI); TDEGenericDevice* hwdevice = mHardwareDevices->findByUniqueID(inUDI);
@ -52,7 +52,7 @@ BatterySrc::~BatterySrc(){
std::list<Source*>BatterySrc::createInstances(TQWidget* inParent){ std::list<Source*>BatterySrc::createInstances(TQWidget* inParent){
std::list<Source*> list; std::list<Source*> list;
#ifdef __TDE_HAVE_TDEHWLIB #ifdef HAVE_TDEHWLIB
TDEHardwareDevices* hardwareDevices = TDEGlobal::hardwareDevices(); TDEHardwareDevices* hardwareDevices = TDEGlobal::hardwareDevices();
TDEGenericHardwareList hwlist = hardwareDevices->listAllPhysicalDevices(); TDEGenericHardwareList hwlist = hardwareDevices->listAllPhysicalDevices();
TDEGenericDevice *hwdevice; TDEGenericDevice *hwdevice;
@ -67,7 +67,7 @@ std::list<Source*>BatterySrc::createInstances(TQWidget* inParent){
TQString BatterySrc::fetchValue() { TQString BatterySrc::fetchValue() {
TQString s = "n/a"; TQString s = "n/a";
#ifdef __TDE_HAVE_TDEHWLIB #ifdef HAVE_TDEHWLIB
if (mHardwareDevices != NULL) { if (mHardwareDevices != NULL) {
TDEGenericDevice* hwdevice = mHardwareDevices->findByUniqueID(mUDI); TDEGenericDevice* hwdevice = mHardwareDevices->findByUniqueID(mUDI);
if (hwdevice->type() != TDEGenericDeviceType::Battery) { if (hwdevice->type() != TDEGenericDeviceType::Battery) {

@ -26,7 +26,7 @@
#include <tqstring.h> #include <tqstring.h>
#include <list> #include <list>
#ifdef __TDE_HAVE_TDEHWLIB #ifdef HAVE_TDEHWLIB
class TDEHardwareDevices; class TDEHardwareDevices;
#else #else
#define TDEHardwareDevices void #define TDEHardwareDevices void

Loading…
Cancel
Save