summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 23:31:57 (UTC)
committer simon <simon>2002-12-02 23:31:57 (UTC)
commit22e232bdb4bae5e28013a4d14bfda3c068827557 (patch) (side-by-side diff)
treebcefd6ed54318bb075cd71455b82236606634cd4
parent24a00c944aace8d7627c1eb0d7cc0ebf40731c57 (diff)
downloadopie-22e232bdb4bae5e28013a4d14bfda3c068827557.zip
opie-22e232bdb4bae5e28013a4d14bfda3c068827557.tar.gz
opie-22e232bdb4bae5e28013a4d14bfda3c068827557.tar.bz2
- yay, last singleton gone. global playList variable is no more :)
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 ) {
static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
-AudioWidget::AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
+AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
- MediaWidget( mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
+ MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
setCaption( tr("OpiePlayer") );
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;
class AudioWidget : public MediaWidget {
Q_OBJECT
public:
- AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
+ AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
~AudioWidget();
void setTickerText( const QString &text ) { songInfo.setText( text ); }
public slots:
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 @@
#include "mediaplayerstate.h"
#include "playlistwidget.h"
#include "mediaplayer.h"
-PlayListWidget *playList;
-
int main(int argc, char **argv) {
QPEApplication a(argc,argv);
MediaPlayerState st( 0, "mediaPlayerState" );
PlayListWidget pl( st, 0, "playList" );
- playList = &pl;
pl.showMaximized();
- MediaPlayer mp( st, 0, "mediaPlayer" );
+ MediaPlayer mp( pl, st, 0, "mediaPlayer" );
QObject::connect( &pl, SIGNAL( skinSelected() ),
&mp, SLOT( recreateAudioAndVideoWidgets() ) );
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 @@
#include <sys/file.h>
#include <sys/ioctl.h>
-extern VideoWidget *videoUI;
-extern PlayListWidget *playList;
#define FBIOBLANK 0x4611
-MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
- : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) {
+MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
+ : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
audioUI = 0;
videoUI = 0;
xineControl = 0;
recreateAudioAndVideoWidgets();
fd=-1;fl=-1;
- playList->setCaption( tr( "OpiePlayer: Initializating" ) );
+ playList.setCaption( tr( "OpiePlayer: Initializating" ) );
qApp->processEvents();
// QPEApplication::grabKeyboard(); // EVIL
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
@@ -56,9 +54,9 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent,
volControl = new VolumeControl;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
- playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
+ playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
}
MediaPlayer::~MediaPlayer() {
delete xineControl;
@@ -86,9 +84,9 @@ void MediaPlayer::setPlaying( bool play ) {
return;
}
QString tickerText, time, fileName;
- if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) {
+ if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) {
//if playing in file list.. play in a different way
// random and looping settings enabled causes problems here,
// since there is no selected file in the playlist, but a selected file in the file list,
// so we remember and shutoff
@@ -99,9 +97,9 @@ void MediaPlayer::setPlaying( bool play ) {
r = mediaPlayerState.isShuffled();
mediaPlayerState.setShuffled( false );
}
- PlayListWidget::Entry playListEntry = playList->currentEntry();
+ PlayListWidget::Entry playListEntry = playList.currentEntry();
fileName = playListEntry.name;
xineControl->play( playListEntry.file );
long seconds = mediaPlayerState.length();
@@ -125,13 +123,13 @@ void MediaPlayer::setPlaying( bool play ) {
}
void MediaPlayer::prev() {
- if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
- if ( playList->prev() ) {
+ if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
+ if ( playList.prev() ) {
play();
} else if ( mediaPlayerState.isLooping() ) {
- if ( playList->last() ) {
+ if ( playList.last() ) {
play();
}
} else {
mediaPlayerState.setList();
@@ -141,13 +139,13 @@ void MediaPlayer::prev() {
void MediaPlayer::next() {
- if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
- if ( playList->next() ) {
+ if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
+ if ( playList.next() ) {
play();
} else if ( mediaPlayerState.isLooping() ) {
- if ( playList->first() ) {
+ if ( playList.first() ) {
play();
}
} else {
mediaPlayerState.setList();
@@ -338,9 +336,9 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
void MediaPlayer::cleanUp() {// this happens on closing
Config cfg( "OpiePlayer" );
mediaPlayerState.writeConfig( cfg );
- playList->writeDefaultPlaylist( );
+ playList.writeDefaultPlaylist( );
// QPEApplication::grabKeyboard();
// QPEApplication::ungrabKeyboard();
}
@@ -349,10 +347,10 @@ void MediaPlayer::recreateAudioAndVideoWidgets()
{
delete xineControl;
delete audioUI;
delete videoUI;
- audioUI = new AudioWidget( mediaPlayerState, 0, "audioUI" );
- videoUI = new VideoWidget( mediaPlayerState, 0, "videoUI" );
+ audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
+ videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
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 @@
#include <qframe.h>
#include "xinecontrol.h"
+#include "playlistwidget.h"
+
class DocLnk;
class VolumeControl;
class MediaPlayerState;
class AudioWidget;
@@ -47,9 +49,9 @@ class VideoWidget;
class MediaPlayer : public QObject {
Q_OBJECT
public:
- MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
+ MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
~MediaPlayer();
public slots:
void recreateAudioAndVideoWidgets();
@@ -76,8 +78,9 @@ private:
int volumeDirection;
XineControl *xineControl;
VolumeControl *volControl;
MediaPlayerState &mediaPlayerState;
+ PlayListWidget &playList;
AudioWidget *audioUI;
VideoWidget *videoUI;
};
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 @@
#include "mediawidget.h"
#include "playlistwidget.h"
-extern PlayListWidget *playList;
-
-MediaWidget::MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
- : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState )
+MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
+ : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
{
connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
@@ -47,10 +45,10 @@ void MediaWidget::handleCommand( Command command, bool buttonDown )
{
switch ( command ) {
case Play: mediaPlayerState.togglePaused();
case Stop: mediaPlayerState.setPlaying(FALSE); return;
- case Next: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
- case Previous: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
+ case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
+ case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
case Loop: mediaPlayerState.setLooping( buttonDown ); return;
case VolumeUp: emit moreReleased(); return;
case VolumeDown: emit lessReleased(); return;
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 @@
#include <qwidget.h>
#include "mediaplayerstate.h"
+#include "playlistwidget.h"
class MediaWidget : public QWidget
{
Q_OBJECT
public:
enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back };
- MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
+ MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
virtual ~MediaWidget();
public slots:
virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
@@ -49,8 +50,9 @@ protected:
void handleCommand( Command command, bool buttonDown );
MediaPlayerState &mediaPlayerState;
+ PlayListWidget &playList;
};
#endif // MEDIAWIDGET_H
/* 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 @@
# include <qgfxraster_qws.h>
#endif
-extern PlayListWidget *playList;
static const int xo = 2; // movable x offset
static const int yo = 0; // movable y offset
@@ -80,12 +79,11 @@ const char *skinV_mask_file_names[7] = {
static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
-VideoWidget::VideoWidget(MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
-MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) {
-
-
+VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
+ : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 )
+{
setCaption( tr("OpiePlayer - Video") );
videoFrame = new XineVideoWidget ( this, "Video frame" );
@@ -331,10 +329,10 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
}
}
case VideoStop: mediaPlayerState.setPlaying( FALSE ); return;
- case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
- case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
+ case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
+ case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
case VideoVolUp: emit moreReleased(); return;
case VideoVolDown: emit lessReleased(); return;
case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return;
}
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 {
class VideoWidget : public MediaWidget {
Q_OBJECT
public:
- VideoWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
+ VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
~VideoWidget();
XineVideoWidget* vidWidget();