-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 100 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 92 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 2 |
7 files changed, 127 insertions, 75 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 040e965..446fa45 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -444,24 +444,25 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
444 | return; | 444 | return; |
445 | } | 445 | } |
446 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 446 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
447 | audioButtons[i].isHeld = FALSE; | 447 | audioButtons[i].isHeld = FALSE; |
448 | toggleButton(i); | 448 | toggleButton(i); |
449 | } | 449 | } |
450 | } else { | 450 | } else { |
451 | if ( audioButtons[i].isHeld ) { | 451 | if ( audioButtons[i].isHeld ) { |
452 | audioButtons[i].isHeld = FALSE; | 452 | audioButtons[i].isHeld = FALSE; |
453 | if ( !audioButtons[i].isToggle ) { | 453 | if ( !audioButtons[i].isToggle ) { |
454 | setToggleButton( i, FALSE ); | 454 | setToggleButton( i, FALSE ); |
455 | } | 455 | } |
456 | qDebug("mouseEvent %d", i); | ||
456 | switch (i) { | 457 | switch (i) { |
457 | case AudioPlay: | 458 | case AudioPlay: |
458 | if( mediaPlayerState->isPaused ) { | 459 | if( mediaPlayerState->isPaused ) { |
459 | // setToggleButton( i, FALSE ); | 460 | // setToggleButton( i, FALSE ); |
460 | mediaPlayerState->setPaused( FALSE ); | 461 | mediaPlayerState->setPaused( FALSE ); |
461 | return; | 462 | return; |
462 | } else if( !mediaPlayerState->isPaused ) { | 463 | } else if( !mediaPlayerState->isPaused ) { |
463 | // setToggleButton( i, TRUE ); | 464 | // setToggleButton( i, TRUE ); |
464 | mediaPlayerState->setPaused( TRUE ); | 465 | mediaPlayerState->setPaused( TRUE ); |
465 | return; | 466 | return; |
466 | } else { | 467 | } else { |
467 | // setToggleButton( i, TRUE ); | 468 | // setToggleButton( i, TRUE ); |
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp index 9edb1d3..62240b2 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.cpp +++ b/noncore/multimedia/opieplayer2/inputDialog.cpp | |||
@@ -16,24 +16,25 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags | |||
16 | setName( "InputDialog" ); | 16 | setName( "InputDialog" ); |
17 | } | 17 | } |
18 | resize( 234, 115); | 18 | resize( 234, 115); |
19 | setMaximumSize( QSize( 240, 40)); | 19 | setMaximumSize( QSize( 240, 40)); |
20 | setCaption( tr( name ) ); | 20 | setCaption( tr( name ) ); |
21 | 21 | ||
22 | QPushButton *browserButton; | 22 | QPushButton *browserButton; |
23 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); | 23 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); |
24 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); | 24 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); |
25 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); | 25 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); |
26 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 26 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
27 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); | 27 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); |
28 | LineEdit1->setFocus(); | ||
28 | } | 29 | } |
29 | /* | 30 | /* |
30 | * return the current text(input) | 31 | * return the current text(input) |
31 | */ | 32 | */ |
32 | QString InputDialog::text() const { | 33 | QString InputDialog::text() const { |
33 | return LineEdit1->text(); | 34 | return LineEdit1->text(); |
34 | } | 35 | } |
35 | /* | 36 | /* |
36 | * Destroys the object and frees any allocated resources | 37 | * Destroys the object and frees any allocated resources |
37 | */ | 38 | */ |
38 | InputDialog::~InputDialog() { | 39 | InputDialog::~InputDialog() { |
39 | } | 40 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index bf2acc8..553e3c1 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,17 +1,18 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/qcopenvelope_qws.h> | 5 | #include <qpe/qcopenvelope_qws.h> |
6 | #include <qfileinfo.h> | ||
6 | 7 | ||
7 | #include <qmainwindow.h> | 8 | #include <qmainwindow.h> |
8 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
9 | #include <qwidgetstack.h> | 10 | #include <qwidgetstack.h> |
10 | #include <qfile.h> | 11 | #include <qfile.h> |
11 | 12 | ||
12 | #include "mediaplayer.h" | 13 | #include "mediaplayer.h" |
13 | #include "playlistwidget.h" | 14 | #include "playlistwidget.h" |
14 | #include "audiowidget.h" | 15 | #include "audiowidget.h" |
15 | #include "videowidget.h" | 16 | #include "videowidget.h" |
16 | #include "volumecontrol.h" | 17 | #include "volumecontrol.h" |
17 | 18 | ||
@@ -66,83 +67,112 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
66 | MediaPlayer::~MediaPlayer() { | 67 | MediaPlayer::~MediaPlayer() { |
67 | delete xineControl; | 68 | delete xineControl; |
68 | delete volControl; | 69 | delete volControl; |
69 | } | 70 | } |
70 | 71 | ||
71 | void MediaPlayer::pauseCheck( bool b ) { | 72 | void MediaPlayer::pauseCheck( bool b ) { |
72 | if ( b && !mediaPlayerState->playing() ) { | 73 | if ( b && !mediaPlayerState->playing() ) { |
73 | mediaPlayerState->setPaused( FALSE ); | 74 | mediaPlayerState->setPaused( FALSE ); |
74 | } | 75 | } |
75 | } | 76 | } |
76 | 77 | ||
77 | void MediaPlayer::play() { | 78 | void MediaPlayer::play() { |
78 | mediaPlayerState->setPlaying( FALSE ); | 79 | mediaPlayerState->setPlaying( FALSE ); |
79 | mediaPlayerState->setPlaying( TRUE ); | 80 | mediaPlayerState->setPlaying( TRUE ); |
80 | } | 81 | } |
81 | 82 | ||
82 | void MediaPlayer::setPlaying( bool play ) { | 83 | void MediaPlayer::setPlaying( bool play ) { |
83 | if ( !play ) { | 84 | if ( !play ) { |
84 | return; | 85 | return; |
85 | } | 86 | } |
86 | 87 | ||
87 | if ( mediaPlayerState->paused() ) { | 88 | if ( mediaPlayerState->paused() ) { |
88 | mediaPlayerState->setPaused( FALSE ); | 89 | mediaPlayerState->setPaused( FALSE ); |
89 | return; | 90 | return; |
90 | } | ||
91 | |||
92 | const DocLnk *playListCurrent = playList->current(); | ||
93 | if ( playListCurrent != NULL ) { | ||
94 | currentFile = playListCurrent; | ||
95 | } | 91 | } |
96 | 92 | ||
97 | xineControl->play( currentFile->file() ); | 93 | QString tickerText, time, fileName; |
98 | 94 | if( playList->whichList() == 0 ) { //check for filelist | |
99 | long seconds = mediaPlayerState->length();// | 95 | const DocLnk *playListCurrent = playList->current(); |
100 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 96 | if ( playListCurrent != NULL ) { |
101 | qDebug(time); | 97 | currentFile = playListCurrent; |
102 | 98 | } | |
103 | QString tickerText; | 99 | xineControl->play( currentFile->file() ); |
104 | if( currentFile->file().left(4) == "http" ) | 100 | fileName = currentFile->name(); |
105 | tickerText= tr( " File: " ) + currentFile->name(); | 101 | long seconds = mediaPlayerState->length();// |
106 | else | 102 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
107 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | 103 | qDebug(time); |
108 | 104 | ||
109 | audioUI->setTickerText( currentFile->file( ) ); | 105 | } else { //if playing in file list.. play in a different way |
106 | // random and looping settings enabled causes problems here, | ||
107 | // since there is no selected file in the playlist, but a selected file in the file list, | ||
108 | // so we remember and shutoff | ||
109 | l = mediaPlayerState->looping(); | ||
110 | if(l) | ||
111 | mediaPlayerState->setLooping( false ); | ||
112 | r = mediaPlayerState->shuffled(); | ||
113 | mediaPlayerState->setShuffled(false); | ||
114 | |||
115 | fileName = playList->currentFileListPathName(); | ||
116 | xineControl->play( fileName); | ||
117 | long seconds = mediaPlayerState->length();// | ||
118 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | ||
119 | qDebug(time); | ||
120 | if( fileName.left(4) != "http" ) | ||
121 | fileName = QFileInfo( fileName).baseName(); | ||
110 | 122 | ||
123 | } | ||
124 | if( fileName.left(4) == "http" ) | ||
125 | tickerText= tr( " File: " ) + fileName; | ||
126 | else | ||
127 | tickerText = tr( " File: " ) + fileName + tr(", Length: ") + time; | ||
128 | audioUI->setTickerText( tickerText ); | ||
111 | } | 129 | } |
112 | 130 | ||
113 | 131 | ||
114 | void MediaPlayer::prev() { | 132 | void MediaPlayer::prev() { |
115 | if ( playList->prev() ) { | 133 | if(playList->whichList() == 0) { //if using the playlist |
116 | play(); | 134 | if ( playList->prev() ) { |
117 | } else if ( mediaPlayerState->looping() ) { | ||
118 | if ( playList->last() ) { | ||
119 | play(); | 135 | play(); |
136 | } else if ( mediaPlayerState->looping() ) { | ||
137 | if ( playList->last() ) { | ||
138 | play(); | ||
139 | } | ||
140 | } else { | ||
141 | mediaPlayerState->setList(); | ||
120 | } | 142 | } |
121 | } else { | ||
122 | mediaPlayerState->setList(); | ||
123 | } | 143 | } |
124 | } | 144 | } |
125 | 145 | ||
126 | 146 | ||
127 | void MediaPlayer::next() { | 147 | void MediaPlayer::next() { |
128 | if ( playList->next() ) { | 148 | |
129 | play(); | 149 | if(playList->whichList() == 0) { //if using the playlist |
130 | } else if ( mediaPlayerState->looping() ) { | 150 | if ( playList->next() ) { |
131 | if ( playList->first() ) { | ||
132 | play(); | 151 | play(); |
152 | } else if ( mediaPlayerState->looping() ) { | ||
153 | if ( playList->first() ) { | ||
154 | play(); | ||
155 | } | ||
156 | } else { | ||
157 | mediaPlayerState->setList(); | ||
133 | } | 158 | } |
134 | } else { | 159 | } else { //if playing from file list, let's just stop |
135 | mediaPlayerState->setList(); | 160 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); |
161 | mediaPlayerState->setPlaying(false); | ||
162 | mediaPlayerState->setView('l'); | ||
163 | if(l) mediaPlayerState->setLooping(l); | ||
164 | if(r) mediaPlayerState->setShuffled(r); | ||
136 | } | 165 | } |
166 | qApp->processEvents(); | ||
137 | } | 167 | } |
138 | 168 | ||
139 | 169 | ||
140 | void MediaPlayer::startDecreasingVolume() { | 170 | void MediaPlayer::startDecreasingVolume() { |
141 | volumeDirection = -1; | 171 | volumeDirection = -1; |
142 | startTimer( 100 ); | 172 | startTimer( 100 ); |
143 | volControl->decVol(2); | 173 | volControl->decVol(2); |
144 | } | 174 | } |
145 | 175 | ||
146 | 176 | ||
147 | void MediaPlayer::startIncreasingVolume() { | 177 | void MediaPlayer::startIncreasingVolume() { |
148 | volumeDirection = +1; | 178 | volumeDirection = +1; |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 81fab88..05be128 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h | |||
@@ -8,40 +8,39 @@ | |||
8 | #include <qpe/mediaplayerplugininterface.h> | 8 | #include <qpe/mediaplayerplugininterface.h> |
9 | 9 | ||
10 | #include "xinecontrol.h" | 10 | #include "xinecontrol.h" |
11 | 11 | ||
12 | class DocLnk; | 12 | class DocLnk; |
13 | class VolumeControl; | 13 | class VolumeControl; |
14 | 14 | ||
15 | class MediaPlayer : public QObject { | 15 | class MediaPlayer : public QObject { |
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | public: | 17 | public: |
18 | MediaPlayer( QObject *parent, const char *name ); | 18 | MediaPlayer( QObject *parent, const char *name ); |
19 | ~MediaPlayer(); | 19 | ~MediaPlayer(); |
20 | |||
21 | private slots: | 20 | private slots: |
22 | void setPlaying( bool ); | 21 | void setPlaying( bool ); |
23 | void pauseCheck( bool ); | 22 | void pauseCheck( bool ); |
24 | void play(); | 23 | void play(); |
25 | void next(); | 24 | void next(); |
26 | void prev(); | 25 | void prev(); |
27 | void startIncreasingVolume(); | 26 | void startIncreasingVolume(); |
28 | void startDecreasingVolume(); | 27 | void startDecreasingVolume(); |
29 | void stopChangingVolume(); | 28 | void stopChangingVolume(); |
30 | void cleanUp(); | 29 | void cleanUp(); |
31 | void blank( bool ); | 30 | void blank( bool ); |
32 | 31 | ||
33 | protected: | 32 | protected: |
34 | void timerEvent( QTimerEvent *e ); | 33 | void timerEvent( QTimerEvent *e ); |
35 | void keyReleaseEvent( QKeyEvent *e); | 34 | void keyReleaseEvent( QKeyEvent *e); |
36 | private: | 35 | private: |
37 | bool isBlanked; | 36 | bool isBlanked, l, r; |
38 | int fd; | 37 | int fd; |
39 | int volumeDirection; | 38 | int volumeDirection; |
40 | const DocLnk *currentFile; | 39 | const DocLnk *currentFile; |
41 | XineControl *xineControl; | 40 | XineControl *xineControl; |
42 | VolumeControl *volControl; | 41 | VolumeControl *volControl; |
43 | }; | 42 | }; |
44 | 43 | ||
45 | 44 | ||
46 | #endif // MEDIA_PLAYER_H | 45 | #endif // MEDIA_PLAYER_H |
47 | 46 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 3bd04bc..15c70c3 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -312,25 +312,25 @@ void PlayListWidget::setDocument( const QString& fileref ) { | |||
312 | qApp->processEvents(); | 312 | qApp->processEvents(); |
313 | setCaption( tr("OpiePlayer") ); | 313 | setCaption( tr("OpiePlayer") ); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | void PlayListWidget::useSelectedDocument() { | 318 | void PlayListWidget::useSelectedDocument() { |
319 | d->setDocumentUsed = FALSE; | 319 | d->setDocumentUsed = FALSE; |
320 | } | 320 | } |
321 | 321 | ||
322 | 322 | ||
323 | const DocLnk *PlayListWidget::current() { // this is fugly | 323 | const DocLnk *PlayListWidget::current() { // this is fugly |
324 | switch ( tabWidget->currentPageIndex() ) { | 324 | switch ( whichList() ) { |
325 | case 0: //playlist | 325 | case 0: //playlist |
326 | { | 326 | { |
327 | // qDebug("playlist"); | 327 | // qDebug("playlist"); |
328 | if ( mediaPlayerState->playlist() ) { | 328 | if ( mediaPlayerState->playlist() ) { |
329 | return d->selectedFiles->current(); | 329 | return d->selectedFiles->current(); |
330 | } else if ( d->setDocumentUsed && d->current ) { | 330 | } else if ( d->setDocumentUsed && d->current ) { |
331 | return d->current; | 331 | return d->current; |
332 | } else { | 332 | } else { |
333 | return d->files->selected(); | 333 | return d->files->selected(); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | break; | 336 | break; |
@@ -385,25 +385,26 @@ bool PlayListWidget::prev() { | |||
385 | return FALSE; | 385 | return FALSE; |
386 | } | 386 | } |
387 | } | 387 | } |
388 | return TRUE; | 388 | return TRUE; |
389 | } | 389 | } |
390 | } else { | 390 | } else { |
391 | return mediaPlayerState->looping(); | 391 | return mediaPlayerState->looping(); |
392 | } | 392 | } |
393 | } | 393 | } |
394 | 394 | ||
395 | 395 | ||
396 | bool PlayListWidget::next() { | 396 | bool PlayListWidget::next() { |
397 | if ( mediaPlayerState->playlist() ) { | 397 | qDebug("<<<<<<<<<<<<next()"); |
398 | if ( mediaPlayerState->playlist() ) { | ||
398 | if ( mediaPlayerState->shuffled() ) { | 399 | if ( mediaPlayerState->shuffled() ) { |
399 | return prev(); | 400 | return prev(); |
400 | } else { | 401 | } else { |
401 | if ( !d->selectedFiles->next() ) { | 402 | if ( !d->selectedFiles->next() ) { |
402 | if ( mediaPlayerState->looping() ) { | 403 | if ( mediaPlayerState->looping() ) { |
403 | return d->selectedFiles->first(); | 404 | return d->selectedFiles->first(); |
404 | } else { | 405 | } else { |
405 | return FALSE; | 406 | return FALSE; |
406 | } | 407 | } |
407 | } | 408 | } |
408 | return TRUE; | 409 | return TRUE; |
409 | } | 410 | } |
@@ -488,25 +489,25 @@ void PlayListWidget::setPlaylist( bool shown ) { | |||
488 | d->playListFrame->hide(); | 489 | d->playListFrame->hide(); |
489 | } | 490 | } |
490 | } | 491 | } |
491 | 492 | ||
492 | 493 | ||
493 | void PlayListWidget::addSelected() { | 494 | void PlayListWidget::addSelected() { |
494 | 495 | ||
495 | Config cfg( "OpiePlayer" ); | 496 | Config cfg( "OpiePlayer" ); |
496 | cfg.setGroup("PlayList"); | 497 | cfg.setGroup("PlayList"); |
497 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 498 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
498 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 499 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
499 | 500 | ||
500 | switch (tabWidget->currentPageIndex()) { | 501 | switch (whichList()) { |
501 | case 0: //playlist | 502 | case 0: //playlist |
502 | break; | 503 | break; |
503 | case 1: { //audio | 504 | case 1: { //audio |
504 | QListViewItemIterator it( audioView ); | 505 | QListViewItemIterator it( audioView ); |
505 | // iterate through all items of the listview | 506 | // iterate through all items of the listview |
506 | for ( ; it.current(); ++it ) { | 507 | for ( ; it.current(); ++it ) { |
507 | if ( it.current()->isSelected() ) { | 508 | if ( it.current()->isSelected() ) { |
508 | QListIterator<DocLnk> dit( files.children() ); | 509 | QListIterator<DocLnk> dit( files.children() ); |
509 | for ( ; dit.current(); ++dit ) { | 510 | for ( ; dit.current(); ++dit ) { |
510 | if( dit.current()->name() == it.current()->text(0) ) { | 511 | if( dit.current()->name() == it.current()->text(0) ) { |
511 | if(QFileInfo( dit.current()->file()).exists()) | 512 | if(QFileInfo( dit.current()->file()).exists()) |
512 | d->selectedFiles->addToSelection( **dit ); | 513 | d->selectedFiles->addToSelection( **dit ); |
@@ -548,25 +549,25 @@ void PlayListWidget::removeSelected() { | |||
548 | void PlayListWidget::playIt( QListViewItem *it) { | 549 | void PlayListWidget::playIt( QListViewItem *it) { |
549 | if(!it) return; | 550 | if(!it) return; |
550 | mediaPlayerState->setPlaying(FALSE); | 551 | mediaPlayerState->setPlaying(FALSE); |
551 | mediaPlayerState->setPlaying(TRUE); | 552 | mediaPlayerState->setPlaying(TRUE); |
552 | d->selectedFiles->unSelect(); | 553 | d->selectedFiles->unSelect(); |
553 | } | 554 | } |
554 | 555 | ||
555 | 556 | ||
556 | void PlayListWidget::addToSelection( QListViewItem *it) { | 557 | void PlayListWidget::addToSelection( QListViewItem *it) { |
557 | d->setDocumentUsed = FALSE; | 558 | d->setDocumentUsed = FALSE; |
558 | 559 | ||
559 | if(it) { | 560 | if(it) { |
560 | switch (tabWidget->currentPageIndex()) { | 561 | switch ( whichList()) { |
561 | case 1: { | 562 | case 1: { |
562 | QListIterator<DocLnk> dit( files.children() ); | 563 | QListIterator<DocLnk> dit( files.children() ); |
563 | for ( ; dit.current(); ++dit ) { | 564 | for ( ; dit.current(); ++dit ) { |
564 | if( dit.current()->name() == it->text(0)) { | 565 | if( dit.current()->name() == it->text(0)) { |
565 | if(QFileInfo( dit.current()->file()).exists()) | 566 | if(QFileInfo( dit.current()->file()).exists()) |
566 | d->selectedFiles->addToSelection( **dit ); | 567 | d->selectedFiles->addToSelection( **dit ); |
567 | } | 568 | } |
568 | } | 569 | } |
569 | } | 570 | } |
570 | break; | 571 | break; |
571 | case 2: { | 572 | case 2: { |
572 | QListIterator<DocLnk> dit( vFiles.children() ); | 573 | QListIterator<DocLnk> dit( vFiles.children() ); |
@@ -579,25 +580,25 @@ void PlayListWidget::addToSelection( QListViewItem *it) { | |||
579 | } | 580 | } |
580 | break; | 581 | break; |
581 | case 0: | 582 | case 0: |
582 | break; | 583 | break; |
583 | }; | 584 | }; |
584 | tabWidget->setCurrentPage(0); | 585 | tabWidget->setCurrentPage(0); |
585 | } | 586 | } |
586 | } | 587 | } |
587 | 588 | ||
588 | 589 | ||
589 | void PlayListWidget::tabChanged(QWidget *) { | 590 | void PlayListWidget::tabChanged(QWidget *) { |
590 | 591 | ||
591 | switch ( tabWidget->currentPageIndex()) { | 592 | switch ( whichList()) { |
592 | case 0: | 593 | case 0: |
593 | { | 594 | { |
594 | if( !tbDeletePlaylist->isHidden() ) { | 595 | if( !tbDeletePlaylist->isHidden() ) { |
595 | tbDeletePlaylist->hide(); | 596 | tbDeletePlaylist->hide(); |
596 | } | 597 | } |
597 | d->tbRemoveFromList->setEnabled(TRUE); | 598 | d->tbRemoveFromList->setEnabled(TRUE); |
598 | d->tbAddToList->setEnabled(FALSE); | 599 | d->tbAddToList->setEnabled(FALSE); |
599 | } | 600 | } |
600 | break; | 601 | break; |
601 | case 1: | 602 | case 1: |
602 | { | 603 | { |
603 | audioView->clear(); | 604 | audioView->clear(); |
@@ -625,53 +626,52 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
625 | { | 626 | { |
626 | if( tbDeletePlaylist->isHidden() ) { | 627 | if( tbDeletePlaylist->isHidden() ) { |
627 | tbDeletePlaylist->show(); | 628 | tbDeletePlaylist->show(); |
628 | } | 629 | } |
629 | playLists->reread(); | 630 | playLists->reread(); |
630 | } | 631 | } |
631 | break; | 632 | break; |
632 | }; | 633 | }; |
633 | } | 634 | } |
634 | 635 | ||
635 | 636 | ||
636 | void PlayListWidget::btnPlay(bool b) { | 637 | void PlayListWidget::btnPlay(bool b) { |
637 | // mediaPlayerState->setPlaying(b); | 638 | mediaPlayerState->setPlaying(b); |
638 | switch ( tabWidget->currentPageIndex()) { | 639 | qApp->processEvents(); |
639 | case 0: | 640 | insanityBool=FALSE; |
640 | { | 641 | // switch ( whichList()) { |
641 | mediaPlayerState->setPlaying(b); | 642 | // case 0: |
642 | } | 643 | // { |
643 | break; | 644 | // mediaPlayerState->setPlaying(b); |
644 | case 1: | 645 | // } |
645 | { | 646 | // break; |
646 | addToSelection( audioView->currentItem() ); | 647 | // case 1: |
647 | mediaPlayerState->setPlaying(b); | 648 | // { |
648 | d->selectedFiles->removeSelected( ); | 649 | // mediaPlayerState->setPlaying(b); |
649 | tabWidget->setCurrentPage(1); | 650 | // qApp->processEvents(); |
650 | d->selectedFiles->unSelect(); | 651 | // insanityBool=FALSE; |
651 | insanityBool=FALSE; | 652 | // }// audioView->clearSelection(); |
652 | }// audioView->clearSelection(); | 653 | // break; |
653 | break; | 654 | // case 2: |
654 | case 2: | 655 | // { |
655 | { | 656 | // // addToSelection( videoView->currentItem() ); |
656 | addToSelection( videoView->currentItem() ); | 657 | // mediaPlayerState->setPlaying(b); |
657 | mediaPlayerState->setPlaying(b); | 658 | // qApp->processEvents(); |
658 | qApp->processEvents(); | 659 | // // d->selectedFiles->removeSelected( ); |
659 | d->selectedFiles->removeSelected( ); | 660 | // // tabWidget->setCurrentPage(2); |
660 | tabWidget->setCurrentPage(2); | 661 | // // d->selectedFiles->unSelect(); |
661 | d->selectedFiles->unSelect(); | 662 | // insanityBool=FALSE; |
662 | insanityBool=FALSE; | 663 | // }// videoView->clearSelection(); |
663 | }// videoView->clearSelection(); | 664 | // break; |
664 | break; | 665 | // }; |
665 | }; | ||
666 | 666 | ||
667 | } | 667 | } |
668 | 668 | ||
669 | void PlayListWidget::deletePlaylist() { | 669 | void PlayListWidget::deletePlaylist() { |
670 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 670 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
671 | (tr("You really want to delete\nthis playlist?")), | 671 | (tr("You really want to delete\nthis playlist?")), |
672 | (tr("Yes")), (tr("No")), 0 )){ | 672 | (tr("Yes")), (tr("No")), 0 )){ |
673 | case 0: // Yes clicked, | 673 | case 0: // Yes clicked, |
674 | QFile().remove(playLists->selected()->file()); | 674 | QFile().remove(playLists->selected()->file()); |
675 | QFile().remove(playLists->selected()->linkFile()); | 675 | QFile().remove(playLists->selected()->linkFile()); |
676 | playLists->reread(); | 676 | playLists->reread(); |
677 | break; | 677 | break; |
@@ -727,57 +727,59 @@ void PlayListWidget::populateAudioView() { | |||
727 | if(dit.current()->file().find(path) != -1 ) { | 727 | if(dit.current()->file().find(path) != -1 ) { |
728 | storage = name; | 728 | storage = name; |
729 | } | 729 | } |
730 | } | 730 | } |
731 | 731 | ||
732 | QListViewItem * newItem; | 732 | QListViewItem * newItem; |
733 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { | 733 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { |
734 | long size; | 734 | long size; |
735 | if( dit.current()->file().left(4) == "http" ) | 735 | if( dit.current()->file().left(4) == "http" ) |
736 | size=0; | 736 | size=0; |
737 | else | 737 | else |
738 | size = QFile( dit.current()->file() ).size(); | 738 | size = QFile( dit.current()->file() ).size(); |
739 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage); | 739 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
740 | QString::number(size ), storage, dit.current()->file()); | ||
740 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); | 741 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); |
741 | } | 742 | } |
742 | } | 743 | } |
743 | } | 744 | } |
744 | 745 | ||
745 | 746 | ||
746 | void PlayListWidget::populateVideoView() { | 747 | void PlayListWidget::populateVideoView() { |
747 | videoView->clear(); | 748 | videoView->clear(); |
748 | StorageInfo storageInfo; | 749 | StorageInfo storageInfo; |
749 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 750 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
750 | 751 | ||
751 | if(!videoScan ) { | 752 | if(!videoScan ) { |
752 | scanForVideo(); | 753 | scanForVideo(); |
753 | } | 754 | } |
754 | 755 | ||
755 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 756 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
756 | QListIterator<FileSystem> it ( fs ); | 757 | QListIterator<FileSystem> it ( fs ); |
757 | videoView->clear(); | 758 | videoView->clear(); |
758 | QString storage; | 759 | QString storage, pathName; |
759 | for ( ; Vdit.current(); ++Vdit ) { | 760 | for ( ; Vdit.current(); ++Vdit ) { |
760 | for( ; it.current(); ++it ) { | 761 | for( ; it.current(); ++it ) { |
761 | const QString name = (*it)->name(); | 762 | const QString name = (*it)->name(); |
762 | const QString path = (*it)->path(); | 763 | const QString path = (*it)->path(); |
763 | if( Vdit.current()->file().find(path) != -1 ) { | 764 | if( Vdit.current()->file().find(path) != -1 ) { |
764 | storage=name; | 765 | storage=name; |
766 | pathName=path; | ||
765 | } | 767 | } |
766 | } | 768 | } |
767 | 769 | ||
768 | QListViewItem * newItem; | 770 | QListViewItem * newItem; |
769 | if ( QFile( Vdit.current()->file() ).exists() ) { | 771 | if ( QFile( Vdit.current()->file() ).exists() ) { |
770 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 772 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
771 | QString::number( QFile( Vdit.current()->file() ).size() ), storage ); | 773 | QString::number( QFile( Vdit.current()->file() ).size() ), storage, Vdit.current()->file()); |
772 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | 774 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); |
773 | } | 775 | } |
774 | } | 776 | } |
775 | } | 777 | } |
776 | 778 | ||
777 | 779 | ||
778 | void PlayListWidget::openFile() { | 780 | void PlayListWidget::openFile() { |
779 | QString filename, name; | 781 | QString filename, name; |
780 | InputDialog *fileDlg; | 782 | InputDialog *fileDlg; |
781 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 783 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
782 | fileDlg->exec(); | 784 | fileDlg->exec(); |
783 | if( fileDlg->result() == 1 ) { | 785 | if( fileDlg->result() == 1 ) { |
@@ -1053,12 +1055,28 @@ void PlayListWidget::populateSkinsMenu() { | |||
1053 | } | 1055 | } |
1054 | 1056 | ||
1055 | void PlayListWidget::skinsMenuActivated( int item ) { | 1057 | void PlayListWidget::skinsMenuActivated( int item ) { |
1056 | for( uint i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1058 | for( uint i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1057 | skinsMenu->setItemChecked( i, FALSE ); | 1059 | skinsMenu->setItemChecked( i, FALSE ); |
1058 | } | 1060 | } |
1059 | skinsMenu->setItemChecked( item, TRUE ); | 1061 | skinsMenu->setItemChecked( item, TRUE ); |
1060 | 1062 | ||
1061 | Config cfg( "OpiePlayer" ); | 1063 | Config cfg( "OpiePlayer" ); |
1062 | cfg.setGroup("Options"); | 1064 | cfg.setGroup("Options"); |
1063 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1065 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1064 | } | 1066 | } |
1067 | |||
1068 | int PlayListWidget::whichList() { | ||
1069 | return tabWidget->currentPageIndex(); | ||
1070 | } | ||
1071 | |||
1072 | QString PlayListWidget::currentFileListPathName() { | ||
1073 | switch (whichList()) { | ||
1074 | case 1: | ||
1075 | return audioView->currentItem()->text(3); | ||
1076 | break; | ||
1077 | case 2: | ||
1078 | return videoView->currentItem()->text(3); | ||
1079 | break; | ||
1080 | }; | ||
1081 | return ""; | ||
1082 | } | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index dcfdd48..2873dca 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -57,32 +57,33 @@ class PlayListWidget : public PlayListWidgetGui { | |||
57 | public: | 57 | public: |
58 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 58 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
59 | ~PlayListWidget(); | 59 | ~PlayListWidget(); |
60 | DocLnkSet files; | 60 | DocLnkSet files; |
61 | DocLnkSet vFiles; | 61 | DocLnkSet vFiles; |
62 | bool fromSetDocument; | 62 | bool fromSetDocument; |
63 | bool insanityBool; | 63 | bool insanityBool; |
64 | QString setDocFileRef; | 64 | QString setDocFileRef; |
65 | // retrieve the current playlist entry (media file link) | 65 | // retrieve the current playlist entry (media file link) |
66 | const DocLnk *current(); | 66 | const DocLnk *current(); |
67 | void useSelectedDocument(); | 67 | void useSelectedDocument(); |
68 | int selected; | 68 | int selected; |
69 | int whichList(); | ||
69 | 70 | ||
70 | public slots: | 71 | public slots: |
71 | bool first(); | 72 | bool first(); |
72 | bool last(); | 73 | bool last(); |
73 | bool next(); | 74 | bool next(); |
74 | bool prev(); | 75 | bool prev(); |
75 | void writeConfig( Config& cfg ) const; | 76 | void writeConfig( Config& cfg ) const; |
76 | 77 | QString currentFileListPathName(); | |
77 | protected: | 78 | protected: |
78 | void keyReleaseEvent( QKeyEvent *e); | 79 | void keyReleaseEvent( QKeyEvent *e); |
79 | 80 | ||
80 | private: | 81 | private: |
81 | int defaultSkinIndex; | 82 | int defaultSkinIndex; |
82 | bool audioScan, videoScan; | 83 | bool audioScan, videoScan; |
83 | void readm3u(const QString &); | 84 | void readm3u(const QString &); |
84 | void readPls(const QString &); | 85 | void readPls(const QString &); |
85 | void initializeStates(); | 86 | void initializeStates(); |
86 | void readConfig( Config& cfg ); | 87 | void readConfig( Config& cfg ); |
87 | void populateAudioView(); | 88 | void populateAudioView(); |
88 | void populateVideoView(); | 89 | void populateVideoView(); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index 250833c..f073102 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | |||
@@ -146,45 +146,47 @@ PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags | |||
146 | Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); | 146 | Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); |
147 | 147 | ||
148 | QWidget *aTab; | 148 | QWidget *aTab; |
149 | aTab = new QWidget( tabWidget, "aTab" ); | 149 | aTab = new QWidget( tabWidget, "aTab" ); |
150 | 150 | ||
151 | QGridLayout *Alayout = new QGridLayout( aTab ); | 151 | QGridLayout *Alayout = new QGridLayout( aTab ); |
152 | Alayout->setSpacing( 2 ); | 152 | Alayout->setSpacing( 2 ); |
153 | Alayout->setMargin( 2 ); | 153 | Alayout->setMargin( 2 ); |
154 | audioView = new QListView( aTab, "Audioview" ); | 154 | audioView = new QListView( aTab, "Audioview" ); |
155 | audioView->addColumn( tr( "Title" ), 140 ); | 155 | audioView->addColumn( tr( "Title" ), 140 ); |
156 | audioView->addColumn( tr( "Size" ), -1 ); | 156 | audioView->addColumn( tr( "Size" ), -1 ); |
157 | audioView->addColumn( tr( "Media" ), -1 ); | 157 | audioView->addColumn( tr( "Media" ), -1 ); |
158 | audioView->addColumn( tr( "Path" ), 0 ); | ||
158 | audioView->setColumnAlignment( 1, Qt::AlignRight ); | 159 | audioView->setColumnAlignment( 1, Qt::AlignRight ); |
159 | audioView->setColumnAlignment( 2, Qt::AlignRight ); | 160 | audioView->setColumnAlignment( 2, Qt::AlignRight ); |
160 | audioView->setAllColumnsShowFocus( TRUE ); | 161 | audioView->setAllColumnsShowFocus( TRUE ); |
161 | audioView->setSorting( 0, TRUE ); | 162 | audioView->setSorting( 0, TRUE ); |
162 | audioView->setMultiSelection( TRUE ); | 163 | audioView->setMultiSelection( TRUE ); |
163 | audioView->setSelectionMode( QListView::Extended ); | 164 | audioView->setSelectionMode( QListView::Extended ); |
164 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 165 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
165 | tabWidget->insertTab( aTab, tr( "Audio" ) ); | 166 | tabWidget->insertTab( aTab, tr( "Audio" ) ); |
166 | 167 | ||
167 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); | 168 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); |
168 | 169 | ||
169 | QWidget *vTab; | 170 | QWidget *vTab; |
170 | vTab = new QWidget( tabWidget, "vTab" ); | 171 | vTab = new QWidget( tabWidget, "vTab" ); |
171 | 172 | ||
172 | QGridLayout *Vlayout = new QGridLayout( vTab ); | 173 | QGridLayout *Vlayout = new QGridLayout( vTab ); |
173 | Vlayout->setSpacing( 2 ); | 174 | Vlayout->setSpacing( 2 ); |
174 | Vlayout->setMargin( 2 ); | 175 | Vlayout->setMargin( 2 ); |
175 | videoView = new QListView( vTab, "Videoview" ); | 176 | videoView = new QListView( vTab, "Videoview" ); |
176 | videoView->addColumn( tr( "Title" ), 140); | 177 | videoView->addColumn( tr( "Title" ), 140); |
177 | videoView->addColumn( tr( "Size" ), -1 ); | 178 | videoView->addColumn( tr( "Size" ), -1 ); |
178 | videoView->addColumn(tr( "Media" ), -1 ); | 179 | videoView->addColumn(tr( "Media" ), -1 ); |
180 | videoView->addColumn(tr( "Path" ), 0 ); | ||
179 | videoView->setColumnAlignment( 1, Qt::AlignRight ); | 181 | videoView->setColumnAlignment( 1, Qt::AlignRight ); |
180 | videoView->setColumnAlignment( 2, Qt::AlignRight ); | 182 | videoView->setColumnAlignment( 2, Qt::AlignRight ); |
181 | videoView->setAllColumnsShowFocus( TRUE ); | 183 | videoView->setAllColumnsShowFocus( TRUE ); |
182 | videoView->setSorting( 0, TRUE ); | 184 | videoView->setSorting( 0, TRUE ); |
183 | videoView->setMultiSelection( TRUE ); | 185 | videoView->setMultiSelection( TRUE ); |
184 | videoView->setSelectionMode( QListView::Extended ); | 186 | videoView->setSelectionMode( QListView::Extended ); |
185 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 187 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
186 | 188 | ||
187 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); | 189 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); |
188 | 190 | ||
189 | tabWidget->insertTab( vTab, tr( "Video" ) ); | 191 | tabWidget->insertTab( vTab, tr( "Video" ) ); |
190 | 192 | ||