summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-08 22:26:34 (UTC)
committer simon <simon>2002-12-08 22:26:34 (UTC)
commit3b5f97272ded8a40da3853476371b4edc41d1a34 (patch) (unidiff)
treecc965571aa2f8ca62bf859e49acc91b440b96f1a
parent5d3f3d429bb6247741a30c00a344302a2c9a20c0 (diff)
downloadopie-3b5f97272ded8a40da3853476371b4edc41d1a34.zip
opie-3b5f97272ded8a40da3853476371b4edc41d1a34.tar.gz
opie-3b5f97272ded8a40da3853476371b4edc41d1a34.tar.bz2
- share the imgButtonMask member variable in the base class
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
5 files changed, 14 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index a9d5a88..022aa82 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -76,74 +76,74 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
76 76
77 Button defaultButton; 77 Button defaultButton;
78 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; 78 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false;
79 Button toggleButton; 79 Button toggleButton;
80 toggleButton.isToggle = true; 80 toggleButton.isToggle = true;
81 toggleButton.isHeld = toggleButton.isDown = false; 81 toggleButton.isHeld = toggleButton.isDown = false;
82 82
83 buttons.reserve( 10 ); 83 buttons.reserve( 10 );
84 buttons.push_back( toggleButton ); // play 84 buttons.push_back( toggleButton ); // play
85 buttons.push_back( defaultButton ); // stop 85 buttons.push_back( defaultButton ); // stop
86 buttons.push_back( defaultButton ); // next 86 buttons.push_back( defaultButton ); // next
87 buttons.push_back( defaultButton ); // previous 87 buttons.push_back( defaultButton ); // previous
88 buttons.push_back( defaultButton ); // volume up 88 buttons.push_back( defaultButton ); // volume up
89 buttons.push_back( defaultButton ); // volume down 89 buttons.push_back( defaultButton ); // volume down
90 buttons.push_back( toggleButton ); // repeat/loop 90 buttons.push_back( toggleButton ); // repeat/loop
91 buttons.push_back( defaultButton ); // playlist 91 buttons.push_back( defaultButton ); // playlist
92 buttons.push_back( defaultButton ); // forward 92 buttons.push_back( defaultButton ); // forward
93 buttons.push_back( defaultButton ); // back 93 buttons.push_back( defaultButton ); // back
94 94
95 setCaption( tr("OpiePlayer") ); 95 setCaption( tr("OpiePlayer") );
96 96
97 Config cfg("OpiePlayer"); 97 Config cfg("OpiePlayer");
98 cfg.setGroup("Options"); 98 cfg.setGroup("Options");
99 skin = cfg.readEntry("Skin","default"); 99 skin = cfg.readEntry("Skin","default");
100 //skin = "scaleTest"; 100 //skin = "scaleTest";
101 // color of background, frame, degree of transparency 101 // color of background, frame, degree of transparency
102 102
103 QString skinPath = "opieplayer2/skins/" + skin; 103 QString skinPath = "opieplayer2/skins/" + skin;
104 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 104 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
105 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 105 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
106 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 106 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
107 107
108 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 108 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
109 imgButtonMask.fill( 0 ); 109 buttonMask.fill( 0 );
110 110
111 for ( int i = 0; i < 10; i++ ) { 111 for ( int i = 0; i < 10; i++ ) {
112 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); 112 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" );
113 masks[i] = new QBitmap( filename ); 113 masks[i] = new QBitmap( filename );
114 114
115 if ( !masks[i]->isNull() ) { 115 if ( !masks[i]->isNull() ) {
116 QImage imgMask = masks[i]->convertToImage(); 116 QImage imgMask = masks[i]->convertToImage();
117 uchar **dest = imgButtonMask.jumpTable(); 117 uchar **dest = buttonMask.jumpTable();
118 for ( int y = 0; y < imgUp.height(); y++ ) { 118 for ( int y = 0; y < imgUp.height(); y++ ) {
119 uchar *line = dest[y]; 119 uchar *line = dest[y];
120 for ( int x = 0; x < imgUp.width(); x++ ) 120 for ( int x = 0; x < imgUp.width(); x++ )
121 if ( !qRed( imgMask.pixel( x, y ) ) ) 121 if ( !qRed( imgMask.pixel( x, y ) ) )
122 line[x] = i + 1; 122 line[x] = i + 1;
123 } 123 }
124 } 124 }
125 125
126 } 126 }
127 127
128 for ( int i = 0; i < 10; i++ ) { 128 for ( int i = 0; i < 10; i++ ) {
129 buttonPixUp[i] = 0l; 129 buttonPixUp[i] = 0l;
130 buttonPixDown[i] = 0l; 130 buttonPixDown[i] = 0l;
131 } 131 }
132 132
133 setBackgroundPixmap( pixBg ); 133 setBackgroundPixmap( pixBg );
134 134
135 songInfo.setFocusPolicy( QWidget::NoFocus ); 135 songInfo.setFocusPolicy( QWidget::NoFocus );
136// changeTextColor( &songInfo ); 136// changeTextColor( &songInfo );
137// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 137// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
138// songInfo.setFrameStyle( QFrame::NoFrame); 138// songInfo.setFrameStyle( QFrame::NoFrame);
139 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 139 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
140// songInfo.setForegroundColor(Qt::white); 140// songInfo.setForegroundColor(Qt::white);
141 141
142 slider.setFixedHeight( 20 ); 142 slider.setFixedHeight( 20 );
143 slider.setMinValue( 0 ); 143 slider.setMinValue( 0 );
144 slider.setMaxValue( 1 ); 144 slider.setMaxValue( 1 );
145 slider.setFocusPolicy( QWidget::NoFocus ); 145 slider.setFocusPolicy( QWidget::NoFocus );
146 slider.setBackgroundPixmap( pixBg ); 146 slider.setBackgroundPixmap( pixBg );
147 147
148// Config cofg("qpe"); 148// Config cofg("qpe");
149// cofg.setGroup("Appearance"); 149// cofg.setGroup("Appearance");
@@ -355,67 +355,67 @@ void AudioWidget::skipFor() {
355 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 355 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
356} 356}
357 357
358void AudioWidget::skipBack() { 358void AudioWidget::skipBack() {
359 skipDirection = -1; 359 skipDirection = -1;
360 startTimer( 50 ); 360 startTimer( 50 );
361 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 361 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
362} 362}
363 363
364 364
365 365
366void AudioWidget::stopSkip() { 366void AudioWidget::stopSkip() {
367 killTimers(); 367 killTimers();
368} 368}
369 369
370 370
371void AudioWidget::timerEvent( QTimerEvent * ) { 371void AudioWidget::timerEvent( QTimerEvent * ) {
372 if ( skipDirection == +1 ) { 372 if ( skipDirection == +1 ) {
373 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 373 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
374 } else if ( skipDirection == -1 ) { 374 } else if ( skipDirection == -1 ) {
375 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 375 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
376 } 376 }
377} 377}
378 378
379 379
380void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 380void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
381 for ( unsigned int i = 0; i < buttons.size(); i++ ) { 381 for ( unsigned int i = 0; i < buttons.size(); i++ ) {
382 if ( event->state() == QMouseEvent::LeftButton ) { 382 if ( event->state() == QMouseEvent::LeftButton ) {
383 // The test to see if the mouse click is inside the button or not 383 // The test to see if the mouse click is inside the button or not
384 int x = event->pos().x() - xoff; 384 int x = event->pos().x() - xoff;
385 int y = event->pos().y() - yoff; 385 int y = event->pos().y() - yoff;
386 386
387 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() 387 bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width()
388 && y < imgButtonMask.height() 388 && y < buttonMask.height()
389 && imgButtonMask.pixelIndex( x, y ) == i + 1 ); 389 && buttonMask.pixelIndex( x, y ) == i + 1 );
390 390
391 if ( isOnButton && !buttons[i].isHeld ) { 391 if ( isOnButton && !buttons[i].isHeld ) {
392 buttons[i].isHeld = TRUE; 392 buttons[i].isHeld = TRUE;
393 toggleButton(i); 393 toggleButton(i);
394 switch (i) { 394 switch (i) {
395 case VolumeUp: 395 case VolumeUp:
396 emit moreClicked(); 396 emit moreClicked();
397 return; 397 return;
398 case VolumeDown: 398 case VolumeDown:
399 emit lessClicked(); 399 emit lessClicked();
400 return; 400 return;
401 case Forward: 401 case Forward:
402 emit forwardClicked(); 402 emit forwardClicked();
403 return; 403 return;
404 case Back: 404 case Back:
405 emit backClicked(); 405 emit backClicked();
406 return; 406 return;
407 } 407 }
408 } else if ( !isOnButton && buttons[i].isHeld ) { 408 } else if ( !isOnButton && buttons[i].isHeld ) {
409 buttons[i].isHeld = FALSE; 409 buttons[i].isHeld = FALSE;
410 toggleButton(i); 410 toggleButton(i);
411 } 411 }
412 } else { 412 } else {
413 if ( buttons[i].isHeld ) { 413 if ( buttons[i].isHeld ) {
414 buttons[i].isHeld = FALSE; 414 buttons[i].isHeld = FALSE;
415 if ( !buttons[i].isToggle ) { 415 if ( !buttons[i].isToggle ) {
416 setToggleButton( i, FALSE ); 416 setToggleButton( i, FALSE );
417 } 417 }
418 qDebug("mouseEvent %d", i); 418 qDebug("mouseEvent %d", i);
419 handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); 419 handleCommand( static_cast<Command>( i ), buttons[ i ].isDown );
420 } 420 }
421 } 421 }
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 52a358c..da22946 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -70,48 +70,47 @@ public:
70 70
71signals: 71signals:
72 void moreClicked(); 72 void moreClicked();
73 void lessClicked(); 73 void lessClicked();
74 void forwardClicked(); 74 void forwardClicked();
75 void backClicked(); 75 void backClicked();
76 void sliderMoved(long); 76 void sliderMoved(long);
77 77
78protected: 78protected:
79 void doBlank(); 79 void doBlank();
80 void doUnblank(); 80 void doUnblank();
81 void paintEvent( QPaintEvent *pe ); 81 void paintEvent( QPaintEvent *pe );
82 void showEvent( QShowEvent *se ); 82 void showEvent( QShowEvent *se );
83 void resizeEvent( QResizeEvent *re ); 83 void resizeEvent( QResizeEvent *re );
84 void mouseMoveEvent( QMouseEvent *event ); 84 void mouseMoveEvent( QMouseEvent *event );
85 void mousePressEvent( QMouseEvent *event ); 85 void mousePressEvent( QMouseEvent *event );
86 void mouseReleaseEvent( QMouseEvent *event ); 86 void mouseReleaseEvent( QMouseEvent *event );
87 void timerEvent( QTimerEvent *event ); 87 void timerEvent( QTimerEvent *event );
88 void keyReleaseEvent( QKeyEvent *e); 88 void keyReleaseEvent( QKeyEvent *e);
89private slots: 89private slots:
90 void skipFor(); 90 void skipFor();
91 void skipBack(); 91 void skipBack();
92 void stopSkip(); 92 void stopSkip();
93private: 93private:
94 void toggleButton( int ); 94 void toggleButton( int );
95 void setToggleButton( int, bool ); 95 void setToggleButton( int, bool );
96 void paintButton( QPainter *p, int i ); 96 void paintButton( QPainter *p, int i );
97 int skipDirection; 97 int skipDirection;
98 QString skin; 98 QString skin;
99 QPixmap pixBg; 99 QPixmap pixBg;
100 QImage imgUp; 100 QImage imgUp;
101 QImage imgDn; 101 QImage imgDn;
102 QImage imgButtonMask;
103 QBitmap *masks[10]; 102 QBitmap *masks[10];
104 QPixmap *buttonPixUp[10]; 103 QPixmap *buttonPixUp[10];
105 QPixmap *buttonPixDown[10]; 104 QPixmap *buttonPixDown[10];
106 105
107 QPixmap *pixmaps[4]; 106 QPixmap *pixmaps[4];
108 OTicker songInfo; 107 OTicker songInfo;
109 QSlider slider; 108 QSlider slider;
110 QLineEdit time; 109 QLineEdit time;
111 int xoff, yoff; 110 int xoff, yoff;
112 bool isStreaming : 1; 111 bool isStreaming : 1;
113}; 112};
114 113
115 114
116#endif // AUDIO_WIDGET_H 115#endif // AUDIO_WIDGET_H
117 116
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index b88d7e2..044ab6c 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -40,37 +40,39 @@ public:
40 { 40 {
41 Button() : isToggle( false ), isHeld( false ), isDown( false ) {} 41 Button() : isToggle( false ), isHeld( false ), isDown( false ) {}
42 42
43 bool isToggle : 1; 43 bool isToggle : 1;
44 bool isHeld : 1; 44 bool isHeld : 1;
45 bool isDown : 1; 45 bool isDown : 1;
46 }; 46 };
47 typedef std::vector<Button> ButtonVector; 47 typedef std::vector<Button> ButtonVector;
48 48
49 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 49 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
50 virtual ~MediaWidget(); 50 virtual ~MediaWidget();
51 51
52public slots: 52public slots:
53 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; 53 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
54 virtual void setLength( long length ) = 0; 54 virtual void setLength( long length ) = 0;
55 virtual void setPlaying( bool playing ) = 0; 55 virtual void setPlaying( bool playing ) = 0;
56 56
57signals: 57signals:
58 void moreReleased(); 58 void moreReleased();
59 void lessReleased(); 59 void lessReleased();
60 void forwardReleased(); 60 void forwardReleased();
61 void backReleased(); 61 void backReleased();
62 62
63protected: 63protected:
64 virtual void closeEvent( QCloseEvent * ); 64 virtual void closeEvent( QCloseEvent * );
65 65
66 void handleCommand( Command command, bool buttonDown ); 66 void handleCommand( Command command, bool buttonDown );
67 67
68 MediaPlayerState &mediaPlayerState; 68 MediaPlayerState &mediaPlayerState;
69 PlayListWidget &playList; 69 PlayListWidget &playList;
70 70
71 ButtonVector buttons; 71 ButtonVector buttons;
72
73 QImage buttonMask;
72}; 74};
73 75
74#endif // MEDIAWIDGET_H 76#endif // MEDIAWIDGET_H
75/* vim: et sw=4 ts=4 77/* vim: et sw=4 ts=4
76 */ 78 */
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 7838229..459f592 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -70,74 +70,74 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
70{ 70{
71 setCaption( tr("OpiePlayer - Video") ); 71 setCaption( tr("OpiePlayer - Video") );
72 72
73 Button defaultButton; 73 Button defaultButton;
74 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; 74 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false;
75 Button toggleButton; 75 Button toggleButton;
76 toggleButton.isToggle = true; 76 toggleButton.isToggle = true;
77 toggleButton.isHeld = toggleButton.isDown = false; 77 toggleButton.isHeld = toggleButton.isDown = false;
78 78
79 buttons.reserve( 7 ); 79 buttons.reserve( 7 );
80 buttons.push_back( defaultButton ); // stop 80 buttons.push_back( defaultButton ); // stop
81 buttons.push_back( toggleButton ); // play 81 buttons.push_back( toggleButton ); // play
82 buttons.push_back( defaultButton ); // previous 82 buttons.push_back( defaultButton ); // previous
83 buttons.push_back( defaultButton ); // next 83 buttons.push_back( defaultButton ); // next
84 buttons.push_back( defaultButton ); // volUp 84 buttons.push_back( defaultButton ); // volUp
85 buttons.push_back( defaultButton ); // volDown 85 buttons.push_back( defaultButton ); // volDown
86 buttons.push_back( toggleButton ); //fullscreen 86 buttons.push_back( toggleButton ); //fullscreen
87 87
88 videoFrame = new XineVideoWidget ( this, "Video frame" ); 88 videoFrame = new XineVideoWidget ( this, "Video frame" );
89 89
90 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 90 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
91 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 91 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
92 92
93 Config cfg("OpiePlayer"); 93 Config cfg("OpiePlayer");
94 cfg.setGroup("Options"); 94 cfg.setGroup("Options");
95 skin = cfg.readEntry("Skin","default"); 95 skin = cfg.readEntry("Skin","default");
96 96
97 QString skinPath = "opieplayer2/skins/" + skin; 97 QString skinPath = "opieplayer2/skins/" + skin;
98 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 98 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
99 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 99 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
100 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 100 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
101 101
102 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 102 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
103 imgButtonMask.fill( 0 ); 103 buttonMask.fill( 0 );
104 104
105 for ( int i = 0; i < 7; i++ ) { 105 for ( int i = 0; i < 7; i++ ) {
106 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 106 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
107 masks[i] = new QBitmap( filename ); 107 masks[i] = new QBitmap( filename );
108 108
109 if ( !masks[i]->isNull() ) { 109 if ( !masks[i]->isNull() ) {
110 QImage imgMask = masks[i]->convertToImage(); 110 QImage imgMask = masks[i]->convertToImage();
111 uchar **dest = imgButtonMask.jumpTable(); 111 uchar **dest = buttonMask.jumpTable();
112 for ( int y = 0; y < imgUp.height(); y++ ) { 112 for ( int y = 0; y < imgUp.height(); y++ ) {
113 uchar *line = dest[y]; 113 uchar *line = dest[y];
114 for ( int x = 0; x < imgUp.width(); x++ ) { 114 for ( int x = 0; x < imgUp.width(); x++ ) {
115 if ( !qRed( imgMask.pixel( x, y ) ) ) 115 if ( !qRed( imgMask.pixel( x, y ) ) )
116 line[x] = i + 1; 116 line[x] = i + 1;
117 } 117 }
118 } 118 }
119 } 119 }
120 } 120 }
121 121
122 for ( int i = 0; i < 7; i++ ) { 122 for ( int i = 0; i < 7; i++ ) {
123 buttonPixUp[i] = NULL; 123 buttonPixUp[i] = NULL;
124 buttonPixDown[i] = NULL; 124 buttonPixDown[i] = NULL;
125 } 125 }
126 126
127 setBackgroundPixmap( pixBg ); 127 setBackgroundPixmap( pixBg );
128 128
129 slider = new QSlider( Qt::Horizontal, this ); 129 slider = new QSlider( Qt::Horizontal, this );
130 slider->setMinValue( 0 ); 130 slider->setMinValue( 0 );
131 slider->setMaxValue( 1 ); 131 slider->setMaxValue( 1 );
132 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 132 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
133 //slider->setFocusPolicy( QWidget::NoFocus ); 133 //slider->setFocusPolicy( QWidget::NoFocus );
134 134
135 resizeEvent( NULL ); 135 resizeEvent( NULL );
136 136
137 setLength( mediaPlayerState.length() ); 137 setLength( mediaPlayerState.length() );
138 setPosition( mediaPlayerState.position() ); 138 setPosition( mediaPlayerState.position() );
139 setFullscreen( mediaPlayerState.isFullscreen() ); 139 setFullscreen( mediaPlayerState.isFullscreen() );
140 setPlaying( mediaPlayerState.isPlaying() ); 140 setPlaying( mediaPlayerState.isPlaying() );
141} 141}
142 142
143 143
@@ -256,67 +256,67 @@ void VideoWidget::updateSlider( long i, long max ) {
256 } 256 }
257 } 257 }
258} 258}
259 259
260void VideoWidget::setToggleButton( int i, bool down ) { 260void VideoWidget::setToggleButton( int i, bool down ) {
261 if ( down != buttons[i].isDown ) { 261 if ( down != buttons[i].isDown ) {
262 toggleButton( i ); 262 toggleButton( i );
263 } 263 }
264} 264}
265 265
266void VideoWidget::toggleButton( int i ) { 266void VideoWidget::toggleButton( int i ) {
267 buttons[i].isDown = !buttons[i].isDown; 267 buttons[i].isDown = !buttons[i].isDown;
268 QPainter p(this); 268 QPainter p(this);
269 paintButton ( &p, i ); 269 paintButton ( &p, i );
270} 270}
271 271
272void VideoWidget::paintButton( QPainter *p, int i ) { 272void VideoWidget::paintButton( QPainter *p, int i ) {
273 273
274 if ( buttons[i].isDown ) { 274 if ( buttons[i].isDown ) {
275 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 275 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
276 } else { 276 } else {
277 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 277 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
278 } 278 }
279} 279}
280 280
281void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 281void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
282 for ( unsigned int i = 0; i < buttons.size(); i++ ) { 282 for ( unsigned int i = 0; i < buttons.size(); i++ ) {
283 if ( event->state() == QMouseEvent::LeftButton ) { 283 if ( event->state() == QMouseEvent::LeftButton ) {
284 // The test to see if the mouse click is inside the button or not 284 // The test to see if the mouse click is inside the button or not
285 int x = event->pos().x() - xoff; 285 int x = event->pos().x() - xoff;
286 int y = event->pos().y() - yoff; 286 int y = event->pos().y() - yoff;
287 287
288 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() 288 bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width()
289 && y < imgButtonMask.height() 289 && y < buttonMask.height()
290 && imgButtonMask.pixelIndex( x, y ) == i + 1 ); 290 && buttonMask.pixelIndex( x, y ) == i + 1 );
291 291
292 if ( isOnButton && !buttons[i].isHeld ) { 292 if ( isOnButton && !buttons[i].isHeld ) {
293 buttons[i].isHeld = TRUE; 293 buttons[i].isHeld = TRUE;
294 toggleButton(i); 294 toggleButton(i);
295 295
296 switch (i) { 296 switch (i) {
297 case VideoVolUp: 297 case VideoVolUp:
298 emit moreClicked(); 298 emit moreClicked();
299 return; 299 return;
300 case VideoVolDown: 300 case VideoVolDown:
301 emit lessClicked(); 301 emit lessClicked();
302 return; 302 return;
303 } 303 }
304 } else if ( !isOnButton && buttons[i].isHeld ) { 304 } else if ( !isOnButton && buttons[i].isHeld ) {
305 buttons[i].isHeld = FALSE; 305 buttons[i].isHeld = FALSE;
306 toggleButton(i); 306 toggleButton(i);
307 } 307 }
308 } else { 308 } else {
309 309
310 if ( buttons[i].isHeld ) { 310 if ( buttons[i].isHeld ) {
311 buttons[i].isHeld = FALSE; 311 buttons[i].isHeld = FALSE;
312 if ( !buttons[i].isToggle ) { 312 if ( !buttons[i].isToggle ) {
313 setToggleButton( i, FALSE ); 313 setToggleButton( i, FALSE );
314 } 314 }
315 315
316 switch(i) { 316 switch(i) {
317 317
318 case VideoPlay: { 318 case VideoPlay: {
319 if( mediaPlayerState.isPaused() ) { 319 if( mediaPlayerState.isPaused() ) {
320 setToggleButton( i, FALSE ); 320 setToggleButton( i, FALSE );
321 mediaPlayerState.setPaused( FALSE ); 321 mediaPlayerState.setPaused( FALSE );
322 return; 322 return;
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index f996803..a5500d7 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -71,58 +71,57 @@ public slots:
71 void makeVisible(); 71 void makeVisible();
72 void backToNormal(); 72 void backToNormal();
73 void setPosition( long ); 73 void setPosition( long );
74 74
75public: 75public:
76 virtual void setPlaying( bool b); 76 virtual void setPlaying( bool b);
77 virtual void setLength( long ); 77 virtual void setLength( long );
78 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 78 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
79 79
80signals: 80signals:
81 void moreClicked(); 81 void moreClicked();
82 void lessClicked(); 82 void lessClicked();
83 void moreReleased(); 83 void moreReleased();
84 void lessReleased(); 84 void lessReleased();
85 void sliderMoved( long ); 85 void sliderMoved( long );
86 void videoResized ( const QSize &s ); 86 void videoResized ( const QSize &s );
87 87
88protected: 88protected:
89 89
90 void resizeEvent( QResizeEvent * ); 90 void resizeEvent( QResizeEvent * );
91 void paintEvent( QPaintEvent *pe ); 91 void paintEvent( QPaintEvent *pe );
92 void showEvent( QShowEvent *se ); 92 void showEvent( QShowEvent *se );
93 void mouseMoveEvent( QMouseEvent *event ); 93 void mouseMoveEvent( QMouseEvent *event );
94 void mousePressEvent( QMouseEvent *event ); 94 void mousePressEvent( QMouseEvent *event );
95 void mouseReleaseEvent( QMouseEvent *event ); 95 void mouseReleaseEvent( QMouseEvent *event );
96 void keyReleaseEvent( QKeyEvent *e); 96 void keyReleaseEvent( QKeyEvent *e);
97 97
98private: 98private:
99// Ticker songInfo; 99// Ticker songInfo;
100 QPixmap pixBg; 100 QPixmap pixBg;
101 QImage imgUp; 101 QImage imgUp;
102 QImage imgDn; 102 QImage imgDn;
103 QImage imgButtonMask;
104 QBitmap *masks[7]; 103 QBitmap *masks[7];
105 QPixmap *buttonPixUp[7]; 104 QPixmap *buttonPixUp[7];
106 QPixmap *buttonPixDown[7]; 105 QPixmap *buttonPixDown[7];
107 QString skin; 106 QString skin;
108// QPixmap *pixmaps[4]; 107// QPixmap *pixmaps[4];
109 int xoff, yoff; 108 int xoff, yoff;
110 109
111 110
112 void paintButton( QPainter *p, int i ); 111 void paintButton( QPainter *p, int i );
113 void toggleButton( int ); 112 void toggleButton( int );
114 void setToggleButton( int, bool ); 113 void setToggleButton( int, bool );
115 114
116 QString backgroundPix; 115 QString backgroundPix;
117 QSlider *slider; 116 QSlider *slider;
118 QPixmap *pixmaps[3]; 117 QPixmap *pixmaps[3];
119 QImage *currentFrame; 118 QImage *currentFrame;
120 int scaledWidth; 119 int scaledWidth;
121 int scaledHeight; 120 int scaledHeight;
122 XineVideoWidget* videoFrame; 121 XineVideoWidget* videoFrame;
123}; 122};
124 123
125#endif // VIDEO_WIDGET_H 124#endif // VIDEO_WIDGET_H
126 125
127 126
128 127