author | simon <simon> | 2002-12-02 15:11:50 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 15:11:50 (UTC) |
commit | 9f770813346acbe7817b20c5fe0fea03827fc41a (patch) (side-by-side diff) | |
tree | 271e8091f19e5701576fa5f1503cca08f955a7b0 | |
parent | 5380767372ecf3ab22f799abda32f414b0cc7ede (diff) | |
download | opie-9f770813346acbe7817b20c5fe0fea03827fc41a.zip opie-9f770813346acbe7817b20c5fe0fea03827fc41a.tar.gz opie-9f770813346acbe7817b20c5fe0fea03827fc41a.tar.bz2 |
- removed whichList() alltogether
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 23 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 4 |
2 files changed, 10 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index a8429e3..fd256b7 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -545,121 +545,118 @@ void PlayListWidget::addSelected() { DocLnk lnk; lnk.setName( QFileInfo( filename ).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk ); } fileListView->clearSelection(); tabWidget->setCurrentPage( 0 ); writeCurrentM3u(); } void PlayListWidget::removeSelected() { d->selectedFiles->removeSelected( ); writeCurrentM3u(); } void PlayListWidget::playIt( QListViewItem *it) { if(!it) return; mediaPlayerState->setPlaying(FALSE); mediaPlayerState->setPlaying(TRUE); d->selectedFiles->unSelect(); } void PlayListWidget::addToSelection( QListViewItem *it) { d->setDocumentUsed = FALSE; if(it) { - switch ( whichList()) { - case 0: //playlist + if ( currentTab() == CurrentPlayList ) return; - break; - }; // case 1: { DocLnk lnk; QString filename; filename=it->text(3); lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); writeCurrentM3u(); tabWidget->setCurrentPage(0); } } void PlayListWidget::tabChanged(QWidget *) { - switch ( whichList()) { - case 0: + switch ( currentTab() ) { + case CurrentPlayList: { if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } d->tbRemoveFromList->setEnabled(TRUE); d->tbAddToList->setEnabled(FALSE); } break; - case 1: + case AudioFiles: { // audioView->clear(); if(!audioPopulated) populateAudioView(); if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } d->tbRemoveFromList->setEnabled(FALSE); d->tbAddToList->setEnabled(TRUE); } break; - case 2: + case VideoFiles: { // videoView->clear(); if(!videoPopulated) populateVideoView(); if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } d->tbRemoveFromList->setEnabled(FALSE); d->tbAddToList->setEnabled(TRUE); } break; - case 3: + case PlayLists: { if( tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->show(); } playLists->reread(); d->tbAddToList->setEnabled(FALSE); } break; }; } void PlayListWidget::btnPlay(bool b) { // mediaPlayerState->setPlaying(false); mediaPlayerState->setPlaying(b); insanityBool=FALSE; } void PlayListWidget::deletePlaylist() { switch( QMessageBox::information( this, (tr("Remove Playlist?")), (tr("You really want to delete\nthis playlist?")), (tr("Yes")), (tr("No")), 0 )){ case 0: // Yes clicked, QFile().remove(playLists->selectedDocument().file()); QFile().remove(playLists->selectedDocument().linkFile()); playLists->reread(); break; case 1: // Cancel break; }; } @@ -1104,50 +1101,46 @@ void PlayListWidget::populateSkinsMenu() { const QFileInfoList *skinslist = skinsDir.entryInfoList(); QFileInfoListIterator it( *skinslist ); QFileInfo *fi; while ( ( fi = it.current() ) ) { skinName = fi->fileName(); // qDebug( fi->fileName() ); if( skinName != "." && skinName != ".." && skinName !="CVS" ) { item = skinsMenu->insertItem( fi->fileName() ) ; } if( skinName == "default" ) { defaultSkinIndex = item; } if( skinName == skin ) { skinsMenu->setItemChecked( item, TRUE ); } ++it; } } void PlayListWidget::skinsMenuActivated( int item ) { for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { skinsMenu->setItemChecked( i, FALSE ); } skinsMenu->setItemChecked( item, TRUE ); Config cfg( "OpiePlayer" ); cfg.setGroup("Options"); cfg.writeEntry("Skin", skinsMenu->text( item ) ); QMessageBox::warning( this, tr( "OpiePlayer" ), tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); } -int PlayListWidget::whichList() const { - return tabWidget->currentPageIndex(); -} - PlayListWidget::TabType PlayListWidget::currentTab() const { - static const TabType indexToTabType[ NumTabTypes ] = + static const TabType indexToTabType[ TabTypeCount ] = { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; int index = tabWidget->currentPageIndex(); - assert( index < NumTabTypes && index >= 0 ); + assert( index < TabTypeCount && index >= 0 ); return indexToTabType[ index ]; } QString PlayListWidget::currentFileListPathName() const { return currentFileListView()->currentItem()->text( 3 ); } diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 238a75c..2e2ff89 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -26,78 +26,78 @@ -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef PLAY_LIST_WIDGET_H #define PLAY_LIST_WIDGET_H #include <qmainwindow.h> #include <qpe/applnk.h> #include <qtabwidget.h> #include <qpe/fileselector.h> #include <qpushbutton.h> #include <qpopupmenu.h> #include "playlistwidgetgui.h" //class PlayListWidgetPrivate; class Config; class QListViewItem; class QListView; class QPoint; class QAction; class QLabel; class PlayListWidget : public PlayListWidgetGui { Q_OBJECT public: - enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists, NumTabTypes = 4 }; + enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; + enum { TabTypeCount = 4 }; PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); ~PlayListWidget(); DocLnkSet files; DocLnkSet vFiles; bool fromSetDocument; bool insanityBool; QString setDocFileRef, currentPlayList; // retrieve the current playlist entry (media file link) const DocLnk *current(); void useSelectedDocument(); int selected; - int whichList() const; TabType currentTab() const; public slots: bool first(); bool last(); 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; bool inFileListMode() const; private slots: void populateSkinsMenu(); void skinsMenuActivated(int); void pmViewActivated(int); void writem3u(); void writeCurrentM3u(); void scanForAudio(); |