Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 4e1543e..269aed8 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -30,25 +30,25 @@ | |||
30 | #include <qimage.h> | 30 | #include <qimage.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlist.h> | 34 | #include <qlist.h> |
35 | #include <qlistbox.h> | 35 | #include <qlistbox.h> |
36 | #include <qmainwindow.h> | 36 | #include <qmainwindow.h> |
37 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
38 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
39 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
40 | #include <qlistview.h> | 40 | #include <qlistview.h> |
41 | #include <qpoint.h> | 41 | #include <qpoint.h> |
42 | #include <qtimer.h> | 42 | //#include <qtimer.h> |
43 | 43 | ||
44 | #include "playlistselection.h" | 44 | #include "playlistselection.h" |
45 | #include "playlistwidget.h" | 45 | #include "playlistwidget.h" |
46 | #include "mediaplayerstate.h" | 46 | #include "mediaplayerstate.h" |
47 | 47 | ||
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | 49 | ||
50 | #define BUTTONS_ON_TOOLBAR | 50 | #define BUTTONS_ON_TOOLBAR |
51 | #define SIDE_BUTTONS | 51 | #define SIDE_BUTTONS |
52 | #define CAN_SAVE_LOAD_PLAYLISTS | 52 | #define CAN_SAVE_LOAD_PLAYLISTS |
53 | 53 | ||
54 | extern MediaPlayerState *mediaPlayerState; | 54 | extern MediaPlayerState *mediaPlayerState; |
@@ -89,26 +89,26 @@ public: | |||
89 | connect( this, SIGNAL( activated() ), handler, slot ); | 89 | connect( this, SIGNAL( activated() ), handler, slot ); |
90 | addTo( parent ); | 90 | addTo( parent ); |
91 | } | 91 | } |
92 | }; | 92 | }; |
93 | 93 | ||
94 | 94 | ||
95 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 95 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
96 | : QMainWindow( parent, name, fl ) { | 96 | : QMainWindow( parent, name, fl ) { |
97 | 97 | ||
98 | d = new PlayListWidgetPrivate; | 98 | d = new PlayListWidgetPrivate; |
99 | d->setDocumentUsed = FALSE; | 99 | d->setDocumentUsed = FALSE; |
100 | d->current = NULL; | 100 | d->current = NULL; |
101 | menuTimer = new QTimer( this ,"menu timer"), | 101 | // menuTimer = new QTimer( this ,"menu timer"), |
102 | connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 102 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
103 | 103 | ||
104 | setBackgroundMode( PaletteButton ); | 104 | setBackgroundMode( PaletteButton ); |
105 | 105 | ||
106 | setCaption( tr("OpiePlayer") ); | 106 | setCaption( tr("OpiePlayer") ); |
107 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 107 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); |
108 | 108 | ||
109 | setToolBarsMovable( FALSE ); | 109 | setToolBarsMovable( FALSE ); |
110 | 110 | ||
111 | // Create Toolbar | 111 | // Create Toolbar |
112 | QPEToolBar *toolbar = new QPEToolBar( this ); | 112 | QPEToolBar *toolbar = new QPEToolBar( this ); |
113 | toolbar->setHorizontalStretchable( TRUE ); | 113 | toolbar->setHorizontalStretchable( TRUE ); |
114 | 114 | ||
@@ -195,54 +195,59 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
195 | audioView->addColumn("Size", 45); | 195 | audioView->addColumn("Size", 45); |
196 | audioView->addColumn("Media",35); | 196 | audioView->addColumn("Media",35); |
197 | audioView->setColumnAlignment(1, Qt::AlignRight); | 197 | audioView->setColumnAlignment(1, Qt::AlignRight); |
198 | audioView->setColumnAlignment(2, Qt::AlignRight); | 198 | audioView->setColumnAlignment(2, Qt::AlignRight); |
199 | tabWidget->insertTab(aTab,"Audio"); | 199 | tabWidget->insertTab(aTab,"Audio"); |
200 | // audioView | 200 | // audioView |
201 | Global::findDocuments(&files, "audio/*"); | 201 | Global::findDocuments(&files, "audio/*"); |
202 | QListIterator<DocLnk> dit( files.children() ); | 202 | QListIterator<DocLnk> dit( files.children() ); |
203 | QString storage; | 203 | QString storage; |
204 | for ( ; dit.current(); ++dit ) { | 204 | for ( ; dit.current(); ++dit ) { |
205 | QListViewItem * newItem; | 205 | QListViewItem * newItem; |
206 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 206 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
207 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
207 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 208 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
208 | else storage="RAM"; | 209 | else storage="RAM"; |
209 | 210 | if ( QFile( dit.current()->file()).exists() ) { | |
210 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | 211 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); |
211 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | 212 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); |
213 | } | ||
212 | } | 214 | } |
213 | // videowidget | 215 | // videowidget |
214 | 216 | ||
215 | QWidget *vTab; | 217 | QWidget *vTab; |
216 | vTab = new QWidget( tabWidget, "vTab" ); | 218 | vTab = new QWidget( tabWidget, "vTab" ); |
217 | videoView = new QListView( vTab, "Videoview" ); | 219 | videoView = new QListView( vTab, "Videoview" ); |
218 | videoView->setMinimumSize(233,260); | 220 | videoView->setMinimumSize(233,260); |
219 | 221 | ||
220 | videoView->addColumn("Title",150); | 222 | videoView->addColumn("Title",150); |
221 | videoView->addColumn("Size",45); | 223 | videoView->addColumn("Size",45); |
222 | videoView->addColumn("Media",35); | 224 | videoView->addColumn("Media",35); |
223 | videoView->setColumnAlignment(1, Qt::AlignRight); | 225 | videoView->setColumnAlignment(1, Qt::AlignRight); |
224 | videoView->setColumnAlignment(2, Qt::AlignRight); | 226 | videoView->setColumnAlignment(2, Qt::AlignRight); |
225 | 227 | ||
226 | tabWidget->insertTab( vTab,"Video"); | 228 | tabWidget->insertTab( vTab,"Video"); |
227 | 229 | ||
228 | Global::findDocuments(&vFiles, "video/*"); | 230 | Global::findDocuments(&vFiles, "video/*"); |
229 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 231 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
230 | for ( ; Vdit.current(); ++Vdit ) { | 232 | for ( ; Vdit.current(); ++Vdit ) { |
231 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; | 233 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage="CF"; |
234 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage="CF"; | ||
232 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; | 235 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage="SD"; |
233 | else storage="RAM"; | 236 | else storage="RAM"; |
234 | QListViewItem * newItem; | 237 | QListViewItem * newItem; |
238 | if ( QFile( Vdit.current()->file()).exists() ) { | ||
235 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | 239 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); |
236 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | 240 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); |
241 | } | ||
237 | } | 242 | } |
238 | 243 | ||
239 | 244 | ||
240 | // d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); | 245 | // d->tbPlay = new ToolButton( vbox1, tr( "Play" ), "mpegplayer/play", mediaPlayerState, SLOT(setPlaying(bool)), TRUE ); |
241 | // d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 246 | // d->tbShuffle = new ToolButton( vbox1, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
242 | 247 | ||
243 | // add the library area | 248 | // add the library area |
244 | 249 | ||
245 | // d->files->setBackgroundMode( PaletteButton ); | 250 | // d->files->setBackgroundMode( PaletteButton ); |
246 | // QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); | 251 | // QVBox *vbox7 = new QVBox( hbox6 ); vbox7->setBackgroundMode( PaletteButton ); |
247 | 252 | ||
248 | // #ifdef SIDE_BUTTONS | 253 | // #ifdef SIDE_BUTTONS |
@@ -654,40 +659,40 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
654 | d->tbAddToList->setEnabled(TRUE); | 659 | d->tbAddToList->setEnabled(TRUE); |
655 | } | 660 | } |
656 | break; | 661 | break; |
657 | case 2: | 662 | case 2: |
658 | { | 663 | { |
659 | d->tbRemoveFromList->setEnabled(FALSE); | 664 | d->tbRemoveFromList->setEnabled(FALSE); |
660 | d->tbAddToList->setEnabled(TRUE); | 665 | d->tbAddToList->setEnabled(TRUE); |
661 | } | 666 | } |
662 | break; | 667 | break; |
663 | }; | 668 | }; |
664 | } | 669 | } |
665 | 670 | ||
666 | void PlayListWidget::cancelMenuTimer() { | 671 | // void PlayListWidget::cancelMenuTimer() { |
667 | if( menuTimer->isActive() ) | 672 | // if( menuTimer->isActive() ) |
668 | menuTimer->stop(); | 673 | // menuTimer->stop(); |
669 | } | 674 | // } |
670 | 675 | ||
671 | void PlayListWidget::showFileMenu() { | 676 | // void PlayListWidget::showFileMenu() { |
672 | 677 | ||
673 | } | 678 | // } |
674 | 679 | ||
675 | void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) | 680 | // void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) |
676 | { | 681 | // { |
677 | // QListView::contentsMousePressEvent( e ); | 682 | // // QListView::contentsMousePressEvent( e ); |
678 | menuTimer->start( 750, TRUE ); | 683 | // menuTimer->start( 750, TRUE ); |
679 | } | 684 | // } |
680 | 685 | ||
681 | 686 | ||
682 | void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) | 687 | // void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) |
683 | { | 688 | // { |
684 | // QListView::contentsMouseReleaseEvent( e ); | 689 | // // QListView::contentsMouseReleaseEvent( e ); |
685 | menuTimer->stop(); | 690 | // menuTimer->stop(); |
686 | } | 691 | // } |
687 | // void PlayListWidget::setFullScreen() { | 692 | // // void PlayListWidget::setFullScreen() { |
688 | // mediaPlayerState->toggleFullscreen( ); | 693 | // mediaPlayerState->toggleFullscreen( ); |
689 | // } | 694 | // } |
690 | 695 | ||
691 | // void PlayListWidget::setScaled() { | 696 | // void PlayListWidget::setScaled() { |
692 | // mediaPlayerState->toggleScaled(); | 697 | // mediaPlayerState->toggleScaled(); |
693 | // } | 698 | // } |