summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-04 10:52:00 (UTC)
committer simon <simon>2002-12-04 10:52:00 (UTC)
commit63541c46776721ef5ae63903e5b40838c1c49a43 (patch) (unidiff)
treee9beaf0d1340b32a7fffdce8e6dad7b0cbc54866
parentd000538b68b3411a409e829c4e68f42f9646b940 (diff)
downloadopie-63541c46776721ef5ae63903e5b40838c1c49a43.zip
opie-63541c46776721ef5ae63903e5b40838c1c49a43.tar.gz
opie-63541c46776721ef5ae63903e5b40838c1c49a43.tar.bz2
- merged scanForVideo and scanForAudio into a common scanFiles method in
the PlayListFileView. less duplicated code :)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h13
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp25
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h4
6 files changed, 37 insertions, 28 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp
index c4f93e7..2726296 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.cpp
+++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp
@@ -1,24 +1,36 @@
1 1
2#include "playlistfileview.h" 2#include "playlistfileview.h"
3 3
4PlayListFileView::PlayListFileView( QWidget *parent, const char *name ) 4#include <qpe/global.h>
5 : PlayListView( parent, name ) 5
6PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name )
7 : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern )
6{ 8{
7 addColumn( tr( "Title" ), 140); 9 addColumn( tr( "Title" ), 140);
8 addColumn( tr( "Size" ), -1 ); 10 addColumn( tr( "Size" ), -1 );
9 addColumn(tr( "Media" ), 0 ); 11 addColumn(tr( "Media" ), 0 );
10 addColumn(tr( "Path" ), -1 ); 12 addColumn(tr( "Path" ), -1 );
11 setColumnAlignment( 1, Qt::AlignRight ); 13 setColumnAlignment( 1, Qt::AlignRight );
12 setColumnAlignment( 2, Qt::AlignRight ); 14 setColumnAlignment( 2, Qt::AlignRight );
13 setAllColumnsShowFocus( TRUE ); 15 setAllColumnsShowFocus( TRUE );
14 setSorting( 3, TRUE ); 16 setSorting( 3, TRUE );
15 setMultiSelection( TRUE ); 17 setMultiSelection( TRUE );
16 setSelectionMode( QListView::Extended ); 18 setSelectionMode( QListView::Extended );
17} 19}
18 20
19PlayListFileView::~PlayListFileView() 21PlayListFileView::~PlayListFileView()
20{ 22{
21} 23}
22 24
25void PlayListFileView::scanFiles()
26{
27 m_files.detachChildren();
28 QListIterator<DocLnk> sdit( m_files.children() );
29 for ( ; sdit.current(); ++sdit )
30 delete sdit.current();
31
32 Global::findDocuments( &m_files, m_mimeTypePattern );
33}
34
23/* vim: et sw=4 ts=4 35/* vim: et sw=4 ts=4
24 */ 36 */
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index eef4bd1..08db929 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -1,16 +1,27 @@
1#ifndef PLAYLISTFILEVIEW_H 1#ifndef PLAYLISTFILEVIEW_H
2#define PLAYLISTFILEVIEW_H 2#define PLAYLISTFILEVIEW_H
3 3
4#include "playlistview.h" 4#include "playlistview.h"
5 5
6#include <qpe/applnk.h>
7
6class PlayListFileView : public PlayListView 8class PlayListFileView : public PlayListView
7{ 9{
8 Q_OBJECT 10 Q_OBJECT
9public: 11public:
10 PlayListFileView( QWidget *parent, const char *name = 0 ); 12 PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name = 0 );
11 virtual ~PlayListFileView(); 13 virtual ~PlayListFileView();
14
15 DocLnkSet &files() { return m_files; }
16
17public slots:
18 void scanFiles();
19
20private:
21 QString m_mimeTypePattern;
22 DocLnkSet m_files;
12}; 23};
13 24
14#endif // PLAYLISTFILEVIEW_H 25#endif // PLAYLISTFILEVIEW_H
15/* vim: et sw=4 ts=4 26/* vim: et sw=4 ts=4
16 */ 27 */
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6bda71e..93e7919 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,130 +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#include <qpe/qpetoolbar.h> 34#include <qpe/qpetoolbar.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
37#include <qpe/mimetype.h> 37#include <qpe/mimetype.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40 40
41#include <qdatetime.h> 41#include <qdatetime.h>
42#include <qdir.h> 42#include <qdir.h>
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44#include <qregexp.h> 44#include <qregexp.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46 46
47#include "playlistselection.h" 47#include "playlistselection.h"
48#include "playlistwidget.h" 48#include "playlistwidget.h"
49#include "mediaplayerstate.h" 49#include "mediaplayerstate.h"
50#include "inputDialog.h" 50#include "inputDialog.h"
51#include "om3u.h" 51#include "om3u.h"
52#include "playlistfileview.h"
52 53
53//only needed for the random play 54//only needed for the random play
54#include <stdlib.h> 55#include <stdlib.h>
55#include <assert.h> 56#include <assert.h>
56 57
57#include "audiowidget.h" 58#include "audiowidget.h"
58#include "videowidget.h" 59#include "videowidget.h"
59 60
60extern MediaPlayerState *mediaPlayerState; 61extern MediaPlayerState *mediaPlayerState;
61// extern AudioWidget *audioUI; 62// extern AudioWidget *audioUI;
62// extern VideoWidget *videoUI; 63// extern VideoWidget *videoUI;
63 64
64QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg";
65// no m3u's here please
66
67PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 65PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
68 : PlayListWidgetGui( mediaPlayerState, parent, name ) { 66 : PlayListWidgetGui( mediaPlayerState, parent, name ) {
69 67
70 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 68 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
71 "opieplayer2/add_to_playlist", 69 "opieplayer2/add_to_playlist",
72 this , SLOT(addSelected() ) ); 70 this , SLOT(addSelected() ) );
73 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 71 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
74 "opieplayer2/remove_from_playlist", 72 "opieplayer2/remove_from_playlist",
75 this , SLOT(removeSelected() ) ); 73 this , SLOT(removeSelected() ) );
76 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 74 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
77 this , SLOT( btnPlay( bool) ), TRUE ); 75 this , SLOT( btnPlay( bool) ), TRUE );
78 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 76 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
79 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 77 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
80 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 78 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
81 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 79 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
82 80
83 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 81 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
84 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 82 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
85 this, SLOT( addAllMusicToList() ) ); 83 this, SLOT( addAllMusicToList() ) );
86 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 84 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
87 this, SLOT( addAllVideoToList() ) ); 85 this, SLOT( addAllVideoToList() ) );
88 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 86 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
89 this, SLOT( addAllToList() ) ); 87 this, SLOT( addAllToList() ) );
90 pmPlayList->insertSeparator(-1); 88 pmPlayList->insertSeparator(-1);
91// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), 89// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ),
92// this, SLOT( saveList() ) ); 90// this, SLOT( saveList() ) );
93 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 91 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
94 this, SLOT(writem3u() ) ); 92 this, SLOT(writem3u() ) );
95 pmPlayList->insertSeparator(-1); 93 pmPlayList->insertSeparator(-1);
96 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), 94 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
97 this,SLOT( openFile() ) ); 95 this,SLOT( openFile() ) );
98 pmPlayList->insertSeparator(-1); 96 pmPlayList->insertSeparator(-1);
99 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 97 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
100 this,SLOT( scanForAudio() ) ); 98 this,SLOT( scanForAudio() ) );
101 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 99 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
102 this,SLOT( scanForVideo() ) ); 100 this,SLOT( scanForVideo() ) );
103 101
104 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 102 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
105 &mediaPlayerState, SLOT( toggleFullscreen() ) ); 103 &mediaPlayerState, SLOT( toggleFullscreen() ) );
106 104
107 Config cfg( "OpiePlayer" ); 105 Config cfg( "OpiePlayer" );
108 bool b= cfg.readBoolEntry("FullScreen", 0); 106 bool b= cfg.readBoolEntry("FullScreen", 0);
109 mediaPlayerState.setFullscreen( b ); 107 mediaPlayerState.setFullscreen( b );
110 pmView->setItemChecked( -16, b ); 108 pmView->setItemChecked( -16, b );
111 109
112 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 110 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
113 d->selectedFiles, SLOT(moveSelectedUp() ) ); 111 d->selectedFiles, SLOT(moveSelectedUp() ) );
114 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 112 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
115 d->selectedFiles, SLOT(removeSelected() ) ); 113 d->selectedFiles, SLOT(removeSelected() ) );
116 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 114 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
117 d->selectedFiles, SLOT(moveSelectedDown() ) ); 115 d->selectedFiles, SLOT(moveSelectedDown() ) );
118 // QVBox *stretch2 = new QVBox( vbox1 ); 116 // QVBox *stretch2 = new QVBox( vbox1 );
119 117
120 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 118 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
121 SLOT( deletePlaylist() ) ); 119 SLOT( deletePlaylist() ) );
122 connect( pmView, SIGNAL( activated( int ) ), 120 connect( pmView, SIGNAL( activated( int ) ),
123 this, SLOT( pmViewActivated( int ) ) ); 121 this, SLOT( pmViewActivated( int ) ) );
124 connect( skinsMenu, SIGNAL( activated( int ) ) , 122 connect( skinsMenu, SIGNAL( activated( int ) ) ,
125 this, SLOT( skinsMenuActivated( int ) ) ); 123 this, SLOT( skinsMenuActivated( int ) ) );
126 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 124 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
127 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 125 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
128 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 126 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
129 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 127 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
130 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 128 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
@@ -578,204 +576,191 @@ void PlayListWidget::tabChanged(QWidget *) {
578 { 576 {
579 // audioView->clear(); 577 // audioView->clear();
580 if(!audioPopulated) populateAudioView(); 578 if(!audioPopulated) populateAudioView();
581 579
582 if( !tbDeletePlaylist->isHidden() ) { 580 if( !tbDeletePlaylist->isHidden() ) {
583 tbDeletePlaylist->hide(); 581 tbDeletePlaylist->hide();
584 } 582 }
585 d->tbRemoveFromList->setEnabled(FALSE); 583 d->tbRemoveFromList->setEnabled(FALSE);
586 d->tbAddToList->setEnabled(TRUE); 584 d->tbAddToList->setEnabled(TRUE);
587 } 585 }
588 break; 586 break;
589 case VideoFiles: 587 case VideoFiles:
590 { 588 {
591 // videoView->clear(); 589 // videoView->clear();
592 if(!videoPopulated) populateVideoView(); 590 if(!videoPopulated) populateVideoView();
593 if( !tbDeletePlaylist->isHidden() ) { 591 if( !tbDeletePlaylist->isHidden() ) {
594 tbDeletePlaylist->hide(); 592 tbDeletePlaylist->hide();
595 } 593 }
596 d->tbRemoveFromList->setEnabled(FALSE); 594 d->tbRemoveFromList->setEnabled(FALSE);
597 d->tbAddToList->setEnabled(TRUE); 595 d->tbAddToList->setEnabled(TRUE);
598 } 596 }
599 break; 597 break;
600 case PlayLists: 598 case PlayLists:
601 { 599 {
602 if( tbDeletePlaylist->isHidden() ) { 600 if( tbDeletePlaylist->isHidden() ) {
603 tbDeletePlaylist->show(); 601 tbDeletePlaylist->show();
604 } 602 }
605 playLists->reread(); 603 playLists->reread();
606 d->tbAddToList->setEnabled(FALSE); 604 d->tbAddToList->setEnabled(FALSE);
607 605
608 d->tbPlay->setEnabled( false ); 606 d->tbPlay->setEnabled( false );
609 } 607 }
610 break; 608 break;
611 }; 609 };
612} 610}
613 611
614 612
615void PlayListWidget::btnPlay(bool b) { 613void PlayListWidget::btnPlay(bool b) {
616// mediaPlayerState->setPlaying(false); 614// mediaPlayerState->setPlaying(false);
617 mediaPlayerState.setPlaying(b); 615 mediaPlayerState.setPlaying(b);
618 insanityBool=FALSE; 616 insanityBool=FALSE;
619} 617}
620 618
621void PlayListWidget::deletePlaylist() { 619void PlayListWidget::deletePlaylist() {
622 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 620 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
623 (tr("You really want to delete\nthis playlist?")), 621 (tr("You really want to delete\nthis playlist?")),
624 (tr("Yes")), (tr("No")), 0 )){ 622 (tr("Yes")), (tr("No")), 0 )){
625 case 0: // Yes clicked, 623 case 0: // Yes clicked,
626 QFile().remove(playLists->selectedDocument().file()); 624 QFile().remove(playLists->selectedDocument().file());
627 QFile().remove(playLists->selectedDocument().linkFile()); 625 QFile().remove(playLists->selectedDocument().linkFile());
628 playLists->reread(); 626 playLists->reread();
629 break; 627 break;
630 case 1: // Cancel 628 case 1: // Cancel
631 break; 629 break;
632 }; 630 };
633} 631}
634 632
635 633
636void PlayListWidget::playSelected() { 634void PlayListWidget::playSelected() {
637 btnPlay( TRUE); 635 btnPlay( TRUE);
638} 636}
639 637
640 638
641void PlayListWidget::scanForAudio() { 639void PlayListWidget::scanForAudio() {
642// qDebug("scan for audio"); 640 audioView->scanFiles();
643 files.detachChildren();
644 QListIterator<DocLnk> sdit( files.children() );
645 for ( ; sdit.current(); ++sdit ) {
646 delete sdit.current();
647 }
648// Global::findDocuments( &files, "audio/*");
649 Global::findDocuments( &files, audioMimes);
650 audioScan = true; 641 audioScan = true;
651 populateAudioView(); 642 populateAudioView();
652} 643}
653 644
654void PlayListWidget::scanForVideo() { 645void PlayListWidget::scanForVideo() {
655// qDebug("scan for video"); 646 videoView->scanFiles();
656 vFiles.detachChildren();
657 QListIterator<DocLnk> sdit( vFiles.children() );
658 for ( ; sdit.current(); ++sdit ) {
659 delete sdit.current();
660 }
661 Global::findDocuments(&vFiles, "video/*");
662 videoScan = true; 647 videoScan = true;
663 populateVideoView(); 648 populateVideoView();
664} 649}
665 650
666void PlayListWidget::populateAudioView() { 651void PlayListWidget::populateAudioView() {
667 audioView->clear(); 652 audioView->clear();
668 StorageInfo storageInfo; 653 StorageInfo storageInfo;
669 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 654 // const QList<FileSystem> &fs = storageInfo.fileSystems();
670 if(!audioScan) { 655 if(!audioScan) {
671 scanForAudio(); 656 scanForAudio();
672 } 657 }
673 658
674 QListIterator<DocLnk> dit( files.children() ); 659 QListIterator<DocLnk> dit( audioView->files().children() );
675 // QListIterator<FileSystem> it ( fs ); 660 // QListIterator<FileSystem> it ( fs );
676 audioView->clear(); 661 audioView->clear();
677 662
678 QString storage; 663 QString storage;
679 for ( ; dit.current(); ++dit ) { 664 for ( ; dit.current(); ++dit ) {
680// // for( ; it.current(); ++it ){ 665// // for( ; it.current(); ++it ){
681// const QString name = (*dit)->name(); 666// const QString name = (*dit)->name();
682// const QString path = (*dit)->path(); 667// const QString path = (*dit)->path();
683// if(dit.current()->file().find(path) != -1 ) { 668// if(dit.current()->file().find(path) != -1 ) {
684// storage = name; 669// storage = name;
685// // } 670// // }
686// } 671// }
687 672
688 QListViewItem * newItem; 673 QListViewItem * newItem;
689 if ( QFile( dit.current()->file()).exists() || 674 if ( QFile( dit.current()->file()).exists() ||
690 dit.current()->file().left(4) == "http" ) { 675 dit.current()->file().left(4) == "http" ) {
691 long size; 676 long size;
692 if( dit.current()->file().left(4) == "http" ) 677 if( dit.current()->file().left(4) == "http" )
693 size=0; 678 size=0;
694 else 679 else
695 size = QFile( dit.current()->file() ).size(); 680 size = QFile( dit.current()->file() ).size();
696 681
697 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 682 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
698 QString::number(size ), "" /*storage*/, 683 QString::number(size ), "" /*storage*/,
699 dit.current()->file() ); 684 dit.current()->file() );
700 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 685 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
701// qDebug("<<<< "+dit.current()->file()); 686// qDebug("<<<< "+dit.current()->file());
702 } 687 }
703 } 688 }
704 audioPopulated=true; 689 audioPopulated=true;
705} 690}
706 691
707 692
708void PlayListWidget::populateVideoView() { 693void PlayListWidget::populateVideoView() {
709 videoView->clear(); 694 videoView->clear();
710 StorageInfo storageInfo; 695 StorageInfo storageInfo;
711 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 696 // const QList<FileSystem> &fs = storageInfo.fileSystems();
712 697
713 if(!videoScan ) { 698 if(!videoScan ) {
714 scanForVideo(); 699 scanForVideo();
715 } 700 }
716 701
717 QListIterator<DocLnk> Vdit( vFiles.children() ); 702 QListIterator<DocLnk> Vdit( videoView->files().children() );
718// QListIterator<FileSystem> it ( fs ); 703// QListIterator<FileSystem> it ( fs );
719 videoView->clear(); 704 videoView->clear();
720 QString storage, pathName; 705 QString storage, pathName;
721 for ( ; Vdit.current(); ++Vdit ) { 706 for ( ; Vdit.current(); ++Vdit ) {
722// // for( ; it.current(); ++it ) { 707// // for( ; it.current(); ++it ) {
723// const QString name = (*Vdit)->name(); 708// const QString name = (*Vdit)->name();
724// const QString path = (*Vdit)->path(); 709// const QString path = (*Vdit)->path();
725// if( Vdit.current()->file().find(path) != -1 ) { 710// if( Vdit.current()->file().find(path) != -1 ) {
726// storage=name; 711// storage=name;
727// pathName=path; 712// pathName=path;
728// // } 713// // }
729// } 714// }
730 715
731 QListViewItem * newItem; 716 QListViewItem * newItem;
732 if ( QFile( Vdit.current()->file() ).exists() ) { 717 if ( QFile( Vdit.current()->file() ).exists() ) {
733 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 718 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
734 QString::number( QFile( Vdit.current()->file() ).size() ), 719 QString::number( QFile( Vdit.current()->file() ).size() ),
735 ""/*storage*/, Vdit.current()->file()); 720 ""/*storage*/, Vdit.current()->file());
736 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 721 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
737 } 722 }
738 } 723 }
739 videoPopulated=true; 724 videoPopulated=true;
740} 725}
741 726
742QListView *PlayListWidget::currentFileListView() const 727QListView *PlayListWidget::currentFileListView() const
743{ 728{
744 switch ( currentTab() ) { 729 switch ( currentTab() ) {
745 case AudioFiles: return audioView; 730 case AudioFiles: return audioView;
746 case VideoFiles: return videoView; 731 case VideoFiles: return videoView;
747 default: assert( false ); 732 default: assert( false );
748 } 733 }
749 return 0; 734 return 0;
750} 735}
751 736
752bool PlayListWidget::inFileListMode() const 737bool PlayListWidget::inFileListMode() const
753{ 738{
754 TabType tab = currentTab(); 739 TabType tab = currentTab();
755 return tab == AudioFiles || tab == VideoFiles; 740 return tab == AudioFiles || tab == VideoFiles;
756} 741}
757 742
758void PlayListWidget::openFile() { 743void PlayListWidget::openFile() {
759 // http://66.28.164.33:2080 744 // http://66.28.164.33:2080
760 // http://somafm.com/star0242.m3u 745 // http://somafm.com/star0242.m3u
761 QString filename, name; 746 QString filename, name;
762 InputDialog *fileDlg; 747 InputDialog *fileDlg;
763 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 748 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
764 fileDlg->exec(); 749 fileDlg->exec();
765 if( fileDlg->result() == 1 ) { 750 if( fileDlg->result() == 1 ) {
766 filename = fileDlg->text(); 751 filename = fileDlg->text();
767 qDebug( "Selected filename is " + filename ); 752 qDebug( "Selected filename is " + filename );
768 // Om3u *m3uList; 753 // Om3u *m3uList;
769 DocLnk lnk; 754 DocLnk lnk;
770 Config cfg( "OpiePlayer" ); 755 Config cfg( "OpiePlayer" );
771 cfg.setGroup("PlayList"); 756 cfg.setGroup("PlayList");
772 757
773 if(filename.left(4) == "http") { 758 if(filename.left(4) == "http") {
774 QString m3uFile, m3uFilePath; 759 QString m3uFile, m3uFilePath;
775 if(filename.find(":",8,TRUE) != -1) { //found a port 760 if(filename.find(":",8,TRUE) != -1) { //found a port
776 m3uFile = filename.left( filename.find( ":",8,TRUE)); 761 m3uFile = filename.left( filename.find( ":",8,TRUE));
777 m3uFile = m3uFile.right( 7); 762 m3uFile = m3uFile.right( 7);
778 } else if(filename.left(4) == "http"){ 763 } else if(filename.left(4) == "http"){
779 m3uFile=filename; 764 m3uFile=filename;
780 m3uFile = m3uFile.right( m3uFile.length() - 7); 765 m3uFile = m3uFile.right( m3uFile.length() - 7);
781 } else{ 766 } else{
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 62d78a2..e81ef3c 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -73,74 +73,72 @@ public:
73 ~PlayListWidget(); 73 ~PlayListWidget();
74 74
75 // retrieve the current playlist entry (media file link) 75 // retrieve the current playlist entry (media file link)
76 const DocLnk *current() const; 76 const DocLnk *current() const;
77 void useSelectedDocument(); 77 void useSelectedDocument();
78 TabType currentTab() const; 78 TabType currentTab() const;
79 79
80 Entry currentEntry() const; 80 Entry currentEntry() const;
81 81
82public slots: 82public slots:
83 bool first(); 83 bool first();
84 bool last(); 84 bool last();
85 bool next(); 85 bool next();
86 bool prev(); 86 bool prev();
87 void writeDefaultPlaylist( ); 87 void writeDefaultPlaylist( );
88 QString currentFileListPathName() const; 88 QString currentFileListPathName() const;
89protected: 89protected:
90 void keyReleaseEvent( QKeyEvent *e); 90 void keyReleaseEvent( QKeyEvent *e);
91 91
92signals: 92signals:
93 void skinSelected(); 93 void skinSelected();
94 94
95private: 95private:
96 int defaultSkinIndex; 96 int defaultSkinIndex;
97 bool audioScan, videoScan, audioPopulated, videoPopulated; 97 bool audioScan, videoScan, audioPopulated, videoPopulated;
98 void readm3u(const QString &); 98 void readm3u(const QString &);
99 void readPls(const QString &); 99 void readPls(const QString &);
100 void initializeStates(); 100 void initializeStates();
101 void populateAudioView(); 101 void populateAudioView();
102 void populateVideoView(); 102 void populateVideoView();
103 103
104 QListView *currentFileListView() const; 104 QListView *currentFileListView() const;
105 105
106 bool inFileListMode() const; 106 bool inFileListMode() const;
107 107
108private slots: 108private slots:
109 void populateSkinsMenu(); 109 void populateSkinsMenu();
110 void skinsMenuActivated(int); 110 void skinsMenuActivated(int);
111 void pmViewActivated(int); 111 void pmViewActivated(int);
112 void writem3u(); 112 void writem3u();
113 void writeCurrentM3u(); 113 void writeCurrentM3u();
114 void scanForAudio(); 114 void scanForAudio();
115 void scanForVideo(); 115 void scanForVideo();
116 void openFile(); 116 void openFile();
117 void setDocument( const QString& fileref ); 117 void setDocument( const QString& fileref );
118 void addToSelection( const DocLnk& ); // Add a media file to the playlist 118 void addToSelection( const DocLnk& ); // Add a media file to the playlist
119 void addToSelection( QListViewItem* ); // Add a media file to the playlist 119 void addToSelection( QListViewItem* ); // Add a media file to the playlist
120 void clearList(); 120 void clearList();
121 void addAllToList(); 121 void addAllToList();
122 void addAllMusicToList(); 122 void addAllMusicToList();
123 void addAllVideoToList(); 123 void addAllVideoToList();
124 void saveList(); // Save the playlist 124 void saveList(); // Save the playlist
125 void loadList( const DocLnk &); // Load a playlist 125 void loadList( const DocLnk &); // Load a playlist
126 void playIt( QListViewItem *); 126 void playIt( QListViewItem *);
127 void btnPlay(bool); 127 void btnPlay(bool);
128 void deletePlaylist(); 128 void deletePlaylist();
129 void addSelected(); 129 void addSelected();
130 void removeSelected(); 130 void removeSelected();
131 void tabChanged(QWidget*); 131 void tabChanged(QWidget*);
132 void viewPressed( int, QListViewItem *, const QPoint&, int); 132 void viewPressed( int, QListViewItem *, const QPoint&, int);
133 void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 133 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
134 void playSelected(); 134 void playSelected();
135 135
136private: 136private:
137 DocLnkSet files;
138 DocLnkSet vFiles;
139 bool fromSetDocument; 137 bool fromSetDocument;
140 bool insanityBool; 138 bool insanityBool;
141 QString setDocFileRef, currentPlayList; 139 QString setDocFileRef, currentPlayList;
142 int selected; 140 int selected;
143}; 141};
144 142
145#endif // PLAY_LIST_WIDGET_H 143#endif // PLAY_LIST_WIDGET_H
146 144
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index cfca5e3..a219cfd 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -89,119 +89,120 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg
89 pmPlayList = new QPopupMenu( this ); 89 pmPlayList = new QPopupMenu( this );
90 menu->insertItem( tr( "File" ), pmPlayList ); 90 menu->insertItem( tr( "File" ), pmPlayList );
91 91
92 pmView = new QPopupMenu( this ); 92 pmView = new QPopupMenu( this );
93 menu->insertItem( tr( "View" ), pmView ); 93 menu->insertItem( tr( "View" ), pmView );
94 pmView->isCheckable(); 94 pmView->isCheckable();
95 95
96 skinsMenu = new QPopupMenu( this ); 96 skinsMenu = new QPopupMenu( this );
97 pmView->insertItem( tr( "Skins" ), skinsMenu ); 97 pmView->insertItem( tr( "Skins" ), skinsMenu );
98 skinsMenu->isCheckable(); 98 skinsMenu->isCheckable();
99 99
100 gammaMenu = new QPopupMenu( this ); 100 gammaMenu = new QPopupMenu( this );
101 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); 101 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu );
102 102
103 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); 103 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
104 gammaSlider->setRange( -40, 40 ); 104 gammaSlider->setRange( -40, 40 );
105 gammaSlider->setTickmarks( QSlider::Left ); 105 gammaSlider->setTickmarks( QSlider::Left );
106 gammaSlider->setTickInterval( 20 ); 106 gammaSlider->setTickInterval( 20 );
107 gammaSlider->setFocusPolicy( QWidget::StrongFocus ); 107 gammaSlider->setFocusPolicy( QWidget::StrongFocus );
108 gammaSlider->setValue( 0 ); 108 gammaSlider->setValue( 0 );
109 gammaSlider->setMinimumHeight( 50 ); 109 gammaSlider->setMinimumHeight( 50 );
110 110
111 gammaLCD = new QLCDNumber( 3, gammaMenu ); 111 gammaLCD = new QLCDNumber( 3, gammaMenu );
112 gammaLCD-> setFrameShape ( QFrame::NoFrame ); 112 gammaLCD-> setFrameShape ( QFrame::NoFrame );
113 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); 113 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
114 114
115 gammaMenu->insertItem( gammaSlider ); 115 gammaMenu->insertItem( gammaSlider );
116 gammaMenu->insertItem( gammaLCD ); 116 gammaMenu->insertItem( gammaLCD );
117 117
118 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); 118 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) );
119 119
120 vbox5 = new QVBox( this ); 120 vbox5 = new QVBox( this );
121 QVBox *vbox4 = new QVBox( vbox5 ); 121 QVBox *vbox4 = new QVBox( vbox5 );
122 QHBox *hbox6 = new QHBox( vbox4 ); 122 QHBox *hbox6 = new QHBox( vbox4 );
123 123
124 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 124 tabWidget = new QTabWidget( hbox6, "tabWidget" );
125 125
126 QWidget *pTab; 126 QWidget *pTab;
127 pTab = new QWidget( tabWidget, "pTab" ); 127 pTab = new QWidget( tabWidget, "pTab" );
128 tabWidget->insertTab( pTab, "Playlist"); 128 tabWidget->insertTab( pTab, "Playlist");
129 129
130 QGridLayout *Playout = new QGridLayout( pTab ); 130 QGridLayout *Playout = new QGridLayout( pTab );
131 Playout->setSpacing( 2); 131 Playout->setSpacing( 2);
132 Playout->setMargin( 2); 132 Playout->setMargin( 2);
133 133
134 // Add the playlist area 134 // Add the playlist area
135 QVBox *vbox3 = new QVBox( pTab ); 135 QVBox *vbox3 = new QVBox( pTab );
136 d->playListFrame = vbox3; 136 d->playListFrame = vbox3;
137 137
138 QHBox *hbox2 = new QHBox( vbox3 ); 138 QHBox *hbox2 = new QHBox( vbox3 );
139 d->selectedFiles = new PlayListSelection( hbox2 ); 139 d->selectedFiles = new PlayListSelection( hbox2 );
140 140
141 vbox1 = new QVBox( hbox2 ); 141 vbox1 = new QVBox( hbox2 );
142 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 142 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
143 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 143 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
144 144
145 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 145 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
146 146
147 QWidget *aTab; 147 QWidget *aTab;
148 aTab = new QWidget( tabWidget, "aTab" ); 148 aTab = new QWidget( tabWidget, "aTab" );
149 149
150 QGridLayout *Alayout = new QGridLayout( aTab ); 150 QGridLayout *Alayout = new QGridLayout( aTab );
151 Alayout->setSpacing( 2 ); 151 Alayout->setSpacing( 2 );
152 Alayout->setMargin( 2 ); 152 Alayout->setMargin( 2 );
153 audioView = new PlayListFileView( aTab, "Audioview" ); 153 // no m3u's here please
154 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", aTab, "Audioview" );
154 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 155 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
155 tabWidget->insertTab( aTab, tr( "Audio" ) ); 156 tabWidget->insertTab( aTab, tr( "Audio" ) );
156 157
157 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 158 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
158 159
159 QWidget *vTab; 160 QWidget *vTab;
160 vTab = new QWidget( tabWidget, "vTab" ); 161 vTab = new QWidget( tabWidget, "vTab" );
161 162
162 QGridLayout *Vlayout = new QGridLayout( vTab ); 163 QGridLayout *Vlayout = new QGridLayout( vTab );
163 Vlayout->setSpacing( 2 ); 164 Vlayout->setSpacing( 2 );
164 Vlayout->setMargin( 2 ); 165 Vlayout->setMargin( 2 );
165 videoView = new PlayListFileView( vTab, "Videoview" ); 166 videoView = new PlayListFileView( "video/*", vTab, "Videoview" );
166 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 167 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
167 168
168 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); 169 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
169 170
170 tabWidget->insertTab( vTab, tr( "Video" ) ); 171 tabWidget->insertTab( vTab, tr( "Video" ) );
171 172
172 //playlists list 173 //playlists list
173 QWidget *LTab; 174 QWidget *LTab;
174 LTab = new QWidget( tabWidget, "LTab" ); 175 LTab = new QWidget( tabWidget, "LTab" );
175 QGridLayout *Llayout = new QGridLayout( LTab ); 176 QGridLayout *Llayout = new QGridLayout( LTab );
176 Llayout->setSpacing( 2 ); 177 Llayout->setSpacing( 2 );
177 Llayout->setMargin( 2 ); 178 Llayout->setMargin( 2 );
178 179
179 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); 180 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
180 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 181 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
181 182
182 tabWidget->insertTab( LTab, tr( "Lists" ) ); 183 tabWidget->insertTab( LTab, tr( "Lists" ) );
183 184
184 setCentralWidget( vbox5 ); 185 setCentralWidget( vbox5 );
185} 186}
186 187
187 188
188 189
189PlayListWidgetGui::~PlayListWidgetGui() { 190PlayListWidgetGui::~PlayListWidgetGui() {
190} 191}
191 192
192void PlayListWidgetGui::setView( char view ) { 193void PlayListWidgetGui::setView( char view ) {
193 if ( view == 'l' ) 194 if ( view == 'l' )
194 showMaximized(); 195 showMaximized();
195 else 196 else
196 hide(); 197 hide();
197} 198}
198 199
199 200
200void PlayListWidgetGui::setActiveWindow() { 201void PlayListWidgetGui::setActiveWindow() {
201 // qDebug("SETTING active window"); 202 // qDebug("SETTING active window");
202 // When we get raised we need to ensure that it switches views 203 // When we get raised we need to ensure that it switches views
203 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); 204 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType();
204 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate 205 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
205 mediaPlayerState.setDisplayType( origDisplayType ); // now switch back 206 mediaPlayerState.setDisplayType( origDisplayType ); // now switch back
206} 207}
207 208
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index 9b5252a..0d8af43 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -1,130 +1,132 @@
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;
52class MediaPlayerState; 52class MediaPlayerState;
53class PlayListFileView;
53 54
54class Config; 55class Config;
55class QPEToolBar; 56class QPEToolBar;
56class QListViewItem; 57class QListViewItem;
57class QListView; 58class QListView;
58class QPoint; 59class QPoint;
59class QAction; 60class QAction;
60class QLabel; 61class QLabel;
61 62
62class PlayListWidgetPrivate { 63class PlayListWidgetPrivate {
63public: 64public:
64 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 65 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
65 QFrame *playListFrame; 66 QFrame *playListFrame;
66 PlayListSelection *selectedFiles; 67 PlayListSelection *selectedFiles;
67 bool setDocumentUsed; 68 bool setDocumentUsed;
68}; 69};
69 70
70 71
71class ToolButton : public QToolButton { 72class ToolButton : public QToolButton {
72public: 73public:
73 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 74 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
74 : QToolButton( parent, name ) { 75 : QToolButton( parent, name ) {
75 setTextLabel( name ); 76 setTextLabel( name );
76 setPixmap( Resource::loadPixmap( icon ) ); 77 setPixmap( Resource::loadPixmap( icon ) );
77 setAutoRaise( TRUE ); 78 setAutoRaise( TRUE );
78 setFocusPolicy( QWidget::NoFocus ); 79 setFocusPolicy( QWidget::NoFocus );
79 setToggleButton( t ); 80 setToggleButton( t );
80 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 81 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
81 QPEMenuToolFocusManager::manager()->addWidget( this ); 82 QPEMenuToolFocusManager::manager()->addWidget( this );
82 } 83 }
83}; 84};
84 85
85 86
86class MenuItem : public QAction { 87class MenuItem : public QAction {
87 88
88public: 89public:
89 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 90 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
90 : QAction( text, QString::null, 0, 0 ) { 91 : QAction( text, QString::null, 0, 0 ) {
91 connect( this, SIGNAL( activated() ), handler, slot ); 92 connect( this, SIGNAL( activated() ), handler, slot );
92 addTo( parent ); 93 addTo( parent );
93 } 94 }
94}; 95};
95 96
96class PlayListWidgetGui : public QMainWindow { 97class PlayListWidgetGui : public QMainWindow {
97 Q_OBJECT 98 Q_OBJECT
98public: 99public:
99 PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 ); 100 PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 );
100 ~PlayListWidgetGui(); 101 ~PlayListWidgetGui();
101 102
102protected: 103protected:
103 QTabWidget * tabWidget; 104 QTabWidget * tabWidget;
104 QListView *audioView, *videoView, *playlistView; 105 PlayListFileView *audioView, *videoView;
106 QListView *playlistView;
105 QLabel *libString; 107 QLabel *libString;
106 QPopupMenu *pmView ; 108 QPopupMenu *pmView ;
107 QPopupMenu *gammaMenu; 109 QPopupMenu *gammaMenu;
108 QSlider *gammaSlider; 110 QSlider *gammaSlider;
109 QLCDNumber *gammaLCD; 111 QLCDNumber *gammaLCD;
110 bool fromSetDocument; 112 bool fromSetDocument;
111 bool insanityBool; 113 bool insanityBool;
112 QString setDocFileRef; 114 QString setDocFileRef;
113 // retrieve the current playlist entry (media file link) 115 // retrieve the current playlist entry (media file link)
114 QPushButton *tbDeletePlaylist; 116 QPushButton *tbDeletePlaylist;
115 int selected; 117 int selected;
116 QPopupMenu *pmPlayList; 118 QPopupMenu *pmPlayList;
117 FileSelector* playLists; 119 FileSelector* playLists;
118 QPopupMenu *skinsMenu; 120 QPopupMenu *skinsMenu;
119 PlayListWidgetPrivate *d; // Private implementation data 121 PlayListWidgetPrivate *d; // Private implementation data
120 QVBox *vbox1; 122 QVBox *vbox1;
121 QVBox *vbox5; 123 QVBox *vbox5;
122 QPEToolBar *bar; 124 QPEToolBar *bar;
123 void setActiveWindow(); // need to handle this to show the right view 125 void setActiveWindow(); // need to handle this to show the right view
124 void setView( char ); 126 void setView( char );
125 127
126 MediaPlayerState &mediaPlayerState; 128 MediaPlayerState &mediaPlayerState;
127}; 129};
128 130
129#endif 131#endif
130 132