author | llornkcor <llornkcor> | 2002-11-14 02:56:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-14 02:56:04 (UTC) |
commit | 4a60497bd689bd01ca301378f382bff6863b592e (patch) (unidiff) | |
tree | 3b9926eb8f6f89b204eaca2a443b6bb9b5e9f883 | |
parent | 3bfb64a41ca7948b593982fc1c266d5ec829b9ab (diff) | |
download | opie-4a60497bd689bd01ca301378f382bff6863b592e.zip opie-4a60497bd689bd01ca301378f382bff6863b592e.tar.gz opie-4a60497bd689bd01ca301378f382bff6863b592e.tar.bz2 |
no longer scans and populates audio_video lists everytime tab is changed. rescan from File menu does it except for the first tab change
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 18 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index c2b5c77..6bedb57 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -63,192 +63,194 @@ extern MediaPlayerState *mediaPlayerState; | |||
63 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; | 63 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; |
64 | // no m3u's here please | 64 | // no m3u's here please |
65 | 65 | ||
66 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 66 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
67 | : PlayListWidgetGui( parent, name, fl ) { | 67 | : PlayListWidgetGui( parent, name, fl ) { |
68 | 68 | ||
69 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 69 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
70 | "opieplayer2/add_to_playlist", | 70 | "opieplayer2/add_to_playlist", |
71 | this , SLOT(addSelected() ) ); | 71 | this , SLOT(addSelected() ) ); |
72 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), | 72 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), |
73 | "opieplayer2/remove_from_playlist", | 73 | "opieplayer2/remove_from_playlist", |
74 | this , SLOT(removeSelected() ) ); | 74 | this , SLOT(removeSelected() ) ); |
75 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 75 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", |
76 | this , SLOT( btnPlay( bool) ), TRUE ); | 76 | this , SLOT( btnPlay( bool) ), TRUE ); |
77 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 77 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
78 | mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); | 78 | mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); |
79 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", | 79 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", |
80 | mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); | 80 | mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); |
81 | 81 | ||
82 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 82 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
83 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), | 83 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), |
84 | this, SLOT( addAllMusicToList() ) ); | 84 | this, SLOT( addAllMusicToList() ) ); |
85 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), | 85 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), |
86 | this, SLOT( addAllVideoToList() ) ); | 86 | this, SLOT( addAllVideoToList() ) ); |
87 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), | 87 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), |
88 | this, SLOT( addAllToList() ) ); | 88 | this, SLOT( addAllToList() ) ); |
89 | pmPlayList->insertSeparator(-1); | 89 | pmPlayList->insertSeparator(-1); |
90 | // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), | 90 | // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), |
91 | // this, SLOT( saveList() ) ); | 91 | // this, SLOT( saveList() ) ); |
92 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), | 92 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), |
93 | this, SLOT(writem3u() ) ); | 93 | this, SLOT(writem3u() ) ); |
94 | pmPlayList->insertSeparator(-1); | 94 | pmPlayList->insertSeparator(-1); |
95 | (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), | 95 | (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), |
96 | this,SLOT( openFile() ) ); | 96 | this,SLOT( openFile() ) ); |
97 | pmPlayList->insertSeparator(-1); | 97 | pmPlayList->insertSeparator(-1); |
98 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), | 98 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), |
99 | this,SLOT( scanForAudio() ) ); | 99 | this,SLOT( scanForAudio() ) ); |
100 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), | 100 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), |
101 | this,SLOT( scanForVideo() ) ); | 101 | this,SLOT( scanForVideo() ) ); |
102 | 102 | ||
103 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), | 103 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), |
104 | mediaPlayerState, SLOT( toggleFullscreen() ) ); | 104 | mediaPlayerState, SLOT( toggleFullscreen() ) ); |
105 | 105 | ||
106 | Config cfg( "OpiePlayer" ); | 106 | Config cfg( "OpiePlayer" ); |
107 | bool b= cfg.readBoolEntry("FullScreen", 0); | 107 | bool b= cfg.readBoolEntry("FullScreen", 0); |
108 | mediaPlayerState->setFullscreen( b ); | 108 | mediaPlayerState->setFullscreen( b ); |
109 | pmView->setItemChecked( -16, b ); | 109 | pmView->setItemChecked( -16, b ); |
110 | 110 | ||
111 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", | 111 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", |
112 | d->selectedFiles, SLOT(moveSelectedUp() ) ); | 112 | d->selectedFiles, SLOT(moveSelectedUp() ) ); |
113 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", | 113 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", |
114 | d->selectedFiles, SLOT(removeSelected() ) ); | 114 | d->selectedFiles, SLOT(removeSelected() ) ); |
115 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", | 115 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", |
116 | d->selectedFiles, SLOT(moveSelectedDown() ) ); | 116 | d->selectedFiles, SLOT(moveSelectedDown() ) ); |
117 | QVBox *stretch2 = new QVBox( vbox1 ); | 117 | QVBox *stretch2 = new QVBox( vbox1 ); |
118 | 118 | ||
119 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), | 119 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), |
120 | SLOT( deletePlaylist() ) ); | 120 | SLOT( deletePlaylist() ) ); |
121 | connect( pmView, SIGNAL( activated( int ) ), | 121 | connect( pmView, SIGNAL( activated( int ) ), |
122 | this, SLOT( pmViewActivated( int ) ) ); | 122 | this, SLOT( pmViewActivated( int ) ) ); |
123 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 123 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
124 | this, SLOT( skinsMenuActivated( int ) ) ); | 124 | this, SLOT( skinsMenuActivated( int ) ) ); |
125 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 125 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
126 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 126 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
127 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), | 127 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), |
128 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 128 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
129 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), | 129 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), |
130 | this,SLOT( playIt( QListViewItem *) ) ); | 130 | this,SLOT( playIt( QListViewItem *) ) ); |
131 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), | 131 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), |
132 | this, SLOT( addToSelection( QListViewItem *) ) ); | 132 | this, SLOT( addToSelection( QListViewItem *) ) ); |
133 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 133 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
134 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); | 134 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); |
135 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), | 135 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), |
136 | this,SLOT( playIt( QListViewItem *) ) ); | 136 | this,SLOT( playIt( QListViewItem *) ) ); |
137 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), | 137 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), |
138 | this, SLOT( addToSelection( QListViewItem *) ) ); | 138 | this, SLOT( addToSelection( QListViewItem *) ) ); |
139 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), | 139 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), |
140 | this, SLOT( loadList( const DocLnk & ) ) ); | 140 | this, SLOT( loadList( const DocLnk & ) ) ); |
141 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), | 141 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), |
142 | this, SLOT( tabChanged( QWidget* ) ) ); | 142 | this, SLOT( tabChanged( QWidget* ) ) ); |
143 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 143 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
144 | d->tbPlay, SLOT( setOn( bool ) ) ); | 144 | d->tbPlay, SLOT( setOn( bool ) ) ); |
145 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), | 145 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), |
146 | d->tbLoop, SLOT( setOn( bool ) ) ); | 146 | d->tbLoop, SLOT( setOn( bool ) ) ); |
147 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), | 147 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), |
148 | d->tbShuffle, SLOT( setOn( bool ) ) ); | 148 | d->tbShuffle, SLOT( setOn( bool ) ) ); |
149 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), | 149 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), |
150 | this, SLOT( setPlaylist( bool ) ) ); | 150 | this, SLOT( setPlaylist( bool ) ) ); |
151 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), | 151 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), |
152 | this, SLOT( playIt( QListViewItem *) ) ); | 152 | this, SLOT( playIt( QListViewItem *) ) ); |
153 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), | 153 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), |
154 | mediaPlayerState, SLOT( setVideoGamma( int ) ) ); | 154 | mediaPlayerState, SLOT( setVideoGamma( int ) ) ); |
155 | 155 | ||
156 | // see which skins are installed | 156 | // see which skins are installed |
157 | videoScan=false; | 157 | videoScan=false; |
158 | audioScan=false; | 158 | audioScan=false; |
159 | audioPopulated=false; | ||
160 | videoPopulated=false; | ||
159 | populateSkinsMenu(); | 161 | populateSkinsMenu(); |
160 | initializeStates(); | 162 | initializeStates(); |
161 | 163 | ||
162 | cfg.setGroup("PlayList"); | 164 | cfg.setGroup("PlayList"); |
163 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 165 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
164 | loadList(DocLnk( currentPlaylist ) ); | 166 | loadList(DocLnk( currentPlaylist ) ); |
165 | } | 167 | } |
166 | 168 | ||
167 | 169 | ||
168 | PlayListWidget::~PlayListWidget() { | 170 | PlayListWidget::~PlayListWidget() { |
169 | if ( d->current ) { | 171 | if ( d->current ) { |
170 | delete d->current; | 172 | delete d->current; |
171 | } | 173 | } |
172 | delete d; | 174 | delete d; |
173 | } | 175 | } |
174 | 176 | ||
175 | 177 | ||
176 | void PlayListWidget::initializeStates() { | 178 | void PlayListWidget::initializeStates() { |
177 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 179 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
178 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 180 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
179 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 181 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
180 | setPlaylist( true ); | 182 | setPlaylist( true ); |
181 | } | 183 | } |
182 | 184 | ||
183 | void PlayListWidget::writeDefaultPlaylist() { | 185 | void PlayListWidget::writeDefaultPlaylist() { |
184 | 186 | ||
185 | Config config( "OpiePlayer" ); | 187 | Config config( "OpiePlayer" ); |
186 | config.setGroup( "PlayList" ); | 188 | config.setGroup( "PlayList" ); |
187 | QString filename=QPEApplication::documentDir() + "/default.m3u"; | 189 | QString filename=QPEApplication::documentDir() + "/default.m3u"; |
188 | QString currentString = config.readEntry( "CurrentPlaylist", filename); | 190 | QString currentString = config.readEntry( "CurrentPlaylist", filename); |
189 | if( currentString == filename) { | 191 | if( currentString == filename) { |
190 | Om3u *m3uList; | 192 | Om3u *m3uList; |
191 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); | 193 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); |
192 | if( d->selectedFiles->first() ) { | 194 | if( d->selectedFiles->first() ) { |
193 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 195 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
194 | do { | 196 | do { |
195 | // qDebug(d->selectedFiles->current()->file()); | 197 | // qDebug(d->selectedFiles->current()->file()); |
196 | m3uList->add( d->selectedFiles->current()->file() ); | 198 | m3uList->add( d->selectedFiles->current()->file() ); |
197 | } | 199 | } |
198 | while ( d->selectedFiles->next() ); | 200 | while ( d->selectedFiles->next() ); |
199 | 201 | ||
200 | m3uList->write(); | 202 | m3uList->write(); |
201 | m3uList->close(); | 203 | m3uList->close(); |
202 | if(m3uList) delete m3uList; | 204 | if(m3uList) delete m3uList; |
203 | 205 | ||
204 | } | 206 | } |
205 | } | 207 | } |
206 | } | 208 | } |
207 | 209 | ||
208 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 210 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
209 | d->setDocumentUsed = FALSE; | 211 | d->setDocumentUsed = FALSE; |
210 | if ( mediaPlayerState->playlist() ) { | 212 | if ( mediaPlayerState->playlist() ) { |
211 | if( QFileInfo( lnk.file() ).exists() || | 213 | if( QFileInfo( lnk.file() ).exists() || |
212 | lnk.file().left(4) == "http" ) { | 214 | lnk.file().left(4) == "http" ) { |
213 | d->selectedFiles->addToSelection( lnk ); | 215 | d->selectedFiles->addToSelection( lnk ); |
214 | } | 216 | } |
215 | // writeCurrentM3u(); | 217 | // writeCurrentM3u(); |
216 | } | 218 | } |
217 | else | 219 | else |
218 | mediaPlayerState->setPlaying( TRUE ); | 220 | mediaPlayerState->setPlaying( TRUE ); |
219 | } | 221 | } |
220 | 222 | ||
221 | 223 | ||
222 | void PlayListWidget::clearList() { | 224 | void PlayListWidget::clearList() { |
223 | while ( first() ) { | 225 | while ( first() ) { |
224 | d->selectedFiles->removeSelected(); | 226 | d->selectedFiles->removeSelected(); |
225 | } | 227 | } |
226 | } | 228 | } |
227 | 229 | ||
228 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { | 230 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { |
229 | switch (mouse) { | 231 | switch (mouse) { |
230 | case 1: | 232 | case 1: |
231 | break; | 233 | break; |
232 | case 2: | 234 | case 2: |
233 | { | 235 | { |
234 | QPopupMenu m; | 236 | QPopupMenu m; |
235 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 237 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
236 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 238 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
237 | m.exec( QCursor::pos() ); | 239 | m.exec( QCursor::pos() ); |
238 | } | 240 | } |
239 | break; | 241 | break; |
240 | } | 242 | } |
241 | } | 243 | } |
242 | 244 | ||
243 | 245 | ||
244 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 246 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
245 | switch (mouse) { | 247 | switch (mouse) { |
246 | case 1: | 248 | case 1: |
247 | break; | 249 | break; |
248 | case 2: | 250 | case 2: |
249 | { | 251 | { |
250 | QPopupMenu m; | 252 | QPopupMenu m; |
251 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 253 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
252 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 254 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
253 | m.exec( QCursor::pos() ); | 255 | m.exec( QCursor::pos() ); |
254 | } | 256 | } |
@@ -525,342 +527,346 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
525 | } | 527 | } |
526 | } | 528 | } |
527 | 529 | ||
528 | 530 | ||
529 | void PlayListWidget::setPlaylist( bool shown ) { | 531 | void PlayListWidget::setPlaylist( bool shown ) { |
530 | if ( shown ) { | 532 | if ( shown ) { |
531 | d->playListFrame->show(); | 533 | d->playListFrame->show(); |
532 | } else { | 534 | } else { |
533 | d->playListFrame->hide(); | 535 | d->playListFrame->hide(); |
534 | } | 536 | } |
535 | } | 537 | } |
536 | 538 | ||
537 | 539 | ||
538 | void PlayListWidget::addSelected() { | 540 | void PlayListWidget::addSelected() { |
539 | qDebug("addSelected"); | 541 | qDebug("addSelected"); |
540 | DocLnk lnk; | 542 | DocLnk lnk; |
541 | QString filename; | 543 | QString filename; |
542 | switch (whichList()) { | 544 | switch (whichList()) { |
543 | 545 | ||
544 | case 0: //playlist | 546 | case 0: //playlist |
545 | return; | 547 | return; |
546 | break; | 548 | break; |
547 | case 1: { //audio | 549 | case 1: { //audio |
548 | filename=audioView->currentItem()->text(3); | 550 | filename=audioView->currentItem()->text(3); |
549 | // d->selectedFiles->next(); | 551 | // d->selectedFiles->next(); |
550 | } | 552 | } |
551 | break; | 553 | break; |
552 | 554 | ||
553 | case 2: { // video | 555 | case 2: { // video |
554 | filename=videoView->currentItem()->text(3); | 556 | filename=videoView->currentItem()->text(3); |
555 | // tabWidget->setCurrentPage(0); | 557 | // tabWidget->setCurrentPage(0); |
556 | 558 | ||
557 | } | 559 | } |
558 | break; | 560 | break; |
559 | }; | 561 | }; |
560 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 562 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
561 | lnk.setFile( filename ); //sets file name | 563 | lnk.setFile( filename ); //sets file name |
562 | d->selectedFiles->addToSelection( lnk); | 564 | d->selectedFiles->addToSelection( lnk); |
563 | tabWidget->setCurrentPage(0); | 565 | tabWidget->setCurrentPage(0); |
564 | writeCurrentM3u(); | 566 | writeCurrentM3u(); |
565 | } | 567 | } |
566 | 568 | ||
567 | 569 | ||
568 | void PlayListWidget::removeSelected() { | 570 | void PlayListWidget::removeSelected() { |
569 | d->selectedFiles->removeSelected( ); | 571 | d->selectedFiles->removeSelected( ); |
570 | writeCurrentM3u(); | 572 | writeCurrentM3u(); |
571 | } | 573 | } |
572 | 574 | ||
573 | 575 | ||
574 | void PlayListWidget::playIt( QListViewItem *it) { | 576 | void PlayListWidget::playIt( QListViewItem *it) { |
575 | if(!it) return; | 577 | if(!it) return; |
576 | mediaPlayerState->setPlaying(FALSE); | 578 | mediaPlayerState->setPlaying(FALSE); |
577 | mediaPlayerState->setPlaying(TRUE); | 579 | mediaPlayerState->setPlaying(TRUE); |
578 | d->selectedFiles->unSelect(); | 580 | d->selectedFiles->unSelect(); |
579 | } | 581 | } |
580 | 582 | ||
581 | 583 | ||
582 | void PlayListWidget::addToSelection( QListViewItem *it) { | 584 | void PlayListWidget::addToSelection( QListViewItem *it) { |
583 | d->setDocumentUsed = FALSE; | 585 | d->setDocumentUsed = FALSE; |
584 | 586 | ||
585 | if(it) { | 587 | if(it) { |
586 | switch ( whichList()) { | 588 | switch ( whichList()) { |
587 | case 0: //playlist | 589 | case 0: //playlist |
588 | return; | 590 | return; |
589 | break; | 591 | break; |
590 | }; | 592 | }; |
591 | // case 1: { | 593 | // case 1: { |
592 | DocLnk lnk; | 594 | DocLnk lnk; |
593 | QString filename; | 595 | QString filename; |
594 | 596 | ||
595 | filename=it->text(3); | 597 | filename=it->text(3); |
596 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 598 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
597 | lnk.setFile( filename ); //sets file name | 599 | lnk.setFile( filename ); //sets file name |
598 | d->selectedFiles->addToSelection( lnk); | 600 | d->selectedFiles->addToSelection( lnk); |
599 | 601 | ||
600 | writeCurrentM3u(); | 602 | writeCurrentM3u(); |
601 | tabWidget->setCurrentPage(0); | 603 | tabWidget->setCurrentPage(0); |
602 | 604 | ||
603 | } | 605 | } |
604 | } | 606 | } |
605 | 607 | ||
606 | 608 | ||
607 | void PlayListWidget::tabChanged(QWidget *) { | 609 | void PlayListWidget::tabChanged(QWidget *) { |
608 | 610 | ||
609 | switch ( whichList()) { | 611 | switch ( whichList()) { |
610 | case 0: | 612 | case 0: |
611 | { | 613 | { |
612 | if( !tbDeletePlaylist->isHidden() ) { | 614 | if( !tbDeletePlaylist->isHidden() ) { |
613 | tbDeletePlaylist->hide(); | 615 | tbDeletePlaylist->hide(); |
614 | } | 616 | } |
615 | d->tbRemoveFromList->setEnabled(TRUE); | 617 | d->tbRemoveFromList->setEnabled(TRUE); |
616 | d->tbAddToList->setEnabled(FALSE); | 618 | d->tbAddToList->setEnabled(FALSE); |
617 | } | 619 | } |
618 | break; | 620 | break; |
619 | case 1: | 621 | case 1: |
620 | { | 622 | { |
621 | audioView->clear(); | 623 | // audioView->clear(); |
622 | populateAudioView(); | 624 | if(!audioPopulated) populateAudioView(); |
623 | 625 | ||
624 | if( !tbDeletePlaylist->isHidden() ) { | 626 | if( !tbDeletePlaylist->isHidden() ) { |
625 | tbDeletePlaylist->hide(); | 627 | tbDeletePlaylist->hide(); |
626 | } | 628 | } |
627 | d->tbRemoveFromList->setEnabled(FALSE); | 629 | d->tbRemoveFromList->setEnabled(FALSE); |
628 | d->tbAddToList->setEnabled(TRUE); | 630 | d->tbAddToList->setEnabled(TRUE); |
629 | } | 631 | } |
630 | break; | 632 | break; |
631 | case 2: | 633 | case 2: |
632 | { | 634 | { |
633 | videoView->clear(); | 635 | // videoView->clear(); |
634 | populateVideoView(); | 636 | if(!videoPopulated) populateVideoView(); |
635 | if( !tbDeletePlaylist->isHidden() ) { | 637 | if( !tbDeletePlaylist->isHidden() ) { |
636 | tbDeletePlaylist->hide(); | 638 | tbDeletePlaylist->hide(); |
637 | } | 639 | } |
638 | d->tbRemoveFromList->setEnabled(FALSE); | 640 | d->tbRemoveFromList->setEnabled(FALSE); |
639 | d->tbAddToList->setEnabled(TRUE); | 641 | d->tbAddToList->setEnabled(TRUE); |
640 | } | 642 | } |
641 | break; | 643 | break; |
642 | case 3: | 644 | case 3: |
643 | { | 645 | { |
644 | if( tbDeletePlaylist->isHidden() ) { | 646 | if( tbDeletePlaylist->isHidden() ) { |
645 | tbDeletePlaylist->show(); | 647 | tbDeletePlaylist->show(); |
646 | } | 648 | } |
647 | playLists->reread(); | 649 | playLists->reread(); |
648 | } | 650 | } |
649 | break; | 651 | break; |
650 | }; | 652 | }; |
651 | } | 653 | } |
652 | 654 | ||
653 | 655 | ||
654 | void PlayListWidget::btnPlay(bool b) { | 656 | void PlayListWidget::btnPlay(bool b) { |
655 | // mediaPlayerState->setPlaying(false); | 657 | // mediaPlayerState->setPlaying(false); |
656 | mediaPlayerState->setPlaying(b); | 658 | mediaPlayerState->setPlaying(b); |
657 | insanityBool=FALSE; | 659 | insanityBool=FALSE; |
658 | } | 660 | } |
659 | 661 | ||
660 | void PlayListWidget::deletePlaylist() { | 662 | void PlayListWidget::deletePlaylist() { |
661 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 663 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
662 | (tr("You really want to delete\nthis playlist?")), | 664 | (tr("You really want to delete\nthis playlist?")), |
663 | (tr("Yes")), (tr("No")), 0 )){ | 665 | (tr("Yes")), (tr("No")), 0 )){ |
664 | case 0: // Yes clicked, | 666 | case 0: // Yes clicked, |
665 | QFile().remove(playLists->selectedDocument().file()); | 667 | QFile().remove(playLists->selectedDocument().file()); |
666 | QFile().remove(playLists->selectedDocument().linkFile()); | 668 | QFile().remove(playLists->selectedDocument().linkFile()); |
667 | playLists->reread(); | 669 | playLists->reread(); |
668 | break; | 670 | break; |
669 | case 1: // Cancel | 671 | case 1: // Cancel |
670 | break; | 672 | break; |
671 | }; | 673 | }; |
672 | } | 674 | } |
673 | 675 | ||
674 | 676 | ||
675 | void PlayListWidget::playSelected() { | 677 | void PlayListWidget::playSelected() { |
676 | btnPlay( TRUE); | 678 | btnPlay( TRUE); |
677 | } | 679 | } |
678 | 680 | ||
679 | 681 | ||
680 | void PlayListWidget::scanForAudio() { | 682 | void PlayListWidget::scanForAudio() { |
681 | // qDebug("scan for audio"); | 683 | // qDebug("scan for audio"); |
682 | files.detachChildren(); | 684 | files.detachChildren(); |
683 | QListIterator<DocLnk> sdit( files.children() ); | 685 | QListIterator<DocLnk> sdit( files.children() ); |
684 | for ( ; sdit.current(); ++sdit ) { | 686 | for ( ; sdit.current(); ++sdit ) { |
685 | delete sdit.current(); | 687 | delete sdit.current(); |
686 | } | 688 | } |
687 | // Global::findDocuments( &files, "audio/*"); | 689 | // Global::findDocuments( &files, "audio/*"); |
688 | Global::findDocuments( &files, audioMimes); | 690 | Global::findDocuments( &files, audioMimes); |
689 | audioScan = TRUE; | 691 | audioScan = true; |
692 | populateAudioView(); | ||
690 | } | 693 | } |
691 | 694 | ||
692 | void PlayListWidget::scanForVideo() { | 695 | void PlayListWidget::scanForVideo() { |
693 | // qDebug("scan for video"); | 696 | // qDebug("scan for video"); |
694 | vFiles.detachChildren(); | 697 | vFiles.detachChildren(); |
695 | QListIterator<DocLnk> sdit( vFiles.children() ); | 698 | QListIterator<DocLnk> sdit( vFiles.children() ); |
696 | for ( ; sdit.current(); ++sdit ) { | 699 | for ( ; sdit.current(); ++sdit ) { |
697 | delete sdit.current(); | 700 | delete sdit.current(); |
698 | } | 701 | } |
699 | Global::findDocuments(&vFiles, "video/*"); | 702 | Global::findDocuments(&vFiles, "video/*"); |
700 | videoScan = TRUE; | 703 | videoScan = true; |
704 | populateVideoView(); | ||
701 | } | 705 | } |
702 | 706 | ||
703 | void PlayListWidget::populateAudioView() { | 707 | void PlayListWidget::populateAudioView() { |
704 | audioView->clear(); | 708 | audioView->clear(); |
705 | StorageInfo storageInfo; | 709 | StorageInfo storageInfo; |
706 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 710 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
707 | if(!audioScan) { | 711 | if(!audioScan) { |
708 | scanForAudio(); | 712 | scanForAudio(); |
709 | } | 713 | } |
710 | 714 | ||
711 | QListIterator<DocLnk> dit( files.children() ); | 715 | QListIterator<DocLnk> dit( files.children() ); |
712 | QListIterator<FileSystem> it ( fs ); | 716 | QListIterator<FileSystem> it ( fs ); |
713 | 717 | ||
714 | QString storage; | 718 | QString storage; |
715 | for ( ; dit.current(); ++dit ) { | 719 | for ( ; dit.current(); ++dit ) { |
716 | for( ; it.current(); ++it ){ | 720 | for( ; it.current(); ++it ){ |
717 | const QString name = (*it)->name(); | 721 | const QString name = (*it)->name(); |
718 | const QString path = (*it)->path(); | 722 | const QString path = (*it)->path(); |
719 | if(dit.current()->file().find(path) != -1 ) { | 723 | if(dit.current()->file().find(path) != -1 ) { |
720 | storage = name; | 724 | storage = name; |
721 | } | 725 | } |
722 | } | 726 | } |
723 | 727 | ||
724 | QListViewItem * newItem; | 728 | QListViewItem * newItem; |
725 | if ( QFile( dit.current()->file()).exists() || | 729 | if ( QFile( dit.current()->file()).exists() || |
726 | dit.current()->file().left(4) == "http" ) { | 730 | dit.current()->file().left(4) == "http" ) { |
727 | long size; | 731 | long size; |
728 | if( dit.current()->file().left(4) == "http" ) | 732 | if( dit.current()->file().left(4) == "http" ) |
729 | size=0; | 733 | size=0; |
730 | else | 734 | else |
731 | size = QFile( dit.current()->file() ).size(); | 735 | size = QFile( dit.current()->file() ).size(); |
732 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 736 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
733 | QString::number(size ), storage, dit.current()->file()); | 737 | QString::number(size ), storage, dit.current()->file()); |
734 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); | 738 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); |
735 | } | 739 | } |
736 | } | 740 | } |
741 | audioPopulated=true; | ||
737 | } | 742 | } |
738 | 743 | ||
739 | 744 | ||
740 | void PlayListWidget::populateVideoView() { | 745 | void PlayListWidget::populateVideoView() { |
741 | videoView->clear(); | 746 | videoView->clear(); |
742 | StorageInfo storageInfo; | 747 | StorageInfo storageInfo; |
743 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 748 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
744 | 749 | ||
745 | if(!videoScan ) { | 750 | if(!videoScan ) { |
746 | scanForVideo(); | 751 | scanForVideo(); |
747 | } | 752 | } |
748 | 753 | ||
749 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 754 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
750 | QListIterator<FileSystem> it ( fs ); | 755 | QListIterator<FileSystem> it ( fs ); |
751 | videoView->clear(); | 756 | videoView->clear(); |
752 | QString storage, pathName; | 757 | QString storage, pathName; |
753 | for ( ; Vdit.current(); ++Vdit ) { | 758 | for ( ; Vdit.current(); ++Vdit ) { |
754 | for( ; it.current(); ++it ) { | 759 | for( ; it.current(); ++it ) { |
755 | const QString name = (*it)->name(); | 760 | const QString name = (*it)->name(); |
756 | const QString path = (*it)->path(); | 761 | const QString path = (*it)->path(); |
757 | if( Vdit.current()->file().find(path) != -1 ) { | 762 | if( Vdit.current()->file().find(path) != -1 ) { |
758 | storage=name; | 763 | storage=name; |
759 | pathName=path; | 764 | pathName=path; |
760 | } | 765 | } |
761 | } | 766 | } |
762 | 767 | ||
763 | QListViewItem * newItem; | 768 | QListViewItem * newItem; |
764 | if ( QFile( Vdit.current()->file() ).exists() ) { | 769 | if ( QFile( Vdit.current()->file() ).exists() ) { |
765 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 770 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
766 | QString::number( QFile( Vdit.current()->file() ).size() ), | 771 | QString::number( QFile( Vdit.current()->file() ).size() ), |
767 | storage, Vdit.current()->file()); | 772 | storage, Vdit.current()->file()); |
768 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | 773 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); |
769 | } | 774 | } |
770 | } | 775 | } |
776 | videoPopulated=true; | ||
771 | } | 777 | } |
772 | 778 | ||
773 | 779 | ||
774 | void PlayListWidget::openFile() { | 780 | void PlayListWidget::openFile() { |
775 | // http://66.28.164.33:2080 | 781 | // http://66.28.164.33:2080 |
776 | // http://somafm.com/star0242.m3u | 782 | // http://somafm.com/star0242.m3u |
777 | QString filename, name; | 783 | QString filename, name; |
778 | InputDialog *fileDlg; | 784 | InputDialog *fileDlg; |
779 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 785 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
780 | fileDlg->exec(); | 786 | fileDlg->exec(); |
781 | if( fileDlg->result() == 1 ) { | 787 | if( fileDlg->result() == 1 ) { |
782 | filename = fileDlg->text(); | 788 | filename = fileDlg->text(); |
783 | qDebug( "Selected filename is " + filename ); | 789 | qDebug( "Selected filename is " + filename ); |
784 | Om3u *m3uList; | 790 | Om3u *m3uList; |
785 | DocLnk lnk; | 791 | DocLnk lnk; |
786 | Config cfg( "OpiePlayer" ); | 792 | Config cfg( "OpiePlayer" ); |
787 | cfg.setGroup("PlayList"); | 793 | cfg.setGroup("PlayList"); |
788 | 794 | ||
789 | if(filename.left(4) == "http") { | 795 | if(filename.left(4) == "http") { |
790 | QString m3uFile, m3uFilePath; | 796 | QString m3uFile, m3uFilePath; |
791 | if(filename.find(":",8,TRUE) != -1) { //found a port | 797 | if(filename.find(":",8,TRUE) != -1) { //found a port |
792 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | 798 | m3uFile = filename.left( filename.find( ":",8,TRUE)); |
793 | m3uFile = m3uFile.right( 7); | 799 | m3uFile = m3uFile.right( 7); |
794 | } else if(filename.left(4) == "http"){ | 800 | } else if(filename.left(4) == "http"){ |
795 | m3uFile=filename; | 801 | m3uFile=filename; |
796 | m3uFile = m3uFile.right( m3uFile.length() - 7); | 802 | m3uFile = m3uFile.right( m3uFile.length() - 7); |
797 | } else{ | 803 | } else{ |
798 | m3uFile=filename; | 804 | m3uFile=filename; |
799 | } | 805 | } |
800 | 806 | ||
801 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 807 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); |
802 | lnk.setName( filename ); //sets name | 808 | lnk.setName( filename ); //sets name |
803 | lnk.setFile( filename ); //sets file name | 809 | lnk.setFile( filename ); //sets file name |
804 | 810 | ||
805 | // lnk.setIcon("opieplayer2/musicfile"); | 811 | // lnk.setIcon("opieplayer2/musicfile"); |
806 | 812 | ||
807 | d->selectedFiles->addToSelection( lnk ); | 813 | d->selectedFiles->addToSelection( lnk ); |
808 | writeCurrentM3u(); | 814 | writeCurrentM3u(); |
809 | d->selectedFiles->setSelectedItem( lnk.name()); | 815 | d->selectedFiles->setSelectedItem( lnk.name()); |
810 | } | 816 | } |
811 | else if( filename.right( 3) == "m3u" ) { | 817 | else if( filename.right( 3) == "m3u" ) { |
812 | readm3u( filename ); | 818 | readm3u( filename ); |
813 | 819 | ||
814 | } else if( filename.right(3) == "pls" ) { | 820 | } else if( filename.right(3) == "pls" ) { |
815 | readPls( filename ); | 821 | readPls( filename ); |
816 | } else { | 822 | } else { |
817 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 823 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
818 | lnk.setFile( filename ); //sets file name | 824 | lnk.setFile( filename ); //sets file name |
819 | d->selectedFiles->addToSelection( lnk); | 825 | d->selectedFiles->addToSelection( lnk); |
820 | writeCurrentM3u(); | 826 | writeCurrentM3u(); |
821 | d->selectedFiles->setSelectedItem( lnk.name()); | 827 | d->selectedFiles->setSelectedItem( lnk.name()); |
822 | } | 828 | } |
823 | } | 829 | } |
824 | 830 | ||
825 | if( fileDlg ) { | 831 | if( fileDlg ) { |
826 | delete fileDlg; | 832 | delete fileDlg; |
827 | } | 833 | } |
828 | } | 834 | } |
829 | 835 | ||
830 | /* | 836 | /* |
831 | reads m3u and shows files/urls to playlist widget */ | 837 | reads m3u and shows files/urls to playlist widget */ |
832 | void PlayListWidget::readm3u( const QString &filename ) { | 838 | void PlayListWidget::readm3u( const QString &filename ) { |
833 | qDebug( "read m3u filename " + filename ); | 839 | qDebug( "read m3u filename " + filename ); |
834 | 840 | ||
835 | Om3u *m3uList; | 841 | Om3u *m3uList; |
836 | QString s, name; | 842 | QString s, name; |
837 | m3uList = new Om3u( filename, IO_ReadOnly ); | 843 | m3uList = new Om3u( filename, IO_ReadOnly ); |
838 | m3uList->readM3u(); | 844 | m3uList->readM3u(); |
839 | DocLnk lnk; | 845 | DocLnk lnk; |
840 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 846 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
841 | s = *it; | 847 | s = *it; |
842 | // qDebug("reading "+ s); | 848 | // qDebug("reading "+ s); |
843 | if(s.left(4)=="http") { | 849 | if(s.left(4)=="http") { |
844 | lnk.setName( s ); //sets file name | 850 | lnk.setName( s ); //sets file name |
845 | lnk.setIcon("opieplayer2/musicfile"); | 851 | lnk.setIcon("opieplayer2/musicfile"); |
846 | lnk.setFile( s ); //sets file name | 852 | lnk.setFile( s ); //sets file name |
847 | 853 | ||
848 | } else { | 854 | } else { |
849 | // if( QFileInfo( s ).exists() ) { | 855 | // if( QFileInfo( s ).exists() ) { |
850 | lnk.setName( QFileInfo(s).baseName()); | 856 | lnk.setName( QFileInfo(s).baseName()); |
851 | // if(s.right(4) == '.') {//if regular file | 857 | // if(s.right(4) == '.') {//if regular file |
852 | if(s.left(1) != "/") { | 858 | if(s.left(1) != "/") { |
853 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 859 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
854 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 860 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
855 | // lnk.setIcon(MimeType(s).pixmap() ); | 861 | // lnk.setIcon(MimeType(s).pixmap() ); |
856 | // lnk.setIcon("SoundPlayer"); | 862 | // lnk.setIcon("SoundPlayer"); |
857 | } else { | 863 | } else { |
858 | // qDebug("set link2 "+s); | 864 | // qDebug("set link2 "+s); |
859 | lnk.setFile( s); | 865 | lnk.setFile( s); |
860 | // lnk.setIcon(MimeType(s).pixmap() ); | 866 | // lnk.setIcon(MimeType(s).pixmap() ); |
861 | // lnk.setIcon("SoundPlayer"); | 867 | // lnk.setIcon("SoundPlayer"); |
862 | } | 868 | } |
863 | } | 869 | } |
864 | d->selectedFiles->addToSelection( lnk ); | 870 | d->selectedFiles->addToSelection( lnk ); |
865 | } | 871 | } |
866 | Config config( "OpiePlayer" ); | 872 | Config config( "OpiePlayer" ); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 53be7a7..b2c389e 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -1,121 +1,121 @@ | |||
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 | 43 | ||
44 | #include "playlistwidgetgui.h" | 44 | #include "playlistwidgetgui.h" |
45 | 45 | ||
46 | 46 | ||
47 | //class PlayListWidgetPrivate; | 47 | //class PlayListWidgetPrivate; |
48 | class Config; | 48 | class Config; |
49 | class QListViewItem; | 49 | class QListViewItem; |
50 | class QListView; | 50 | class QListView; |
51 | class QPoint; | 51 | class QPoint; |
52 | class QAction; | 52 | class QAction; |
53 | class QLabel; | 53 | class QLabel; |
54 | 54 | ||
55 | class PlayListWidget : public PlayListWidgetGui { | 55 | class PlayListWidget : public PlayListWidgetGui { |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | public: | 57 | public: |
58 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 58 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
59 | ~PlayListWidget(); | 59 | ~PlayListWidget(); |
60 | DocLnkSet files; | 60 | DocLnkSet files; |
61 | DocLnkSet vFiles; | 61 | DocLnkSet vFiles; |
62 | bool fromSetDocument; | 62 | bool fromSetDocument; |
63 | bool insanityBool; | 63 | bool insanityBool; |
64 | QString setDocFileRef, currentPlayList; | 64 | QString setDocFileRef, currentPlayList; |
65 | // retrieve the current playlist entry (media file link) | 65 | // retrieve the current playlist entry (media file link) |
66 | const DocLnk *current(); | 66 | const DocLnk *current(); |
67 | void useSelectedDocument(); | 67 | void useSelectedDocument(); |
68 | int selected; | 68 | int selected; |
69 | int whichList(); | 69 | int whichList(); |
70 | 70 | ||
71 | public slots: | 71 | public slots: |
72 | bool first(); | 72 | bool first(); |
73 | bool last(); | 73 | bool last(); |
74 | bool next(); | 74 | bool next(); |
75 | bool prev(); | 75 | bool prev(); |
76 | void writeDefaultPlaylist( ); | 76 | void writeDefaultPlaylist( ); |
77 | QString currentFileListPathName(); | 77 | QString currentFileListPathName(); |
78 | protected: | 78 | protected: |
79 | void keyReleaseEvent( QKeyEvent *e); | 79 | void keyReleaseEvent( QKeyEvent *e); |
80 | 80 | ||
81 | private: | 81 | private: |
82 | int defaultSkinIndex; | 82 | int defaultSkinIndex; |
83 | bool audioScan, videoScan; | 83 | bool audioScan, videoScan, audioPopulated, videoPopulated; |
84 | void readm3u(const QString &); | 84 | void readm3u(const QString &); |
85 | void readPls(const QString &); | 85 | void readPls(const QString &); |
86 | void initializeStates(); | 86 | void initializeStates(); |
87 | void populateAudioView(); | 87 | void populateAudioView(); |
88 | void populateVideoView(); | 88 | void populateVideoView(); |
89 | 89 | ||
90 | private slots: | 90 | private slots: |
91 | void populateSkinsMenu(); | 91 | void populateSkinsMenu(); |
92 | void skinsMenuActivated(int); | 92 | void skinsMenuActivated(int); |
93 | void pmViewActivated(int); | 93 | void pmViewActivated(int); |
94 | void writem3u(); | 94 | void writem3u(); |
95 | void writeCurrentM3u(); | 95 | void writeCurrentM3u(); |
96 | void scanForAudio(); | 96 | void scanForAudio(); |
97 | void scanForVideo(); | 97 | void scanForVideo(); |
98 | void openFile(); | 98 | void openFile(); |
99 | void setDocument( const QString& fileref ); | 99 | void setDocument( const QString& fileref ); |
100 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 100 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
101 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 101 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
102 | void setPlaylist( bool ); // Show/Hide the playlist | 102 | void setPlaylist( bool ); // Show/Hide the playlist |
103 | void clearList(); | 103 | void clearList(); |
104 | void addAllToList(); | 104 | void addAllToList(); |
105 | void addAllMusicToList(); | 105 | void addAllMusicToList(); |
106 | void addAllVideoToList(); | 106 | void addAllVideoToList(); |
107 | void saveList(); // Save the playlist | 107 | void saveList(); // Save the playlist |
108 | void loadList( const DocLnk &); // Load a playlist | 108 | void loadList( const DocLnk &); // Load a playlist |
109 | void playIt( QListViewItem *); | 109 | void playIt( QListViewItem *); |
110 | void btnPlay(bool); | 110 | void btnPlay(bool); |
111 | void deletePlaylist(); | 111 | void deletePlaylist(); |
112 | void addSelected(); | 112 | void addSelected(); |
113 | void removeSelected(); | 113 | void removeSelected(); |
114 | void tabChanged(QWidget*); | 114 | void tabChanged(QWidget*); |
115 | void viewPressed( int, QListViewItem *, const QPoint&, int); | 115 | void viewPressed( int, QListViewItem *, const QPoint&, int); |
116 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); | 116 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); |
117 | void playSelected(); | 117 | void playSelected(); |
118 | }; | 118 | }; |
119 | 119 | ||
120 | #endif // PLAY_LIST_WIDGET_H | 120 | #endif // PLAY_LIST_WIDGET_H |
121 | 121 | ||