From acc0ce463c8872d7549f32992c561c654fc1303e Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Fri, 30 Apr 2010 14:22:24 -0300 Subject: Phonon Notifier wrapper. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Luciano Wolf Reviewer: Renato Araújo --- PySide/global.h | 1 + PySide/phonon/CMakeLists.txt | 5 +---- PySide/phonon/pyside_phonon.h | 39 +++++++++++++++++++++++++++++++++++++ PySide/phonon/typesystem_phonon.xml | 25 +++++++++++++++++++++++- 4 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 PySide/phonon/pyside_phonon.h (limited to 'PySide') diff --git a/PySide/global.h b/PySide/global.h index 93c3ae6ff..1c88abcee 100644 --- a/PySide/global.h +++ b/PySide/global.h @@ -371,6 +371,7 @@ QT_END_HEADER #endif // Phonon +#include "phonon/pyside_phonon.h" #include #include #include diff --git a/PySide/phonon/CMakeLists.txt b/PySide/phonon/CMakeLists.txt index 5909c623f..1433151de 100644 --- a/PySide/phonon/CMakeLists.txt +++ b/PySide/phonon/CMakeLists.txt @@ -36,10 +36,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_volumefadereffect_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_volumefaderinterface_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_volumeslider_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_wrapper.cpp -) - -set(phonon_GLUE_CODE -${CMAKE_CURRENT_SOURCE_DIR}/glue/phonon_backendcapabilities_notifier_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_backendcapabilities_notifierwrapper_wrapper.cpp ) execute_generator(phonon phonon_SRC "${CMAKE_CURRENT_BINARY_DIR}:${QtCore_SOURCE_DIR}:${QtGui_BINARY_DIR}:${QtGui_SOURCE_DIR}:${phonon_SOURCE_DIR}") diff --git a/PySide/phonon/pyside_phonon.h b/PySide/phonon/pyside_phonon.h new file mode 100644 index 000000000..c9d262828 --- /dev/null +++ b/PySide/phonon/pyside_phonon.h @@ -0,0 +1,39 @@ +#ifndef PYSIDE_PHONON +#define PYSIDE_PHONON + +#include +#include + +namespace Phonon +{ +namespace BackendCapabilities +{ + class NotifierWrapper : public QObject + { + public: + + inline static NotifierWrapper* notifier() { + Notifier* notifier = BackendCapabilities::notifier(); + + if (notifier != m_notifier) { + delete m_instance; + m_instance = new NotifierWrapper(notifier); + + } + + return m_instance; + } + + inline const QMetaObject* metaObject() const { return m_notifier->metaObject(); } + + private: + static NotifierWrapper* m_instance; + static Notifier* m_notifier; + + NotifierWrapper(Notifier* notifier) { m_notifier = notifier; } + NotifierWrapper() {} + }; +} +} + +#endif diff --git a/PySide/phonon/typesystem_phonon.xml b/PySide/phonon/typesystem_phonon.xml index 5f243415b..ab098b0b9 100644 --- a/PySide/phonon/typesystem_phonon.xml +++ b/PySide/phonon/typesystem_phonon.xml @@ -10,17 +10,40 @@ + + - + + + Phonon::BackendCapabilities::NotifierWrapper* Phonon::BackendCapabilities::NotifierWrapper::m_instance = 0; + Phonon::BackendCapabilities::Notifier* Phonon::BackendCapabilities::NotifierWrapper::m_notifier = 0; + + + + + Phonon::BackendCapabilities::NotifierWrapper *_notifierWrapper = Phonon::BackendCapabilities::NotifierWrapper::notifier(); + %PYARG_0 = %CONVERTTOPYTHON[Phonon::BackendCapabilities::NotifierWrapper*](_notifierWrapper); + + + + + + + + + + + + -- cgit v1.2.3