summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h1
2 files changed, 3 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index b04fe8d..55b66ab 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -369,133 +369,132 @@ void PlayListWidget::addAllVideoToList() {
369 for ( ; videoIt.current(); ++videoIt ) { 369 for ( ; videoIt.current(); ++videoIt ) {
370 filename = videoIt.current()->text(3); 370 filename = videoIt.current()->text(3);
371 lnk.setName( QFileInfo(filename).baseName() ); //sets name 371 lnk.setName( QFileInfo(filename).baseName() ); //sets name
372 lnk.setFile( filename ); //sets file name 372 lnk.setFile( filename ); //sets file name
373 d->selectedFiles->addToSelection( lnk); 373 d->selectedFiles->addToSelection( lnk);
374 } 374 }
375 375
376 376
377 /* if(!videoScan) 377 /* if(!videoScan)
378 scanForVideo(); 378 scanForVideo();
379 QListIterator<DocLnk> dit( vFiles.children() ); 379 QListIterator<DocLnk> dit( vFiles.children() );
380 for ( ; dit.current(); ++dit ) { 380 for ( ; dit.current(); ++dit ) {
381 if( QFileInfo( dit.current()->file() ).exists() ) { 381 if( QFileInfo( dit.current()->file() ).exists() ) {
382 d->selectedFiles->addToSelection( **dit ); 382 d->selectedFiles->addToSelection( **dit );
383 } 383 }
384 } 384 }
385*/ 385*/
386 tabWidget->setCurrentPage(0); 386 tabWidget->setCurrentPage(0);
387 writeCurrentM3u(); 387 writeCurrentM3u();
388 d->selectedFiles->first(); 388 d->selectedFiles->first();
389} 389}
390 390
391 391
392void PlayListWidget::setDocument( const QString& fileref ) { 392void PlayListWidget::setDocument( const QString& fileref ) {
393 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 393 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
394 fromSetDocument = TRUE; 394 fromSetDocument = TRUE;
395 if ( fileref.isNull() ) { 395 if ( fileref.isNull() ) {
396 QMessageBox::warning( this, tr( "Invalid File" ), 396 QMessageBox::warning( this, tr( "Invalid File" ),
397 tr( "There was a problem in getting the file." ) ); 397 tr( "There was a problem in getting the file." ) );
398 return; 398 return;
399 } 399 }
400 400
401 clearList(); 401 clearList();
402 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u 402 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
403 readm3u( fileref ); 403 readm3u( fileref );
404 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { 404 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
405 readm3u( DocLnk( fileref).file() ); 405 readm3u( DocLnk( fileref).file() );
406 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 406 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
407 readPls( fileref ); 407 readPls( fileref );
408 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 408 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
409 readPls( DocLnk( fileref).file() ); 409 readPls( DocLnk( fileref).file() );
410 } else { 410 } else {
411 clearList(); 411 clearList();
412 addToSelection( DocLnk( fileref ) ); 412 addToSelection( DocLnk( fileref ) );
413 writeCurrentM3u(); 413 writeCurrentM3u();
414 414
415 d->setDocumentUsed = TRUE; 415 d->setDocumentUsed = TRUE;
416 mediaPlayerState->setPlaying( FALSE ); 416 mediaPlayerState->setPlaying( FALSE );
417 mediaPlayerState->setPlaying( TRUE ); 417 mediaPlayerState->setPlaying( TRUE );
418 } 418 }
419} 419}
420 420
421 421
422void PlayListWidget::useSelectedDocument() { 422void PlayListWidget::useSelectedDocument() {
423 d->setDocumentUsed = FALSE; 423 d->setDocumentUsed = FALSE;
424} 424}
425 425
426 426
427const DocLnk *PlayListWidget::current() const { // this is fugly 427const DocLnk *PlayListWidget::current() const { // this is fugly
428 assert( currentTab() == CurrentPlayList ); 428 assert( currentTab() == CurrentPlayList );
429 429
430// qDebug("playlist"); 430// qDebug("playlist");
431 if ( mediaPlayerState->isUsingPlaylist() ) { 431 if ( mediaPlayerState->isUsingPlaylist() ) {
432 return d->selectedFiles->current(); 432 return d->selectedFiles->current();
433 } else if ( d->setDocumentUsed && d->current ) { 433 } else if ( d->setDocumentUsed && d->current )
434 return d->current; 434 return d->current;
435 } else { 435
436 return &(d->files->selectedDocument()); 436 assert( false );
437 }
438} 437}
439 438
440 439
441bool PlayListWidget::prev() { 440bool PlayListWidget::prev() {
442 if ( mediaPlayerState->isUsingPlaylist() ) { 441 if ( mediaPlayerState->isUsingPlaylist() ) {
443 if ( mediaPlayerState->isShuffled() ) { 442 if ( mediaPlayerState->isShuffled() ) {
444 const DocLnk *cur = current(); 443 const DocLnk *cur = current();
445 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 444 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
446 for ( int i = 0; i < j; i++ ) { 445 for ( int i = 0; i < j; i++ ) {
447 if ( !d->selectedFiles->next() ) 446 if ( !d->selectedFiles->next() )
448 d->selectedFiles->first(); 447 d->selectedFiles->first();
449 } 448 }
450 if ( cur == current() ) 449 if ( cur == current() )
451 if ( !d->selectedFiles->next() ) { 450 if ( !d->selectedFiles->next() ) {
452 d->selectedFiles->first(); 451 d->selectedFiles->first();
453 } 452 }
454 return TRUE; 453 return TRUE;
455 } else { 454 } else {
456 if ( !d->selectedFiles->prev() ) { 455 if ( !d->selectedFiles->prev() ) {
457 if ( mediaPlayerState->isLooping() ) { 456 if ( mediaPlayerState->isLooping() ) {
458 return d->selectedFiles->last(); 457 return d->selectedFiles->last();
459 } else { 458 } else {
460 return FALSE; 459 return FALSE;
461 } 460 }
462 } 461 }
463 return TRUE; 462 return TRUE;
464 } 463 }
465 } else { 464 } else {
466 return mediaPlayerState->isLooping(); 465 return mediaPlayerState->isLooping();
467 } 466 }
468} 467}
469 468
470 469
471bool PlayListWidget::next() { 470bool PlayListWidget::next() {
472//qDebug("<<<<<<<<<<<<next()"); 471//qDebug("<<<<<<<<<<<<next()");
473 if ( mediaPlayerState->isUsingPlaylist() ) { 472 if ( mediaPlayerState->isUsingPlaylist() ) {
474 if ( mediaPlayerState->isShuffled() ) { 473 if ( mediaPlayerState->isShuffled() ) {
475 return prev(); 474 return prev();
476 } else { 475 } else {
477 if ( !d->selectedFiles->next() ) { 476 if ( !d->selectedFiles->next() ) {
478 if ( mediaPlayerState->isLooping() ) { 477 if ( mediaPlayerState->isLooping() ) {
479 return d->selectedFiles->first(); 478 return d->selectedFiles->first();
480 } else { 479 } else {
481 return FALSE; 480 return FALSE;
482 } 481 }
483 } 482 }
484 return TRUE; 483 return TRUE;
485 } 484 }
486 } else { 485 } else {
487 return mediaPlayerState->isLooping(); 486 return mediaPlayerState->isLooping();
488 } 487 }
489} 488}
490 489
491 490
492bool PlayListWidget::first() { 491bool PlayListWidget::first() {
493 if ( mediaPlayerState->isUsingPlaylist() ) 492 if ( mediaPlayerState->isUsingPlaylist() )
494 return d->selectedFiles->first(); 493 return d->selectedFiles->first();
495 else 494 else
496 return mediaPlayerState->isLooping(); 495 return mediaPlayerState->isLooping();
497} 496}
498 497
499 498
500bool PlayListWidget::last() { 499bool PlayListWidget::last() {
501 if ( mediaPlayerState->isUsingPlaylist() ) 500 if ( mediaPlayerState->isUsingPlaylist() )
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index 61fd40d..6c35771 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -1,129 +1,128 @@
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_GUI_H 34#ifndef PLAY_LIST_WIDGET_GUI_H
35#define PLAY_LIST_WIDGET_GUI_H 35#define PLAY_LIST_WIDGET_GUI_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qpe/applnk.h> 38#include <qpe/applnk.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/qpemenubar.h> 40#include <qpe/qpemenubar.h>
41 41
42#include <qtabwidget.h> 42#include <qtabwidget.h>
43#include <qpe/fileselector.h> 43#include <qpe/fileselector.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qpopupmenu.h> 45#include <qpopupmenu.h>
46#include <qaction.h> 46#include <qaction.h>
47#include <qslider.h> 47#include <qslider.h>
48#include <qlcdnumber.h> 48#include <qlcdnumber.h>
49 49
50class PlayListWidgetPrivate; 50class PlayListWidgetPrivate;
51class PlayListSelection; 51class PlayListSelection;
52 52
53class Config; 53class Config;
54class QPEToolBar; 54class QPEToolBar;
55class QListViewItem; 55class QListViewItem;
56class QListView; 56class QListView;
57class QPoint; 57class QPoint;
58class QAction; 58class QAction;
59class QLabel; 59class QLabel;
60 60
61class PlayListWidgetPrivate { 61class PlayListWidgetPrivate {
62public: 62public:
63 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 63 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
64 QFrame *playListFrame; 64 QFrame *playListFrame;
65 FileSelector *files;
66 PlayListSelection *selectedFiles; 65 PlayListSelection *selectedFiles;
67 bool setDocumentUsed; 66 bool setDocumentUsed;
68 DocLnk *current; 67 DocLnk *current;
69}; 68};
70 69
71 70
72class ToolButton : public QToolButton { 71class ToolButton : public QToolButton {
73public: 72public:
74 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 73 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
75 : QToolButton( parent, name ) { 74 : QToolButton( parent, name ) {
76 setTextLabel( name ); 75 setTextLabel( name );
77 setPixmap( Resource::loadPixmap( icon ) ); 76 setPixmap( Resource::loadPixmap( icon ) );
78 setAutoRaise( TRUE ); 77 setAutoRaise( TRUE );
79 setFocusPolicy( QWidget::NoFocus ); 78 setFocusPolicy( QWidget::NoFocus );
80 setToggleButton( t ); 79 setToggleButton( t );
81 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 80 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
82 QPEMenuToolFocusManager::manager()->addWidget( this ); 81 QPEMenuToolFocusManager::manager()->addWidget( this );
83 } 82 }
84}; 83};
85 84
86 85
87class MenuItem : public QAction { 86class MenuItem : public QAction {
88 87
89public: 88public:
90 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 89 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
91 : QAction( text, QString::null, 0, 0 ) { 90 : QAction( text, QString::null, 0, 0 ) {
92 connect( this, SIGNAL( activated() ), handler, slot ); 91 connect( this, SIGNAL( activated() ), handler, slot );
93 addTo( parent ); 92 addTo( parent );
94 } 93 }
95}; 94};
96 95
97class PlayListWidgetGui : public QMainWindow { 96class PlayListWidgetGui : public QMainWindow {
98 Q_OBJECT 97 Q_OBJECT
99public: 98public:
100 PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 99 PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 );
101 ~PlayListWidgetGui(); 100 ~PlayListWidgetGui();
102 101
103protected: 102protected:
104 QTabWidget * tabWidget; 103 QTabWidget * tabWidget;
105 QListView *audioView, *videoView, *playlistView; 104 QListView *audioView, *videoView, *playlistView;
106 QLabel *libString; 105 QLabel *libString;
107 QPopupMenu *pmView ; 106 QPopupMenu *pmView ;
108 QPopupMenu *gammaMenu; 107 QPopupMenu *gammaMenu;
109 QSlider *gammaSlider; 108 QSlider *gammaSlider;
110 QLCDNumber *gammaLCD; 109 QLCDNumber *gammaLCD;
111 bool fromSetDocument; 110 bool fromSetDocument;
112 bool insanityBool; 111 bool insanityBool;
113 QString setDocFileRef; 112 QString setDocFileRef;
114 // retrieve the current playlist entry (media file link) 113 // retrieve the current playlist entry (media file link)
115 QPushButton *tbDeletePlaylist; 114 QPushButton *tbDeletePlaylist;
116 int selected; 115 int selected;
117 QPopupMenu *pmPlayList; 116 QPopupMenu *pmPlayList;
118 FileSelector* playLists; 117 FileSelector* playLists;
119 QPopupMenu *skinsMenu; 118 QPopupMenu *skinsMenu;
120 PlayListWidgetPrivate *d; // Private implementation data 119 PlayListWidgetPrivate *d; // Private implementation data
121 QVBox *vbox1; 120 QVBox *vbox1;
122 QVBox *vbox5; 121 QVBox *vbox5;
123 QPEToolBar *bar; 122 QPEToolBar *bar;
124 void setActiveWindow(); // need to handle this to show the right view 123 void setActiveWindow(); // need to handle this to show the right view
125 void setView( char ); 124 void setView( char );
126 125
127}; 126};
128 127
129#endif 128#endif