From 24a00c944aace8d7627c1eb0d7cc0ebf40731c57 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 02 Dec 2002 23:22:22 +0000 Subject: - AudioWidget and VideoWidget are no more singletons via audioUI and videoUI. this allows switching skins at run-time (the appropriate connections are already made and it works quite nicely :) --- (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index eccb5d9..a9c74c4 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -24,7 +24,6 @@ #include -extern AudioWidget *audioUI; extern VideoWidget *videoUI; extern PlayListWidget *playList; @@ -34,6 +33,11 @@ extern PlayListWidget *playList; MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) { + audioUI = 0; + videoUI = 0; + xineControl = 0; + recreateAudioAndVideoWidgets(); + fd=-1;fl=-1; playList->setCaption( tr( "OpiePlayer: Initializating" ) ); @@ -49,18 +53,7 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); - connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); - connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); - connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); - connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); - - connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); - connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); - connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); - connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); - volControl = new VolumeControl; - xineControl = new XineControl( mediaPlayerState ); Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); @@ -351,3 +344,25 @@ void MediaPlayer::cleanUp() {// this happens on closing // QPEApplication::grabKeyboard(); // QPEApplication::ungrabKeyboard(); } + +void MediaPlayer::recreateAudioAndVideoWidgets() +{ + delete xineControl; + delete audioUI; + delete videoUI; + audioUI = new AudioWidget( mediaPlayerState, 0, "audioUI" ); + videoUI = new VideoWidget( mediaPlayerState, 0, "videoUI" ); + + connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); + connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); + connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); + connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); + + connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); + connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); + connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); + connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); + + xineControl = new XineControl( videoUI, mediaPlayerState ); +} + -- cgit v0.9.0.2