summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 18:17:40 (UTC)
committer simon <simon>2002-12-02 18:17:40 (UTC)
commit2aa2e01cd678012d4b28365c9c765a2076f64a3b (patch) (unidiff)
tree53fb067b1670b734cd65ce1d2fddd920e059d200
parentdaf5a1cfa07615a3259dce3f7f980d30241fa3d5 (diff)
downloadopie-2aa2e01cd678012d4b28365c9c765a2076f64a3b.zip
opie-2aa2e01cd678012d4b28365c9c765a2076f64a3b.tar.gz
opie-2aa2e01cd678012d4b28365c9c765a2076f64a3b.tar.bz2
- adapted to the new MediaPlayerState::MediaType
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp15
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h4
2 files changed, 10 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 46d374d..74bc390 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -139,49 +139,49 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
139// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 139// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
140// songInfo.setFrameStyle( QFrame::NoFrame); 140// songInfo.setFrameStyle( QFrame::NoFrame);
141 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 141 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
142// songInfo.setForegroundColor(Qt::white); 142// songInfo.setForegroundColor(Qt::white);
143 143
144 slider.setFixedHeight( 20 ); 144 slider.setFixedHeight( 20 );
145 slider.setMinValue( 0 ); 145 slider.setMinValue( 0 );
146 slider.setMaxValue( 1 ); 146 slider.setMaxValue( 1 );
147 slider.setFocusPolicy( QWidget::NoFocus ); 147 slider.setFocusPolicy( QWidget::NoFocus );
148 slider.setBackgroundPixmap( pixBg ); 148 slider.setBackgroundPixmap( pixBg );
149 149
150// Config cofg("qpe"); 150// Config cofg("qpe");
151// cofg.setGroup("Appearance"); 151// cofg.setGroup("Appearance");
152// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 152// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
153 153
154 time.setFocusPolicy( QWidget::NoFocus ); 154 time.setFocusPolicy( QWidget::NoFocus );
155 time.setAlignment( Qt::AlignCenter ); 155 time.setAlignment( Qt::AlignCenter );
156 156
157// time.setFrame(FALSE); 157// time.setFrame(FALSE);
158// changeTextColor( &time ); 158// changeTextColor( &time );
159 159
160 resizeEvent( NULL ); 160 resizeEvent( NULL );
161 161
162 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 162 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
163 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 163 connect( mediaPlayerState, SIGNAL( mediaTypeChanged(MediaPlayerState::MediaType) ), this, SLOT( setMediaType(MediaPlayerState::MediaType) ) );
164 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 164 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
165 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 165 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
166 connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 166 connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
167 167
168 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 168 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
169 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 169 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
170 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 170 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
171 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 171 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
172 172
173 // Intialise state 173 // Intialise state
174 setLength( mediaPlayerState->length() ); 174 setLength( mediaPlayerState->length() );
175 setPosition( mediaPlayerState->position() ); 175 setPosition( mediaPlayerState->position() );
176 setLooping( mediaPlayerState->isFullscreen() ); 176 setLooping( mediaPlayerState->isFullscreen() );
177 // setPaused( mediaPlayerState->paused() ); 177 // setPaused( mediaPlayerState->paused() );
178 setPlaying( mediaPlayerState->isPlaying() ); 178 setPlaying( mediaPlayerState->isPlaying() );
179 179
180} 180}
181 181
182AudioWidget::~AudioWidget() { 182AudioWidget::~AudioWidget() {
183 183
184 for ( int i = 0; i < 10; i++ ) { 184 for ( int i = 0; i < 10; i++ ) {
185 delete buttonPixUp[i]; 185 delete buttonPixUp[i];
186 delete buttonPixDown[i]; 186 delete buttonPixDown[i];
187 } 187 }
@@ -243,58 +243,57 @@ static bool audioSliderBeingMoved = FALSE;
243void AudioWidget::sliderPressed() { 243void AudioWidget::sliderPressed() {
244 audioSliderBeingMoved = TRUE; 244 audioSliderBeingMoved = TRUE;
245} 245}
246 246
247 247
248void AudioWidget::sliderReleased() { 248void AudioWidget::sliderReleased() {
249 audioSliderBeingMoved = FALSE; 249 audioSliderBeingMoved = FALSE;
250 if ( slider.width() == 0 ) 250 if ( slider.width() == 0 )
251 return; 251 return;
252 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); 252 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
253 mediaPlayerState->setPosition( val ); 253 mediaPlayerState->setPosition( val );
254} 254}
255 255
256void AudioWidget::setPosition( long i ) { 256void AudioWidget::setPosition( long i ) {
257 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 257 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
258 updateSlider( i, mediaPlayerState->length() ); 258 updateSlider( i, mediaPlayerState->length() );
259} 259}
260 260
261 261
262void AudioWidget::setLength( long max ) { 262void AudioWidget::setLength( long max ) {
263 updateSlider( mediaPlayerState->position(), max ); 263 updateSlider( mediaPlayerState->position(), max );
264} 264}
265 265
266 266
267void AudioWidget::setView( char view ) { 267void AudioWidget::setMediaType( MediaPlayerState::MediaType mediaType ) {
268 268 if ( mediaType == MediaPlayerState::Video ) {
269if ( view == 'a' ) {
270 // startTimer( 150 );
271 showMaximized();
272 } else {
273 killTimers(); 269 killTimers();
274 hide(); 270 hide();
271 return;
275 } 272 }
276 // qApp->processEvents(); 273
274 // startTimer( 150 );
275 showMaximized();
277} 276}
278 277
279 278
280void AudioWidget::setSeekable( bool isSeekable ) { 279void AudioWidget::setSeekable( bool isSeekable ) {
281 280
282 if ( !isSeekable ) { 281 if ( !isSeekable ) {
283 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 282 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
284 if( !slider.isHidden()) { 283 if( !slider.isHidden()) {
285 slider.hide(); 284 slider.hide();
286 } 285 }
287 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 286 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
288 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 287 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
289 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 288 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
290 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 289 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
291 } else { 290 } else {
292 // this stops the slider from being moved, thus 291 // this stops the slider from being moved, thus
293 // does not stop stream when it reaches the end 292 // does not stop stream when it reaches the end
294 slider.show(); 293 slider.show();
295 qDebug( " CONNECT SET POSTION " ); 294 qDebug( " CONNECT SET POSTION " );
296 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 295 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
297 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 296 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
298 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 297 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
299 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 298 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
300 } 299 }
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 54adb36..3f0c059 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -25,82 +25,84 @@
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
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 AUDIO_WIDGET_H 34#ifndef AUDIO_WIDGET_H
35#define AUDIO_WIDGET_H 35#define AUDIO_WIDGET_H
36 36
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qpainter.h> 38#include <qpainter.h>
39#include <qdrawutil.h> 39#include <qdrawutil.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qstring.h> 41#include <qstring.h>
42#include <qslider.h> 42#include <qslider.h>
43#include <qframe.h> 43#include <qframe.h>
44#include <qlineedit.h> 44#include <qlineedit.h>
45#include <qimage.h> 45#include <qimage.h>
46 46
47#include <opie/oticker.h> 47#include <opie/oticker.h>
48 48
49#include "mediaplayerstate.h"
50
49class QPixmap; 51class QPixmap;
50 52
51namespace { 53namespace {
52 54
53enum AudioButtons { 55enum AudioButtons {
54 AudioPlay=0, 56 AudioPlay=0,
55 AudioStop, 57 AudioStop,
56 AudioNext, 58 AudioNext,
57 AudioPrevious, 59 AudioPrevious,
58 AudioVolumeUp, 60 AudioVolumeUp,
59 AudioVolumeDown, 61 AudioVolumeDown,
60 AudioLoop, 62 AudioLoop,
61 AudioPlayList, 63 AudioPlayList,
62 AudioForward, 64 AudioForward,
63 AudioBack 65 AudioBack
64}; 66};
65}; 67};
66 68
67class AudioWidget : public QWidget { 69class AudioWidget : public QWidget {
68 Q_OBJECT 70 Q_OBJECT
69public: 71public:
70 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); 72 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
71 ~AudioWidget(); 73 ~AudioWidget();
72 void setTickerText( const QString &text ) { songInfo.setText( text ); } 74 void setTickerText( const QString &text ) { songInfo.setText( text ); }
73public slots: 75public slots:
74 void updateSlider( long, long ); 76 void updateSlider( long, long );
75 void sliderPressed( ); 77 void sliderPressed( );
76 void sliderReleased( ); 78 void sliderReleased( );
77 void setLooping( bool b) { setToggleButton( AudioLoop, b ); } 79 void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
78 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } 80 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
79 void setPosition( long ); 81 void setPosition( long );
80 void setLength( long ); 82 void setLength( long );
81 void setSeekable( bool ); 83 void setSeekable( bool );
82 void setView( char ); 84 void setMediaType( MediaPlayerState::MediaType mediaType );
83 85
84signals: 86signals:
85 void moreClicked(); 87 void moreClicked();
86 void lessClicked(); 88 void lessClicked();
87 void moreReleased(); 89 void moreReleased();
88 void lessReleased(); 90 void lessReleased();
89 void forwardClicked(); 91 void forwardClicked();
90 void backClicked(); 92 void backClicked();
91 void forwardReleased(); 93 void forwardReleased();
92 void backReleased(); 94 void backReleased();
93 void sliderMoved(long); 95 void sliderMoved(long);
94 96
95protected: 97protected:
96 void doBlank(); 98 void doBlank();
97 void doUnblank(); 99 void doUnblank();
98 void paintEvent( QPaintEvent *pe ); 100 void paintEvent( QPaintEvent *pe );
99 void showEvent( QShowEvent *se ); 101 void showEvent( QShowEvent *se );
100 void resizeEvent( QResizeEvent *re ); 102 void resizeEvent( QResizeEvent *re );
101 void mouseMoveEvent( QMouseEvent *event ); 103 void mouseMoveEvent( QMouseEvent *event );
102 void mousePressEvent( QMouseEvent *event ); 104 void mousePressEvent( QMouseEvent *event );
103 void mouseReleaseEvent( QMouseEvent *event ); 105 void mouseReleaseEvent( QMouseEvent *event );
104 void timerEvent( QTimerEvent *event ); 106 void timerEvent( QTimerEvent *event );
105 void closeEvent( QCloseEvent *event ); 107 void closeEvent( QCloseEvent *event );
106 void keyReleaseEvent( QKeyEvent *e); 108 void keyReleaseEvent( QKeyEvent *e);