-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 46 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 4 |
2 files changed, 50 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index a0bf4db..5e1be2f 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -143,4 +143,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) // menuTimer = new QTimer( this ,"menu timer"), // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); + channel = new QCopChannel( "QPE/Application/opieplayer", this ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), + this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); setBackgroundMode( PaletteButton ); @@ -1421,2 +1424,45 @@ void PlayListWidget::skinsMenuActivated( int item ) { cfg.writeEntry("Skin", skinsMenu->text( item ) ); } + +void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { + qDebug("qcop message "+msg ); + QDataStream stream ( data, IO_ReadOnly ); + if ( msg == "play()" ) { //plays current selection + btnPlay( true); + } else if ( msg == "stop()" ) { + mediaPlayerState->setPlaying( false); + } else if ( msg == "togglePause()" ) { + mediaPlayerState->togglePaused(); + } else if ( msg == "next()" ) { //select next in list + mediaPlayerState->setNext(); + } else if ( msg == "prev()" ) { //select previous in list + mediaPlayerState->setPrev(); + } else if ( msg == "toggleLooping()" ) { //loop or not loop + mediaPlayerState->toggleLooping(); + } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled + mediaPlayerState->toggleShuffled(); + } else if ( msg == "volUp()" ) { //volume more +// emit moreClicked(); +// emit moreReleased(); + } else if ( msg == "volDown()" ) { //volume less +// emit lessClicked(); +// emit lessReleased(); + } else if ( msg == "play(QString)" ) { //play this now + QString file; + stream >> file; + setDocument( (const QString &) file); + } else if ( msg == "add(QString)" ) { //add to playlist + QString file; + stream >> file; + QFileInfo fileInfo(file); + DocLnk lnk; + lnk.setName( fileInfo.baseName() ); //sets name + lnk.setFile( file ); //sets file name + addToSelection( lnk ); + } else if ( msg == "rem(QString)" ) { //remove from playlist + QString file; + stream >> file; + + } + +} diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 1118b76..e66bcb9 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h @@ -27,4 +27,6 @@ #include <qpushbutton.h> +#include <qpe/qcopenvelope_qws.h> + #include "om3u.h" /* #include <qtimer.h> */ @@ -69,4 +71,5 @@ public slots: /* void setScaled(); */ protected: + QCopChannel * channel; QPopupMenu *skinsMenu; /* void contentsMousePressEvent( QMouseEvent * e ); */ @@ -91,4 +94,5 @@ private: private slots: + void qcopReceive(const QCString&, const QByteArray&); void populateSkinsMenu(); void skinsMenuActivated(int); |