diff options
author | Emanoil Kotsev <deloptes@gmail.com> | 2024-06-18 21:25:43 +0000 |
---|---|---|
committer | Emanoil Kotsev <deloptes@gmail.com> | 2024-06-24 22:52:24 +0000 |
commit | b15f74f1d69fc1db7dca4b0e0d8dd0bbde3e8af5 (patch) | |
tree | 746d74e58314950bccac7c13eed4369040839080 | |
parent | 802ffbda85f4aaae7754a01b16e70d9103df983d (diff) | |
download | tdelibs-feat/new_hwcontrol.tar.gz tdelibs-feat/new_hwcontrol.zip |
Cleanup CMakeLists.txt files - use tde_automoc and tde_setup_dbus macrosfeat/new_hwcontrol
Remove debug msg for ignored interfaces in HardwareControl and consistent logging for dbus name aquired
Cleanup header files and consistent formatting
Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
11 files changed, 24 insertions, 92 deletions
diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/BrightnessService.h b/tdecore/tdehw/hwlibdaemons/tdedbus/BrightnessService.h index 584c8959b..42f4381b4 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/BrightnessService.h +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/BrightnessService.h @@ -34,16 +34,11 @@ public: BrightnessService(TQT_DBusConnection&); virtual ~BrightnessService(); -protected: +protected: // implement DBus calls virtual bool CanSetBrightness(const TQString& device, bool& value, TQT_DBusError& error); - virtual bool SetBrightness(const TQString& device, const TQString& brightness, bool& value, TQT_DBusError& error); - -protected: // implement sending replies + // implement sending replies void handleMethodReply(const TQT_DBusMessage& reply); -// -// virtual void BrightnessServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid); - }; #endif /* BRIGHTNESSSERVICE_H_ */ diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/CMakeLists.txt b/tdecore/tdehw/hwlibdaemons/tdedbus/CMakeLists.txt index 28ef745c2..776f8f0eb 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/CMakeLists.txt +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/CMakeLists.txt @@ -9,26 +9,6 @@ # ################################################# -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) -set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) -#-Wl,--whole-archive -set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" ) - -##### configure checks ########################## -if( NOT DBUS_SYS_DIR ) - set( DBUS_SYS_DIR ${SYSCONF_INSTALL_DIR}/dbus-1/system.d ) -endif( ) - - -if( WITH_GCC_VISIBILITY ) - if( NOT UNIX ) - tde_message_fatal(FATAL_ERROR "\ngcc visibility support was requested, but your system is not *NIX" ) - endif( NOT UNIX ) - set( __KDE_HAVE_GCC_VISIBILITY 1 ) - set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") -endif( ) - add_definitions( # -DQT_THREAD_SUPPORT ${TQT_CFLAGS_OTHER} diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/CPUGovernorService.h b/tdecore/tdehw/hwlibdaemons/tdedbus/CPUGovernorService.h index da5f36189..bbd8d9f95 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/CPUGovernorService.h +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/CPUGovernorService.h @@ -31,16 +31,12 @@ class CPUGovernorService: public org::trinitydesktop::hardwarecontrol::CPUGovern public: CPUGovernorService(TQT_DBusConnection&); virtual ~CPUGovernorService(); -protected: - virtual bool CanSetCPUGovernor(TQ_INT32 cpu, bool& value, TQT_DBusError& error) ; +protected: // implement DBus calls + virtual bool CanSetCPUGovernor(TQ_INT32 cpu, bool& value, TQT_DBusError& error) ; virtual bool SetCPUGovernor(TQ_INT32 cpu, const TQString& governor, bool& value, TQT_DBusError& error); - -protected: // implement sending replies + // implement sending replies void handleMethodReply(const TQT_DBusMessage& reply); - -// -// virtual void CPUGovernorServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid); }; #endif /* CPUGOVERNORSERVICE_H_ */ diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/DeviceServiceBase.h b/tdecore/tdehw/hwlibdaemons/tdedbus/DeviceServiceBase.h index 7c06de401..fe35d490e 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/DeviceServiceBase.h +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/DeviceServiceBase.h @@ -31,11 +31,10 @@ public: DeviceServiceBase(TQT_DBusConnection&); virtual ~DeviceServiceBase(); -protected: +protected: // implement DBus calls bool canSetDeviceValue(const TQString& device, TQT_DBusError& error); bool setDeviceValue(const TQString& device, const TQString& param, TQT_DBusError& error); - -protected: // implement sending replies + // implement sending replies virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0; protected: diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/HardwareControl.cpp b/tdecore/tdehw/hwlibdaemons/tdedbus/HardwareControl.cpp index 27e629dfb..ce054004d 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/HardwareControl.cpp +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/HardwareControl.cpp @@ -72,16 +72,13 @@ void HardwareControl::slotDbusSignal(const TQT_DBusMessage& message) { message.member() == TQString("NameAcquired") && serviceName == DBUS_HWCTRL_SERVICE_NAME ) { - tqDebug("Name acquired: " + serviceName); + tqDebug("TDEHW unique DBus name acquired: " + serviceName); rootService = new RootNodeService(m_connection); orgService = new OrgNodeService(m_connection); trinitydesktopService = new TrinityDesktopNodeService(m_connection); hardwarecontrolService = new HardwareControlNodeService(m_connection); tqDebug("TDEHW service setup done."); - } else { - tqDebug("TDEHW service ignored: " + serviceName); } - } void HardwareControl::dbusConnectionClose() { diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/HardwareControl.h b/tdecore/tdehw/hwlibdaemons/tdedbus/HardwareControl.h index 0ac42b9c6..d4cb20a96 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/HardwareControl.h +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/HardwareControl.h @@ -45,6 +45,7 @@ private: //! to close the connection to D-Bus void dbusConnectionClose(); +private: RootNodeService *rootService; OrgNodeService *orgService; TrinityDesktopNodeService *trinitydesktopService; @@ -63,8 +64,6 @@ private slots: * \return void */ void slotDbusSignal(const TQT_DBusMessage&); - }; - #endif /* HARDWARECONTROL_H_ */ diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/InputEventsService.h b/tdecore/tdehw/hwlibdaemons/tdedbus/InputEventsService.h index a1eff3d19..4e3595ec0 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/InputEventsService.h +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/InputEventsService.h @@ -31,18 +31,13 @@ class InputEventsService: public org::trinitydesktop::hardwarecontrol::InputEven public: InputEventsService(TQT_DBusConnection&); virtual ~InputEventsService(); -protected: +protected: // implement DBus calls TQValueList< TQ_UINT32 > getSwitches(const TQString& device, bool active, TQT_DBusError& error); - virtual bool GetProvidedSwitches(const TQString& device, TQValueList< TQ_UINT32 >& value, TQT_DBusError& error); - virtual bool GetActiveSwitches(const TQString& device, TQValueList< TQ_UINT32 >& value, TQT_DBusError& error); - -protected: // implement sending replies + // implement sending replies virtual void handleMethodReply(const TQT_DBusMessage& reply); -// -// virtual void InputEventsServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid); private: TQT_DBusConnection *m_connection; diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/PowerService.h b/tdecore/tdehw/hwlibdaemons/tdedbus/PowerService.h index b08a55bda..964004acd 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/PowerService.h +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/PowerService.h @@ -31,43 +31,27 @@ class PowerService: public org::trinitydesktop::hardwarecontrol::PowerInterface, public: PowerService(TQT_DBusConnection&); virtual ~PowerService(); + protected: + // implement DBus calls bool canSetPower(TQString state, TQT_DBusError& error); - bool setPower(TQString state, TQT_DBusError& error); - bool canSetHibernation(TQString state, TQT_DBusError& error); - bool setHibernation(TQString state, TQT_DBusError& error); - virtual bool CanStandby(bool& value, TQT_DBusError& error); - virtual bool Standby(bool& value, TQT_DBusError& error); - virtual bool CanFreeze(bool& value, TQT_DBusError& error); - virtual bool Freeze(bool& value, TQT_DBusError& error); - virtual bool CanSuspend(bool& value, TQT_DBusError& error); - virtual bool Suspend(bool& value, TQT_DBusError& error); - virtual bool CanHibernate(bool& value, TQT_DBusError& error); - virtual bool Hibernate(bool& value, TQT_DBusError& error); - virtual bool CanHybridSuspend(bool& value, TQT_DBusError& error); - virtual bool HybridSuspend(bool& value, TQT_DBusError& error); - virtual bool CanSetHibernationMethod(bool& value, TQT_DBusError& error); - virtual bool SetHibernationMethod(const TQString& method, bool& value, TQT_DBusError& error); - -protected: // implement sending replies + // implement sending replies void handleMethodReply(const TQT_DBusMessage& reply); -// -// virtual void PowerServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid); }; #endif /* POWERSERVICE_H_ */ diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/PropertiesService.h b/tdecore/tdehw/hwlibdaemons/tdedbus/PropertiesService.h index 3d16925cf..c0f080ddc 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/PropertiesService.h +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/PropertiesService.h @@ -37,16 +37,13 @@ public: protected: // implement sending signals virtual bool handleSignalSend(const TQT_DBusMessage& reply); + // returns the path virtual TQString objectPath() const; - -protected: + // implement DBus calls virtual bool Get(const TQString& interface, const TQString& name, TQT_DBusVariant& value, TQT_DBusError& error); - virtual bool Set(const TQString& interface, const TQString& name, const TQT_DBusVariant& value, TQT_DBusError& error); - virtual bool GetAll(const TQString& interface, TQMap< TQString, TQT_DBusVariant >& properties, TQT_DBusError& error); - -protected: // implement sending replies + // implement sending replies virtual void handleMethodReply(const TQT_DBusMessage& reply); private: diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/hardwarecontrolService.h b/tdecore/tdehw/hwlibdaemons/tdedbus/hardwarecontrolService.h index 1c00270e7..b32e93177 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/hardwarecontrolService.h +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/hardwarecontrolService.h @@ -42,8 +42,10 @@ class RootNodeService : public DBusBaseNode public: RootNodeService(TQT_DBusConnection&); ~RootNodeService(); + protected: virtual TQT_DBusObjectBase* createInterface(const TQString&); + private: TQMap<TQString, TQT_DBusObjectBase*> m_interfaces; TQT_DBusConnection m_connection; @@ -60,8 +62,10 @@ class OrgNodeService : public DBusBaseNode public: OrgNodeService(TQT_DBusConnection&); ~OrgNodeService(); + protected: virtual TQT_DBusObjectBase* createInterface(const TQString&); + private: TQMap<TQString, TQT_DBusObjectBase*> m_interfaces; TQT_DBusConnection m_connection; @@ -78,8 +82,10 @@ class TrinityDesktopNodeService : public DBusBaseNode public: TrinityDesktopNodeService(TQT_DBusConnection&); ~TrinityDesktopNodeService(); + protected: virtual TQT_DBusObjectBase* createInterface(const TQString&); + private: TQMap<TQString, TQT_DBusObjectBase*> m_interfaces; TQT_DBusConnection m_connection; diff --git a/tdecore/tdehw/hwlibdaemons/tdedbus/interfaces/CMakeLists.txt b/tdecore/tdehw/hwlibdaemons/tdedbus/interfaces/CMakeLists.txt index eeb1ef20b..a19fecb27 100644 --- a/tdecore/tdehw/hwlibdaemons/tdedbus/interfaces/CMakeLists.txt +++ b/tdecore/tdehw/hwlibdaemons/tdedbus/interfaces/CMakeLists.txt @@ -21,16 +21,6 @@ set( DBUSXML2QT3_EXECUTABLE dbusxml2qt3 ) set( HardwareControl_HDRS brightnessInterface.h brightnessProxy.h cpugovernorInterface.h cpugovernorProxy.h dbusbaseNode.h hardwarecontrolNode.h inputeventsInterface.h inputeventsProxy.h introspectableInterface.h powerInterface.h powerProxy.h propertiesInterface.h propertiesProxy.h ) set( HardwareControl_SRCS brightnessInterface.cpp brightnessProxy.cpp cpugovernorInterface.cpp cpugovernorProxy.cpp dbusbaseNode.cpp hardwarecontrolNode.cpp inputeventsInterface.cpp inputeventsProxy.cpp introspectableInterface.cpp powerInterface.cpp powerProxy.cpp propertiesInterface.cpp propertiesProxy.cpp) -function( make_moc fileinput ) - add_custom_command( OUTPUT ${fileinput}.moc - COMMAND ${TMOC_EXECUTABLE} ${fileinput}.h -o ${fileinput}.moc - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${fileinput}.h - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - set_property( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${fileinput}.cpp APPEND - PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${fileinput}.moc ) -endfunction( ) - ##### HardwareControl ######################### add_custom_command( OUTPUT ${HardwareControl_HDRS} ${HardwareControl_SRCS} @@ -39,13 +29,7 @@ add_custom_command( WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) -make_moc ( brightnessProxy ) -make_moc ( cpugovernorProxy ) -make_moc ( inputeventsProxy) -make_moc ( powerProxy ) -make_moc ( propertiesProxy ) - -tde_add_library( hwcontrolinterfaces STATIC_PIC +tde_add_library( hwcontrolinterfaces STATIC_PIC AUTOMOC SOURCES ${HardwareControl_SRCS} LINK ${DBUS_TQT_LIBRARIES} ) |