author | simon <simon> | 2002-12-02 14:51:53 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 14:51:53 (UTC) |
commit | f90e42128a496a0fb5a67c3148c30ef46092624b (patch) (side-by-side diff) | |
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 @@ -776,32 +776,41 @@ void PlayListWidget::populateVideoView() { // storage=name; // pathName=path; // // } // } QListViewItem * newItem; if ( QFile( Vdit.current()->file() ).exists() ) { newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file() ).size() ), ""/*storage*/, Vdit.current()->file()); newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); } } videoPopulated=true; } +QListView *PlayListWidget::currentFileListView() const +{ + switch ( currentTab() ) { + case AudioFiles: return audioView; + case VideoFiles: return videoView; + default: assert( false ); + } + return 0; +} void PlayListWidget::openFile() { // http://66.28.164.33:2080 // http://somafm.com/star0242.m3u QString filename, name; InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { filename = fileDlg->text(); qDebug( "Selected filename is " + filename ); // Om3u *m3uList; DocLnk lnk; Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); @@ -1140,25 +1149,18 @@ void PlayListWidget::skinsMenuActivated( int item ) { int PlayListWidget::whichList() const { return tabWidget->currentPageIndex(); } PlayListWidget::TabType PlayListWidget::currentTab() const { static const TabType indexToTabType[ NumTabTypes ] = { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; int index = tabWidget->currentPageIndex(); assert( index < NumTabTypes && index >= 0 ); return indexToTabType[ index ]; } QString PlayListWidget::currentFileListPathName() const { - switch (currentTab()) { - case AudioFiles: - return audioView->currentItem()->text(3); - case VideoFiles: - return videoView->currentItem()->text(3); - default: assert( false ); - }; - return QString::null; + return currentFileListView()->currentItem()->text( 3 ); } 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 @@ -77,32 +77,34 @@ public slots: bool next(); bool prev(); void writeDefaultPlaylist( ); QString currentFileListPathName() const; protected: void keyReleaseEvent( QKeyEvent *e); private: int defaultSkinIndex; bool audioScan, videoScan, audioPopulated, videoPopulated; void readm3u(const QString &); void readPls(const QString &); void initializeStates(); void populateAudioView(); void populateVideoView(); + QListView *currentFileListView() const; + private slots: void populateSkinsMenu(); void skinsMenuActivated(int); void pmViewActivated(int); void writem3u(); void writeCurrentM3u(); void scanForAudio(); void scanForVideo(); void openFile(); void setDocument( const QString& fileref ); void addToSelection( const DocLnk& ); // Add a media file to the playlist void addToSelection( QListViewItem* ); // Add a media file to the playlist void setPlaylist( bool ); // Show/Hide the playlist void clearList(); void addAllToList(); void addAllMusicToList(); |