author | simon <simon> | 2002-12-02 14:51:53 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 14:51:53 (UTC) |
commit | f90e42128a496a0fb5a67c3148c30ef46092624b (patch) (unidiff) | |
tree | 8c0f0bee0fd71536c70c751d29ef9114e4313437 | |
parent | 3644bde7c86013c699978446c29ec6502220e29c (diff) | |
download | opie-f90e42128a496a0fb5a67c3148c30ef46092624b.zip opie-f90e42128a496a0fb5a67c3148c30ef46092624b.tar.gz opie-f90e42128a496a0fb5a67c3148c30ef46092624b.tar.bz2 |
- added currentFileListView() method that returns the current file list
qlistview object and simplified currentFileListPathName with that
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 18 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 2 |
2 files changed, 12 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index a708cf6..92da73b 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -760,64 +760,73 @@ void PlayListWidget::populateVideoView() { | |||
760 | StorageInfo storageInfo; | 760 | StorageInfo storageInfo; |
761 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); | 761 | // const QList<FileSystem> &fs = storageInfo.fileSystems(); |
762 | 762 | ||
763 | if(!videoScan ) { | 763 | if(!videoScan ) { |
764 | scanForVideo(); | 764 | scanForVideo(); |
765 | } | 765 | } |
766 | 766 | ||
767 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 767 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
768 | // QListIterator<FileSystem> it ( fs ); | 768 | // QListIterator<FileSystem> it ( fs ); |
769 | videoView->clear(); | 769 | videoView->clear(); |
770 | QString storage, pathName; | 770 | QString storage, pathName; |
771 | for ( ; Vdit.current(); ++Vdit ) { | 771 | for ( ; Vdit.current(); ++Vdit ) { |
772 | // // for( ; it.current(); ++it ) { | 772 | // // for( ; it.current(); ++it ) { |
773 | // const QString name = (*Vdit)->name(); | 773 | // const QString name = (*Vdit)->name(); |
774 | // const QString path = (*Vdit)->path(); | 774 | // const QString path = (*Vdit)->path(); |
775 | // if( Vdit.current()->file().find(path) != -1 ) { | 775 | // if( Vdit.current()->file().find(path) != -1 ) { |
776 | // storage=name; | 776 | // storage=name; |
777 | // pathName=path; | 777 | // pathName=path; |
778 | // // } | 778 | // // } |
779 | // } | 779 | // } |
780 | 780 | ||
781 | QListViewItem * newItem; | 781 | QListViewItem * newItem; |
782 | if ( QFile( Vdit.current()->file() ).exists() ) { | 782 | if ( QFile( Vdit.current()->file() ).exists() ) { |
783 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 783 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
784 | QString::number( QFile( Vdit.current()->file() ).size() ), | 784 | QString::number( QFile( Vdit.current()->file() ).size() ), |
785 | ""/*storage*/, Vdit.current()->file()); | 785 | ""/*storage*/, Vdit.current()->file()); |
786 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | 786 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); |
787 | } | 787 | } |
788 | } | 788 | } |
789 | videoPopulated=true; | 789 | videoPopulated=true; |
790 | } | 790 | } |
791 | 791 | ||
792 | QListView *PlayListWidget::currentFileListView() const | ||
793 | { | ||
794 | switch ( currentTab() ) { | ||
795 | case AudioFiles: return audioView; | ||
796 | case VideoFiles: return videoView; | ||
797 | default: assert( false ); | ||
798 | } | ||
799 | return 0; | ||
800 | } | ||
792 | 801 | ||
793 | void PlayListWidget::openFile() { | 802 | void PlayListWidget::openFile() { |
794 | // http://66.28.164.33:2080 | 803 | // http://66.28.164.33:2080 |
795 | // http://somafm.com/star0242.m3u | 804 | // http://somafm.com/star0242.m3u |
796 | QString filename, name; | 805 | QString filename, name; |
797 | InputDialog *fileDlg; | 806 | InputDialog *fileDlg; |
798 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 807 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
799 | fileDlg->exec(); | 808 | fileDlg->exec(); |
800 | if( fileDlg->result() == 1 ) { | 809 | if( fileDlg->result() == 1 ) { |
801 | filename = fileDlg->text(); | 810 | filename = fileDlg->text(); |
802 | qDebug( "Selected filename is " + filename ); | 811 | qDebug( "Selected filename is " + filename ); |
803 | // Om3u *m3uList; | 812 | // Om3u *m3uList; |
804 | DocLnk lnk; | 813 | DocLnk lnk; |
805 | Config cfg( "OpiePlayer" ); | 814 | Config cfg( "OpiePlayer" ); |
806 | cfg.setGroup("PlayList"); | 815 | cfg.setGroup("PlayList"); |
807 | 816 | ||
808 | if(filename.left(4) == "http") { | 817 | if(filename.left(4) == "http") { |
809 | QString m3uFile, m3uFilePath; | 818 | QString m3uFile, m3uFilePath; |
810 | if(filename.find(":",8,TRUE) != -1) { //found a port | 819 | if(filename.find(":",8,TRUE) != -1) { //found a port |
811 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | 820 | m3uFile = filename.left( filename.find( ":",8,TRUE)); |
812 | m3uFile = m3uFile.right( 7); | 821 | m3uFile = m3uFile.right( 7); |
813 | } else if(filename.left(4) == "http"){ | 822 | } else if(filename.left(4) == "http"){ |
814 | m3uFile=filename; | 823 | m3uFile=filename; |
815 | m3uFile = m3uFile.right( m3uFile.length() - 7); | 824 | m3uFile = m3uFile.right( m3uFile.length() - 7); |
816 | } else{ | 825 | } else{ |
817 | m3uFile=filename; | 826 | m3uFile=filename; |
818 | } | 827 | } |
819 | 828 | ||
820 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 829 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); |
821 | lnk.setName( filename ); //sets name | 830 | lnk.setName( filename ); //sets name |
822 | lnk.setFile( filename ); //sets file name | 831 | lnk.setFile( filename ); //sets file name |
823 | 832 | ||
@@ -1124,41 +1133,34 @@ void PlayListWidget::populateSkinsMenu() { | |||
1124 | } | 1133 | } |
1125 | } | 1134 | } |
1126 | 1135 | ||
1127 | void PlayListWidget::skinsMenuActivated( int item ) { | 1136 | void PlayListWidget::skinsMenuActivated( int item ) { |
1128 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1137 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1129 | skinsMenu->setItemChecked( i, FALSE ); | 1138 | skinsMenu->setItemChecked( i, FALSE ); |
1130 | } | 1139 | } |
1131 | skinsMenu->setItemChecked( item, TRUE ); | 1140 | skinsMenu->setItemChecked( item, TRUE ); |
1132 | 1141 | ||
1133 | Config cfg( "OpiePlayer" ); | 1142 | Config cfg( "OpiePlayer" ); |
1134 | cfg.setGroup("Options"); | 1143 | cfg.setGroup("Options"); |
1135 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1144 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1136 | QMessageBox::warning( this, tr( "OpiePlayer" ), | 1145 | QMessageBox::warning( this, tr( "OpiePlayer" ), |
1137 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); | 1146 | tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); |
1138 | } | 1147 | } |
1139 | 1148 | ||
1140 | int PlayListWidget::whichList() const { | 1149 | int PlayListWidget::whichList() const { |
1141 | return tabWidget->currentPageIndex(); | 1150 | return tabWidget->currentPageIndex(); |
1142 | } | 1151 | } |
1143 | 1152 | ||
1144 | PlayListWidget::TabType PlayListWidget::currentTab() const | 1153 | PlayListWidget::TabType PlayListWidget::currentTab() const |
1145 | { | 1154 | { |
1146 | static const TabType indexToTabType[ NumTabTypes ] = | 1155 | static const TabType indexToTabType[ NumTabTypes ] = |
1147 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 1156 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
1148 | 1157 | ||
1149 | int index = tabWidget->currentPageIndex(); | 1158 | int index = tabWidget->currentPageIndex(); |
1150 | assert( index < NumTabTypes && index >= 0 ); | 1159 | assert( index < NumTabTypes && index >= 0 ); |
1151 | 1160 | ||
1152 | return indexToTabType[ index ]; | 1161 | return indexToTabType[ index ]; |
1153 | } | 1162 | } |
1154 | 1163 | ||
1155 | QString PlayListWidget::currentFileListPathName() const { | 1164 | QString PlayListWidget::currentFileListPathName() const { |
1156 | switch (currentTab()) { | 1165 | return currentFileListView()->currentItem()->text( 3 ); |
1157 | case AudioFiles: | ||
1158 | return audioView->currentItem()->text(3); | ||
1159 | case VideoFiles: | ||
1160 | return videoView->currentItem()->text(3); | ||
1161 | default: assert( false ); | ||
1162 | }; | ||
1163 | return QString::null; | ||
1164 | } | 1166 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 7044abe..a608eae 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -61,64 +61,66 @@ public: | |||
61 | ~PlayListWidget(); | 61 | ~PlayListWidget(); |
62 | DocLnkSet files; | 62 | DocLnkSet files; |
63 | DocLnkSet vFiles; | 63 | DocLnkSet vFiles; |
64 | bool fromSetDocument; | 64 | bool fromSetDocument; |
65 | bool insanityBool; | 65 | bool insanityBool; |
66 | QString setDocFileRef, currentPlayList; | 66 | QString setDocFileRef, currentPlayList; |
67 | // retrieve the current playlist entry (media file link) | 67 | // retrieve the current playlist entry (media file link) |
68 | const DocLnk *current(); | 68 | const DocLnk *current(); |
69 | void useSelectedDocument(); | 69 | void useSelectedDocument(); |
70 | int selected; | 70 | int selected; |
71 | int whichList() const; | 71 | int whichList() const; |
72 | TabType currentTab() const; | 72 | TabType currentTab() const; |
73 | 73 | ||
74 | public slots: | 74 | public slots: |
75 | bool first(); | 75 | bool first(); |
76 | bool last(); | 76 | bool last(); |
77 | bool next(); | 77 | bool next(); |
78 | bool prev(); | 78 | bool prev(); |
79 | void writeDefaultPlaylist( ); | 79 | void writeDefaultPlaylist( ); |
80 | QString currentFileListPathName() const; | 80 | QString currentFileListPathName() const; |
81 | protected: | 81 | protected: |
82 | void keyReleaseEvent( QKeyEvent *e); | 82 | void keyReleaseEvent( QKeyEvent *e); |
83 | 83 | ||
84 | private: | 84 | private: |
85 | int defaultSkinIndex; | 85 | int defaultSkinIndex; |
86 | bool audioScan, videoScan, audioPopulated, videoPopulated; | 86 | bool audioScan, videoScan, audioPopulated, videoPopulated; |
87 | void readm3u(const QString &); | 87 | void readm3u(const QString &); |
88 | void readPls(const QString &); | 88 | void readPls(const QString &); |
89 | void initializeStates(); | 89 | void initializeStates(); |
90 | void populateAudioView(); | 90 | void populateAudioView(); |
91 | void populateVideoView(); | 91 | void populateVideoView(); |
92 | 92 | ||
93 | QListView *currentFileListView() const; | ||
94 | |||
93 | private slots: | 95 | private slots: |
94 | void populateSkinsMenu(); | 96 | void populateSkinsMenu(); |
95 | void skinsMenuActivated(int); | 97 | void skinsMenuActivated(int); |
96 | void pmViewActivated(int); | 98 | void pmViewActivated(int); |
97 | void writem3u(); | 99 | void writem3u(); |
98 | void writeCurrentM3u(); | 100 | void writeCurrentM3u(); |
99 | void scanForAudio(); | 101 | void scanForAudio(); |
100 | void scanForVideo(); | 102 | void scanForVideo(); |
101 | void openFile(); | 103 | void openFile(); |
102 | void setDocument( const QString& fileref ); | 104 | void setDocument( const QString& fileref ); |
103 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 105 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
104 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 106 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
105 | void setPlaylist( bool ); // Show/Hide the playlist | 107 | void setPlaylist( bool ); // Show/Hide the playlist |
106 | void clearList(); | 108 | void clearList(); |
107 | void addAllToList(); | 109 | void addAllToList(); |
108 | void addAllMusicToList(); | 110 | void addAllMusicToList(); |
109 | void addAllVideoToList(); | 111 | void addAllVideoToList(); |
110 | void saveList(); // Save the playlist | 112 | void saveList(); // Save the playlist |
111 | void loadList( const DocLnk &); // Load a playlist | 113 | void loadList( const DocLnk &); // Load a playlist |
112 | void playIt( QListViewItem *); | 114 | void playIt( QListViewItem *); |
113 | void btnPlay(bool); | 115 | void btnPlay(bool); |
114 | void deletePlaylist(); | 116 | void deletePlaylist(); |
115 | void addSelected(); | 117 | void addSelected(); |
116 | void removeSelected(); | 118 | void removeSelected(); |
117 | void tabChanged(QWidget*); | 119 | void tabChanged(QWidget*); |
118 | void viewPressed( int, QListViewItem *, const QPoint&, int); | 120 | void viewPressed( int, QListViewItem *, const QPoint&, int); |
119 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); | 121 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); |
120 | void playSelected(); | 122 | void playSelected(); |
121 | }; | 123 | }; |
122 | 124 | ||
123 | #endif // PLAY_LIST_WIDGET_H | 125 | #endif // PLAY_LIST_WIDGET_H |
124 | 126 | ||