aboutsummaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-04-30 14:22:24 -0300
committerHugo Parente Lima <hugo.lima@openbossa.org>2010-04-30 15:52:24 -0300
commitacc0ce463c8872d7549f32992c561c654fc1303e (patch)
tree1e0f38f5095d233ac2bb877dd061af0b7e81c1a6 /PySide
parenta7c7c9a76c0e9a132a8526ac420d0fb68905d53e (diff)
Phonon Notifier wrapper.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Reviewer: Renato Araújo <renato.araujo@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r--PySide/global.h1
-rw-r--r--PySide/phonon/CMakeLists.txt5
-rw-r--r--PySide/phonon/pyside_phonon.h39
-rw-r--r--PySide/phonon/typesystem_phonon.xml25
4 files changed, 65 insertions, 5 deletions
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<phonon/abstractaudiooutput.h>
#include<phonon/abstractmediastream.h>
#include<phonon/abstractvideooutput.h>
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 <QObject>
+#include <phonon/backendcapabilities.h>
+
+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 @@
<rejection class="Phonon::Factory"/>
<rejection class="Phonon::Experimental"/>
<rejection class="AudioOutputAdaptor"/>
+ <rejection class="Phonon::BackendCapabilities::Notifier"/>
<rejection class="*" field-name="k_ptr"/>
+ <rejection class="*" field-name="k_func"/>
<namespace-type name="Phonon">
<extra-includes>
<include file-name="phononnamespace.h" location="global"/>
</extra-includes>
</namespace-type>
- <namespace-type name="Phonon::BackendCapabilities" />
+ <namespace-type name="Phonon::BackendCapabilities" >
+ <inject-code class="native">
+ Phonon::BackendCapabilities::NotifierWrapper* Phonon::BackendCapabilities::NotifierWrapper::m_instance = 0;
+ Phonon::BackendCapabilities::Notifier* Phonon::BackendCapabilities::NotifierWrapper::m_notifier = 0;
+ </inject-code>
+
+ <add-function signature="notifier()" return-type="Phonon::BackendCapabilities::NotifierWrapper">
+ <inject-code class="target">
+ Phonon::BackendCapabilities::NotifierWrapper *_notifierWrapper = Phonon::BackendCapabilities::NotifierWrapper::notifier();
+ %PYARG_0 = %CONVERTTOPYTHON[Phonon::BackendCapabilities::NotifierWrapper*](_notifierWrapper);
+ </inject-code>
+ </add-function>
+ </namespace-type>
<!-- ### causes moc-related linker error -->
<!-- <object-type name="Phonon::BackendCapabilities::Notifier"/> -->
+ <object-type name="Phonon::BackendCapabilities::NotifierWrapper" target-lang-name="Notifier">
+ <include file-name="backendcapabilities.h" location="global"/>
+ <include file-name="pyside_phonon.h" location="local"/>
+
+ <modify-function signature="notifier()" remove="all"/>
+ <modify-function signature="Phonon::BackendCapabilities::NotifierWrapper(Phonon::BackendCapabilities::Notifier*)">
+ <access modifier="private"/>
+ </modify-function>
+ </object-type>
<enum-type name="Phonon::Category" />
<enum-type name="Phonon::DiscType"/>