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.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 87184ba..be59d8d 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,96 +1,101 @@
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 5
6#include <qmainwindow.h> 6#include <qmainwindow.h>
7#include <qmessagebox.h> 7#include <qmessagebox.h>
8#include <qwidgetstack.h> 8#include <qwidgetstack.h>
9#include <qfile.h> 9#include <qfile.h>
10 10
11#include "mediaplayer.h" 11#include "mediaplayer.h"
12#include "playlistwidget.h" 12#include "playlistwidget.h"
13#include "audiowidget.h" 13#include "audiowidget.h"
14 14
15#include "mediaplayerstate.h" 15#include "mediaplayerstate.h"
16 16
17 17
18
18extern AudioWidget *audioUI; 19extern AudioWidget *audioUI;
19extern PlayListWidget *playList; 20extern PlayListWidget *playList;
20extern MediaPlayerState *mediaPlayerState; 21extern MediaPlayerState *mediaPlayerState;
21 22
22 23
23MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 24MediaPlayer::MediaPlayer( QObject *parent, const char *name )
24 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 25 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
25 26
26 27
28 xineControl = new XineControl();
27// QPEApplication::grabKeyboard(); // EVIL 29// QPEApplication::grabKeyboard(); // EVIL
28 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 30 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
29 31
30 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 32 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
31 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 33 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
32 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 34 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
33 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 35 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
36
37 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
38 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
39 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
40 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
34 41
35 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
36 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
37 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
38 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
39} 42}
40 43
41MediaPlayer::~MediaPlayer() { 44MediaPlayer::~MediaPlayer() {
42} 45}
43 46
44void MediaPlayer::pauseCheck( bool b ) { 47void MediaPlayer::pauseCheck( bool b ) {
45 // Only pause if playing 48 // Only pause if playing
46 if ( b && !mediaPlayerState->playing() ) 49 if ( b && !mediaPlayerState->playing() ) {
47 mediaPlayerState->setPaused( FALSE ); 50 mediaPlayerState->setPaused( FALSE );
51 }
48} 52}
49 53
50void MediaPlayer::play() { 54void MediaPlayer::play() {
51 mediaPlayerState->setPlaying( FALSE ); 55 mediaPlayerState->setPlaying( FALSE );
52 mediaPlayerState->setPlaying( TRUE ); 56 mediaPlayerState->setPlaying( TRUE );
53} 57}
54 58
55void MediaPlayer::setPlaying( bool play ) { 59void MediaPlayer::setPlaying( bool play ) {
56 if ( !play ) { 60 if ( !play ) {
57 mediaPlayerState->setPaused( FALSE ); 61 mediaPlayerState->setPaused( FALSE );
58 return; 62 return;
59 } 63 }
60 64
61 if ( mediaPlayerState->paused() ) { 65 if ( mediaPlayerState->paused() ) {
62 mediaPlayerState->setPaused( FALSE ); 66 mediaPlayerState->setPaused( FALSE );
63 return; 67 return;
64 } 68 }
65 69
66 const DocLnk *playListCurrent = playList->current(); 70 const DocLnk *playListCurrent = playList->current();
67 if ( playListCurrent != NULL ) { 71 if ( playListCurrent != NULL ) {
68 currentFile = playListCurrent; 72 currentFile = playListCurrent;
69 } 73 }
70 74
71 audioUI->setTickerText( currentFile->file() ); 75 audioUI->setTickerText( currentFile->file( ) );
72 76
77 xineControl->play( currentFile->file() );
73 78
74 // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben 79 // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben
75 80
76 // Ob auch video 'v' : 'a' 81 // Ob auch video 'v' : 'a'
77 // mediaPlayerState->setView( 'v' ); 82 // mediaPlayerState->setView( 'v' );
78 83
79 // abspielen starten. 84 // abspielen starten.
80} 85}
81 86
82 87
83void MediaPlayer::prev() { 88void MediaPlayer::prev() {
84 if ( playList->prev() ) 89 if ( playList->prev() )
85 play(); 90 play();
86 else if ( mediaPlayerState->looping() ) { 91 else if ( mediaPlayerState->looping() ) {
87 if ( playList->last() ) 92 if ( playList->last() )
88 play(); 93 play();
89 } else 94 } else
90 mediaPlayerState->setList(); 95 mediaPlayerState->setList();
91} 96}
92 97
93 98
94void MediaPlayer::next() { 99void MediaPlayer::next() {
95 if ( playList->next() ) 100 if ( playList->next() )
96 play(); 101 play();