summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp32
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h1
2 files changed, 0 insertions, 33 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6299328..10f1792 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -744,250 +744,218 @@ void PlayListWidget::tabChanged(QWidget *) {
744 switch ( tabWidget->currentPageIndex()) { 744 switch ( tabWidget->currentPageIndex()) {
745 case 0: 745 case 0:
746 { 746 {
747 if( !tbDeletePlaylist->isHidden()) 747 if( !tbDeletePlaylist->isHidden())
748 tbDeletePlaylist->hide(); 748 tbDeletePlaylist->hide();
749 d->tbRemoveFromList->setEnabled(TRUE); 749 d->tbRemoveFromList->setEnabled(TRUE);
750 d->tbAddToList->setEnabled(FALSE); 750 d->tbAddToList->setEnabled(FALSE);
751 } 751 }
752 break; 752 break;
753 case 1: 753 case 1:
754 { 754 {
755 audioView->clear(); 755 audioView->clear();
756 populateAudioView(); 756 populateAudioView();
757 757
758 if( !tbDeletePlaylist->isHidden()) 758 if( !tbDeletePlaylist->isHidden())
759 tbDeletePlaylist->hide(); 759 tbDeletePlaylist->hide();
760 d->tbRemoveFromList->setEnabled(FALSE); 760 d->tbRemoveFromList->setEnabled(FALSE);
761 d->tbAddToList->setEnabled(TRUE); 761 d->tbAddToList->setEnabled(TRUE);
762 } 762 }
763 break; 763 break;
764 case 2: 764 case 2:
765 { 765 {
766 videoView->clear(); 766 videoView->clear();
767 populateVideoView(); 767 populateVideoView();
768 if( !tbDeletePlaylist->isHidden()) 768 if( !tbDeletePlaylist->isHidden())
769 tbDeletePlaylist->hide(); 769 tbDeletePlaylist->hide();
770 d->tbRemoveFromList->setEnabled(FALSE); 770 d->tbRemoveFromList->setEnabled(FALSE);
771 d->tbAddToList->setEnabled(TRUE); 771 d->tbAddToList->setEnabled(TRUE);
772 } 772 }
773 break; 773 break;
774 case 3: 774 case 3:
775 { 775 {
776 if( tbDeletePlaylist->isHidden()) 776 if( tbDeletePlaylist->isHidden())
777 tbDeletePlaylist->show(); 777 tbDeletePlaylist->show();
778 playLists->reread(); 778 playLists->reread();
779 } 779 }
780 break; 780 break;
781 }; 781 };
782} 782}
783 783
784void PlayListWidget::btnPlay(bool b) { 784void PlayListWidget::btnPlay(bool b) {
785 785
786 // mediaPlayerState->setPlaying(b); 786 // mediaPlayerState->setPlaying(b);
787 switch ( tabWidget->currentPageIndex()) { 787 switch ( tabWidget->currentPageIndex()) {
788 case 0: 788 case 0:
789 { 789 {
790 mediaPlayerState->setPlaying(b); 790 mediaPlayerState->setPlaying(b);
791 } 791 }
792 break; 792 break;
793 case 1: 793 case 1:
794 { 794 {
795 addToSelection( audioView->currentItem() ); 795 addToSelection( audioView->currentItem() );
796 mediaPlayerState->setPlaying(b); 796 mediaPlayerState->setPlaying(b);
797 d->selectedFiles->removeSelected( ); 797 d->selectedFiles->removeSelected( );
798 tabWidget->setCurrentPage(1); 798 tabWidget->setCurrentPage(1);
799 d->selectedFiles->unSelect(); 799 d->selectedFiles->unSelect();
800 insanityBool=FALSE; 800 insanityBool=FALSE;
801 }// audioView->clearSelection(); 801 }// audioView->clearSelection();
802 break; 802 break;
803 case 2: 803 case 2:
804 { 804 {
805 addToSelection( videoView->currentItem() ); 805 addToSelection( videoView->currentItem() );
806 mediaPlayerState->setPlaying(b); 806 mediaPlayerState->setPlaying(b);
807 qApp->processEvents(); 807 qApp->processEvents();
808 d->selectedFiles->removeSelected( ); 808 d->selectedFiles->removeSelected( );
809 tabWidget->setCurrentPage(2); 809 tabWidget->setCurrentPage(2);
810 d->selectedFiles->unSelect(); 810 d->selectedFiles->unSelect();
811 insanityBool=FALSE; 811 insanityBool=FALSE;
812 }// videoView->clearSelection(); 812 }// videoView->clearSelection();
813 break; 813 break;
814 }; 814 };
815 815
816} 816}
817 817
818void PlayListWidget::deletePlaylist() { 818void PlayListWidget::deletePlaylist() {
819 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 819 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
820 (tr("You really want to delete\nthis playlist?")), 820 (tr("You really want to delete\nthis playlist?")),
821 (tr("Yes")), (tr("No")), 0 )){ 821 (tr("Yes")), (tr("No")), 0 )){
822 case 0: // Yes clicked, 822 case 0: // Yes clicked,
823 QFile().remove(playLists->selected()->file()); 823 QFile().remove(playLists->selected()->file());
824 QFile().remove(playLists->selected()->linkFile()); 824 QFile().remove(playLists->selected()->linkFile());
825 playLists->reread(); 825 playLists->reread();
826 break; 826 break;
827 case 1: // Cancel 827 case 1: // Cancel
828 break; 828 break;
829 }; 829 };
830} 830}
831 831
832void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 832void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
833 switch (mouse) { 833 switch (mouse) {
834 case 1: 834 case 1:
835 break; 835 break;
836 case 2:{ 836 case 2:{
837 QPopupMenu m; 837 QPopupMenu m;
838 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 838 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
839 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 839 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
840 m.insertSeparator();
841 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
842 m.exec( QCursor::pos() ); 840 m.exec( QCursor::pos() );
843 } 841 }
844 break; 842 break;
845 }; 843 };
846} 844}
847 845
848void PlayListWidget::playSelected() { 846void PlayListWidget::playSelected() {
849 btnPlay( TRUE); 847 btnPlay( TRUE);
850} 848}
851 849
852void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 850void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
853 switch (mouse) { 851 switch (mouse) {
854 case 1: 852 case 1:
855 853
856 break; 854 break;
857 case 2: 855 case 2:
858 { 856 {
859 QPopupMenu m; 857 QPopupMenu m;
860 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 858 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
861 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 859 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
862 m.exec( QCursor::pos() ); 860 m.exec( QCursor::pos() );
863 } 861 }
864 break; 862 break;
865 }; 863 };
866} 864}
867 865
868void PlayListWidget::listDelete() {
869 Config cfg( "OpiePlayer" );
870 cfg.setGroup("PlayList");
871 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
872 QString file;
873 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
874 switch ( tabWidget->currentPageIndex()) {
875 case 0:
876 break;
877 case 1:
878 {
879 file = audioView->currentItem()->text(0);
880 QListIterator<DocLnk> Pdit( files.children() );
881 for ( ; Pdit.current(); ++Pdit ) {
882 if( Pdit.current()->name() == file) {
883 LnkProperties prop( Pdit.current() );
884 prop.showMaximized();
885 prop.exec();
886 }
887 }
888 populateAudioView();
889 }
890 break;
891 case 2:
892 {
893
894 }
895 break;
896 };
897}
898 866
899void PlayListWidget::scanForAudio() { 867void PlayListWidget::scanForAudio() {
900 qDebug("scan for audio"); 868 qDebug("scan for audio");
901 files.detachChildren(); 869 files.detachChildren();
902 QListIterator<DocLnk> sdit( files.children() ); 870 QListIterator<DocLnk> sdit( files.children() );
903 for ( ; sdit.current(); ++sdit ) { 871 for ( ; sdit.current(); ++sdit ) {
904 delete sdit.current(); 872 delete sdit.current();
905 } 873 }
906 Global::findDocuments(&files, "audio/*"); 874 Global::findDocuments(&files, "audio/*");
907 audioScan = TRUE; 875 audioScan = TRUE;
908} 876}
909 877
910void PlayListWidget::scanForVideo() { 878void PlayListWidget::scanForVideo() {
911 qDebug("scan for video"); 879 qDebug("scan for video");
912 vFiles.detachChildren(); 880 vFiles.detachChildren();
913 QListIterator<DocLnk> sdit( vFiles.children() ); 881 QListIterator<DocLnk> sdit( vFiles.children() );
914 for ( ; sdit.current(); ++sdit ) { 882 for ( ; sdit.current(); ++sdit ) {
915 delete sdit.current(); 883 delete sdit.current();
916 } 884 }
917 Global::findDocuments(&vFiles, "video/*"); 885 Global::findDocuments(&vFiles, "video/*");
918 videoScan = TRUE; 886 videoScan = TRUE;
919} 887}
920 888
921void PlayListWidget::populateAudioView() { 889void PlayListWidget::populateAudioView() {
922 890
923 audioView->clear(); 891 audioView->clear();
924 StorageInfo storageInfo; 892 StorageInfo storageInfo;
925 const QList<FileSystem> &fs = storageInfo.fileSystems(); 893 const QList<FileSystem> &fs = storageInfo.fileSystems();
926 if(!audioScan) scanForAudio(); 894 if(!audioScan) scanForAudio();
927 895
928 QListIterator<DocLnk> dit( files.children() ); 896 QListIterator<DocLnk> dit( files.children() );
929 QListIterator<FileSystem> it ( fs ); 897 QListIterator<FileSystem> it ( fs );
930 898
931 QString storage; 899 QString storage;
932 for ( ; dit.current(); ++dit ) { 900 for ( ; dit.current(); ++dit ) {
933 for( ; it.current(); ++it ){ 901 for( ; it.current(); ++it ){
934 const QString name = (*it)->name(); 902 const QString name = (*it)->name();
935 const QString path = (*it)->path(); 903 const QString path = (*it)->path();
936 if(dit.current()->file().find(path) != -1 ) storage=name; 904 if(dit.current()->file().find(path) != -1 ) storage=name;
937 } 905 }
938 906
939 QListViewItem * newItem; 907 QListViewItem * newItem;
940 if ( QFile( dit.current()->file()).exists() ) { 908 if ( QFile( dit.current()->file()).exists() ) {
941 // qDebug(dit.current()->name()); 909 // qDebug(dit.current()->name());
942 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 910 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
943 QString::number( QFile( dit.current()->file()).size() ), storage); 911 QString::number( QFile( dit.current()->file()).size() ), storage);
944 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" )); 912 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" ));
945 } 913 }
946 } 914 }
947 915
948} 916}
949 917
950void PlayListWidget::populateVideoView() { 918void PlayListWidget::populateVideoView() {
951 videoView->clear(); 919 videoView->clear();
952 StorageInfo storageInfo; 920 StorageInfo storageInfo;
953 const QList<FileSystem> &fs = storageInfo.fileSystems(); 921 const QList<FileSystem> &fs = storageInfo.fileSystems();
954 922
955 if(!videoScan ) scanForVideo(); 923 if(!videoScan ) scanForVideo();
956 924
957 QListIterator<DocLnk> Vdit( vFiles.children() ); 925 QListIterator<DocLnk> Vdit( vFiles.children() );
958 QListIterator<FileSystem> it ( fs ); 926 QListIterator<FileSystem> it ( fs );
959 videoView->clear(); 927 videoView->clear();
960 QString storage; 928 QString storage;
961 for ( ; Vdit.current(); ++Vdit ) { 929 for ( ; Vdit.current(); ++Vdit ) {
962 for( ; it.current(); ++it ){ 930 for( ; it.current(); ++it ){
963 const QString name = (*it)->name(); 931 const QString name = (*it)->name();
964 const QString path = (*it)->path(); 932 const QString path = (*it)->path();
965 if( Vdit.current()->file().find(path) != -1 ) storage=name; 933 if( Vdit.current()->file().find(path) != -1 ) storage=name;
966 } 934 }
967 935
968 QListViewItem * newItem; 936 QListViewItem * newItem;
969 if ( QFile( Vdit.current()->file()).exists() ) { 937 if ( QFile( Vdit.current()->file()).exists() ) {
970 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 938 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
971 QString::number( QFile( Vdit.current()->file()).size() ), storage); 939 QString::number( QFile( Vdit.current()->file()).size() ), storage);
972 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); 940 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ));
973 } 941 }
974 } 942 }
975} 943}
976 944
977void PlayListWidget::openFile() { 945void PlayListWidget::openFile() {
978 QString filename, name; 946 QString filename, name;
979 InputDialog *fileDlg; 947 InputDialog *fileDlg;
980 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 948 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
981 fileDlg->exec(); 949 fileDlg->exec();
982 if( fileDlg->result() == 1 ) { 950 if( fileDlg->result() == 1 ) {
983 filename = fileDlg->LineEdit1->text(); 951 filename = fileDlg->LineEdit1->text();
984 952
985 qDebug("Selected filename is "+filename); 953 qDebug("Selected filename is "+filename);
986 if(filename.right(3) == "m3u") { 954 if(filename.right(3) == "m3u") {
987 readm3u( filename ); 955 readm3u( filename );
988 } else if(filename.right(3) == "pls") { 956 } else if(filename.right(3) == "pls") {
989 readPls( filename ); 957 readPls( filename );
990 } else { 958 } else {
991 DocLnk lnk; 959 DocLnk lnk;
992 960
993 lnk.setName(filename); //sets file name 961 lnk.setName(filename); //sets file name
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index dd4bee0..8076707 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -5,108 +5,107 @@
5#include <qmainwindow.h> 5#include <qmainwindow.h>
6#include <qpe/applnk.h> 6#include <qpe/applnk.h>
7#include <qtabwidget.h> 7#include <qtabwidget.h>
8#include <qpe/fileselector.h> 8#include <qpe/fileselector.h>
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qpopupmenu.h> 10#include <qpopupmenu.h>
11 11
12/* #include <qtimer.h> */ 12/* #include <qtimer.h> */
13 13
14 14
15class PlayListWidgetPrivate; 15class PlayListWidgetPrivate;
16class Config; 16class Config;
17class QListViewItem; 17class QListViewItem;
18class QListView; 18class QListView;
19class QPoint; 19class QPoint;
20class QAction; 20class QAction;
21class QLabel; 21class QLabel;
22 22
23class PlayListWidget : public QMainWindow { 23class PlayListWidget : public QMainWindow {
24 Q_OBJECT 24 Q_OBJECT
25public: 25public:
26 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 26 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
27 ~PlayListWidget(); 27 ~PlayListWidget();
28 QTabWidget * tabWidget; 28 QTabWidget * tabWidget;
29// MenuItem *fullScreenButton, *scaleButton; 29// MenuItem *fullScreenButton, *scaleButton;
30// QAction *fullScreenButton, *scaleButton; 30// QAction *fullScreenButton, *scaleButton;
31 DocLnkSet files; 31 DocLnkSet files;
32 DocLnkSet vFiles; 32 DocLnkSet vFiles;
33 QListView *audioView, *videoView, *playlistView; 33 QListView *audioView, *videoView, *playlistView;
34 QLabel *libString; 34 QLabel *libString;
35 QPopupMenu *pmView ; 35 QPopupMenu *pmView ;
36 bool fromSetDocument; 36 bool fromSetDocument;
37 bool insanityBool; 37 bool insanityBool;
38 QString setDocFileRef; 38 QString setDocFileRef;
39 // retrieve the current playlist entry (media file link) 39 // retrieve the current playlist entry (media file link)
40 const DocLnk *current(); 40 const DocLnk *current();
41 void useSelectedDocument(); 41 void useSelectedDocument();
42/* QTimer * menuTimer; */ 42/* QTimer * menuTimer; */
43 FileSelector* playLists; 43 FileSelector* playLists;
44 QPushButton *tbDeletePlaylist; 44 QPushButton *tbDeletePlaylist;
45 int selected; 45 int selected;
46public slots: 46public slots:
47 bool first(); 47 bool first();
48 bool last(); 48 bool last();
49 bool next(); 49 bool next();
50 bool prev(); 50 bool prev();
51/* void setFullScreen(); */ 51/* void setFullScreen(); */
52/* void setScaled(); */ 52/* void setScaled(); */
53protected: 53protected:
54/* void contentsMousePressEvent( QMouseEvent * e ); */ 54/* void contentsMousePressEvent( QMouseEvent * e ); */
55/* void contentsMouseReleaseEvent( QMouseEvent * e ); */ 55/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
56void keyReleaseEvent( QKeyEvent *e); 56void keyReleaseEvent( QKeyEvent *e);
57void keyPressEvent( QKeyEvent *e); 57void keyPressEvent( QKeyEvent *e);
58private: 58private:
59 int defaultSkinIndex; 59 int defaultSkinIndex;
60 QPopupMenu *skinsMenu; 60 QPopupMenu *skinsMenu;
61 bool audioScan, videoScan; 61 bool audioScan, videoScan;
62 void readm3u(const QString &); 62 void readm3u(const QString &);
63 void readPls(const QString &); 63 void readPls(const QString &);
64 64
65 void initializeStates(); 65 void initializeStates();
66 void readConfig( Config& cfg ); 66 void readConfig( Config& cfg );
67 void writeConfig( Config& cfg ) const; 67 void writeConfig( Config& cfg ) const;
68 PlayListWidgetPrivate *d; // Private implementation data 68 PlayListWidgetPrivate *d; // Private implementation data
69 void populateAudioView(); 69 void populateAudioView();
70 void populateVideoView(); 70 void populateVideoView();
71private slots: 71private slots:
72 void populateSkinsMenu(); 72 void populateSkinsMenu();
73 void skinsMenuActivated(int); 73 void skinsMenuActivated(int);
74 void pmViewActivated(int); 74 void pmViewActivated(int);
75 void writem3u(); 75 void writem3u();
76 void scanForAudio(); 76 void scanForAudio();
77 void scanForVideo(); 77 void scanForVideo();
78 void openFile(); 78 void openFile();
79 void setDocument( const QString& fileref ); 79 void setDocument( const QString& fileref );
80 void addToSelection( const DocLnk& ); // Add a media file to the playlist 80 void addToSelection( const DocLnk& ); // Add a media file to the playlist
81 void addToSelection( QListViewItem* ); // Add a media file to the playlist 81 void addToSelection( QListViewItem* ); // Add a media file to the playlist
82 void setActiveWindow(); // need to handle this to show the right view 82 void setActiveWindow(); // need to handle this to show the right view
83 void setPlaylist( bool ); // Show/Hide the playlist 83 void setPlaylist( bool ); // Show/Hide the playlist
84 void setView( char ); 84 void setView( char );
85 void clearList(); 85 void clearList();
86 void addAllToList(); 86 void addAllToList();
87 void addAllMusicToList(); 87 void addAllMusicToList();
88 void addAllVideoToList(); 88 void addAllVideoToList();
89 void saveList(); // Save the playlist 89 void saveList(); // Save the playlist
90 void loadList( const DocLnk &); // Load a playlist 90 void loadList( const DocLnk &); // Load a playlist
91 void playIt( QListViewItem *); 91 void playIt( QListViewItem *);
92 92
93 void btnPlay(bool); 93 void btnPlay(bool);
94 void deletePlaylist(); 94 void deletePlaylist();
95 void addSelected(); 95 void addSelected();
96 void removeSelected(); 96 void removeSelected();
97 void tabChanged(QWidget*); 97 void tabChanged(QWidget*);
98 void viewPressed( int, QListViewItem *, const QPoint&, int); 98 void viewPressed( int, QListViewItem *, const QPoint&, int);
99 void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 99 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
100 void playSelected(); 100 void playSelected();
101 void listDelete();
102 101
103protected slots: 102protected slots:
104/* void cancelMenuTimer(); */ 103/* void cancelMenuTimer(); */
105/* void showFileMenu(); */ 104/* void showFileMenu(); */
106 105
107 106
108}; 107};
109 108
110 109
111#endif // PLAY_LIST_WIDGET_H 110#endif // PLAY_LIST_WIDGET_H
112 111