summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp32
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
9 files changed, 36 insertions, 40 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index f6e6086..b573c45 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -86,11 +86,11 @@ static void changeTextColor( QWidget *w ) {
86 86
87static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 87static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
88 88
89 89
90AudioWidget::AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 90AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
91 91
92 MediaWidget( mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { 92 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
93 93
94 setCaption( tr("OpiePlayer") ); 94 setCaption( tr("OpiePlayer") );
95 95
96 Config cfg("OpiePlayer"); 96 Config cfg("OpiePlayer");
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index f092699..52a358c 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -51,9 +51,9 @@ class QPixmap;
51 51
52class AudioWidget : public MediaWidget { 52class AudioWidget : public MediaWidget {
53 Q_OBJECT 53 Q_OBJECT
54public: 54public:
55 AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 55 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
56 ~AudioWidget(); 56 ~AudioWidget();
57 void setTickerText( const QString &text ) { songInfo.setText( text ); } 57 void setTickerText( const QString &text ) { songInfo.setText( text ); }
58public slots: 58public slots:
59 void updateSlider( long, long ); 59 void updateSlider( long, long );
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp
index 7fc7b94..ffc7cb6 100644
--- a/noncore/multimedia/opieplayer2/main.cpp
+++ b/noncore/multimedia/opieplayer2/main.cpp
@@ -3,18 +3,15 @@
3#include "mediaplayerstate.h" 3#include "mediaplayerstate.h"
4#include "playlistwidget.h" 4#include "playlistwidget.h"
5#include "mediaplayer.h" 5#include "mediaplayer.h"
6 6
7PlayListWidget *playList;
8
9int main(int argc, char **argv) { 7int main(int argc, char **argv) {
10 QPEApplication a(argc,argv); 8 QPEApplication a(argc,argv);
11 9
12 MediaPlayerState st( 0, "mediaPlayerState" ); 10 MediaPlayerState st( 0, "mediaPlayerState" );
13 PlayListWidget pl( st, 0, "playList" ); 11 PlayListWidget pl( st, 0, "playList" );
14 playList = &pl;
15 pl.showMaximized(); 12 pl.showMaximized();
16 MediaPlayer mp( st, 0, "mediaPlayer" ); 13 MediaPlayer mp( pl, st, 0, "mediaPlayer" );
17 QObject::connect( &pl, SIGNAL( skinSelected() ), 14 QObject::connect( &pl, SIGNAL( skinSelected() ),
18 &mp, SLOT( recreateAudioAndVideoWidgets() ) ); 15 &mp, SLOT( recreateAudioAndVideoWidgets() ) );
19 16
20 a.showMainDocumentWidget(&pl); 17 a.showMainDocumentWidget(&pl);
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index a9c74c4..8acc488 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -23,24 +23,22 @@
23#include <sys/file.h> 23#include <sys/file.h>
24#include <sys/ioctl.h> 24#include <sys/ioctl.h>
25 25
26 26
27extern VideoWidget *videoUI;
28extern PlayListWidget *playList;
29 27
30 28
31#define FBIOBLANK 0x4611 29#define FBIOBLANK 0x4611
32 30
33MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 31MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
34 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) { 32 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
35 33
36 audioUI = 0; 34 audioUI = 0;
37 videoUI = 0; 35 videoUI = 0;
38 xineControl = 0; 36 xineControl = 0;
39 recreateAudioAndVideoWidgets(); 37 recreateAudioAndVideoWidgets();
40 38
41 fd=-1;fl=-1; 39 fd=-1;fl=-1;
42 playList->setCaption( tr( "OpiePlayer: Initializating" ) ); 40 playList.setCaption( tr( "OpiePlayer: Initializating" ) );
43 41
44 qApp->processEvents(); 42 qApp->processEvents();
45 // QPEApplication::grabKeyboard(); // EVIL 43 // QPEApplication::grabKeyboard(); // EVIL
46 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 44 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
@@ -56,9 +54,9 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent,
56 volControl = new VolumeControl; 54 volControl = new VolumeControl;
57 Config cfg( "OpiePlayer" ); 55 Config cfg( "OpiePlayer" );
58 cfg.setGroup("PlayList"); 56 cfg.setGroup("PlayList");
59 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 57 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
60 playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); 58 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
61} 59}
62 60
63MediaPlayer::~MediaPlayer() { 61MediaPlayer::~MediaPlayer() {
64 delete xineControl; 62 delete xineControl;
@@ -86,9 +84,9 @@ void MediaPlayer::setPlaying( bool play ) {
86 return; 84 return;
87 } 85 }
88 86
89 QString tickerText, time, fileName; 87 QString tickerText, time, fileName;
90 if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) { 88 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) {
91 //if playing in file list.. play in a different way 89 //if playing in file list.. play in a different way
92 // random and looping settings enabled causes problems here, 90 // random and looping settings enabled causes problems here,
93 // since there is no selected file in the playlist, but a selected file in the file list, 91 // since there is no selected file in the playlist, but a selected file in the file list,
94 // so we remember and shutoff 92 // so we remember and shutoff
@@ -99,9 +97,9 @@ void MediaPlayer::setPlaying( bool play ) {
99 r = mediaPlayerState.isShuffled(); 97 r = mediaPlayerState.isShuffled();
100 mediaPlayerState.setShuffled( false ); 98 mediaPlayerState.setShuffled( false );
101 } 99 }
102 100
103 PlayListWidget::Entry playListEntry = playList->currentEntry(); 101 PlayListWidget::Entry playListEntry = playList.currentEntry();
104 fileName = playListEntry.name; 102 fileName = playListEntry.name;
105 xineControl->play( playListEntry.file ); 103 xineControl->play( playListEntry.file );
106 104
107 long seconds = mediaPlayerState.length(); 105 long seconds = mediaPlayerState.length();
@@ -125,13 +123,13 @@ void MediaPlayer::setPlaying( bool play ) {
125} 123}
126 124
127 125
128void MediaPlayer::prev() { 126void MediaPlayer::prev() {
129 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist 127 if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
130 if ( playList->prev() ) { 128 if ( playList.prev() ) {
131 play(); 129 play();
132 } else if ( mediaPlayerState.isLooping() ) { 130 } else if ( mediaPlayerState.isLooping() ) {
133 if ( playList->last() ) { 131 if ( playList.last() ) {
134 play(); 132 play();
135 } 133 }
136 } else { 134 } else {
137 mediaPlayerState.setList(); 135 mediaPlayerState.setList();
@@ -141,13 +139,13 @@ void MediaPlayer::prev() {
141 139
142 140
143void MediaPlayer::next() { 141void MediaPlayer::next() {
144 142
145 if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist 143 if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
146 if ( playList->next() ) { 144 if ( playList.next() ) {
147 play(); 145 play();
148 } else if ( mediaPlayerState.isLooping() ) { 146 } else if ( mediaPlayerState.isLooping() ) {
149 if ( playList->first() ) { 147 if ( playList.first() ) {
150 play(); 148 play();
151 } 149 }
152 } else { 150 } else {
153 mediaPlayerState.setList(); 151 mediaPlayerState.setList();
@@ -338,9 +336,9 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
338 336
339void MediaPlayer::cleanUp() {// this happens on closing 337void MediaPlayer::cleanUp() {// this happens on closing
340 Config cfg( "OpiePlayer" ); 338 Config cfg( "OpiePlayer" );
341 mediaPlayerState.writeConfig( cfg ); 339 mediaPlayerState.writeConfig( cfg );
342 playList->writeDefaultPlaylist( ); 340 playList.writeDefaultPlaylist( );
343 341
344// QPEApplication::grabKeyboard(); 342// QPEApplication::grabKeyboard();
345// QPEApplication::ungrabKeyboard(); 343// QPEApplication::ungrabKeyboard();
346} 344}
@@ -349,10 +347,10 @@ void MediaPlayer::recreateAudioAndVideoWidgets()
349{ 347{
350 delete xineControl; 348 delete xineControl;
351 delete audioUI; 349 delete audioUI;
352 delete videoUI; 350 delete videoUI;
353 audioUI = new AudioWidget( mediaPlayerState, 0, "audioUI" ); 351 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
354 videoUI = new VideoWidget( mediaPlayerState, 0, "videoUI" ); 352 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
355 353
356 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 354 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
357 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 355 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
358 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 356 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 0d6f722..dc306c4 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -38,8 +38,10 @@
38#include <qframe.h> 38#include <qframe.h>
39 39
40#include "xinecontrol.h" 40#include "xinecontrol.h"
41 41
42#include "playlistwidget.h"
43
42class DocLnk; 44class DocLnk;
43class VolumeControl; 45class VolumeControl;
44class MediaPlayerState; 46class MediaPlayerState;
45class AudioWidget; 47class AudioWidget;
@@ -47,9 +49,9 @@ class VideoWidget;
47 49
48class MediaPlayer : public QObject { 50class MediaPlayer : public QObject {
49 Q_OBJECT 51 Q_OBJECT
50public: 52public:
51 MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); 53 MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
52 ~MediaPlayer(); 54 ~MediaPlayer();
53 55
54public slots: 56public slots:
55 void recreateAudioAndVideoWidgets(); 57 void recreateAudioAndVideoWidgets();
@@ -76,8 +78,9 @@ private:
76 int volumeDirection; 78 int volumeDirection;
77 XineControl *xineControl; 79 XineControl *xineControl;
78 VolumeControl *volControl; 80 VolumeControl *volControl;
79 MediaPlayerState &mediaPlayerState; 81 MediaPlayerState &mediaPlayerState;
82 PlayListWidget &playList;
80 AudioWidget *audioUI; 83 AudioWidget *audioUI;
81 VideoWidget *videoUI; 84 VideoWidget *videoUI;
82}; 85};
83 86
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 2992fd6..ed5bc5a 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -20,12 +20,10 @@
20 20
21#include "mediawidget.h" 21#include "mediawidget.h"
22#include "playlistwidget.h" 22#include "playlistwidget.h"
23 23
24extern PlayListWidget *playList; 24MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
25 25 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
26MediaWidget::MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
27 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState )
28{ 26{
29 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 27 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
30 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 28 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
31 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 29 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
@@ -47,10 +45,10 @@ void MediaWidget::handleCommand( Command command, bool buttonDown )
47{ 45{
48 switch ( command ) { 46 switch ( command ) {
49 case Play: mediaPlayerState.togglePaused(); 47 case Play: mediaPlayerState.togglePaused();
50 case Stop: mediaPlayerState.setPlaying(FALSE); return; 48 case Stop: mediaPlayerState.setPlaying(FALSE); return;
51 case Next: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; 49 case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
52 case Previous: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; 50 case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
53 case Loop: mediaPlayerState.setLooping( buttonDown ); return; 51 case Loop: mediaPlayerState.setLooping( buttonDown ); return;
54 case VolumeUp: emit moreReleased(); return; 52 case VolumeUp: emit moreReleased(); return;
55 case VolumeDown: emit lessReleased(); return; 53 case VolumeDown: emit lessReleased(); return;
56 case PlayList: mediaPlayerState.setList(); return; 54 case PlayList: mediaPlayerState.setList(); return;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index e3f09ce..2d92d65 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -22,16 +22,17 @@
22 22
23#include <qwidget.h> 23#include <qwidget.h>
24 24
25#include "mediaplayerstate.h" 25#include "mediaplayerstate.h"
26#include "playlistwidget.h"
26 27
27class MediaWidget : public QWidget 28class MediaWidget : public QWidget
28{ 29{
29 Q_OBJECT 30 Q_OBJECT
30public: 31public:
31 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; 32 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back };
32 33
33 MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 34 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
34 virtual ~MediaWidget(); 35 virtual ~MediaWidget();
35 36
36public slots: 37public slots:
37 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; 38 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
@@ -49,8 +50,9 @@ protected:
49 50
50 void handleCommand( Command command, bool buttonDown ); 51 void handleCommand( Command command, bool buttonDown );
51 52
52 MediaPlayerState &mediaPlayerState; 53 MediaPlayerState &mediaPlayerState;
54 PlayListWidget &playList;
53}; 55};
54 56
55#endif // MEDIAWIDGET_H 57#endif // MEDIAWIDGET_H
56/* vim: et sw=4 ts=4 58/* vim: et sw=4 ts=4
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index c0039b1..b7305fe 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -52,9 +52,8 @@
52# include <qgfxraster_qws.h> 52# include <qgfxraster_qws.h>
53#endif 53#endif
54 54
55 55
56extern PlayListWidget *playList;
57 56
58 57
59static const int xo = 2; // movable x offset 58static const int xo = 2; // movable x offset
60static const int yo = 0; // movable y offset 59static const int yo = 0; // movable y offset
@@ -80,12 +79,11 @@ const char *skinV_mask_file_names[7] = {
80 79
81static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 80static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
82 81
83 82
84VideoWidget::VideoWidget(MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 83VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
85MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { 84 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 )
86 85{
87
88 setCaption( tr("OpiePlayer - Video") ); 86 setCaption( tr("OpiePlayer - Video") );
89 87
90 videoFrame = new XineVideoWidget ( this, "Video frame" ); 88 videoFrame = new XineVideoWidget ( this, "Video frame" );
91 89
@@ -331,10 +329,10 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
331 } 329 }
332 } 330 }
333 331
334 case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; 332 case VideoStop: mediaPlayerState.setPlaying( FALSE ); return;
335 case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; 333 case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
336 case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; 334 case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
337 case VideoVolUp: emit moreReleased(); return; 335 case VideoVolUp: emit moreReleased(); return;
338 case VideoVolDown: emit lessReleased(); return; 336 case VideoVolDown: emit lessReleased(); return;
339 case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; 337 case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return;
340 } 338 }
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index ae0e687..f996803 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -57,9 +57,9 @@ enum VideoButtons {
57 57
58class VideoWidget : public MediaWidget { 58class VideoWidget : public MediaWidget {
59 Q_OBJECT 59 Q_OBJECT
60public: 60public:
61 VideoWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 61 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
62 ~VideoWidget(); 62 ~VideoWidget();
63 63
64 64
65 XineVideoWidget* vidWidget(); 65 XineVideoWidget* vidWidget();