author | simon <simon> | 2002-12-11 17:16:17 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 17:16:17 (UTC) |
commit | 94461696cfdcf8cdbaabec1400300e546edc447e (patch) (side-by-side diff) | |
tree | bacef808031edb254214d04489d4a8e4df53cdb9 | |
parent | 9f5e007f4859027eaeb989c620ec62fc698b44cc (diff) | |
download | opie-94461696cfdcf8cdbaabec1400300e546edc447e.zip opie-94461696cfdcf8cdbaabec1400300e546edc447e.tar.gz opie-94461696cfdcf8cdbaabec1400300e546edc447e.tar.bz2 |
- expose information about the buttons
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
4 files changed, 28 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 78079dd..4db444a 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -90,48 +90,58 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye loadSkin(); connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); // Intialise state setLength( mediaPlayerState.length() ); setPosition( mediaPlayerState.position() ); setLooping( mediaPlayerState.isFullscreen() ); // setPaused( mediaPlayerState->paused() ); setPlaying( mediaPlayerState.isPlaying() ); } AudioWidget::~AudioWidget() { // mediaPlayerState->setPlaying(false); } +const MediaWidget::SkinButtonInfo *AudioWidget::skinInfo() +{ + return ::skinInfo; +} + +const uint AudioWidget::buttonCount() +{ + return ::buttonCount; +} + void AudioWidget::resizeEvent( QResizeEvent *e ) { int h = height(); int w = width(); songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); slider.setFixedWidth( w - 110 ); slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); slider.setBackgroundOrigin( QWidget::ParentOrigin ); time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; MediaWidget::resizeEvent( e ); } void AudioWidget::sliderPressed() { audioSliderBeingMoved = TRUE; } void AudioWidget::sliderReleased() { audioSliderBeingMoved = FALSE; if ( slider.width() == 0 ) @@ -143,49 +153,49 @@ void AudioWidget::sliderReleased() { void AudioWidget::setPosition( long i ) { // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); updateSlider( i, mediaPlayerState.length() ); } void AudioWidget::setLength( long max ) { updateSlider( mediaPlayerState.position(), max ); } void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { if ( mediaType == MediaPlayerState::Audio ) { // startTimer( 150 ); showMaximized(); return; } killTimers(); hide(); } void AudioWidget::loadSkin() { - loadDefaultSkin( skinInfo, buttonCount ); + loadDefaultSkin( ::skinInfo, ::buttonCount ); setBackgroundPixmap( backgroundPixmap ); songInfo.setFocusPolicy( QWidget::NoFocus ); // changeTextColor( &songInfo ); // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); // songInfo.setFrameStyle( QFrame::NoFrame); songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); // songInfo.setForegroundColor(Qt::white); slider.setFixedHeight( 20 ); slider.setMinValue( 0 ); slider.setMaxValue( 1 ); slider.setFocusPolicy( QWidget::NoFocus ); slider.setBackgroundPixmap( backgroundPixmap ); // Config cofg("qpe"); // cofg.setGroup("Appearance"); // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); time.setFocusPolicy( QWidget::NoFocus ); time.setAlignment( Qt::AlignCenter ); // time.setFrame(FALSE); diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 670fb45..75d4857 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -34,48 +34,52 @@ #ifndef AUDIO_WIDGET_H #define AUDIO_WIDGET_H #include <qpainter.h> #include <qdrawutil.h> #include <qpixmap.h> #include <qstring.h> #include <qslider.h> #include <qframe.h> #include <qlineedit.h> #include <qimage.h> #include <opie/oticker.h> #include "mediawidget.h" class QPixmap; class AudioWidget : public MediaWidget { Q_OBJECT public: AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~AudioWidget(); void setTickerText( const QString &text ) { songInfo.setText( text ); } + + static const MediaWidget::SkinButtonInfo *skinInfo(); + static const uint buttonCount(); + public slots: void updateSlider( long, long ); void sliderPressed( ); void sliderReleased( ); void setLooping( bool b) { setToggleButton( Loop, b ); } void setPosition( long ); void setSeekable( bool ); public: virtual void setLength( long ); virtual void setPlaying( bool b) { setToggleButton( Play, b ); } virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); virtual void loadSkin(); signals: void sliderMoved(long); protected: void doBlank(); void doUnblank(); void resizeEvent( QResizeEvent *re ); void timerEvent( QTimerEvent *event ); void keyReleaseEvent( QKeyEvent *e); diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index a8ff540..058730f 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -78,48 +78,58 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) { 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() ) ); slider = 0; loadSkin(); setLength( mediaPlayerState.length() ); setPosition( mediaPlayerState.position() ); setFullscreen( mediaPlayerState.isFullscreen() ); setPlaying( mediaPlayerState.isPlaying() ); } VideoWidget::~VideoWidget() { } +const MediaWidget::SkinButtonInfo *VideoWidget::skinInfo() +{ + return ::skinInfo; +} + +const uint VideoWidget::buttonCount() +{ + return ::buttonCount; +} + void VideoWidget::resizeEvent( QResizeEvent *e ) { int h = height(); int w = width(); //int Vh = 160; //int Vw = 220; slider->setFixedWidth( w - 20 ); slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); slider->setBackgroundOrigin( QWidget::ParentOrigin ); slider->setFocusPolicy( QWidget::NoFocus ); slider->setBackgroundPixmap( backgroundPixmap ); upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; if(w>h) upperLeftOfButtonMask.ry() = 0; else upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; MediaWidget::resizeEvent( e ); } void VideoWidget::sliderPressed() { videoSliderBeingMoved = TRUE; } @@ -136,49 +146,49 @@ void VideoWidget::sliderReleased() { void VideoWidget::setPosition( long i ) { updateSlider( i, mediaPlayerState.length() ); } void VideoWidget::setLength( long max ) { updateSlider( mediaPlayerState.position(), max ); } void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) { if ( displayType == MediaPlayerState::Video ) { makeVisible(); return; } // Effectively blank the view next time we show it so it looks nicer scaledWidth = 0; scaledHeight = 0; hide(); } void VideoWidget::loadSkin() { - loadDefaultSkin( skinInfo, buttonCount, "V" ); + loadDefaultSkin( ::skinInfo, ::buttonCount, "V" ); setBackgroundPixmap( backgroundPixmap ); delete slider; slider = new QSlider( Qt::Horizontal, this ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); slider->setBackgroundPixmap( backgroundPixmap ); //slider->setFocusPolicy( QWidget::NoFocus ); resizeEvent( 0 ); } void VideoWidget::updateSlider( long i, long max ) { // Will flicker too much if we don't do this if ( max == 0 ) { return; } int width = slider->width(); int val = int((double)i * width / max); if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { if ( slider->value() != val ) { slider->setValue( val ); } diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index f434945..80e9356 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -29,48 +29,50 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef VIDEO_WIDGET_H #define VIDEO_WIDGET_H #include <qwidget.h> #include <qimage.h> #include <qpixmap.h> #include "xinevideowidget.h" #include "mediawidget.h" class QPixmap; class QSlider; class VideoWidget : public MediaWidget { Q_OBJECT public: VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~VideoWidget(); + static const MediaWidget::SkinButtonInfo *skinInfo(); + static const uint buttonCount(); XineVideoWidget* vidWidget(); public slots: void updateSlider( long, long ); void sliderPressed( ); void sliderReleased( ); void setFullscreen( bool b ); virtual void makeVisible(); void backToNormal(); void setPosition( long ); public: virtual void setPlaying( bool b); virtual void setLength( long ); virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); virtual void loadSkin(); signals: void moreClicked(); void lessClicked(); void sliderMoved( long ); void videoResized ( const QSize &s ); |