-rw-r--r-- | noncore/multimedia/opieplayer2/README | 22 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 49 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 3 |
3 files changed, 74 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/README b/noncore/multimedia/opieplayer2/README new file mode 100644 index 0000000..8db1376 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/README @@ -0,0 +1,22 @@ +qcop channel is: +QPE/Application/opieplayer2 + +qcop calls enabled: +"play()" //plays current selection +"stop()" //stops playing +"togglePause()"//pauses +"next()" //select next in list +"prev()" //select previous in list +"toggleLooping()" //loop or not loop +"toggleShuffled()" //shuffled or not shuffled +"play(QString)" //play this now, needs full file path +"add(QString)" //add to playlist, needs full file path + + +qcop calls to be enabled: +"volUp()" //volume more +"volDown()" //volume less +"rem(QString)" //remove from playlist +"getPlaylist()" // gets list of songs in current playlist + + diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 580460e..c91a565 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -135,32 +135,37 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par this, SLOT( tabChanged( QWidget* ) ) ); connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); connect ( gammaSlider, SIGNAL( valueChanged( int ) ), &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); // see which skins are installed populateSkinsMenu(); initializeStates(); + channel = new QCopChannel( "QPE/Application/opieplayer2", this ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), + this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); + + cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); loadList(DocLnk( currentPlaylist ) ); tabWidget->showPage( playListTab ); } PlayListWidget::~PlayListWidget() { delete d; } void PlayListWidget::initializeStates() { d->tbPlay->setOn( mediaPlayerState.isPlaying() ); d->tbLoop->setOn( mediaPlayerState.isLooping() ); @@ -901,16 +906,60 @@ PlayListWidget::TabType PlayListWidget::currentTab() const return indexToTabType[ index ]; } PlayListWidget::Entry PlayListWidget::currentEntry() const { if ( currentTab() == CurrentPlayList ) { const DocLnk *lnk = current(); return Entry( lnk->name(), lnk->file() ); } return Entry( currentFileListPathName() ); } QString PlayListWidget::currentFileListPathName() const { return currentFileListView->currentItem()->text( 3 ); } + + +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/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index cb65d5c..54e9d16 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -27,32 +27,33 @@ -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef PLAY_LIST_WIDGET_H #define PLAY_LIST_WIDGET_H #include <qmainwindow.h> #include <qpe/applnk.h> #include <qtabwidget.h> #include <qpe/fileselector.h> #include <qpushbutton.h> #include <qpopupmenu.h> +#include <qpe/qcopenvelope_qws.h> #include "playlistwidgetgui.h" //class PlayListWidgetPrivate; class Config; class QListViewItem; class QListView; class QPoint; class QAction; class QLabel; class PlayListWidget : public PlayListWidgetGui { Q_OBJECT public: enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; @@ -74,47 +75,49 @@ public: // retrieve the current playlist entry (media file link) const DocLnk *current() const; void useSelectedDocument(); TabType currentTab() const; Entry currentEntry() const; public slots: bool first(); bool last(); bool next(); bool prev(); void writeDefaultPlaylist( ); QString currentFileListPathName() const; protected: + QCopChannel * channel; void keyReleaseEvent( QKeyEvent *e); signals: void skinSelected(); private: int defaultSkinIndex; /* void readm3u(const QString &); */ /* void readPls(const QString &); */ void readListFromFile(const QString &); void initializeStates(); bool inFileListMode() const; private slots: + void qcopReceive(const QCString&, const QByteArray&); void populateSkinsMenu(); void skinsMenuActivated(int); void pmViewActivated(int); void writem3u(); void writeCurrentM3u(); void openFile(); void setDocument( const QString& fileref ); void addToSelection( const DocLnk& ); // Add a media file to the playlist void addToSelection( QListViewItem* ); // Add a media file to the playlist void clearList(); void addAllToList(); void addAllMusicToList(); void addAllVideoToList(); void saveList(); // Save the playlist void loadList( const DocLnk &); // Load a playlist void playIt( QListViewItem *); |