[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdemultimedia/kmix
From: Christian Esken <esken () kde ! org>
Date: 2011-07-21 23:14:40
Message-ID: 20110721231440.4E445AC873 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1242584 by esken:
First version of MPRIS backend. Detects running MPRIS enabled applications.
M +5 -0 apps/kmix.cpp
M +7 -0 backends/kmix-backends.cpp
M +76 -14 backends/mixer_mpris2.cpp
M +25 -4 backends/mixer_mpris2.h
M +7 -0 gui/viewdockareapopup.cpp
--- trunk/KDE/kdemultimedia/kmix/apps/kmix.cpp #1242583:1242584
@@ -494,6 +494,11 @@
*/
void KMixWindow::recreateGUI(bool saveConfig, const QString& mixerId, bool \
forceNewTab) {
+ kDebug(67100) << "new dockarea with popup";
+ ViewBase::ViewFlags vf1 = (ViewBase::ViewFlags)0;
+ ViewDockAreaPopup* vdap = new ViewDockAreaPopup(0, "New Dockarea Popup with Apps", \
Mixer::mixers().at(0), vf1, 0, 0 ); + vdap->show();
+
// -1- Find out which of the tabs is currently selected for restoration
int current_tab = -1;
if (m_wsMixers)
--- trunk/KDE/kdemultimedia/kmix/backends/kmix-backends.cpp #1242583:1242584
@@ -70,6 +70,8 @@
// PORTING: add #ifdef PLATFORM , commands , #endif, add your new mixer below
+#include "backends/mixer_mpris2.cpp"
+
#if defined(SUN_MIXER)
#include "backends/mixer_sun.cpp"
#endif
@@ -111,6 +113,9 @@
#endif
+
+
+
typedef Mixer_Backend *getMixerFunc( Mixer* mixer, int device );
typedef QString getDriverNameFunc( );
@@ -125,6 +130,8 @@
{ SUN_getMixer, SUN_getDriverName },
#endif
+ { MPRIS2_getMixer, MPRIS2_getDriverName },
+
#if defined(IRIX_MIXER)
{ IRIX_getMixer, IRIX_getDriverName },
#endif
--- trunk/KDE/kdemultimedia/kmix/backends/mixer_mpris2.cpp #1242583:1242584
@@ -7,34 +7,75 @@
#include "mixer_mpris2.h"
//#include <QtCore/QCoreApplication>
-#include <QtCore/QDebug>
-#include <QtCore/QStringList>
+#include <QDebug>
+#include <QStringList>
#include <QDBusReply>
-#include <QtGui/QLabel>
-#include <QtGui/QMenu>
-#include <QtGui/QMenuBar>
-#include <QtGui/QAction>
+#include <QString>
// Set the QDBUS_DEBUG env variable for debugging Qt DBUS calls.
-QString Mixer_MPRIS2::MPRIS_IFC2 = "org.mpris.MediaPlayer2";
+QString Mixer_MPRIS2::MPRIS_IFC2; // = "org.mpris.MediaPlayer2";
Mixer_Backend* MPRIS2_getMixer(Mixer *mixer, int device )
{
Mixer_Backend *l_mixer;
- l_mixer = new MPRIS2(mixer, device );
+ l_mixer = new Mixer_MPRIS2(mixer, device );
return l_mixer;
}
-Mixer_MPRIS2(Mixer *mixer, int device = -1 ) : Mixer_Backend(mixer, device )
+Mixer_MPRIS2::Mixer_MPRIS2(Mixer *mixer, int device) : Mixer_Backend(mixer, device \
) {
+// run();
+}
+
+
+ int Mixer_MPRIS2::open()
+ {
+ if ( m_devnum != 0 )
+ return Mixer::ERR_OPEN;
+
run();
+ return 0;
}
+ int Mixer_MPRIS2::close()
+ {
+ return 0;
+ }
+
+ int Mixer_MPRIS2::readVolumeFromHW( const QString& id, MixDevice * )
+ {
+ return 0;
+ }
+
+ int Mixer_MPRIS2::writeVolumeToHW( const QString& id, MixDevice * )
+ {
+ return 0;
+ }
+
+ void Mixer_MPRIS2::setEnumIdHW(const QString& id, unsigned int)
+ {
+ }
+
+ unsigned int Mixer_MPRIS2::enumIdHW(const QString& id)
+ {
+ return 0;
+ }
+
+ void Mixer_MPRIS2::setRecsrcHW( const QString& id, bool on)
+ {
+ }
+
+ bool Mixer_MPRIS2::moveStream( const QString& id, const QString& destId )
+ {
+ return false;
+ }
+
+
/**
* @brief Test method
*
@@ -42,20 +83,22 @@
**/
int Mixer_MPRIS2::run()
{
+ kDebug(67100) << "--- A ---------------------------------";
if (!QDBusConnection::sessionBus().isConnected()) {
- qDebug() << "Cannot connect to the D-Bus session bus.\n"
+ kDebug() << "Cannot connect to the D-Bus session bus.\n"
<< "To start it, run:\n"
<<"\teval `dbus-launch --auto-syntax`\n";
}
- /**
- * @brief ...
- **/
+ kDebug(67100) << "--- B ---------------------------------";
QDBusConnection dbusConn = QDBusConnection::sessionBus();
QDBusReply<QStringList> repl = dbusConn.interface()->registeredServiceNames();
+ kDebug(67100) << "--- C ---------------------------------";
if ( repl.isValid() )
{
+ kDebug(67100) << "--- D ---------------------------------";
+
QStringList result = repl.value();
QString s;
foreach ( s , result )
@@ -67,6 +110,9 @@
}
}
}
+
+
+ return 0;
}
@@ -98,6 +144,12 @@
QString readableName = result2.toString();
qDebug() << "REPLY " << result2.type() << ": " << readableName;
+
+ Volume::ChannelMask chn = (Volume::ChannelMask)(Volume::MLEFT | Volume::MRIGHT);
+ MixDevice* md = new MixDevice(_mixer, readableName, readableName, \
MixDevice::VOLUME); + Volume* vol = new Volume( chn, 100, 0, true, false);
+ md->addPlaybackVolume(*vol);
+ m_mixDevices.append( md );
}
}
else
@@ -115,4 +167,14 @@
}
-#include "Mixer_MPRIS2.moc"
+QString Mixer_MPRIS2::getDriverName()
+{
+ return "MPRIS2";
+}
+
+QString MPRIS2_getDriverName()
+{
+ return "MPRIS2";
+}
+
+//#include "Mixer_MPRIS2.moc"
--- trunk/KDE/kdemultimedia/kmix/backends/mixer_mpris2.h #1242583:1242584
@@ -1,15 +1,36 @@
#ifndef Mixer_MPRIS2_H
#define Mixer_MPRIS2_H
-#include <QtGui/QMainWindow>
-#include <QtDBus/QtDBus>
+#include <QString>
+#include <QMainWindow>
+#include <QtDBus>
-Mixer_MPRIS2 : public Mixer_Backend
+#include "mixer_backend.h"
+
+class Mixer_MPRIS2 : public Mixer_Backend
{
+public:
explicit Mixer_MPRIS2(Mixer *mixer, int device = -1 );
~Mixer_MPRIS2();
void getMprisControl(QDBusConnection& conn, QString arg1);
-}
+ QString getDriverName();
+ virtual int open();
+ virtual int close();
+ virtual int readVolumeFromHW( const QString& id, MixDevice * );
+ virtual int writeVolumeToHW( const QString& id, MixDevice * );
+ virtual void setEnumIdHW(const QString& id, unsigned int);
+ virtual unsigned int enumIdHW(const QString& id);
+ virtual void setRecsrcHW( const QString& id, bool on);
+ virtual bool moveStream( const QString& id, const QString& destId );
+ virtual bool needsPolling() { return false; }
+
+
+private:
+ int run();
+// static char MPRIS_IFC2[40];
+ static QString MPRIS_IFC2;
+};
+
#endif
--- trunk/KDE/kdemultimedia/kmix/gui/viewdockareapopup.cpp #1242583:1242584
@@ -106,8 +106,15 @@
if ( dockMD != 0 ) {
_mixSet->append(dockMD);
}
+
+ MixDevice *md;
+ foreach ( md, _mixer->getMixSet() )
+ {
+ _mixSet->append(md);
}
+}
+
QWidget* ViewDockAreaPopup::add(MixDevice *md)
{
QString dummyMatchAll("*");
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic