author | simon <simon> | 2002-12-02 14:34:45 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 14:34:45 (UTC) |
commit | 77d55b631fa3cf26bfdf809c17ee3252d3c80ac0 (patch) (unidiff) | |
tree | c57ab11232df562532ab4672db7309fef8c917d9 | |
parent | 11d12e26459315713b46dbe00a52eef0ce9e4d77 (diff) | |
download | opie-77d55b631fa3cf26bfdf809c17ee3252d3c80ac0.zip opie-77d55b631fa3cf26bfdf809c17ee3252d3c80ac0.tar.gz opie-77d55b631fa3cf26bfdf809c17ee3252d3c80ac0.tar.bz2 |
- whichList is deprecated
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 8136ff1..6a38adc 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -50,165 +50,165 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
50 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 50 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
51 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); |
52 | 52 | ||
53 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 53 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
54 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 54 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
55 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 55 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
56 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 56 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
57 | 57 | ||
58 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 58 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
59 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 59 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
60 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 60 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
61 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 61 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
62 | 62 | ||
63 | volControl = new VolumeControl; | 63 | volControl = new VolumeControl; |
64 | xineControl = new XineControl(); | 64 | xineControl = new XineControl(); |
65 | Config cfg( "OpiePlayer" ); | 65 | Config cfg( "OpiePlayer" ); |
66 | cfg.setGroup("PlayList"); | 66 | cfg.setGroup("PlayList"); |
67 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 67 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
68 | playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 68 | playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
69 | } | 69 | } |
70 | 70 | ||
71 | MediaPlayer::~MediaPlayer() { | 71 | MediaPlayer::~MediaPlayer() { |
72 | delete xineControl; | 72 | delete xineControl; |
73 | delete volControl; | 73 | delete volControl; |
74 | } | 74 | } |
75 | 75 | ||
76 | void MediaPlayer::pauseCheck( bool b ) { | 76 | void MediaPlayer::pauseCheck( bool b ) { |
77 | if ( b && !mediaPlayerState->isPlaying() ) { | 77 | if ( b && !mediaPlayerState->isPlaying() ) { |
78 | mediaPlayerState->setPaused( FALSE ); | 78 | mediaPlayerState->setPaused( FALSE ); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | void MediaPlayer::play() { | 82 | void MediaPlayer::play() { |
83 | mediaPlayerState->setPlaying( FALSE ); | 83 | mediaPlayerState->setPlaying( FALSE ); |
84 | mediaPlayerState->setPlaying( TRUE ); | 84 | mediaPlayerState->setPlaying( TRUE ); |
85 | } | 85 | } |
86 | 86 | ||
87 | void MediaPlayer::setPlaying( bool play ) { | 87 | void MediaPlayer::setPlaying( bool play ) { |
88 | if ( !play ) { | 88 | if ( !play ) { |
89 | return; | 89 | return; |
90 | } | 90 | } |
91 | 91 | ||
92 | if ( mediaPlayerState->isPaused() ) { | 92 | if ( mediaPlayerState->isPaused() ) { |
93 | mediaPlayerState->setPaused( FALSE ); | 93 | mediaPlayerState->setPaused( FALSE ); |
94 | return; | 94 | return; |
95 | } | 95 | } |
96 | 96 | ||
97 | QString tickerText, time, fileName; | 97 | QString tickerText, time, fileName; |
98 | if( playList->whichList() == 0 ) { //check for filelist | 98 | if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //check for filelist |
99 | const DocLnk *playListCurrent = playList->current(); | 99 | const DocLnk *playListCurrent = playList->current(); |
100 | if ( playListCurrent != NULL ) { | 100 | if ( playListCurrent != NULL ) { |
101 | currentFile = playListCurrent; | 101 | currentFile = playListCurrent; |
102 | } | 102 | } |
103 | xineControl->play( currentFile->file() ); | 103 | xineControl->play( currentFile->file() ); |
104 | fileName = currentFile->name(); | 104 | fileName = currentFile->name(); |
105 | long seconds = mediaPlayerState->length();// | 105 | long seconds = mediaPlayerState->length();// |
106 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 106 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
107 | //qDebug(time); | 107 | //qDebug(time); |
108 | 108 | ||
109 | } else { | 109 | } else { |
110 | //if playing in file list.. play in a different way | 110 | //if playing in file list.. play in a different way |
111 | // random and looping settings enabled causes problems here, | 111 | // random and looping settings enabled causes problems here, |
112 | // since there is no selected file in the playlist, but a selected file in the file list, | 112 | // since there is no selected file in the playlist, but a selected file in the file list, |
113 | // so we remember and shutoff | 113 | // so we remember and shutoff |
114 | l = mediaPlayerState->isLooping(); | 114 | l = mediaPlayerState->isLooping(); |
115 | if(l) { | 115 | if(l) { |
116 | mediaPlayerState->setLooping( false ); | 116 | mediaPlayerState->setLooping( false ); |
117 | } | 117 | } |
118 | r = mediaPlayerState->isShuffled(); | 118 | r = mediaPlayerState->isShuffled(); |
119 | mediaPlayerState->setShuffled( false ); | 119 | mediaPlayerState->setShuffled( false ); |
120 | 120 | ||
121 | fileName = playList->currentFileListPathName(); | 121 | fileName = playList->currentFileListPathName(); |
122 | xineControl->play( fileName ); | 122 | xineControl->play( fileName ); |
123 | long seconds = mediaPlayerState->length(); | 123 | long seconds = mediaPlayerState->length(); |
124 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 124 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
125 | //qDebug(time); | 125 | //qDebug(time); |
126 | if( fileName.left(4) != "http" ) { | 126 | if( fileName.left(4) != "http" ) { |
127 | fileName = QFileInfo( fileName ).baseName(); | 127 | fileName = QFileInfo( fileName ).baseName(); |
128 | } | 128 | } |
129 | 129 | ||
130 | } | 130 | } |
131 | 131 | ||
132 | if( fileName.left(4) == "http" ) { | 132 | if( fileName.left(4) == "http" ) { |
133 | if ( xineControl->getMetaInfo().isEmpty() ) { | 133 | if ( xineControl->getMetaInfo().isEmpty() ) { |
134 | tickerText = tr( " File: " ) + fileName; | 134 | tickerText = tr( " File: " ) + fileName; |
135 | } else { | 135 | } else { |
136 | tickerText = xineControl->getMetaInfo(); | 136 | tickerText = xineControl->getMetaInfo(); |
137 | } | 137 | } |
138 | } else { | 138 | } else { |
139 | if ( xineControl->getMetaInfo().isEmpty() ) { | 139 | if ( xineControl->getMetaInfo().isEmpty() ) { |
140 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; | 140 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; |
141 | } else { | 141 | } else { |
142 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; | 142 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | audioUI->setTickerText( tickerText ); | 145 | audioUI->setTickerText( tickerText ); |
146 | } | 146 | } |
147 | 147 | ||
148 | 148 | ||
149 | void MediaPlayer::prev() { | 149 | void MediaPlayer::prev() { |
150 | if( playList->whichList() == 0 ) { //if using the playlist | 150 | if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist |
151 | if ( playList->prev() ) { | 151 | if ( playList->prev() ) { |
152 | play(); | 152 | play(); |
153 | } else if ( mediaPlayerState->isLooping() ) { | 153 | } else if ( mediaPlayerState->isLooping() ) { |
154 | if ( playList->last() ) { | 154 | if ( playList->last() ) { |
155 | play(); | 155 | play(); |
156 | } | 156 | } |
157 | } else { | 157 | } else { |
158 | mediaPlayerState->setList(); | 158 | mediaPlayerState->setList(); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | void MediaPlayer::next() { | 164 | void MediaPlayer::next() { |
165 | 165 | ||
166 | if(playList->whichList() == 0) { //if using the playlist | 166 | if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist |
167 | if ( playList->next() ) { | 167 | if ( playList->next() ) { |
168 | play(); | 168 | play(); |
169 | } else if ( mediaPlayerState->isLooping() ) { | 169 | } else if ( mediaPlayerState->isLooping() ) { |
170 | if ( playList->first() ) { | 170 | if ( playList->first() ) { |
171 | play(); | 171 | play(); |
172 | } | 172 | } |
173 | } else { | 173 | } else { |
174 | mediaPlayerState->setList(); | 174 | mediaPlayerState->setList(); |
175 | } | 175 | } |
176 | } else { //if playing from file list, let's just stop | 176 | } else { //if playing from file list, let's just stop |
177 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); | 177 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); |
178 | mediaPlayerState->setPlaying(false); | 178 | mediaPlayerState->setPlaying(false); |
179 | mediaPlayerState->setView('l'); | 179 | mediaPlayerState->setView('l'); |
180 | if(l) mediaPlayerState->setLooping(l); | 180 | if(l) mediaPlayerState->setLooping(l); |
181 | if(r) mediaPlayerState->setShuffled(r); | 181 | if(r) mediaPlayerState->setShuffled(r); |
182 | } | 182 | } |
183 | qApp->processEvents(); | 183 | qApp->processEvents(); |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | void MediaPlayer::startDecreasingVolume() { | 187 | void MediaPlayer::startDecreasingVolume() { |
188 | volumeDirection = -1; | 188 | volumeDirection = -1; |
189 | startTimer( 100 ); | 189 | startTimer( 100 ); |
190 | volControl->decVol(2); | 190 | volControl->decVol(2); |
191 | } | 191 | } |
192 | 192 | ||
193 | 193 | ||
194 | void MediaPlayer::startIncreasingVolume() { | 194 | void MediaPlayer::startIncreasingVolume() { |
195 | volumeDirection = +1; | 195 | volumeDirection = +1; |
196 | startTimer( 100 ); | 196 | startTimer( 100 ); |
197 | volControl->incVol(2); | 197 | volControl->incVol(2); |
198 | } | 198 | } |
199 | 199 | ||
200 | 200 | ||
201 | bool drawnOnScreenDisplay = FALSE; | 201 | bool drawnOnScreenDisplay = FALSE; |
202 | unsigned int onScreenDisplayVolume = 0; | 202 | unsigned int onScreenDisplayVolume = 0; |
203 | const int yoff = 110; | 203 | const int yoff = 110; |
204 | 204 | ||
205 | void MediaPlayer::stopChangingVolume() { | 205 | void MediaPlayer::stopChangingVolume() { |
206 | killTimers(); | 206 | killTimers(); |
207 | // Get rid of the on-screen display stuff | 207 | // Get rid of the on-screen display stuff |
208 | drawnOnScreenDisplay = FALSE; | 208 | drawnOnScreenDisplay = FALSE; |
209 | onScreenDisplayVolume = 0; | 209 | onScreenDisplayVolume = 0; |
210 | int w=0; | 210 | int w=0; |
211 | int h=0; | 211 | int h=0; |
212 | if( !xineControl->hasVideo() ) { | 212 | if( !xineControl->hasVideo() ) { |
213 | w = audioUI->width(); | 213 | w = audioUI->width(); |
214 | h = audioUI->height(); | 214 | h = audioUI->height(); |