summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayer.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 13cc4ed..5411a64 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -26,100 +26,118 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name )
26 26
27 27
28 xineControl = new XineControl(); 28 xineControl = new XineControl();
29// QPEApplication::grabKeyboard(); // EVIL 29// QPEApplication::grabKeyboard(); // EVIL
30 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 30 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
31 31
32 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 32 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
33 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 33 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
34 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 34 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
35 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 35 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
36 36
37 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 37 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
38 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 38 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
39 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 39 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
40 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 40 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
41 41
42} 42}
43 43
44MediaPlayer::~MediaPlayer() { 44MediaPlayer::~MediaPlayer() {
45} 45}
46 46
47void MediaPlayer::pauseCheck( bool b ) { 47void MediaPlayer::pauseCheck( bool b ) {
48 // Only pause if playing 48 // Only pause if playing
49 if ( b && !mediaPlayerState->playing() ) { 49 if ( b && !mediaPlayerState->playing() ) {
50 mediaPlayerState->setPaused( FALSE ); 50 mediaPlayerState->setPaused( FALSE );
51 } 51 }
52} 52}
53 53
54void MediaPlayer::play() { 54void MediaPlayer::play() {
55 mediaPlayerState->setPlaying( FALSE ); 55 mediaPlayerState->setPlaying( FALSE );
56 mediaPlayerState->setPlaying( TRUE ); 56 mediaPlayerState->setPlaying( TRUE );
57} 57}
58 58
59void MediaPlayer::setPlaying( bool play ) { 59void MediaPlayer::setPlaying( bool play ) {
60 if ( !play ) { 60 if ( !play ) {
61 mediaPlayerState->setPaused( FALSE ); 61 mediaPlayerState->setPaused( FALSE );
62 return; 62 return;
63 } 63 }
64 64
65 if ( mediaPlayerState->paused() ) { 65 if ( mediaPlayerState->paused() ) {
66 mediaPlayerState->setPaused( FALSE ); 66 mediaPlayerState->setPaused( FALSE );
67 return; 67 return;
68 } 68 }
69 69
70 const DocLnk *playListCurrent = playList->current(); 70 const DocLnk *playListCurrent = playList->current();
71 if ( playListCurrent != NULL ) { 71 if ( playListCurrent != NULL ) {
72 currentFile = playListCurrent; 72 currentFile = playListCurrent;
73 } 73 }
74
75 xineControl->play( currentFile->file() );
74 76
75 audioUI->setTickerText( currentFile->file( ) ); 77 xineControl->length();
78 long seconds = mediaPlayerState->length();//
79 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
80 qDebug(time);
76 81
77 xineControl->play( currentFile->file() ); 82 QString tickerText;
83 if( currentFile->file().left(4) == "http" )
84 tickerText= tr( " File: " ) + currentFile->name();
85 else
86 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
87
88// QString fileInfo = mediaPlayerState->curDecoder()->fileInfo();
89
90// if ( !fileInfo.isEmpty() )
91// tickerText += ", " + fileInfo;
92// audioUI->setTickerText( tickerText + "." );
93
94 audioUI->setTickerText( currentFile->file( ) );
95
78} 96}
79 97
80 98
81void MediaPlayer::prev() { 99void MediaPlayer::prev() {
82 if ( playList->prev() ) { 100 if ( playList->prev() ) {
83 play(); 101 play();
84 } else if ( mediaPlayerState->looping() ) { 102 } else if ( mediaPlayerState->looping() ) {
85 if ( playList->last() ) { 103 if ( playList->last() ) {
86 play(); 104 play();
87 } 105 }
88 } else { 106 } else {
89 mediaPlayerState->setList(); 107 mediaPlayerState->setList();
90 } 108 }
91} 109}
92 110
93 111
94void MediaPlayer::next() { 112void MediaPlayer::next() {
95 if ( playList->next() ) { 113 if ( playList->next() ) {
96 play(); 114 play();
97 } else if ( mediaPlayerState->looping() ) { 115 } else if ( mediaPlayerState->looping() ) {
98 if ( playList->first() ) { 116 if ( playList->first() ) {
99 play(); 117 play();
100 } 118 }
101 } else { 119 } else {
102 mediaPlayerState->setList(); 120 mediaPlayerState->setList();
103 } 121 }
104} 122}
105 123
106 124
107void MediaPlayer::startDecreasingVolume() { 125void MediaPlayer::startDecreasingVolume() {
108 volumeDirection = -1; 126 volumeDirection = -1;
109 startTimer( 100 ); 127 startTimer( 100 );
110 // da kommt demnächst osound denk ich mal 128 // da kommt demnächst osound denk ich mal
111 /////////////////////////// lets just move those change volume here 129 /////////////////////////// lets just move those change volume here
112 // AudioDevice::decreaseVolume(); 130 // AudioDevice::decreaseVolume();
113} 131}
114 132
115 133
116void MediaPlayer::startIncreasingVolume() { 134void MediaPlayer::startIncreasingVolume() {
117 volumeDirection = +1; 135 volumeDirection = +1;
118 startTimer( 100 ); 136 startTimer( 100 );
119 // AudioDevice::increaseVolume(); 137 // AudioDevice::increaseVolume();
120} 138}
121 139
122 140
123bool drawnOnScreenDisplay = FALSE; 141bool drawnOnScreenDisplay = FALSE;
124unsigned int onScreenDisplayVolume = 0; 142unsigned int onScreenDisplayVolume = 0;
125const int yoff = 110; 143const int yoff = 110;