summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 17:22:29 (UTC)
committer simon <simon>2002-12-02 17:22:29 (UTC)
commit28f9d0587b2ee6a6a9467f658567a45ab7e95b94 (patch) (unidiff)
tree509fcf475ca55dde3d64f6719a2a751c8c4a88dc
parenta79674bdbba0093f4bba78f47905b67fd2f32a8f (diff)
downloadopie-28f9d0587b2ee6a6a9467f658567a45ab7e95b94.zip
opie-28f9d0587b2ee6a6a9467f658567a45ab7e95b94.tar.gz
opie-28f9d0587b2ee6a6a9467f658567a45ab7e95b94.tar.bz2
- removed the playlistToggled signal, as it is never emitted
- resulted in some simplification in playlistwidget
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h1
3 files changed, 1 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index d15894f..7a80ad8 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -73,65 +73,64 @@ public slots:
73 void setShuffled( bool b ); 73 void setShuffled( bool b );
74 void setPaused( bool b ); 74 void setPaused( bool b );
75 void setPlaying( bool b ); 75 void setPlaying( bool b );
76 void setStopped( bool b ); 76 void setStopped( bool b );
77 void setPosition( long p ); 77 void setPosition( long p );
78 void updatePosition( long p ); 78 void updatePosition( long p );
79 void setLength( long l ); 79 void setLength( long l );
80 void setView( char v ); 80 void setView( char v );
81 void setBlanked( bool b ); 81 void setBlanked( bool b );
82 void setVideoGamma( int v ); 82 void setVideoGamma( int v );
83 83
84 void setPrev(); 84 void setPrev();
85 void setNext(); 85 void setNext();
86 void setList(); 86 void setList();
87 void setVideo(); 87 void setVideo();
88 void setAudio(); 88 void setAudio();
89 89
90 void toggleFullscreen(); 90 void toggleFullscreen();
91 void toggleScaled(); 91 void toggleScaled();
92 void toggleLooping(); 92 void toggleLooping();
93 void toggleShuffled(); 93 void toggleShuffled();
94 void togglePaused(); 94 void togglePaused();
95 void togglePlaying(); 95 void togglePlaying();
96 void toggleBlank(); 96 void toggleBlank();
97 void writeConfig( Config& cfg ) const; 97 void writeConfig( Config& cfg ) const;
98 98
99 99
100signals: 100signals:
101 void fullscreenToggled( bool ); 101 void fullscreenToggled( bool );
102 void scaledToggled( bool ); 102 void scaledToggled( bool );
103 void loopingToggled( bool ); 103 void loopingToggled( bool );
104 void shuffledToggled( bool ); 104 void shuffledToggled( bool );
105 void playlistToggled( bool );
106 void pausedToggled( bool ); 105 void pausedToggled( bool );
107 void playingToggled( bool ); 106 void playingToggled( bool );
108 void stopToggled( bool ); 107 void stopToggled( bool );
109 void positionChanged( long ); // When the slider is moved 108 void positionChanged( long ); // When the slider is moved
110 void positionUpdated( long ); // When the media file progresses 109 void positionUpdated( long ); // When the media file progresses
111 void lengthChanged( long ); 110 void lengthChanged( long );
112 void viewChanged( char ); 111 void viewChanged( char );
113 void isSeekableToggled( bool ); 112 void isSeekableToggled( bool );
114 void blankToggled( bool ); 113 void blankToggled( bool );
115 void videoGammaChanged( int ); 114 void videoGammaChanged( int );
116 void prev(); 115 void prev();
117 void next(); 116 void next();
118 117
119private: 118private:
120 bool streaming : 1; 119 bool streaming : 1;
121 bool seekable : 1; 120 bool seekable : 1;
122 bool fullscreen: 1; 121 bool fullscreen: 1;
123 bool scaled : 1; 122 bool scaled : 1;
124 bool blanked : 1; 123 bool blanked : 1;
125 bool looping : 1; 124 bool looping : 1;
126 bool shuffled : 1; 125 bool shuffled : 1;
127 bool usePlaylist : 1; 126 bool usePlaylist : 1;
128 bool paused : 1; 127 bool paused : 1;
129 bool playing : 1; 128 bool playing : 1;
130 bool stopped : 1; 129 bool stopped : 1;
131 long curPosition; 130 long curPosition;
132 long curLength; 131 long curLength;
133 char curView; 132 char curView;
134 int videoGamma; 133 int videoGamma;
135 void readConfig( Config& cfg ); 134 void readConfig( Config& cfg );
136 135
137}; 136};
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6355bec..5b277cc 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -118,95 +118,93 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
118 // QVBox *stretch2 = new QVBox( vbox1 ); 118 // QVBox *stretch2 = new QVBox( vbox1 );
119 119
120 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 120 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
121 SLOT( deletePlaylist() ) ); 121 SLOT( deletePlaylist() ) );
122 connect( pmView, SIGNAL( activated( int ) ), 122 connect( pmView, SIGNAL( activated( int ) ),
123 this, SLOT( pmViewActivated( int ) ) ); 123 this, SLOT( pmViewActivated( int ) ) );
124 connect( skinsMenu, SIGNAL( activated( int ) ) , 124 connect( skinsMenu, SIGNAL( activated( int ) ) ,
125 this, SLOT( skinsMenuActivated( int ) ) ); 125 this, SLOT( skinsMenuActivated( int ) ) );
126 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 126 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
127 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 127 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
128 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 128 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
129 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 129 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
130 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 130 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
131 this,SLOT( playIt( QListViewItem *) ) ); 131 this,SLOT( playIt( QListViewItem *) ) );
132 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 132 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
133 this, SLOT( addToSelection( QListViewItem *) ) ); 133 this, SLOT( addToSelection( QListViewItem *) ) );
134 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 134 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
135 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 135 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
136 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 136 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
137 this,SLOT( playIt( QListViewItem *) ) ); 137 this,SLOT( playIt( QListViewItem *) ) );
138 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 138 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
139 this, SLOT( addToSelection( QListViewItem *) ) ); 139 this, SLOT( addToSelection( QListViewItem *) ) );
140 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 140 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
141 this, SLOT( loadList( const DocLnk & ) ) ); 141 this, SLOT( loadList( const DocLnk & ) ) );
142 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 142 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
143 this, SLOT( tabChanged( QWidget* ) ) ); 143 this, SLOT( tabChanged( QWidget* ) ) );
144 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), 144 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ),
145 d->tbPlay, SLOT( setOn( bool ) ) ); 145 d->tbPlay, SLOT( setOn( bool ) ) );
146 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 146 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
147 d->tbLoop, SLOT( setOn( bool ) ) ); 147 d->tbLoop, SLOT( setOn( bool ) ) );
148 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 148 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
149 d->tbShuffle, SLOT( setOn( bool ) ) ); 149 d->tbShuffle, SLOT( setOn( bool ) ) );
150 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ),
151 this, SLOT( setPlaylist( bool ) ) );
152 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 150 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
153 this, SLOT( playIt( QListViewItem *) ) ); 151 this, SLOT( playIt( QListViewItem *) ) );
154 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 152 connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
155 mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 153 mediaPlayerState, SLOT( setVideoGamma( int ) ) );
156 154
157 // see which skins are installed 155 // see which skins are installed
158 videoScan=false; 156 videoScan=false;
159 audioScan=false; 157 audioScan=false;
160 audioPopulated=false; 158 audioPopulated=false;
161 videoPopulated=false; 159 videoPopulated=false;
162 populateSkinsMenu(); 160 populateSkinsMenu();
163 initializeStates(); 161 initializeStates();
164 162
165 cfg.setGroup("PlayList"); 163 cfg.setGroup("PlayList");
166 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 164 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
167 loadList(DocLnk( currentPlaylist ) ); 165 loadList(DocLnk( currentPlaylist ) );
168} 166}
169 167
170 168
171PlayListWidget::~PlayListWidget() { 169PlayListWidget::~PlayListWidget() {
172 delete d; 170 delete d;
173} 171}
174 172
175 173
176void PlayListWidget::initializeStates() { 174void PlayListWidget::initializeStates() {
177 d->tbPlay->setOn( mediaPlayerState->isPlaying() ); 175 d->tbPlay->setOn( mediaPlayerState->isPlaying() );
178 d->tbLoop->setOn( mediaPlayerState->isLooping() ); 176 d->tbLoop->setOn( mediaPlayerState->isLooping() );
179 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 177 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
180 setPlaylist( true ); 178 d->playListFrame->show();
181} 179}
182 180
183void PlayListWidget::writeDefaultPlaylist() { 181void PlayListWidget::writeDefaultPlaylist() {
184 182
185 Config config( "OpiePlayer" ); 183 Config config( "OpiePlayer" );
186 config.setGroup( "PlayList" ); 184 config.setGroup( "PlayList" );
187 QString filename=QPEApplication::documentDir() + "/default.m3u"; 185 QString filename=QPEApplication::documentDir() + "/default.m3u";
188 QString currentString = config.readEntry( "CurrentPlaylist", filename); 186 QString currentString = config.readEntry( "CurrentPlaylist", filename);
189 if( currentString == filename) { 187 if( currentString == filename) {
190 Om3u *m3uList; 188 Om3u *m3uList;
191 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 189 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
192 if( d->selectedFiles->first() ) { 190 if( d->selectedFiles->first() ) {
193 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 191 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
194 do { 192 do {
195 // qDebug(d->selectedFiles->current()->file()); 193 // qDebug(d->selectedFiles->current()->file());
196 m3uList->add( d->selectedFiles->current()->file() ); 194 m3uList->add( d->selectedFiles->current()->file() );
197 } 195 }
198 while ( d->selectedFiles->next() ); 196 while ( d->selectedFiles->next() );
199 197
200 m3uList->write(); 198 m3uList->write();
201 m3uList->close(); 199 m3uList->close();
202 if(m3uList) delete m3uList; 200 if(m3uList) delete m3uList;
203 201
204 } 202 }
205 } 203 }
206} 204}
207 205
208void PlayListWidget::addToSelection( const DocLnk& lnk ) { 206void PlayListWidget::addToSelection( const DocLnk& lnk ) {
209 d->setDocumentUsed = FALSE; 207 d->setDocumentUsed = FALSE;
210 if ( mediaPlayerState->isUsingPlaylist() ) { 208 if ( mediaPlayerState->isUsingPlaylist() ) {
211 if( QFileInfo( lnk.file() ).exists() || 209 if( QFileInfo( lnk.file() ).exists() ||
212 lnk.file().left(4) == "http" ) { 210 lnk.file().left(4) == "http" ) {
@@ -488,74 +486,64 @@ bool PlayListWidget::first() {
488 return d->selectedFiles->first(); 486 return d->selectedFiles->first();
489 else 487 else
490 return mediaPlayerState->isLooping(); 488 return mediaPlayerState->isLooping();
491} 489}
492 490
493 491
494bool PlayListWidget::last() { 492bool PlayListWidget::last() {
495 if ( mediaPlayerState->isUsingPlaylist() ) 493 if ( mediaPlayerState->isUsingPlaylist() )
496 return d->selectedFiles->last(); 494 return d->selectedFiles->last();
497 else 495 else
498 return mediaPlayerState->isLooping(); 496 return mediaPlayerState->isLooping();
499} 497}
500 498
501 499
502 void PlayListWidget::saveList() { 500 void PlayListWidget::saveList() {
503 writem3u(); 501 writem3u();
504 } 502 }
505 503
506 504
507void PlayListWidget::loadList( const DocLnk & lnk) { 505void PlayListWidget::loadList( const DocLnk & lnk) {
508 QString name = lnk.name(); 506 QString name = lnk.name();
509 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 507 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
510 508
511 if( name.length()>0) { 509 if( name.length()>0) {
512 setCaption("OpiePlayer: "+name); 510 setCaption("OpiePlayer: "+name);
513// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 511// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
514 clearList(); 512 clearList();
515 readm3u(lnk.file()); 513 readm3u(lnk.file());
516 tabWidget->setCurrentPage(0); 514 tabWidget->setCurrentPage(0);
517 } 515 }
518} 516}
519 517
520
521void PlayListWidget::setPlaylist( bool shown ) {
522 if ( shown ) {
523 d->playListFrame->show();
524 } else {
525 d->playListFrame->hide();
526 }
527}
528
529
530void PlayListWidget::addSelected() { 518void PlayListWidget::addSelected() {
531 assert( inFileListMode() ); 519 assert( inFileListMode() );
532 520
533 QListView *fileListView = currentFileListView(); 521 QListView *fileListView = currentFileListView();
534 QListViewItemIterator it( fileListView ); 522 QListViewItemIterator it( fileListView );
535 for ( ; it.current(); ++it ) 523 for ( ; it.current(); ++it )
536 if ( it.current()->isSelected() ) { 524 if ( it.current()->isSelected() ) {
537 QString filename = it.current()->text(3); 525 QString filename = it.current()->text(3);
538 526
539 DocLnk lnk; 527 DocLnk lnk;
540 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 528 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
541 lnk.setFile( filename ); //sets file name 529 lnk.setFile( filename ); //sets file name
542 530
543 d->selectedFiles->addToSelection( lnk ); 531 d->selectedFiles->addToSelection( lnk );
544 } 532 }
545 533
546 fileListView->clearSelection(); 534 fileListView->clearSelection();
547 535
548 tabWidget->setCurrentPage( 0 ); 536 tabWidget->setCurrentPage( 0 );
549 writeCurrentM3u(); 537 writeCurrentM3u();
550} 538}
551 539
552 540
553void PlayListWidget::removeSelected() { 541void PlayListWidget::removeSelected() {
554 d->selectedFiles->removeSelected( ); 542 d->selectedFiles->removeSelected( );
555 writeCurrentM3u(); 543 writeCurrentM3u();
556} 544}
557 545
558 546
559void PlayListWidget::playIt( QListViewItem *it) { 547void PlayListWidget::playIt( QListViewItem *it) {
560 if(!it) return; 548 if(!it) return;
561 mediaPlayerState->setPlaying(FALSE); 549 mediaPlayerState->setPlaying(FALSE);
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 511a192..fa2837a 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -90,52 +90,51 @@ public slots:
90 bool next(); 90 bool next();
91 bool prev(); 91 bool prev();
92 void writeDefaultPlaylist( ); 92 void writeDefaultPlaylist( );
93 QString currentFileListPathName() const; 93 QString currentFileListPathName() const;
94protected: 94protected:
95 void keyReleaseEvent( QKeyEvent *e); 95 void keyReleaseEvent( QKeyEvent *e);
96 96
97private: 97private:
98 int defaultSkinIndex; 98 int defaultSkinIndex;
99 bool audioScan, videoScan, audioPopulated, videoPopulated; 99 bool audioScan, videoScan, audioPopulated, videoPopulated;
100 void readm3u(const QString &); 100 void readm3u(const QString &);
101 void readPls(const QString &); 101 void readPls(const QString &);
102 void initializeStates(); 102 void initializeStates();
103 void populateAudioView(); 103 void populateAudioView();
104 void populateVideoView(); 104 void populateVideoView();
105 105
106 QListView *currentFileListView() const; 106 QListView *currentFileListView() const;
107 107
108 bool inFileListMode() const; 108 bool inFileListMode() const;
109 109
110private slots: 110private slots:
111 void populateSkinsMenu(); 111 void populateSkinsMenu();
112 void skinsMenuActivated(int); 112 void skinsMenuActivated(int);
113 void pmViewActivated(int); 113 void pmViewActivated(int);
114 void writem3u(); 114 void writem3u();
115 void writeCurrentM3u(); 115 void writeCurrentM3u();
116 void scanForAudio(); 116 void scanForAudio();
117 void scanForVideo(); 117 void scanForVideo();
118 void openFile(); 118 void openFile();
119 void setDocument( const QString& fileref ); 119 void setDocument( const QString& fileref );
120 void addToSelection( const DocLnk& ); // Add a media file to the playlist 120 void addToSelection( const DocLnk& ); // Add a media file to the playlist
121 void addToSelection( QListViewItem* ); // Add a media file to the playlist 121 void addToSelection( QListViewItem* ); // Add a media file to the playlist
122 void setPlaylist( bool ); // Show/Hide the playlist
123 void clearList(); 122 void clearList();
124 void addAllToList(); 123 void addAllToList();
125 void addAllMusicToList(); 124 void addAllMusicToList();
126 void addAllVideoToList(); 125 void addAllVideoToList();
127 void saveList(); // Save the playlist 126 void saveList(); // Save the playlist
128 void loadList( const DocLnk &); // Load a playlist 127 void loadList( const DocLnk &); // Load a playlist
129 void playIt( QListViewItem *); 128 void playIt( QListViewItem *);
130 void btnPlay(bool); 129 void btnPlay(bool);
131 void deletePlaylist(); 130 void deletePlaylist();
132 void addSelected(); 131 void addSelected();
133 void removeSelected(); 132 void removeSelected();
134 void tabChanged(QWidget*); 133 void tabChanged(QWidget*);
135 void viewPressed( int, QListViewItem *, const QPoint&, int); 134 void viewPressed( int, QListViewItem *, const QPoint&, int);
136 void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 135 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
137 void playSelected(); 136 void playSelected();
138}; 137};
139 138
140#endif // PLAY_LIST_WIDGET_H 139#endif // PLAY_LIST_WIDGET_H
141 140