Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 68 |
1 files changed, 14 insertions, 54 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index e6d0525..87184ba 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -45,87 +45,47 @@ void MediaPlayer::pauseCheck( bool b ) { | |||
45 | // Only pause if playing | 45 | // Only pause if playing |
46 | if ( b && !mediaPlayerState->playing() ) | 46 | if ( b && !mediaPlayerState->playing() ) |
47 | mediaPlayerState->setPaused( FALSE ); | 47 | mediaPlayerState->setPaused( FALSE ); |
48 | } | 48 | } |
49 | 49 | ||
50 | void MediaPlayer::play() { | 50 | void MediaPlayer::play() { |
51 | mediaPlayerState->setPlaying( FALSE ); | 51 | mediaPlayerState->setPlaying( FALSE ); |
52 | mediaPlayerState->setPlaying( TRUE ); | 52 | mediaPlayerState->setPlaying( TRUE ); |
53 | } | 53 | } |
54 | 54 | ||
55 | void MediaPlayer::setPlaying( bool play ) { | 55 | void MediaPlayer::setPlaying( bool play ) { |
56 | if ( !play ) { | 56 | if ( !play ) { |
57 | mediaPlayerState->setPaused( FALSE ); | 57 | mediaPlayerState->setPaused( FALSE ); |
58 | // loopControl->stop( FALSE ); | 58 | return; |
59 | return; | ||
60 | } | 59 | } |
61 | 60 | ||
62 | if ( mediaPlayerState->paused() ) { | 61 | if ( mediaPlayerState->paused() ) { |
63 | mediaPlayerState->setPaused( FALSE ); | 62 | mediaPlayerState->setPaused( FALSE ); |
64 | return; | 63 | return; |
65 | } | 64 | } |
66 | 65 | ||
67 | const DocLnk *playListCurrent = playList->current(); | 66 | const DocLnk *playListCurrent = playList->current(); |
68 | if ( playListCurrent != NULL ) { | 67 | if ( playListCurrent != NULL ) { |
69 | // loopControl->stop( TRUE ); | 68 | currentFile = playListCurrent; |
70 | currentFile = playListCurrent; | ||
71 | } | ||
72 | |||
73 | /* | ||
74 | |||
75 | if ( currentFile == NULL ) { | ||
76 | QMessageBox::critical( 0, tr( "No file"), tr( "Error: There is no file selected" ) ); | ||
77 | mediaPlayerState->setPlaying( FALSE ); | ||
78 | return; | ||
79 | } | ||
80 | |||
81 | if ( ((currentFile->file()).left(4) != "http") && !QFile::exists( currentFile->file() ) ) { | ||
82 | QMessageBox::critical( 0, tr( "File not found"), tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" ); | ||
83 | mediaPlayerState->setPlaying( FALSE ); | ||
84 | return; | ||
85 | } | ||
86 | |||
87 | if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) { | ||
88 | QMessageBox::critical( 0, tr( "No decoder found"), tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" ); | ||
89 | mediaPlayerState->setPlaying( FALSE ); | ||
90 | return; | ||
91 | } | 69 | } |
92 | 70 | ||
93 | // if ( !loopControl->init( currentFile->file() ) ) { | 71 | audioUI->setTickerText( currentFile->file() ); |
94 | // QMessageBox::critical( 0, tr( "Error opening file"), tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" ); | ||
95 | // mediaPlayerState->setPlaying( FALSE ); | ||
96 | // return; | ||
97 | // } | ||
98 | // long seconds = loopControl->totalPlaytime(); | ||
99 | long seconds = 120; | ||
100 | QString time; | ||
101 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | ||
102 | QString tickerText; | ||
103 | if( currentFile->file().left(4) == "http" ) | ||
104 | tickerText= tr( " File: " ) + currentFile->name(); | ||
105 | else | ||
106 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | ||
107 | 72 | ||
108 | QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); | ||
109 | if ( !fileInfo.isEmpty() ) | ||
110 | tickerText += ", " + fileInfo; | ||
111 | audioUI->setTickerText( tickerText + "." ); | ||
112 | 73 | ||
74 | // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben | ||
113 | 75 | ||
114 | */ // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben | 76 | // Ob auch video 'v' : 'a' |
77 | // mediaPlayerState->setView( 'v' ); | ||
115 | 78 | ||
116 | 79 | // abspielen starten. | |
117 | // loopControl->play(); | ||
118 | |||
119 | // mediaPlayerState->setView( loopControl->hasVideo() ? 'v' : 'a' ); | ||
120 | } | 80 | } |
121 | 81 | ||
122 | 82 | ||
123 | void MediaPlayer::prev() { | 83 | void MediaPlayer::prev() { |
124 | if ( playList->prev() ) | 84 | if ( playList->prev() ) |
125 | play(); | 85 | play(); |
126 | else if ( mediaPlayerState->looping() ) { | 86 | else if ( mediaPlayerState->looping() ) { |
127 | if ( playList->last() ) | 87 | if ( playList->last() ) |
128 | play(); | 88 | play(); |
129 | } else | 89 | } else |
130 | mediaPlayerState->setList(); | 90 | mediaPlayerState->setList(); |
131 | } | 91 | } |
@@ -136,45 +96,45 @@ void MediaPlayer::next() { | |||
136 | play(); | 96 | play(); |
137 | else if ( mediaPlayerState->looping() ) { | 97 | else if ( mediaPlayerState->looping() ) { |
138 | if ( playList->first() ) | 98 | if ( playList->first() ) |
139 | play(); | 99 | play(); |
140 | } else | 100 | } else |
141 | mediaPlayerState->setList(); | 101 | mediaPlayerState->setList(); |
142 | } | 102 | } |
143 | 103 | ||
144 | 104 | ||
145 | void MediaPlayer::startDecreasingVolume() { | 105 | void MediaPlayer::startDecreasingVolume() { |
146 | volumeDirection = -1; | 106 | volumeDirection = -1; |
147 | startTimer( 100 ); | 107 | startTimer( 100 ); |
148 | // sollte volumeapplet machen | 108 | // da kommt demnächst osound denk ich mal |
149 | // AudioDevice::decreaseVolume(); | 109 | // AudioDevice::decreaseVolume(); |
150 | } | 110 | } |
151 | 111 | ||
152 | 112 | ||
153 | void MediaPlayer::startIncreasingVolume() { | 113 | void MediaPlayer::startIncreasingVolume() { |
154 | volumeDirection = +1; | 114 | volumeDirection = +1; |
155 | startTimer( 100 ); | 115 | startTimer( 100 ); |
156 | // AudioDevice::increaseVolume(); | 116 | // AudioDevice::increaseVolume(); |
157 | } | 117 | } |
158 | 118 | ||
159 | 119 | ||
160 | void MediaPlayer::stopChangingVolume() { | 120 | void MediaPlayer::stopChangingVolume() { |
161 | killTimers(); | 121 | killTimers(); |
162 | } | 122 | } |
163 | 123 | ||
164 | 124 | ||
165 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 125 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
166 | // if ( volumeDirection == +1 ) | 126 | // if ( volumeDirection == +1 ) |
167 | // AudioDevice::increaseVolume(); | 127 | // AudioDevice::increaseVolume(); |
168 | // else if ( volumeDirection == -1 ) | 128 | // else if ( volumeDirection == -1 ) |
169 | // AudioDevice::decreaseVolume(); | 129 | // AudioDevice::decreaseVolume(); |
170 | } | 130 | } |
171 | 131 | ||
172 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 132 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
173 | switch ( e->key() ) { | 133 | switch ( e->key() ) { |
174 | ////////////////////////////// Zaurus keys | 134 | ////////////////////////////// Zaurus keys |
175 | case Key_Home: | 135 | case Key_Home: |
176 | break; | 136 | break; |
177 | case Key_F9: //activity | 137 | case Key_F9: //activity |
178 | break; | 138 | break; |
179 | case Key_F10: //contacts | 139 | case Key_F10: //contacts |
180 | break; | 140 | break; |