summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/mediaplayer.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp
index b77708c..6c743ec 100644
--- a/core/multimedia/opieplayer/mediaplayer.cpp
+++ b/core/multimedia/opieplayer/mediaplayer.cpp
@@ -1,94 +1,94 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21 21
22#include <qmessagebox.h> 22#include <qmessagebox.h>
23 23
24#include "mediaplayer.h" 24#include "mediaplayer.h"
25#include "playlistwidget.h" 25#include "playlistwidget.h"
26#include "audiowidget.h" 26#include "audiowidget.h"
27#include "loopcontrol.h" 27#include "loopcontrol.h"
28#include "audiodevice.h" 28#include "audiodevice.h"
29 29
30#include "mediaplayerstate.h" 30#include "mediaplayerstate.h"
31 31
32 32
33extern AudioWidget *audioUI; 33extern AudioWidget *audioUI;
34extern PlayListWidget *playList; 34extern PlayListWidget *playList;
35extern LoopControl *loopControl; 35extern LoopControl *loopControl;
36extern MediaPlayerState *mediaPlayerState; 36extern MediaPlayerState *mediaPlayerState;
37 37
38 38
39MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 39MediaPlayer::MediaPlayer( QObject *parent, const char *name )
40 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 40 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
41 41
42// QPEApplication::grabKeyboard(); 42// QPEApplication::grabKeyboard();
43 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 43 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
44 44
45 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 45 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
46 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 46 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) );
47 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 47 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
48 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 48 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
49 49
50 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 50 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
51 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 51 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
52 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 52 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
53 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 53 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
54} 54}
55 55
56 56
57MediaPlayer::~MediaPlayer() { 57MediaPlayer::~MediaPlayer() {
58 58
59} 59}
60 60
61 61
62void MediaPlayer::pauseCheck( bool b ) { 62void MediaPlayer::pauseCheck( bool b ) {
63 // Only pause if playing 63 // Only pause if playing
64 if ( b && !mediaPlayerState->playing() ) 64 if ( b && !mediaPlayerState->playing() )
65 mediaPlayerState->setPaused( FALSE ); 65 mediaPlayerState->setPaused( FALSE );
66} 66}
67 67
68 68
69void MediaPlayer::play() { 69void MediaPlayer::play() {
70 mediaPlayerState->setPlaying( FALSE ); 70 mediaPlayerState->setPlaying( FALSE );
71 mediaPlayerState->setPlaying( TRUE ); 71 mediaPlayerState->setPlaying( TRUE );
72} 72}
73 73
74 74
75void MediaPlayer::setPlaying( bool play ) { 75void MediaPlayer::setPlaying( bool play ) {
76 // qDebug("MediaPlayer setPlaying %d", play); 76 // qDebug("MediaPlayer setPlaying %d", play);
77 if ( !play ) { 77 if ( !play ) {
78 mediaPlayerState->setPaused( FALSE ); 78 mediaPlayerState->setPaused( FALSE );
79 loopControl->stop( FALSE ); 79 loopControl->stop( FALSE );
80 return; 80 return;
81 } 81 }
82 82
83 if ( mediaPlayerState->paused() ) { 83 if ( mediaPlayerState->paused() ) {
84 mediaPlayerState->setPaused( FALSE ); 84 mediaPlayerState->setPaused( FALSE );
85 return; 85 return;
86 } 86 }
87 // qDebug("about to ctrash"); 87 // qDebug("about to ctrash");
88 const DocLnk *playListCurrent = playList->current(); 88 const DocLnk *playListCurrent = playList->current();
89 89
90 if ( playListCurrent != NULL ) { 90 if ( playListCurrent != NULL ) {
91 loopControl->stop( TRUE ); 91 loopControl->stop( TRUE );
92 currentFile = playListCurrent; 92 currentFile = playListCurrent;
93 } 93 }
94 if ( currentFile == NULL ) { 94 if ( currentFile == NULL ) {