author | llornkcor <llornkcor> | 2003-05-04 21:34:02 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-05-04 21:34:02 (UTC) |
commit | 2894d0b14c0b3efa3ce259214b5aa597a6abfed1 (patch) (unidiff) | |
tree | 8dec50e12adb1b66eaf20e1caa4f384a43033073 | |
parent | 7372d0271b19bc6ead8e796a949746ae45fe13fa (diff) | |
download | opie-2894d0b14c0b3efa3ce259214b5aa597a6abfed1.zip opie-2894d0b14c0b3efa3ce259214b5aa597a6abfed1.tar.gz opie-2894d0b14c0b3efa3ce259214b5aa597a6abfed1.tar.bz2 |
added a few convience qcop messages. see readme for more info. not totally finished yet
-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 @@ | |||
1 | qcop channel is: | ||
2 | QPE/Application/opieplayer2 | ||
3 | |||
4 | qcop calls enabled: | ||
5 | "play()" //plays current selection | ||
6 | "stop()" //stops playing | ||
7 | "togglePause()"//pauses | ||
8 | "next()" //select next in list | ||
9 | "prev()" //select previous in list | ||
10 | "toggleLooping()" //loop or not loop | ||
11 | "toggleShuffled()" //shuffled or not shuffled | ||
12 | "play(QString)" //play this now, needs full file path | ||
13 | "add(QString)" //add to playlist, needs full file path | ||
14 | |||
15 | |||
16 | qcop calls to be enabled: | ||
17 | "volUp()" //volume more | ||
18 | "volDown()" //volume less | ||
19 | "rem(QString)" //remove from playlist | ||
20 | "getPlaylist()" // gets list of songs in current playlist | ||
21 | |||
22 | |||
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 | |||
@@ -148,6 +148,11 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
148 | populateSkinsMenu(); | 148 | populateSkinsMenu(); |
149 | initializeStates(); | 149 | initializeStates(); |
150 | 150 | ||
151 | channel = new QCopChannel( "QPE/Application/opieplayer2", this ); | ||
152 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
153 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); | ||
154 | |||
155 | |||
151 | cfg.setGroup("PlayList"); | 156 | cfg.setGroup("PlayList"); |
152 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 157 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
153 | loadList(DocLnk( currentPlaylist ) ); | 158 | loadList(DocLnk( currentPlaylist ) ); |
@@ -914,3 +919,47 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const | |||
914 | QString PlayListWidget::currentFileListPathName() const { | 919 | QString PlayListWidget::currentFileListPathName() const { |
915 | return currentFileListView->currentItem()->text( 3 ); | 920 | return currentFileListView->currentItem()->text( 3 ); |
916 | } | 921 | } |
922 | |||
923 | |||
924 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { | ||
925 | qDebug("qcop message "+msg ); | ||
926 | QDataStream stream ( data, IO_ReadOnly ); | ||
927 | if ( msg == "play()" ) { //plays current selection | ||
928 | btnPlay( true); | ||
929 | } else if ( msg == "stop()" ) { | ||
930 | mediaPlayerState.setPlaying( false); | ||
931 | } else if ( msg == "togglePause()" ) { | ||
932 | mediaPlayerState.togglePaused(); | ||
933 | } else if ( msg == "next()" ) { //select next in list | ||
934 | mediaPlayerState.setNext(); | ||
935 | } else if ( msg == "prev()" ) { //select previous in list | ||
936 | mediaPlayerState.setPrev(); | ||
937 | } else if ( msg == "toggleLooping()" ) { //loop or not loop | ||
938 | mediaPlayerState.toggleLooping(); | ||
939 | } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled | ||
940 | mediaPlayerState.toggleShuffled(); | ||
941 | } else if ( msg == "volUp()" ) { //volume more | ||
942 | // emit moreClicked(); | ||
943 | // emit moreReleased(); | ||
944 | } else if ( msg == "volDown()" ) { //volume less | ||
945 | // emit lessClicked(); | ||
946 | // emit lessReleased(); | ||
947 | } else if ( msg == "play(QString)" ) { //play this now | ||
948 | QString file; | ||
949 | stream >> file; | ||
950 | setDocument( (const QString &) file); | ||
951 | } else if ( msg == "add(QString)" ) { //add to playlist | ||
952 | QString file; | ||
953 | stream >> file; | ||
954 | QFileInfo fileInfo(file); | ||
955 | DocLnk lnk; | ||
956 | lnk.setName( fileInfo.baseName() ); //sets name | ||
957 | lnk.setFile( file ); //sets file name | ||
958 | addToSelection( lnk ); | ||
959 | } else if ( msg == "rem(QString)" ) { //remove from playlist | ||
960 | QString file; | ||
961 | stream >> file; | ||
962 | |||
963 | } | ||
964 | |||
965 | } | ||
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 | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <qpe/fileselector.h> | 40 | #include <qpe/fileselector.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qpopupmenu.h> | 42 | #include <qpopupmenu.h> |
43 | #include <qpe/qcopenvelope_qws.h> | ||
43 | 44 | ||
44 | #include "playlistwidgetgui.h" | 45 | #include "playlistwidgetgui.h" |
45 | 46 | ||
@@ -87,6 +88,7 @@ public slots: | |||
87 | void writeDefaultPlaylist( ); | 88 | void writeDefaultPlaylist( ); |
88 | QString currentFileListPathName() const; | 89 | QString currentFileListPathName() const; |
89 | protected: | 90 | protected: |
91 | QCopChannel * channel; | ||
90 | void keyReleaseEvent( QKeyEvent *e); | 92 | void keyReleaseEvent( QKeyEvent *e); |
91 | 93 | ||
92 | signals: | 94 | signals: |
@@ -102,6 +104,7 @@ private: | |||
102 | bool inFileListMode() const; | 104 | bool inFileListMode() const; |
103 | 105 | ||
104 | private slots: | 106 | private slots: |
107 | void qcopReceive(const QCString&, const QByteArray&); | ||
105 | void populateSkinsMenu(); | 108 | void populateSkinsMenu(); |
106 | void skinsMenuActivated(int); | 109 | void skinsMenuActivated(int); |
107 | void pmViewActivated(int); | 110 | void pmViewActivated(int); |