[Phonon/4.1] 533d3f2 Since no objections were raised in kde-core-devel,

Thiago Macieira thiago at kde.org
Sun Jan 2 22:59:05 CET 2011


	A	 org.kde.Phonon.MixerIface.xml	 [License: Trivialfile.]


	A	 mixeradaptor.h	 [License: GENERATEDFILE]


	A	 mixeradaptor.cpp	 [License: GENERATEDFILE]

commit 533d3f2b247217d21339de340c00f65bf340add5
Author: Thiago Macieira <thiago at kde.org>
Date:   Wed May 31 07:20:26 2006 +0000

    Since no objections were raised in kde-core-devel, I am merging the
    kdelibs4-dbus branch back into trunk. KDELibs compiles, links and
    installs with this, but obviously all other modules will fail to
    build. Let the porting commence.
    
    CCMAIL:kde-core-devel at kde.org,kde-buildsystem at kde.org

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f48503..4458a00 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,6 @@
 
+add_definitions(${QDBUS_DEFINITIONS})
+
 # Those apply to all subdirs
 include_directories( ${KDE4_KIO_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
 
@@ -54,6 +56,7 @@ set(phononcore_LIB_SRCS
 	audioeffect.cpp
 	volumefadereffect.cpp
 	videoeffect.cpp
+	mixeradaptor.cpp
 	brightnesscontrol.cpp
 	abstractaudiooutput.cpp
 	audiooutput.cpp
@@ -68,8 +71,6 @@ set(phononcore_LIB_SRCS
 
 kde4_automoc(${phononcore_LIB_SRCS})
 
-kde4_add_dcop_skels(phononcore_LIB_SRCS factory.h mixeriface.h )
-
 kde4_add_library(phononcore SHARED ${phononcore_LIB_SRCS})
 
 target_link_libraries(phononcore  ${KDE4_KDECORE_LIBS} kio )
@@ -108,8 +109,8 @@ install_files( /include/phonon FILES
 	audioeffect.h
 	volumefadereffect.h
 	videoeffect.h
+	mixeradaptor.h
 	brightnesscontrol.h
-	mixeriface.h
 	abstractaudiooutput.h
 	audiooutput.h
 	audiodataoutput.h
diff --git a/audiooutput.cpp b/audiooutput.cpp
index dce3d0b..9e945b9 100644
--- a/audiooutput.cpp
+++ b/audiooutput.cpp
@@ -117,7 +117,7 @@ void AudioOutput::setupIface()
 	Q_ASSERT( d->iface() );
 	AbstractAudioOutput::setupIface();
 
-	connect( d->iface()->qobject(), SIGNAL( volumeChanged( float ) ), SIGNAL( volumeChanged( float ) ) );
+	connect( d->iface()->qobject(), SIGNAL(volumeChanged(float)), SIGNAL(volumeChanged(float)) );
 
 	// set up attributes
 	d->iface()->setVolume( d->volume );
diff --git a/audiooutput.h b/audiooutput.h
index 2f7e072..7c6d033 100644
--- a/audiooutput.h
+++ b/audiooutput.h
@@ -20,7 +20,6 @@
 #define Phonon_AUDIOOUTPUT_H
 
 #include "abstractaudiooutput.h"
-#include "mixeriface.h"
 #include <kdelibs_export.h>
 #include "phonondefs.h"
 #include "phononnamespace.h"
@@ -49,7 +48,7 @@ namespace Phonon
 	 * \author Matthias Kretz <kretz at kde.org>
 	 * \see Phonon::Ui::VolumeSlider
 	 */
-	class PHONONCORE_EXPORT AudioOutput : public AbstractAudioOutput, public MixerIface
+	class PHONONCORE_EXPORT AudioOutput : public AbstractAudioOutput
 	{
 		Q_OBJECT
 		K_DECLARE_PRIVATE( AudioOutput )
@@ -67,7 +66,7 @@ namespace Phonon
 		 *
 		 * \see volumeDecibel
 		 */
-		Q_PROPERTY( float volume READ volume WRITE setVolume )
+		Q_PROPERTY( float volume READ volume WRITE setVolume NOTIFY volumeChanged )
 		/**
 		 * This is the current volume of the output in decibel.
 		 *
@@ -108,7 +107,6 @@ namespace Phonon
 		PHONON_HEIR( AudioOutput )
 		public:
 			QString name() const;
-			float volume() const;
 			double volumeDecibel() const;
 			Phonon::Category category() const;
 			AudioOutputDevice outputDevice() const;
@@ -118,6 +116,7 @@ namespace Phonon
 
 		public Q_SLOTS:
 			void setName( const QString& newName );
+			float volume() const;
 			void setVolume( float newVolume );
 			void setVolumeDecibel( double newVolumeDecibel );
 			void setCategory( Phonon::Category category );
diff --git a/audiooutput_p.h b/audiooutput_p.h
index 75dcfe4..a661ebf 100644
--- a/audiooutput_p.h
+++ b/audiooutput_p.h
@@ -23,6 +23,7 @@
 #include "audiooutput.h"
 #include "abstractaudiooutput_p.h"
 #include "ifaces/audiooutput.h"
+#include "mixeradaptor.h"
 #include <kaboutdata.h>
 #include <kglobal.h>
 #include <kinstance.h>
@@ -38,12 +39,14 @@ class AudioOutputPrivate : public AbstractAudioOutputPrivate
 			: volume( 1.0 )
 			, category( Phonon::UnspecifiedCategory )
 			, outputDeviceIndex( -1 )
-		{ 
+		{
 			const KAboutData* ad = KGlobal::instance()->aboutData();
 			if( ad )
 				name = ad->programName();
 			else
 				name = KGlobal::instance()->instanceName();
+
+            new MixerIfaceAdaptor(q_func());
 		}
 
 	private:
diff --git a/factory.cpp b/factory.cpp
index 95c89fc..102f3dc 100644
--- a/factory.cpp
+++ b/factory.cpp
@@ -45,6 +45,8 @@
 #include <kdebug.h>
 #include <kstaticdeleter.h>
 
+#include <dbus/qdbus.h>
+
 static KStaticDeleter<Phonon::Factory> sd;
 
 #define PHONON_LOAD_BACKEND_GLOBAL 1
@@ -147,10 +149,10 @@ Factory * Factory::self()
 }
 
 Factory::Factory()
-	: DCOPObject( "PhononFactory" )
-	, d( new Private )
+	: d( new Private )
 {
-	connectDCOPSignal( 0, 0, "phononBackendChanged()", "phononBackendChanged()", false);
+	QDBus::sessionBus().connect(QString(), QString(), "org.kde.Phonon.Factory",
+			"phononBackendChanged", this, SLOT(phononBackendChanged()));
 }
 
 Factory::~Factory()
@@ -159,11 +161,7 @@ Factory::~Factory()
 	emit deleteYourObjects();
 	foreach( BasePrivate* bp, d->basePrivateList )
 		bp->deleteIface();
-	foreach( QObject* o, d->objects )
-	{
-		//kDebug( 600 ) << "delete " << o << endl;
-		delete o;
-	}
+	qDeleteAll(d->objects);
 	delete d->backend;
 	delete d;
 }
diff --git a/factory.h b/factory.h
index 7faf61f..eac40f2 100644
--- a/factory.h
+++ b/factory.h
@@ -22,7 +22,6 @@
 
 #include <QObject>
 
-#include <dcopobject.h>
 #include <kstaticdeleter.h>
 #include <kdelibs_export.h>
 
@@ -63,7 +62,7 @@ namespace Phonon
  *
  * \author Matthias Kretz <kretz at kde.org>
  */
-class PHONONCORE_EXPORT Factory : public QObject, public DCOPObject
+class PHONONCORE_EXPORT Factory : public QObject
 {
 	friend void ::KStaticDeleter<Factory>::destructObject();
 	friend class Phonon::BasePrivate;
@@ -103,7 +102,7 @@ class PHONONCORE_EXPORT Factory : public QObject, public DCOPObject
 		 * \return a pointer to the Ifaces::ByteStream the backend provides
 		 */
 		Ifaces::ByteStream* createByteStream( QObject* parent = 0 );
-		
+
 		/**
 		 * Create a new Ifaces::AudioPath.
 		 *
@@ -175,7 +174,7 @@ class PHONONCORE_EXPORT Factory : public QObject, public DCOPObject
 		 * \copydoc Phonon::Ifaces::Backend::uiSymbol()
 		 */
 		const char* uiSymbol();
-		
+
 		/**
 		 * Get the name of the Backend. It's the name from the .desktop file.
 		 */
@@ -260,24 +259,23 @@ class PHONONCORE_EXPORT Factory : public QObject, public DCOPObject
 		class Private;
 		Private * d;
 
-	K_DCOP
-	k_dcop:
+	private Q_SLOTS:
 		/**
 		 * \internal
 		 * This is called via DCOP when the user changes the Phonon Backend.
 		 */
 		void phononBackendChanged();
 
-//X 		It is probably better if we can get away with internal handling of
-//X 		freeing the soundcard device when it's not needed anymore and
-//X 		providing an IPC method to stop all MediaProducers -> free all
-//X 		devices
-//X 		/**
-//X 		 * \internal
-//X 		 * This is called when the application needs to free the soundcard
-//X 		 * device(s).
-//X 		 */
-//X 		void freeSoundcardDevices();
+//X		It is probably better if we can get away with internal handling of
+//X		freeing the soundcard device when it's not needed anymore and
+//X		providing an IPC method to stop all MediaProducers -> free all
+//X		devices
+//X		/**
+//X		 * \internal
+//X		 * This is called when the application needs to free the soundcard
+//X		 * device(s).
+//X		 */
+//X		void freeSoundcardDevices();
 };
 } // namespace Phonon
 
diff --git a/kcm/backendselection.cpp b/kcm/backendselection.cpp
index 66286e8..52c2618 100644
--- a/kcm/backendselection.cpp
+++ b/kcm/backendselection.cpp
@@ -20,7 +20,6 @@
 #include "backendselection.h"
 
 #include <kservicetypeprofile.h>
-#include <dcopclient.h>
 #include <kservicetypetrader.h>
 #include <ksimpleconfig.h>
 #include <QStringList>
@@ -28,6 +27,7 @@
 #include <kapplication.h>
 #include <kicon.h>
 #include <QList>
+#include <dbus/qdbus.h>
 
 BackendSelection::BackendSelection( QWidget* parent )
 	: QWidget( parent )
@@ -90,7 +90,9 @@ void BackendSelection::save()
 	config.sync();
 	KServiceTypeProfile::clear();
 
-	kapp->dcopClient()->emitDCOPSignal( "phononBackendChanged()", QByteArray() );
+	QDBusMessage signal = QDBusMessage::signal( "/", "org.kde.Phonon.Factory",
+						    "phononBackendChanged" );
+	QDBus::sessionBus().send(signal);
 }
 
 void BackendSelection::defaults()
diff --git a/mixeradaptor.cpp b/mixeradaptor.cpp
new file mode 100644
index 0000000..3879ff0
--- /dev/null
+++ b/mixeradaptor.cpp
@@ -0,0 +1,70 @@
+/*
+ * This file was generated by dbusidl2cpp version 0.3
+ * when processing input file org.kde.MixerIface.xml
+ *
+ * dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
+ *
+ * This is an auto-generated file.
+ */
+
+#include "mixeradaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class MixerIfaceAdaptor
+ */
+
+MixerIfaceAdaptor::MixerIfaceAdaptor(QObject *parent)
+   : QDBusAbstractAdaptor(parent)
+{
+    // constructor
+    setAutoRelaySignals(true);
+}
+
+MixerIfaceAdaptor::~MixerIfaceAdaptor()
+{
+    // destructor
+}
+
+double MixerIfaceAdaptor::volume() const
+{
+    // get the value of property volume
+    return qvariant_cast< double >(object()->property("volume"));
+}
+
+void MixerIfaceAdaptor::setVolume(double value)
+{
+    // set the value of property volume
+    object()->setProperty("volume", value);
+}
+
+QString MixerIfaceAdaptor::categoryName()
+{
+    // handle method call org.kde.Phonon.MixerIface.categoryName
+    QString categoryName;
+    QMetaObject::invokeMethod(object(), "categoryName", Q_RETURN_ARG(QString, categoryName));
+
+    // Alternative:
+    //categoryName = static_cast<YourObjectType *>(object())->categoryName();
+    return categoryName;
+}
+
+QString MixerIfaceAdaptor::name()
+{
+    // handle method call org.kde.Phonon.MixerIface.name
+    QString name;
+    QMetaObject::invokeMethod(object(), "name", Q_RETURN_ARG(QString, name));
+
+    // Alternative:
+    //name = static_cast<YourObjectType *>(object())->name();
+    return name;
+}
+
+
+#include "mixeradaptor.moc"
diff --git a/mixeradaptor.h b/mixeradaptor.h
new file mode 100644
index 0000000..795812b
--- /dev/null
+++ b/mixeradaptor.h
@@ -0,0 +1,55 @@
+/*
+ * This file was generated by dbusidl2cpp version 0.3
+ * when processing input file org.kde.MixerIface.xml
+ *
+ * dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
+ *
+ * This is an auto-generated file.
+ */
+
+#ifndef MIXERADAPTOR_H_257421146496182
+#define MIXERADAPTOR_H_257421146496182
+
+#include <QtCore/QObject>
+#include <dbus/qdbus.h>
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+
+/*
+ * Adaptor class for interface org.kde.Phonon.MixerIface
+ */
+class MixerIfaceAdaptor: public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.kde.Phonon.MixerIface")
+    Q_CLASSINFO("D-Bus Introspection", ""
+"  <interface name=\"org.kde.Phonon.MixerIface\" >"
+"    <method name=\"name\" >"
+"      <arg direction=\"out\" type=\"s\" name=\"name\" />"
+"    </method>"
+"    <method name=\"categoryName\" >"
+"      <arg direction=\"out\" type=\"s\" name=\"categoryName\" />"
+"    </method>"
+"    <property access=\"readwrite\" type=\"d\" name=\"volume\" />"
+"  </interface>"
+        "")
+public:
+    MixerIfaceAdaptor(QObject *parent);
+    virtual ~MixerIfaceAdaptor();
+
+public: // PROPERTIES
+   Q_PROPERTY(double volume READ volume WRITE setVolume)
+    double volume() const;
+    void setVolume(double value);
+
+public slots: // METHODS
+    QString categoryName();
+    QString name();
+signals: // SIGNALS
+};
+
+#endif
diff --git a/mixeriface.h b/mixeriface.h
deleted file mode 100644
index c92784a..0000000
--- a/mixeriface.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*  This file is part of the KDE project
-    Copyright (C) 2004-2005 Matthias Kretz <kretz at kde.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License version 2 as published by the Free Software Foundation.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef PHONON_MIXERIFACE_H
-#define PHONON_MIXERIFACE_H
-
-#include <dcopobject.h>
-#include <kdelibs_export.h>
-
-namespace Phonon
-{
-class PHONONCORE_EXPORT MixerIface : public DCOPObject
-{
-	K_DCOP
-	k_dcop:
-		virtual QString name() const = 0;
-		virtual QString categoryName() const = 0;
-		virtual float volume() const = 0;
-		virtual void setVolume( float volume ) = 0;
-
-	protected:
-		MixerIface() : DCOPObject( "MixerIface" ) {}
-};
-} //namespace Phonon
-
-#endif // PHONON_MIXERIFACE_H
-// vim: sw=4 ts=4 noet tw=80
diff --git a/org.kde.Phonon.MixerIface.xml b/org.kde.Phonon.MixerIface.xml
new file mode 100644
index 0000000..2ca1eef
--- /dev/null
+++ b/org.kde.Phonon.MixerIface.xml
@@ -0,0 +1,13 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+         "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+  <interface name="org.kde.Phonon.MixerIface">
+    <method name="name">
+      <arg name="name" type="s" direction="out" />
+    </method>
+    <method name="categoryName">
+      <arg name="categoryName" type="s" direction="out" />
+    </method>
+    <property name = "volume" type="d" access="readwrite" />
+  </interface>
+</node>


More information about the Kde-buildsystem mailing list