-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 8acc488..06b1a04 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -15,96 +15,98 @@ | |||
15 | #include "audiowidget.h" | 15 | #include "audiowidget.h" |
16 | #include "videowidget.h" | 16 | #include "videowidget.h" |
17 | #include "volumecontrol.h" | 17 | #include "volumecontrol.h" |
18 | 18 | ||
19 | #include "mediaplayerstate.h" | 19 | #include "mediaplayerstate.h" |
20 | 20 | ||
21 | // for setBacklight() | 21 | // for setBacklight() |
22 | #include <linux/fb.h> | 22 | #include <linux/fb.h> |
23 | #include <sys/file.h> | 23 | #include <sys/file.h> |
24 | #include <sys/ioctl.h> | 24 | #include <sys/ioctl.h> |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | #define FBIOBLANK 0x4611 | 29 | #define FBIOBLANK 0x4611 |
30 | 30 | ||
31 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) | 31 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) |
32 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { | 32 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { |
33 | 33 | ||
34 | audioUI = 0; | 34 | audioUI = 0; |
35 | videoUI = 0; | 35 | videoUI = 0; |
36 | xineControl = 0; | 36 | xineControl = 0; |
37 | recreateAudioAndVideoWidgets(); | 37 | recreateAudioAndVideoWidgets(); |
38 | 38 | ||
39 | fd=-1;fl=-1; | 39 | fd=-1;fl=-1; |
40 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); | 40 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); |
41 | 41 | ||
42 | qApp->processEvents(); | 42 | qApp->processEvents(); |
43 | // QPEApplication::grabKeyboard(); // EVIL | 43 | // QPEApplication::grabKeyboard(); // EVIL |
44 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 44 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
45 | 45 | ||
46 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 46 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
47 | 47 | ||
48 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 48 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
49 | 49 | ||
50 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 50 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
51 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 51 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
52 | connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | 52 | connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); |
53 | 53 | ||
54 | volControl = new VolumeControl; | 54 | volControl = new VolumeControl; |
55 | Config cfg( "OpiePlayer" ); | 55 | Config cfg( "OpiePlayer" ); |
56 | cfg.setGroup("PlayList"); | 56 | cfg.setGroup("PlayList"); |
57 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 57 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
58 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 58 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
59 | } | 59 | } |
60 | 60 | ||
61 | MediaPlayer::~MediaPlayer() { | 61 | MediaPlayer::~MediaPlayer() { |
62 | delete xineControl; | 62 | delete xineControl; |
63 | delete audioUI; | ||
64 | delete videoUI; | ||
63 | delete volControl; | 65 | delete volControl; |
64 | } | 66 | } |
65 | 67 | ||
66 | void MediaPlayer::pauseCheck( bool b ) { | 68 | void MediaPlayer::pauseCheck( bool b ) { |
67 | if ( b && !mediaPlayerState.isPlaying() ) { | 69 | if ( b && !mediaPlayerState.isPlaying() ) { |
68 | mediaPlayerState.setPaused( FALSE ); | 70 | mediaPlayerState.setPaused( FALSE ); |
69 | } | 71 | } |
70 | } | 72 | } |
71 | 73 | ||
72 | void MediaPlayer::play() { | 74 | void MediaPlayer::play() { |
73 | mediaPlayerState.setPlaying( FALSE ); | 75 | mediaPlayerState.setPlaying( FALSE ); |
74 | mediaPlayerState.setPlaying( TRUE ); | 76 | mediaPlayerState.setPlaying( TRUE ); |
75 | } | 77 | } |
76 | 78 | ||
77 | void MediaPlayer::setPlaying( bool play ) { | 79 | void MediaPlayer::setPlaying( bool play ) { |
78 | if ( !play ) { | 80 | if ( !play ) { |
79 | return; | 81 | return; |
80 | } | 82 | } |
81 | 83 | ||
82 | if ( mediaPlayerState.isPaused() ) { | 84 | if ( mediaPlayerState.isPaused() ) { |
83 | mediaPlayerState.setPaused( FALSE ); | 85 | mediaPlayerState.setPaused( FALSE ); |
84 | return; | 86 | return; |
85 | } | 87 | } |
86 | 88 | ||
87 | QString tickerText, time, fileName; | 89 | QString tickerText, time, fileName; |
88 | if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { | 90 | if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { |
89 | //if playing in file list.. play in a different way | 91 | //if playing in file list.. play in a different way |
90 | // random and looping settings enabled causes problems here, | 92 | // random and looping settings enabled causes problems here, |
91 | // since there is no selected file in the playlist, but a selected file in the file list, | 93 | // since there is no selected file in the playlist, but a selected file in the file list, |
92 | // so we remember and shutoff | 94 | // so we remember and shutoff |
93 | l = mediaPlayerState.isLooping(); | 95 | l = mediaPlayerState.isLooping(); |
94 | if(l) { | 96 | if(l) { |
95 | mediaPlayerState.setLooping( false ); | 97 | mediaPlayerState.setLooping( false ); |
96 | } | 98 | } |
97 | r = mediaPlayerState.isShuffled(); | 99 | r = mediaPlayerState.isShuffled(); |
98 | mediaPlayerState.setShuffled( false ); | 100 | mediaPlayerState.setShuffled( false ); |
99 | } | 101 | } |
100 | 102 | ||
101 | PlayListWidget::Entry playListEntry = playList.currentEntry(); | 103 | PlayListWidget::Entry playListEntry = playList.currentEntry(); |
102 | fileName = playListEntry.name; | 104 | fileName = playListEntry.name; |
103 | xineControl->play( playListEntry.file ); | 105 | xineControl->play( playListEntry.file ); |
104 | 106 | ||
105 | long seconds = mediaPlayerState.length(); | 107 | long seconds = mediaPlayerState.length(); |
106 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 108 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
107 | 109 | ||
108 | if( fileName.left(4) == "http" ) { | 110 | if( fileName.left(4) == "http" ) { |
109 | fileName = QFileInfo( fileName ).baseName(); | 111 | fileName = QFileInfo( fileName ).baseName(); |
110 | if ( xineControl->getMetaInfo().isEmpty() ) { | 112 | if ( xineControl->getMetaInfo().isEmpty() ) { |