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 | |||
@@ -87,128 +87,133 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
87 | pmPlayList->insertSeparator(-1); | 87 | pmPlayList->insertSeparator(-1); |
88 | (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), | 88 | (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), |
89 | this,SLOT( openFile() ) ); | 89 | this,SLOT( openFile() ) ); |
90 | pmPlayList->insertSeparator(-1); | 90 | pmPlayList->insertSeparator(-1); |
91 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), | 91 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), |
92 | audioView, SLOT( scanFiles() ) ); | 92 | audioView, SLOT( scanFiles() ) ); |
93 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), | 93 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), |
94 | videoView, SLOT( scanFiles() ) ); | 94 | videoView, SLOT( scanFiles() ) ); |
95 | 95 | ||
96 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), | 96 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), |
97 | &mediaPlayerState, SLOT( toggleFullscreen() ) ); | 97 | &mediaPlayerState, SLOT( toggleFullscreen() ) ); |
98 | 98 | ||
99 | Config cfg( "OpiePlayer" ); | 99 | Config cfg( "OpiePlayer" ); |
100 | bool b= cfg.readBoolEntry("FullScreen", 0); | 100 | bool b= cfg.readBoolEntry("FullScreen", 0); |
101 | mediaPlayerState.setFullscreen( b ); | 101 | mediaPlayerState.setFullscreen( b ); |
102 | pmView->setItemChecked( -16, b ); | 102 | pmView->setItemChecked( -16, b ); |
103 | 103 | ||
104 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", | 104 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", |
105 | d->selectedFiles, SLOT(moveSelectedUp() ) ); | 105 | d->selectedFiles, SLOT(moveSelectedUp() ) ); |
106 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", | 106 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", |
107 | d->selectedFiles, SLOT(removeSelected() ) ); | 107 | d->selectedFiles, SLOT(removeSelected() ) ); |
108 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", | 108 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", |
109 | d->selectedFiles, SLOT(moveSelectedDown() ) ); | 109 | d->selectedFiles, SLOT(moveSelectedDown() ) ); |
110 | // QVBox *stretch2 = new QVBox( vbox1 ); | 110 | // QVBox *stretch2 = new QVBox( vbox1 ); |
111 | 111 | ||
112 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), | 112 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), |
113 | SLOT( deletePlaylist() ) ); | 113 | SLOT( deletePlaylist() ) ); |
114 | connect( pmView, SIGNAL( activated( int ) ), | 114 | connect( pmView, SIGNAL( activated( int ) ), |
115 | this, SLOT( pmViewActivated( int ) ) ); | 115 | this, SLOT( pmViewActivated( int ) ) ); |
116 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 116 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
117 | this, SLOT( skinsMenuActivated( int ) ) ); | 117 | this, SLOT( skinsMenuActivated( int ) ) ); |
118 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 118 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
119 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 119 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
120 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), | 120 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), |
121 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 121 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
122 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), | 122 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), |
123 | this,SLOT( playIt( QListViewItem *) ) ); | 123 | this,SLOT( playIt( QListViewItem *) ) ); |
124 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), | 124 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), |
125 | this, SLOT( addToSelection( QListViewItem *) ) ); | 125 | this, SLOT( addToSelection( QListViewItem *) ) ); |
126 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 126 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
127 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); | 127 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); |
128 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), | 128 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), |
129 | this,SLOT( playIt( QListViewItem *) ) ); | 129 | this,SLOT( playIt( QListViewItem *) ) ); |
130 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), | 130 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), |
131 | this, SLOT( addToSelection( QListViewItem *) ) ); | 131 | this, SLOT( addToSelection( QListViewItem *) ) ); |
132 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), | 132 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), |
133 | this, SLOT( loadList( const DocLnk & ) ) ); | 133 | this, SLOT( loadList( const DocLnk & ) ) ); |
134 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), | 134 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), |
135 | this, SLOT( tabChanged( QWidget* ) ) ); | 135 | this, SLOT( tabChanged( QWidget* ) ) ); |
136 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 136 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
137 | d->tbPlay, SLOT( setOn( bool ) ) ); | 137 | d->tbPlay, SLOT( setOn( bool ) ) ); |
138 | connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), | 138 | connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), |
139 | d->tbLoop, SLOT( setOn( bool ) ) ); | 139 | d->tbLoop, SLOT( setOn( bool ) ) ); |
140 | connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), | 140 | connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), |
141 | d->tbShuffle, SLOT( setOn( bool ) ) ); | 141 | d->tbShuffle, SLOT( setOn( bool ) ) ); |
142 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), | 142 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), |
143 | this, SLOT( playIt( QListViewItem *) ) ); | 143 | this, SLOT( playIt( QListViewItem *) ) ); |
144 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), | 144 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), |
145 | &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); | 145 | &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); |
146 | 146 | ||
147 | // see which skins are installed | 147 | // see which skins are installed |
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 ) ); |
154 | 159 | ||
155 | tabWidget->showPage( playListTab ); | 160 | tabWidget->showPage( playListTab ); |
156 | } | 161 | } |
157 | 162 | ||
158 | 163 | ||
159 | PlayListWidget::~PlayListWidget() { | 164 | PlayListWidget::~PlayListWidget() { |
160 | delete d; | 165 | delete d; |
161 | } | 166 | } |
162 | 167 | ||
163 | 168 | ||
164 | void PlayListWidget::initializeStates() { | 169 | void PlayListWidget::initializeStates() { |
165 | d->tbPlay->setOn( mediaPlayerState.isPlaying() ); | 170 | d->tbPlay->setOn( mediaPlayerState.isPlaying() ); |
166 | d->tbLoop->setOn( mediaPlayerState.isLooping() ); | 171 | d->tbLoop->setOn( mediaPlayerState.isLooping() ); |
167 | d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); | 172 | d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); |
168 | d->playListFrame->show(); | 173 | d->playListFrame->show(); |
169 | } | 174 | } |
170 | 175 | ||
171 | void PlayListWidget::writeDefaultPlaylist() { | 176 | void PlayListWidget::writeDefaultPlaylist() { |
172 | 177 | ||
173 | Config config( "OpiePlayer" ); | 178 | Config config( "OpiePlayer" ); |
174 | config.setGroup( "PlayList" ); | 179 | config.setGroup( "PlayList" ); |
175 | QString filename=QPEApplication::documentDir() + "/default.m3u"; | 180 | QString filename=QPEApplication::documentDir() + "/default.m3u"; |
176 | QString currentString = config.readEntry( "CurrentPlaylist", filename); | 181 | QString currentString = config.readEntry( "CurrentPlaylist", filename); |
177 | if( currentString == filename) { | 182 | if( currentString == filename) { |
178 | Om3u *m3uList; | 183 | Om3u *m3uList; |
179 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); | 184 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); |
180 | if( d->selectedFiles->first() ) { | 185 | if( d->selectedFiles->first() ) { |
181 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 186 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
182 | do { | 187 | do { |
183 | // qDebug(d->selectedFiles->current()->file()); | 188 | // qDebug(d->selectedFiles->current()->file()); |
184 | m3uList->add( d->selectedFiles->current()->file() ); | 189 | m3uList->add( d->selectedFiles->current()->file() ); |
185 | } | 190 | } |
186 | while ( d->selectedFiles->next() ); | 191 | while ( d->selectedFiles->next() ); |
187 | 192 | ||
188 | m3uList->write(); | 193 | m3uList->write(); |
189 | m3uList->close(); | 194 | m3uList->close(); |
190 | delete m3uList; | 195 | delete m3uList; |
191 | 196 | ||
192 | } | 197 | } |
193 | } | 198 | } |
194 | } | 199 | } |
195 | 200 | ||
196 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 201 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
197 | d->setDocumentUsed = FALSE; | 202 | d->setDocumentUsed = FALSE; |
198 | if( QFileInfo( lnk.file() ).exists() || | 203 | if( QFileInfo( lnk.file() ).exists() || |
199 | lnk.file().left(4) == "http" ) { | 204 | lnk.file().left(4) == "http" ) { |
200 | d->selectedFiles->addToSelection( lnk ); | 205 | d->selectedFiles->addToSelection( lnk ); |
201 | } | 206 | } |
202 | // writeCurrentM3u(); | 207 | // writeCurrentM3u(); |
203 | } | 208 | } |
204 | 209 | ||
205 | 210 | ||
206 | void PlayListWidget::clearList() { | 211 | void PlayListWidget::clearList() { |
207 | while ( first() ) { | 212 | while ( first() ) { |
208 | d->selectedFiles->removeSelected(); | 213 | d->selectedFiles->removeSelected(); |
209 | } | 214 | } |
210 | Config cfg( "OpiePlayer" ); | 215 | Config cfg( "OpiePlayer" ); |
211 | cfg.setGroup("PlayList"); | 216 | cfg.setGroup("PlayList"); |
212 | cfg.writeEntry("CurrentPlaylist","default"); | 217 | cfg.writeEntry("CurrentPlaylist","default"); |
213 | setCaption("OpiePlayer"); | 218 | setCaption("OpiePlayer"); |
214 | } | 219 | } |
@@ -853,64 +858,108 @@ void PlayListWidget::populateSkinsMenu() { | |||
853 | cfg.setGroup("Options" ); | 858 | cfg.setGroup("Options" ); |
854 | QString skin = cfg.readEntry( "Skin", "default" ); | 859 | QString skin = cfg.readEntry( "Skin", "default" ); |
855 | 860 | ||
856 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 861 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
857 | skinsDir.setFilter( QDir::Dirs ); | 862 | skinsDir.setFilter( QDir::Dirs ); |
858 | skinsDir.setSorting(QDir::Name ); | 863 | skinsDir.setSorting(QDir::Name ); |
859 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 864 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
860 | QFileInfoListIterator it( *skinslist ); | 865 | QFileInfoListIterator it( *skinslist ); |
861 | QFileInfo *fi; | 866 | QFileInfo *fi; |
862 | while ( ( fi = it.current() ) ) { | 867 | while ( ( fi = it.current() ) ) { |
863 | skinName = fi->fileName(); | 868 | skinName = fi->fileName(); |
864 | // qDebug( fi->fileName() ); | 869 | // qDebug( fi->fileName() ); |
865 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 870 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
866 | item = skinsMenu->insertItem( fi->fileName() ) ; | 871 | item = skinsMenu->insertItem( fi->fileName() ) ; |
867 | } | 872 | } |
868 | if( skinName == "default" ) { | 873 | if( skinName == "default" ) { |
869 | defaultSkinIndex = item; | 874 | defaultSkinIndex = item; |
870 | } | 875 | } |
871 | if( skinName == skin ) { | 876 | if( skinName == skin ) { |
872 | skinsMenu->setItemChecked( item, TRUE ); | 877 | skinsMenu->setItemChecked( item, TRUE ); |
873 | } | 878 | } |
874 | ++it; | 879 | ++it; |
875 | } | 880 | } |
876 | } | 881 | } |
877 | 882 | ||
878 | void PlayListWidget::skinsMenuActivated( int item ) { | 883 | void PlayListWidget::skinsMenuActivated( int item ) { |
879 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 884 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
880 | skinsMenu->setItemChecked( i, FALSE ); | 885 | skinsMenu->setItemChecked( i, FALSE ); |
881 | } | 886 | } |
882 | skinsMenu->setItemChecked( item, TRUE ); | 887 | skinsMenu->setItemChecked( item, TRUE ); |
883 | 888 | ||
884 | { | 889 | { |
885 | Config cfg( "OpiePlayer" ); | 890 | Config cfg( "OpiePlayer" ); |
886 | cfg.setGroup("Options"); | 891 | cfg.setGroup("Options"); |
887 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 892 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
888 | } | 893 | } |
889 | 894 | ||
890 | emit skinSelected(); | 895 | emit skinSelected(); |
891 | } | 896 | } |
892 | 897 | ||
893 | PlayListWidget::TabType PlayListWidget::currentTab() const | 898 | PlayListWidget::TabType PlayListWidget::currentTab() const |
894 | { | 899 | { |
895 | static const TabType indexToTabType[ TabTypeCount ] = | 900 | static const TabType indexToTabType[ TabTypeCount ] = |
896 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 901 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
897 | 902 | ||
898 | int index = tabWidget->currentPageIndex(); | 903 | int index = tabWidget->currentPageIndex(); |
899 | assert( index < TabTypeCount && index >= 0 ); | 904 | assert( index < TabTypeCount && index >= 0 ); |
900 | 905 | ||
901 | return indexToTabType[ index ]; | 906 | return indexToTabType[ index ]; |
902 | } | 907 | } |
903 | 908 | ||
904 | PlayListWidget::Entry PlayListWidget::currentEntry() const | 909 | PlayListWidget::Entry PlayListWidget::currentEntry() const |
905 | { | 910 | { |
906 | if ( currentTab() == CurrentPlayList ) { | 911 | if ( currentTab() == CurrentPlayList ) { |
907 | const DocLnk *lnk = current(); | 912 | const DocLnk *lnk = current(); |
908 | return Entry( lnk->name(), lnk->file() ); | 913 | return Entry( lnk->name(), lnk->file() ); |
909 | } | 914 | } |
910 | 915 | ||
911 | return Entry( currentFileListPathName() ); | 916 | return Entry( currentFileListPathName() ); |
912 | } | 917 | } |
913 | 918 | ||
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 | |||
@@ -1,139 +1,142 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef PLAY_LIST_WIDGET_H | 34 | #ifndef PLAY_LIST_WIDGET_H |
35 | #define PLAY_LIST_WIDGET_H | 35 | #define PLAY_LIST_WIDGET_H |
36 | 36 | ||
37 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
38 | #include <qpe/applnk.h> | 38 | #include <qpe/applnk.h> |
39 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
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 | ||
46 | 47 | ||
47 | //class PlayListWidgetPrivate; | 48 | //class PlayListWidgetPrivate; |
48 | class Config; | 49 | class Config; |
49 | class QListViewItem; | 50 | class QListViewItem; |
50 | class QListView; | 51 | class QListView; |
51 | class QPoint; | 52 | class QPoint; |
52 | class QAction; | 53 | class QAction; |
53 | class QLabel; | 54 | class QLabel; |
54 | 55 | ||
55 | class PlayListWidget : public PlayListWidgetGui { | 56 | class PlayListWidget : public PlayListWidgetGui { |
56 | Q_OBJECT | 57 | Q_OBJECT |
57 | public: | 58 | public: |
58 | enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 59 | enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
59 | enum { TabTypeCount = 4 }; | 60 | enum { TabTypeCount = 4 }; |
60 | 61 | ||
61 | struct Entry | 62 | struct Entry |
62 | { | 63 | { |
63 | Entry( const QString &_name, const QString &_fileName ) | 64 | Entry( const QString &_name, const QString &_fileName ) |
64 | : name( _name ), file( _fileName ) {} | 65 | : name( _name ), file( _fileName ) {} |
65 | Entry( const QString &_fileName ) | 66 | Entry( const QString &_fileName ) |
66 | : name( _fileName ), file( _fileName ) {} | 67 | : name( _fileName ), file( _fileName ) {} |
67 | 68 | ||
68 | QString name; | 69 | QString name; |
69 | QString file; | 70 | QString file; |
70 | }; | 71 | }; |
71 | 72 | ||
72 | PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); | 73 | PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
73 | ~PlayListWidget(); | 74 | ~PlayListWidget(); |
74 | 75 | ||
75 | // retrieve the current playlist entry (media file link) | 76 | // retrieve the current playlist entry (media file link) |
76 | const DocLnk *current() const; | 77 | const DocLnk *current() const; |
77 | void useSelectedDocument(); | 78 | void useSelectedDocument(); |
78 | TabType currentTab() const; | 79 | TabType currentTab() const; |
79 | 80 | ||
80 | Entry currentEntry() const; | 81 | Entry currentEntry() const; |
81 | 82 | ||
82 | public slots: | 83 | public slots: |
83 | bool first(); | 84 | bool first(); |
84 | bool last(); | 85 | bool last(); |
85 | bool next(); | 86 | bool next(); |
86 | bool prev(); | 87 | bool prev(); |
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: |
93 | void skinSelected(); | 95 | void skinSelected(); |
94 | 96 | ||
95 | private: | 97 | private: |
96 | int defaultSkinIndex; | 98 | int defaultSkinIndex; |
97 | /* void readm3u(const QString &); */ | 99 | /* void readm3u(const QString &); */ |
98 | /* void readPls(const QString &); */ | 100 | /* void readPls(const QString &); */ |
99 | void readListFromFile(const QString &); | 101 | void readListFromFile(const QString &); |
100 | void initializeStates(); | 102 | void initializeStates(); |
101 | 103 | ||
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); |
108 | void writem3u(); | 111 | void writem3u(); |
109 | void writeCurrentM3u(); | 112 | void writeCurrentM3u(); |
110 | void openFile(); | 113 | void openFile(); |
111 | void setDocument( const QString& fileref ); | 114 | void setDocument( const QString& fileref ); |
112 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 115 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
113 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 116 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
114 | void clearList(); | 117 | void clearList(); |
115 | void addAllToList(); | 118 | void addAllToList(); |
116 | void addAllMusicToList(); | 119 | void addAllMusicToList(); |
117 | void addAllVideoToList(); | 120 | void addAllVideoToList(); |
118 | void saveList(); // Save the playlist | 121 | void saveList(); // Save the playlist |
119 | void loadList( const DocLnk &); // Load a playlist | 122 | void loadList( const DocLnk &); // Load a playlist |
120 | void playIt( QListViewItem *); | 123 | void playIt( QListViewItem *); |
121 | void btnPlay(bool); | 124 | void btnPlay(bool); |
122 | void deletePlaylist(); | 125 | void deletePlaylist(); |
123 | void addSelected(); | 126 | void addSelected(); |
124 | void removeSelected(); | 127 | void removeSelected(); |
125 | void tabChanged(QWidget*); | 128 | void tabChanged(QWidget*); |
126 | void viewPressed( int, QListViewItem *, const QPoint&, int); | 129 | void viewPressed( int, QListViewItem *, const QPoint&, int); |
127 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); | 130 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); |
128 | void playSelected(); | 131 | void playSelected(); |
129 | 132 | ||
130 | private: | 133 | private: |
131 | bool fromSetDocument; | 134 | bool fromSetDocument; |
132 | bool insanityBool; | 135 | bool insanityBool; |
133 | QString setDocFileRef, currentPlayList; | 136 | QString setDocFileRef, currentPlayList; |
134 | int selected; | 137 | int selected; |
135 | QListView *currentFileListView; | 138 | QListView *currentFileListView; |
136 | }; | 139 | }; |
137 | 140 | ||
138 | #endif // PLAY_LIST_WIDGET_H | 141 | #endif // PLAY_LIST_WIDGET_H |
139 | 142 | ||