summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -82,19 +82,19 @@ static void changeTextColor( QWidget *w ) {
p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
w->setPalette( p );
}
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");
cfg.setGroup("Options");
skin = cfg.readEntry("Skin","default");
//skin = "scaleTest";
// color of background, frame, degree of transparency
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
@@ -47,17 +47,17 @@
#include "mediawidget.h"
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 );
void sliderPressed( );
void sliderReleased( );
void setLooping( bool b) { setToggleButton( Loop, b ); }
void setPosition( 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
@@ -1,24 +1,21 @@
#include <qpe/qpeapplication.h>
#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);
return a.exec();
}
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
@@ -19,32 +19,30 @@
#include "mediaplayerstate.h"
// for setBacklight()
#include <linux/fb.h>
#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()) );
connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
@@ -52,17 +50,17 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent,
connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
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;
delete volControl;
}
void MediaPlayer::pauseCheck( bool b ) {
@@ -82,30 +80,30 @@ void MediaPlayer::setPlaying( bool play ) {
}
if ( mediaPlayerState.isPaused() ) {
mediaPlayerState.setPaused( FALSE );
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
l = mediaPlayerState.isLooping();
if(l) {
mediaPlayerState.setLooping( false );
}
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();
time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
if( fileName.left(4) == "http" ) {
fileName = QFileInfo( fileName ).baseName();
@@ -121,37 +119,37 @@ void MediaPlayer::setPlaying( bool play ) {
tickerText = xineControl->getMetaInfo() + " Length: " + time + " ";
}
}
audioUI->setTickerText( tickerText );
}
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();
}
}
}
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();
}
} else { //if playing from file list, let's just stop
qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
mediaPlayerState.setPlaying(false);
@@ -334,29 +332,29 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
// mediaPlayerState->toggleBlank();
break;
}
}
void MediaPlayer::cleanUp() {// this happens on closing
Config cfg( "OpiePlayer" );
mediaPlayerState.writeConfig( cfg );
- playList->writeDefaultPlaylist( );
+ playList.writeDefaultPlaylist( );
// 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" );
+ 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() ) );
connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
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
@@ -34,26 +34,28 @@
#ifndef MEDIA_PLAYER_H
#define MEDIA_PLAYER_H
#include <qmainwindow.h>
#include <qframe.h>
#include "xinecontrol.h"
+#include "playlistwidget.h"
+
class DocLnk;
class VolumeControl;
class MediaPlayerState;
class AudioWidget;
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();
private slots:
void setPlaying( bool );
void pauseCheck( bool );
@@ -72,15 +74,16 @@ protected:
private:
bool isBlanked, l, r;
int fd, fl;
int volumeDirection;
XineControl *xineControl;
VolumeControl *volControl;
MediaPlayerState &mediaPlayerState;
+ PlayListWidget &playList;
AudioWidget *audioUI;
VideoWidget *videoUI;
};
#endif // MEDIA_PLAYER_H
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
@@ -16,20 +16,18 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#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 ) ),
this, SLOT( setLength( long ) ) );
connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
this, SLOT( setPlaying( bool ) ) );
}
@@ -43,18 +41,18 @@ void MediaWidget::closeEvent( QCloseEvent * )
mediaPlayerState.setList();
}
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;
case Forward: emit forwardReleased(); return;
case Back: emit backReleased(); 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
@@ -18,24 +18,25 @@
*/
#ifndef MEDIAWIDGET_H
#define MEDIAWIDGET_H
#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;
virtual void setLength( long length ) = 0;
virtual void setPlaying( bool playing ) = 0;
signals:
@@ -45,13 +46,14 @@ signals:
void backReleased();
protected:
virtual void closeEvent( QCloseEvent * );
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
@@ -48,17 +48,16 @@
#ifdef Q_WS_QWS
# define USE_DIRECT_PAINTER
# include <qdirectpainter_qws.h>
# include <qgfxraster_qws.h>
#endif
-extern PlayListWidget *playList;
static const int xo = 2; // movable x offset
static const int yo = 0; // movable y offset
struct MediaButton {
bool isToggle, isHeld, isDown;
@@ -76,20 +75,19 @@ MediaButton videoButtons[] = {
const char *skinV_mask_file_names[7] = {
"stop","play","back","fwd","up","down","full"
};
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" );
connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
Config cfg("OpiePlayer");
@@ -327,18 +325,18 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
mediaPlayerState.setPaused( TRUE );
return;
} else {
return;
}
}
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
@@ -53,17 +53,17 @@ enum VideoButtons {
VideoVolUp,
VideoVolDown,
VideoFullscreen
};
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();
public slots:
void updateSlider( long, long );
void sliderPressed( );
void sliderReleased( );