summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 17:16:17 (UTC)
committer simon <simon>2002-12-11 17:16:17 (UTC)
commit94461696cfdcf8cdbaabec1400300e546edc447e (patch) (unidiff)
treebacef808031edb254214d04489d4a8e4df53cdb9
parent9f5e007f4859027eaeb989c620ec62fc698b44cc (diff)
downloadopie-94461696cfdcf8cdbaabec1400300e546edc447e.zip
opie-94461696cfdcf8cdbaabec1400300e546edc447e.tar.gz
opie-94461696cfdcf8cdbaabec1400300e546edc447e.tar.bz2
- expose information about the buttons
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
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
90 90
91 loadSkin(); 91 loadSkin();
92 92
93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
95 95
96 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 96 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
97 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 97 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
98 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 98 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
99 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 99 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
100 100
101 // Intialise state 101 // Intialise state
102 setLength( mediaPlayerState.length() ); 102 setLength( mediaPlayerState.length() );
103 setPosition( mediaPlayerState.position() ); 103 setPosition( mediaPlayerState.position() );
104 setLooping( mediaPlayerState.isFullscreen() ); 104 setLooping( mediaPlayerState.isFullscreen() );
105 // setPaused( mediaPlayerState->paused() ); 105 // setPaused( mediaPlayerState->paused() );
106 setPlaying( mediaPlayerState.isPlaying() ); 106 setPlaying( mediaPlayerState.isPlaying() );
107} 107}
108 108
109AudioWidget::~AudioWidget() { 109AudioWidget::~AudioWidget() {
110 110
111// mediaPlayerState->setPlaying(false); 111// mediaPlayerState->setPlaying(false);
112} 112}
113 113
114const MediaWidget::SkinButtonInfo *AudioWidget::skinInfo()
115{
116 return ::skinInfo;
117}
118
119const uint AudioWidget::buttonCount()
120{
121 return ::buttonCount;
122}
123
114void AudioWidget::resizeEvent( QResizeEvent *e ) { 124void AudioWidget::resizeEvent( QResizeEvent *e ) {
115 int h = height(); 125 int h = height();
116 int w = width(); 126 int w = width();
117 127
118 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); 128 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
119 slider.setFixedWidth( w - 110 ); 129 slider.setFixedWidth( w - 110 );
120 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 130 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
121 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 131 slider.setBackgroundOrigin( QWidget::ParentOrigin );
122 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 132 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
123 133
124 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; 134 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2;
125 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; 135 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10;
126 136
127 MediaWidget::resizeEvent( e ); 137 MediaWidget::resizeEvent( e );
128} 138}
129 139
130void AudioWidget::sliderPressed() { 140void AudioWidget::sliderPressed() {
131 audioSliderBeingMoved = TRUE; 141 audioSliderBeingMoved = TRUE;
132} 142}
133 143
134 144
135void AudioWidget::sliderReleased() { 145void AudioWidget::sliderReleased() {
136 audioSliderBeingMoved = FALSE; 146 audioSliderBeingMoved = FALSE;
137 if ( slider.width() == 0 ) 147 if ( slider.width() == 0 )
@@ -143,49 +153,49 @@ void AudioWidget::sliderReleased() {
143void AudioWidget::setPosition( long i ) { 153void AudioWidget::setPosition( long i ) {
144 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 154 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
145 updateSlider( i, mediaPlayerState.length() ); 155 updateSlider( i, mediaPlayerState.length() );
146} 156}
147 157
148 158
149void AudioWidget::setLength( long max ) { 159void AudioWidget::setLength( long max ) {
150 updateSlider( mediaPlayerState.position(), max ); 160 updateSlider( mediaPlayerState.position(), max );
151} 161}
152 162
153 163
154void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 164void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
155 if ( mediaType == MediaPlayerState::Audio ) { 165 if ( mediaType == MediaPlayerState::Audio ) {
156 // startTimer( 150 ); 166 // startTimer( 150 );
157 showMaximized(); 167 showMaximized();
158 return; 168 return;
159 } 169 }
160 170
161 killTimers(); 171 killTimers();
162 hide(); 172 hide();
163} 173}
164 174
165void AudioWidget::loadSkin() 175void AudioWidget::loadSkin()
166{ 176{
167 loadDefaultSkin( skinInfo, buttonCount ); 177 loadDefaultSkin( ::skinInfo, ::buttonCount );
168 178
169 setBackgroundPixmap( backgroundPixmap ); 179 setBackgroundPixmap( backgroundPixmap );
170 180
171 songInfo.setFocusPolicy( QWidget::NoFocus ); 181 songInfo.setFocusPolicy( QWidget::NoFocus );
172// changeTextColor( &songInfo ); 182// changeTextColor( &songInfo );
173// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 183// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
174// songInfo.setFrameStyle( QFrame::NoFrame); 184// songInfo.setFrameStyle( QFrame::NoFrame);
175 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 185 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
176// songInfo.setForegroundColor(Qt::white); 186// songInfo.setForegroundColor(Qt::white);
177 187
178 slider.setFixedHeight( 20 ); 188 slider.setFixedHeight( 20 );
179 slider.setMinValue( 0 ); 189 slider.setMinValue( 0 );
180 slider.setMaxValue( 1 ); 190 slider.setMaxValue( 1 );
181 slider.setFocusPolicy( QWidget::NoFocus ); 191 slider.setFocusPolicy( QWidget::NoFocus );
182 slider.setBackgroundPixmap( backgroundPixmap ); 192 slider.setBackgroundPixmap( backgroundPixmap );
183 193
184// Config cofg("qpe"); 194// Config cofg("qpe");
185// cofg.setGroup("Appearance"); 195// cofg.setGroup("Appearance");
186// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 196// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
187 197
188 time.setFocusPolicy( QWidget::NoFocus ); 198 time.setFocusPolicy( QWidget::NoFocus );
189 time.setAlignment( Qt::AlignCenter ); 199 time.setAlignment( Qt::AlignCenter );
190 200
191// time.setFrame(FALSE); 201// 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 @@
34#ifndef AUDIO_WIDGET_H 34#ifndef AUDIO_WIDGET_H
35#define AUDIO_WIDGET_H 35#define AUDIO_WIDGET_H
36 36
37#include <qpainter.h> 37#include <qpainter.h>
38#include <qdrawutil.h> 38#include <qdrawutil.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include <qstring.h> 40#include <qstring.h>
41#include <qslider.h> 41#include <qslider.h>
42#include <qframe.h> 42#include <qframe.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qimage.h> 44#include <qimage.h>
45 45
46#include <opie/oticker.h> 46#include <opie/oticker.h>
47 47
48#include "mediawidget.h" 48#include "mediawidget.h"
49 49
50class QPixmap; 50class QPixmap;
51 51
52class AudioWidget : public MediaWidget { 52class AudioWidget : public MediaWidget {
53 Q_OBJECT 53 Q_OBJECT
54public: 54public:
55 AudioWidget( PlayListWidget &playList, 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 ); }
58
59 static const MediaWidget::SkinButtonInfo *skinInfo();
60 static const uint buttonCount();
61
58public slots: 62public slots:
59 void updateSlider( long, long ); 63 void updateSlider( long, long );
60 void sliderPressed( ); 64 void sliderPressed( );
61 void sliderReleased( ); 65 void sliderReleased( );
62 void setLooping( bool b) { setToggleButton( Loop, b ); } 66 void setLooping( bool b) { setToggleButton( Loop, b ); }
63 void setPosition( long ); 67 void setPosition( long );
64 void setSeekable( bool ); 68 void setSeekable( bool );
65 69
66public: 70public:
67 virtual void setLength( long ); 71 virtual void setLength( long );
68 virtual void setPlaying( bool b) { setToggleButton( Play, b ); } 72 virtual void setPlaying( bool b) { setToggleButton( Play, b ); }
69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 73 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
70 74
71 virtual void loadSkin(); 75 virtual void loadSkin();
72 76
73signals: 77signals:
74 void sliderMoved(long); 78 void sliderMoved(long);
75 79
76protected: 80protected:
77 void doBlank(); 81 void doBlank();
78 void doUnblank(); 82 void doUnblank();
79 void resizeEvent( QResizeEvent *re ); 83 void resizeEvent( QResizeEvent *re );
80 void timerEvent( QTimerEvent *event ); 84 void timerEvent( QTimerEvent *event );
81 void keyReleaseEvent( QKeyEvent *e); 85 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
78 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) 78 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false )
79{ 79{
80 setCaption( tr("OpiePlayer - Video") ); 80 setCaption( tr("OpiePlayer - Video") );
81 81
82 videoFrame = new XineVideoWidget ( this, "Video frame" ); 82 videoFrame = new XineVideoWidget ( this, "Video frame" );
83 83
84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
86 86
87 slider = 0; 87 slider = 0;
88 88
89 loadSkin(); 89 loadSkin();
90 90
91 setLength( mediaPlayerState.length() ); 91 setLength( mediaPlayerState.length() );
92 setPosition( mediaPlayerState.position() ); 92 setPosition( mediaPlayerState.position() );
93 setFullscreen( mediaPlayerState.isFullscreen() ); 93 setFullscreen( mediaPlayerState.isFullscreen() );
94 setPlaying( mediaPlayerState.isPlaying() ); 94 setPlaying( mediaPlayerState.isPlaying() );
95} 95}
96 96
97 97
98VideoWidget::~VideoWidget() 98VideoWidget::~VideoWidget()
99{ 99{
100} 100}
101 101
102const MediaWidget::SkinButtonInfo *VideoWidget::skinInfo()
103{
104 return ::skinInfo;
105}
106
107const uint VideoWidget::buttonCount()
108{
109 return ::buttonCount;
110}
111
102void VideoWidget::resizeEvent( QResizeEvent *e ) { 112void VideoWidget::resizeEvent( QResizeEvent *e ) {
103 int h = height(); 113 int h = height();
104 int w = width(); 114 int w = width();
105 //int Vh = 160; 115 //int Vh = 160;
106 //int Vw = 220; 116 //int Vw = 220;
107 117
108 slider->setFixedWidth( w - 20 ); 118 slider->setFixedWidth( w - 20 );
109 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 119 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
110 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 120 slider->setBackgroundOrigin( QWidget::ParentOrigin );
111 slider->setFocusPolicy( QWidget::NoFocus ); 121 slider->setFocusPolicy( QWidget::NoFocus );
112 slider->setBackgroundPixmap( backgroundPixmap ); 122 slider->setBackgroundPixmap( backgroundPixmap );
113 123
114 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 124 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
115 if(w>h) 125 if(w>h)
116 upperLeftOfButtonMask.ry() = 0; 126 upperLeftOfButtonMask.ry() = 0;
117 else 127 else
118 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 128 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
119 129
120 MediaWidget::resizeEvent( e ); 130 MediaWidget::resizeEvent( e );
121} 131}
122 132
123void VideoWidget::sliderPressed() { 133void VideoWidget::sliderPressed() {
124 videoSliderBeingMoved = TRUE; 134 videoSliderBeingMoved = TRUE;
125} 135}
@@ -136,49 +146,49 @@ void VideoWidget::sliderReleased() {
136void VideoWidget::setPosition( long i ) { 146void VideoWidget::setPosition( long i ) {
137 updateSlider( i, mediaPlayerState.length() ); 147 updateSlider( i, mediaPlayerState.length() );
138} 148}
139 149
140 150
141void VideoWidget::setLength( long max ) { 151void VideoWidget::setLength( long max ) {
142 updateSlider( mediaPlayerState.position(), max ); 152 updateSlider( mediaPlayerState.position(), max );
143} 153}
144 154
145void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 155void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
146{ 156{
147 if ( displayType == MediaPlayerState::Video ) { 157 if ( displayType == MediaPlayerState::Video ) {
148 makeVisible(); 158 makeVisible();
149 return; 159 return;
150 } 160 }
151 161
152 // Effectively blank the view next time we show it so it looks nicer 162 // Effectively blank the view next time we show it so it looks nicer
153 scaledWidth = 0; 163 scaledWidth = 0;
154 scaledHeight = 0; 164 scaledHeight = 0;
155 hide(); 165 hide();
156} 166}
157 167
158void VideoWidget::loadSkin() 168void VideoWidget::loadSkin()
159{ 169{
160 loadDefaultSkin( skinInfo, buttonCount, "V" ); 170 loadDefaultSkin( ::skinInfo, ::buttonCount, "V" );
161 171
162 setBackgroundPixmap( backgroundPixmap ); 172 setBackgroundPixmap( backgroundPixmap );
163 173
164 delete slider; 174 delete slider;
165 slider = new QSlider( Qt::Horizontal, this ); 175 slider = new QSlider( Qt::Horizontal, this );
166 slider->setMinValue( 0 ); 176 slider->setMinValue( 0 );
167 slider->setMaxValue( 1 ); 177 slider->setMaxValue( 1 );
168 slider->setBackgroundPixmap( backgroundPixmap ); 178 slider->setBackgroundPixmap( backgroundPixmap );
169 //slider->setFocusPolicy( QWidget::NoFocus ); 179 //slider->setFocusPolicy( QWidget::NoFocus );
170 180
171 resizeEvent( 0 ); 181 resizeEvent( 0 );
172} 182}
173 183
174void VideoWidget::updateSlider( long i, long max ) { 184void VideoWidget::updateSlider( long i, long max ) {
175 // Will flicker too much if we don't do this 185 // Will flicker too much if we don't do this
176 if ( max == 0 ) { 186 if ( max == 0 ) {
177 return; 187 return;
178 } 188 }
179 int width = slider->width(); 189 int width = slider->width();
180 int val = int((double)i * width / max); 190 int val = int((double)i * width / max);
181 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 191 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
182 if ( slider->value() != val ) { 192 if ( slider->value() != val ) {
183 slider->setValue( val ); 193 slider->setValue( val );
184 } 194 }
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 @@
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef VIDEO_WIDGET_H 34#ifndef VIDEO_WIDGET_H
35#define VIDEO_WIDGET_H 35#define VIDEO_WIDGET_H
36 36
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qimage.h> 38#include <qimage.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include "xinevideowidget.h" 40#include "xinevideowidget.h"
41 41
42#include "mediawidget.h" 42#include "mediawidget.h"
43 43
44class QPixmap; 44class QPixmap;
45class QSlider; 45class QSlider;
46 46
47class VideoWidget : public MediaWidget { 47class VideoWidget : public MediaWidget {
48 Q_OBJECT 48 Q_OBJECT
49public: 49public:
50 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 50 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
51 ~VideoWidget(); 51 ~VideoWidget();
52 52
53 static const MediaWidget::SkinButtonInfo *skinInfo();
54 static const uint buttonCount();
53 55
54 XineVideoWidget* vidWidget(); 56 XineVideoWidget* vidWidget();
55public slots: 57public slots:
56 void updateSlider( long, long ); 58 void updateSlider( long, long );
57 void sliderPressed( ); 59 void sliderPressed( );
58 void sliderReleased( ); 60 void sliderReleased( );
59 void setFullscreen( bool b ); 61 void setFullscreen( bool b );
60 virtual void makeVisible(); 62 virtual void makeVisible();
61 void backToNormal(); 63 void backToNormal();
62 void setPosition( long ); 64 void setPosition( long );
63 65
64public: 66public:
65 virtual void setPlaying( bool b); 67 virtual void setPlaying( bool b);
66 virtual void setLength( long ); 68 virtual void setLength( long );
67 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
68 70
69 virtual void loadSkin(); 71 virtual void loadSkin();
70 72
71signals: 73signals:
72 void moreClicked(); 74 void moreClicked();
73 void lessClicked(); 75 void lessClicked();
74 void sliderMoved( long ); 76 void sliderMoved( long );
75 void videoResized ( const QSize &s ); 77 void videoResized ( const QSize &s );
76 78