-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 |
5 files changed, 15 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 5cc2814..553c56b 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -66,106 +66,106 @@ const MediaWidget::SkinButtonInfo skinInfo[] = | |||
66 | { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, | 66 | { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, |
67 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, | 67 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, |
68 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, | 68 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, |
69 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, | 69 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, |
70 | { MediaWidget::Back, "back", MediaWidget::NormalButton } | 70 | { MediaWidget::Back, "back", MediaWidget::NormalButton } |
71 | }; | 71 | }; |
72 | 72 | ||
73 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); | 73 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); |
74 | 74 | ||
75 | void changeTextColor( QWidget * w) { | 75 | void changeTextColor( QWidget * w) { |
76 | QPalette p = w->palette(); | 76 | QPalette p = w->palette(); |
77 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 77 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
78 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 78 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
79 | w->setPalette( p ); | 79 | w->setPalette( p ); |
80 | } | 80 | } |
81 | 81 | ||
82 | } | 82 | } |
83 | 83 | ||
84 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : | 84 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
85 | 85 | ||
86 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), | 86 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), |
87 | audioSliderBeingMoved( false ) | 87 | audioSliderBeingMoved( false ) |
88 | { | 88 | { |
89 | setCaption( tr("OpiePlayer") ); | 89 | setCaption( tr("OpiePlayer") ); |
90 | 90 | ||
91 | Config cfg("OpiePlayer"); | 91 | Config cfg("OpiePlayer"); |
92 | cfg.setGroup("Options"); | 92 | cfg.setGroup("Options"); |
93 | skin = cfg.readEntry("Skin","default"); | 93 | skin = cfg.readEntry("Skin","default"); |
94 | //skin = "scaleTest"; | 94 | //skin = "scaleTest"; |
95 | // color of background, frame, degree of transparency | 95 | // color of background, frame, degree of transparency |
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 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
99 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 99 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
100 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 100 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
101 | 101 | ||
102 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 102 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
103 | buttonMask.fill( 0 ); | 103 | buttonMask.fill( 0 ); |
104 | 104 | ||
105 | for ( uint i = 0; i < buttonCount; i++ ) { | 105 | for ( uint i = 0; i < buttonCount; i++ ) { |
106 | Button button; | 106 | Button button; |
107 | button.type = skinInfo[ i ].type; | 107 | button.type = skinInfo[ i ].type; |
108 | 108 | ||
109 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); | 109 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); |
110 | button.mask =QBitmap( filename ); | 110 | button.mask =QBitmap( filename ); |
111 | 111 | ||
112 | if ( !button.mask.isNull() ) { | 112 | if ( !button.mask.isNull() ) { |
113 | QImage imgMask = button.mask.convertToImage(); | 113 | QImage imgMask = button.mask.convertToImage(); |
114 | uchar **dest = buttonMask.jumpTable(); | 114 | uchar **dest = buttonMask.jumpTable(); |
115 | for ( int y = 0; y < imgUp.height(); y++ ) { | 115 | for ( int y = 0; y < imgUp.height(); y++ ) { |
116 | uchar *line = dest[y]; | 116 | uchar *line = dest[y]; |
117 | for ( int x = 0; x < imgUp.width(); x++ ) | 117 | for ( int x = 0; x < imgUp.width(); x++ ) |
118 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 118 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
119 | line[x] = i + 1; | 119 | line[x] = i + 1; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | buttons.insert( i, button ); | 123 | buttons.insert( i, button ); |
124 | } | 124 | } |
125 | 125 | ||
126 | setBackgroundPixmap( pixBg ); | 126 | setBackgroundPixmap( backgroundPixmap ); |
127 | 127 | ||
128 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 128 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
129 | // changeTextColor( &songInfo ); | 129 | // changeTextColor( &songInfo ); |
130 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 130 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
131 | // songInfo.setFrameStyle( QFrame::NoFrame); | 131 | // songInfo.setFrameStyle( QFrame::NoFrame); |
132 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 132 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
133 | // songInfo.setForegroundColor(Qt::white); | 133 | // songInfo.setForegroundColor(Qt::white); |
134 | 134 | ||
135 | slider.setFixedHeight( 20 ); | 135 | slider.setFixedHeight( 20 ); |
136 | slider.setMinValue( 0 ); | 136 | slider.setMinValue( 0 ); |
137 | slider.setMaxValue( 1 ); | 137 | slider.setMaxValue( 1 ); |
138 | slider.setFocusPolicy( QWidget::NoFocus ); | 138 | slider.setFocusPolicy( QWidget::NoFocus ); |
139 | slider.setBackgroundPixmap( pixBg ); | 139 | slider.setBackgroundPixmap( backgroundPixmap ); |
140 | 140 | ||
141 | // Config cofg("qpe"); | 141 | // Config cofg("qpe"); |
142 | // cofg.setGroup("Appearance"); | 142 | // cofg.setGroup("Appearance"); |
143 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | 143 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); |
144 | 144 | ||
145 | time.setFocusPolicy( QWidget::NoFocus ); | 145 | time.setFocusPolicy( QWidget::NoFocus ); |
146 | time.setAlignment( Qt::AlignCenter ); | 146 | time.setAlignment( Qt::AlignCenter ); |
147 | 147 | ||
148 | // time.setFrame(FALSE); | 148 | // time.setFrame(FALSE); |
149 | // changeTextColor( &time ); | 149 | // changeTextColor( &time ); |
150 | 150 | ||
151 | resizeEvent( NULL ); | 151 | resizeEvent( NULL ); |
152 | 152 | ||
153 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 153 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
154 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 154 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
155 | 155 | ||
156 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 156 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
157 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 157 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
158 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 158 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
159 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 159 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
160 | 160 | ||
161 | // Intialise state | 161 | // Intialise state |
162 | setLength( mediaPlayerState.length() ); | 162 | setLength( mediaPlayerState.length() ); |
163 | setPosition( mediaPlayerState.position() ); | 163 | setPosition( mediaPlayerState.position() ); |
164 | setLooping( mediaPlayerState.isFullscreen() ); | 164 | setLooping( mediaPlayerState.isFullscreen() ); |
165 | // setPaused( mediaPlayerState->paused() ); | 165 | // setPaused( mediaPlayerState->paused() ); |
166 | setPlaying( mediaPlayerState.isPlaying() ); | 166 | setPlaying( mediaPlayerState.isPlaying() ); |
167 | 167 | ||
168 | } | 168 | } |
169 | 169 | ||
170 | AudioWidget::~AudioWidget() { | 170 | AudioWidget::~AudioWidget() { |
171 | 171 | ||
@@ -176,66 +176,66 @@ namespace { | |||
176 | 176 | ||
177 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 177 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
178 | QPixmap pix( img.width(), img.height() ); | 178 | QPixmap pix( img.width(), img.height() ); |
179 | QPainter p( &pix ); | 179 | QPainter p( &pix ); |
180 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 180 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
181 | p.drawImage( 0, 0, img ); | 181 | p.drawImage( 0, 0, img ); |
182 | return pix; | 182 | return pix; |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
186 | QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { | 186 | QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { |
187 | QPixmap pixmap( pix ); | 187 | QPixmap pixmap( pix ); |
188 | pixmap.setMask( mask ); | 188 | pixmap.setMask( mask ); |
189 | return pixmap; | 189 | return pixmap; |
190 | } | 190 | } |
191 | 191 | ||
192 | }; | 192 | }; |
193 | 193 | ||
194 | void AudioWidget::resizeEvent( QResizeEvent * ) { | 194 | void AudioWidget::resizeEvent( QResizeEvent * ) { |
195 | int h = height(); | 195 | int h = height(); |
196 | int w = width(); | 196 | int w = width(); |
197 | 197 | ||
198 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 198 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
199 | slider.setFixedWidth( w - 110 ); | 199 | slider.setFixedWidth( w - 110 ); |
200 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 200 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
201 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 201 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
202 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 202 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
203 | 203 | ||
204 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; | 204 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; |
205 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; | 205 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; |
206 | QPoint p = upperLeftOfButtonMask; | 206 | QPoint p = upperLeftOfButtonMask; |
207 | 207 | ||
208 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); | 208 | QPixmap pixUp = combineImageWithBackground( imgUp, backgroundPixmap, p ); |
209 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); | 209 | QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p ); |
210 | 210 | ||
211 | for ( uint i = 0; i < buttons.count(); i++ ) { | 211 | for ( uint i = 0; i < buttons.count(); i++ ) { |
212 | if ( !buttons[i].mask.isNull() ) { | 212 | if ( !buttons[i].mask.isNull() ) { |
213 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); | 213 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); |
214 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); | 214 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | void AudioWidget::sliderPressed() { | 219 | void AudioWidget::sliderPressed() { |
220 | audioSliderBeingMoved = TRUE; | 220 | audioSliderBeingMoved = TRUE; |
221 | } | 221 | } |
222 | 222 | ||
223 | 223 | ||
224 | void AudioWidget::sliderReleased() { | 224 | void AudioWidget::sliderReleased() { |
225 | audioSliderBeingMoved = FALSE; | 225 | audioSliderBeingMoved = FALSE; |
226 | if ( slider.width() == 0 ) | 226 | if ( slider.width() == 0 ) |
227 | return; | 227 | return; |
228 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); | 228 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
229 | mediaPlayerState.setPosition( val ); | 229 | mediaPlayerState.setPosition( val ); |
230 | } | 230 | } |
231 | 231 | ||
232 | void AudioWidget::setPosition( long i ) { | 232 | void AudioWidget::setPosition( long i ) { |
233 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 233 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
234 | updateSlider( i, mediaPlayerState.length() ); | 234 | updateSlider( i, mediaPlayerState.length() ); |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | void AudioWidget::setLength( long max ) { | 238 | void AudioWidget::setLength( long max ) { |
239 | updateSlider( mediaPlayerState.position(), max ); | 239 | updateSlider( mediaPlayerState.position(), max ); |
240 | } | 240 | } |
241 | 241 | ||
@@ -375,65 +375,65 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
375 | setToggleButton( i, FALSE ); | 375 | setToggleButton( i, FALSE ); |
376 | } | 376 | } |
377 | qDebug("mouseEvent %d", i); | 377 | qDebug("mouseEvent %d", i); |
378 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); | 378 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); |
379 | } | 379 | } |
380 | } | 380 | } |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
384 | 384 | ||
385 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 385 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
386 | mouseMoveEvent( event ); | 386 | mouseMoveEvent( event ); |
387 | } | 387 | } |
388 | 388 | ||
389 | 389 | ||
390 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 390 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
391 | mouseMoveEvent( event ); | 391 | mouseMoveEvent( event ); |
392 | } | 392 | } |
393 | 393 | ||
394 | 394 | ||
395 | void AudioWidget::showEvent( QShowEvent* ) { | 395 | void AudioWidget::showEvent( QShowEvent* ) { |
396 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 396 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
397 | mouseMoveEvent( &event ); | 397 | mouseMoveEvent( &event ); |
398 | } | 398 | } |
399 | 399 | ||
400 | 400 | ||
401 | void AudioWidget::paintEvent( QPaintEvent * pe ) { | 401 | void AudioWidget::paintEvent( QPaintEvent * pe ) { |
402 | if ( !pe->erased() ) { | 402 | if ( !pe->erased() ) { |
403 | // Combine with background and double buffer | 403 | // Combine with background and double buffer |
404 | QPixmap pix( pe->rect().size() ); | 404 | QPixmap pix( pe->rect().size() ); |
405 | QPainter p( &pix ); | 405 | QPainter p( &pix ); |
406 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 406 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
407 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 407 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); |
408 | for ( unsigned int i = 0; i < buttons.count(); i++ ) | 408 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
409 | paintButton( p, buttons[ i ] ); | 409 | paintButton( p, buttons[ i ] ); |
410 | QPainter p2( this ); | 410 | QPainter p2( this ); |
411 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 411 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
412 | } else { | 412 | } else { |
413 | QPainter p( this ); | 413 | QPainter p( this ); |
414 | for ( unsigned int i = 0; i < buttons.count(); i++ ) | 414 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
415 | paintButton( p, buttons[ i ] ); | 415 | paintButton( p, buttons[ i ] ); |
416 | } | 416 | } |
417 | } | 417 | } |
418 | 418 | ||
419 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | 419 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
420 | switch ( e->key() ) { | 420 | switch ( e->key() ) { |
421 | ////////////////////////////// Zaurus keys | 421 | ////////////////////////////// Zaurus keys |
422 | case Key_Home: | 422 | case Key_Home: |
423 | break; | 423 | break; |
424 | case Key_F9: //activity | 424 | case Key_F9: //activity |
425 | hide(); | 425 | hide(); |
426 | // qDebug("Audio F9"); | 426 | // qDebug("Audio F9"); |
427 | break; | 427 | break; |
428 | case Key_F10: //contacts | 428 | case Key_F10: //contacts |
429 | break; | 429 | break; |
430 | case Key_F11: //menu | 430 | case Key_F11: //menu |
431 | mediaPlayerState.toggleBlank(); | 431 | mediaPlayerState.toggleBlank(); |
432 | break; | 432 | break; |
433 | case Key_F12: //home | 433 | case Key_F12: //home |
434 | break; | 434 | break; |
435 | case Key_F13: //mail | 435 | case Key_F13: //mail |
436 | mediaPlayerState.toggleBlank(); | 436 | mediaPlayerState.toggleBlank(); |
437 | break; | 437 | break; |
438 | case Key_Space: { | 438 | case Key_Space: { |
439 | mediaPlayerState.togglePaused(); | 439 | mediaPlayerState.togglePaused(); |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 7a775cd..69837cd 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -65,46 +65,45 @@ public slots: | |||
65 | 65 | ||
66 | public: | 66 | public: |
67 | virtual void setLength( long ); | 67 | virtual void setLength( long ); |
68 | virtual void setPlaying( bool b) { setToggleButton( Play, b ); } | 68 | virtual void setPlaying( bool b) { setToggleButton( Play, b ); } |
69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | 69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); |
70 | 70 | ||
71 | signals: | 71 | signals: |
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 | ||
78 | protected: | 78 | protected: |
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); |
89 | private slots: | 89 | private slots: |
90 | void skipFor(); | 90 | void skipFor(); |
91 | void skipBack(); | 91 | void skipBack(); |
92 | void stopSkip(); | 92 | void stopSkip(); |
93 | private: | 93 | private: |
94 | void setToggleButton( int, bool ); | 94 | void setToggleButton( int, bool ); |
95 | int skipDirection; | 95 | int skipDirection; |
96 | QString skin; | 96 | QString skin; |
97 | QPixmap pixBg; | ||
98 | QImage imgUp; | 97 | QImage imgUp; |
99 | QImage imgDn; | 98 | QImage imgDn; |
100 | 99 | ||
101 | OTicker songInfo; | 100 | OTicker songInfo; |
102 | QSlider slider; | 101 | QSlider slider; |
103 | QLineEdit time; | 102 | QLineEdit time; |
104 | bool isStreaming : 1; | 103 | bool isStreaming : 1; |
105 | bool audioSliderBeingMoved : 1; | 104 | bool audioSliderBeingMoved : 1; |
106 | }; | 105 | }; |
107 | 106 | ||
108 | 107 | ||
109 | #endif // AUDIO_WIDGET_H | 108 | #endif // AUDIO_WIDGET_H |
110 | 109 | ||
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 163f449..211e56c 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -69,37 +69,39 @@ public: | |||
69 | 69 | ||
70 | public slots: | 70 | public slots: |
71 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 71 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
72 | virtual void setLength( long length ) = 0; | 72 | virtual void setLength( long length ) = 0; |
73 | virtual void setPlaying( bool playing ) = 0; | 73 | virtual void setPlaying( bool playing ) = 0; |
74 | 74 | ||
75 | signals: | 75 | signals: |
76 | void moreReleased(); | 76 | void moreReleased(); |
77 | void lessReleased(); | 77 | void lessReleased(); |
78 | void forwardReleased(); | 78 | void forwardReleased(); |
79 | void backReleased(); | 79 | void backReleased(); |
80 | 80 | ||
81 | protected: | 81 | protected: |
82 | virtual void closeEvent( QCloseEvent * ); | 82 | virtual void closeEvent( QCloseEvent * ); |
83 | 83 | ||
84 | void handleCommand( Command command, bool buttonDown ); | 84 | void handleCommand( Command command, bool buttonDown ); |
85 | 85 | ||
86 | bool isOverButton( const QPoint &position, int buttonId ) const; | 86 | bool isOverButton( const QPoint &position, int buttonId ) const; |
87 | 87 | ||
88 | void paintButton( int buttonId ); | 88 | void paintButton( int buttonId ); |
89 | void paintButton( QPainter &p, const Button &button ); | 89 | void paintButton( QPainter &p, const Button &button ); |
90 | 90 | ||
91 | void toggleButton( int buttonId ); | 91 | void toggleButton( int buttonId ); |
92 | 92 | ||
93 | MediaPlayerState &mediaPlayerState; | 93 | MediaPlayerState &mediaPlayerState; |
94 | PlayListWidget &playList; | 94 | PlayListWidget &playList; |
95 | 95 | ||
96 | ButtonMap buttons; | 96 | ButtonMap buttons; |
97 | 97 | ||
98 | QImage buttonMask; | 98 | QImage buttonMask; |
99 | 99 | ||
100 | QPoint upperLeftOfButtonMask; | 100 | QPoint upperLeftOfButtonMask; |
101 | |||
102 | QPixmap backgroundPixmap; | ||
101 | }; | 103 | }; |
102 | 104 | ||
103 | #endif // MEDIAWIDGET_H | 105 | #endif // MEDIAWIDGET_H |
104 | /* vim: et sw=4 ts=4 | 106 | /* vim: et sw=4 ts=4 |
105 | */ | 107 | */ |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index a483434..a8bf252 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -63,146 +63,146 @@ const char * const skinV_mask_file_names[7] = { | |||
63 | "play","stop","fwd","back","up","down","full" | 63 | "play","stop","fwd","back","up","down","full" |
64 | }; | 64 | }; |
65 | 65 | ||
66 | } | 66 | } |
67 | 67 | ||
68 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 68 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
69 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) | 69 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) |
70 | { | 70 | { |
71 | setCaption( tr("OpiePlayer - Video") ); | 71 | setCaption( tr("OpiePlayer - Video") ); |
72 | 72 | ||
73 | Button defaultButton; | 73 | Button defaultButton; |
74 | Button toggleButton = defaultButton; | 74 | Button toggleButton = defaultButton; |
75 | toggleButton.type = ToggleButton; | 75 | toggleButton.type = ToggleButton; |
76 | 76 | ||
77 | buttons.insert( 0, toggleButton ); // play | 77 | buttons.insert( 0, toggleButton ); // play |
78 | buttons.insert( 1, toggleButton ); // stop | 78 | buttons.insert( 1, toggleButton ); // stop |
79 | buttons.insert( 2, toggleButton ); // next | 79 | buttons.insert( 2, toggleButton ); // next |
80 | buttons.insert( 3, toggleButton ); // previous | 80 | buttons.insert( 3, toggleButton ); // previous |
81 | buttons.insert( 4, toggleButton ); // volUp | 81 | buttons.insert( 4, toggleButton ); // volUp |
82 | buttons.insert( 5, toggleButton ); // volDown | 82 | buttons.insert( 5, toggleButton ); // volDown |
83 | buttons.insert( 6, toggleButton ); // fullscreen | 83 | buttons.insert( 6, toggleButton ); // fullscreen |
84 | 84 | ||
85 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 85 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
86 | 86 | ||
87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
88 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 88 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
89 | 89 | ||
90 | Config cfg("OpiePlayer"); | 90 | Config cfg("OpiePlayer"); |
91 | cfg.setGroup("Options"); | 91 | cfg.setGroup("Options"); |
92 | skin = cfg.readEntry("Skin","default"); | 92 | skin = cfg.readEntry("Skin","default"); |
93 | 93 | ||
94 | QString skinPath = "opieplayer2/skins/" + skin; | 94 | QString skinPath = "opieplayer2/skins/" + skin; |
95 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 95 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
96 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 96 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
97 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 97 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
98 | 98 | ||
99 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 99 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
100 | buttonMask.fill( 0 ); | 100 | buttonMask.fill( 0 ); |
101 | 101 | ||
102 | for ( int i = 0; i < 7; i++ ) { | 102 | for ( int i = 0; i < 7; i++ ) { |
103 | Button &button = buttons[ i ]; | 103 | Button &button = buttons[ i ]; |
104 | 104 | ||
105 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 105 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
106 | button.mask = QBitmap( filename ); | 106 | button.mask = QBitmap( filename ); |
107 | 107 | ||
108 | if ( !button.mask.isNull() ) { | 108 | if ( !button.mask.isNull() ) { |
109 | QImage imgMask = button.mask.convertToImage(); | 109 | QImage imgMask = button.mask.convertToImage(); |
110 | uchar **dest = buttonMask.jumpTable(); | 110 | uchar **dest = buttonMask.jumpTable(); |
111 | for ( int y = 0; y < imgUp.height(); y++ ) { | 111 | for ( int y = 0; y < imgUp.height(); y++ ) { |
112 | uchar *line = dest[y]; | 112 | uchar *line = dest[y]; |
113 | for ( int x = 0; x < imgUp.width(); x++ ) { | 113 | for ( int x = 0; x < imgUp.width(); x++ ) { |
114 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 114 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
115 | line[x] = i + 1; | 115 | line[x] = i + 1; |
116 | } | 116 | } |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | setBackgroundPixmap( pixBg ); | 121 | setBackgroundPixmap( backgroundPixmap ); |
122 | 122 | ||
123 | slider = new QSlider( Qt::Horizontal, this ); | 123 | slider = new QSlider( Qt::Horizontal, this ); |
124 | slider->setMinValue( 0 ); | 124 | slider->setMinValue( 0 ); |
125 | slider->setMaxValue( 1 ); | 125 | slider->setMaxValue( 1 ); |
126 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 126 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
127 | //slider->setFocusPolicy( QWidget::NoFocus ); | 127 | //slider->setFocusPolicy( QWidget::NoFocus ); |
128 | 128 | ||
129 | resizeEvent( NULL ); | 129 | resizeEvent( NULL ); |
130 | 130 | ||
131 | setLength( mediaPlayerState.length() ); | 131 | setLength( mediaPlayerState.length() ); |
132 | setPosition( mediaPlayerState.position() ); | 132 | setPosition( mediaPlayerState.position() ); |
133 | setFullscreen( mediaPlayerState.isFullscreen() ); | 133 | setFullscreen( mediaPlayerState.isFullscreen() ); |
134 | setPlaying( mediaPlayerState.isPlaying() ); | 134 | setPlaying( mediaPlayerState.isPlaying() ); |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | VideoWidget::~VideoWidget() | 138 | VideoWidget::~VideoWidget() |
139 | { | 139 | { |
140 | } | 140 | } |
141 | 141 | ||
142 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 142 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
143 | QPixmap pix( img.width(), img.height() ); | 143 | QPixmap pix( img.width(), img.height() ); |
144 | QPainter p( &pix ); | 144 | QPainter p( &pix ); |
145 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 145 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
146 | p.drawImage( 0, 0, img ); | 146 | p.drawImage( 0, 0, img ); |
147 | return new QPixmap( pix ); | 147 | return new QPixmap( pix ); |
148 | } | 148 | } |
149 | 149 | ||
150 | QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { | 150 | QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { |
151 | QPixmap pixmap( pix ); | 151 | QPixmap pixmap( pix ); |
152 | pixmap.setMask( mask ); | 152 | pixmap.setMask( mask ); |
153 | return pixmap; | 153 | return pixmap; |
154 | } | 154 | } |
155 | 155 | ||
156 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 156 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
157 | int h = height(); | 157 | int h = height(); |
158 | int w = width(); | 158 | int w = width(); |
159 | //int Vh = 160; | 159 | //int Vh = 160; |
160 | //int Vw = 220; | 160 | //int Vw = 220; |
161 | 161 | ||
162 | slider->setFixedWidth( w - 20 ); | 162 | slider->setFixedWidth( w - 20 ); |
163 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 163 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
164 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 164 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
165 | slider->setFocusPolicy( QWidget::NoFocus ); | 165 | slider->setFocusPolicy( QWidget::NoFocus ); |
166 | slider->setBackgroundPixmap( pixBg ); | 166 | slider->setBackgroundPixmap( backgroundPixmap ); |
167 | 167 | ||
168 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; | 168 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; |
169 | if(w>h) | 169 | if(w>h) |
170 | upperLeftOfButtonMask.ry() = 0; | 170 | upperLeftOfButtonMask.ry() = 0; |
171 | else | 171 | else |
172 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 172 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
173 | QPoint p = upperLeftOfButtonMask; | 173 | QPoint p = upperLeftOfButtonMask; |
174 | 174 | ||
175 | QPixmap *pixUp = combineVImageWithBackground( imgUp, pixBg, p ); | 175 | QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); |
176 | QPixmap *pixDn = combineVImageWithBackground( imgDn, pixBg, p ); | 176 | QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); |
177 | 177 | ||
178 | for ( int i = 0; i < 7; i++ ) { | 178 | for ( int i = 0; i < 7; i++ ) { |
179 | Button &button = buttons[ i ]; | 179 | Button &button = buttons[ i ]; |
180 | 180 | ||
181 | if ( !button.mask.isNull() ) { | 181 | if ( !button.mask.isNull() ) { |
182 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); | 182 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); |
183 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); | 183 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | delete pixUp; | 187 | delete pixUp; |
188 | delete pixDn; | 188 | delete pixDn; |
189 | } | 189 | } |
190 | 190 | ||
191 | static bool videoSliderBeingMoved = FALSE; | 191 | static bool videoSliderBeingMoved = FALSE; |
192 | 192 | ||
193 | void VideoWidget::sliderPressed() { | 193 | void VideoWidget::sliderPressed() { |
194 | videoSliderBeingMoved = TRUE; | 194 | videoSliderBeingMoved = TRUE; |
195 | } | 195 | } |
196 | 196 | ||
197 | void VideoWidget::sliderReleased() { | 197 | void VideoWidget::sliderReleased() { |
198 | videoSliderBeingMoved = FALSE; | 198 | videoSliderBeingMoved = FALSE; |
199 | if ( slider->width() == 0 ) { | 199 | if ( slider->width() == 0 ) { |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); | 202 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); |
203 | mediaPlayerState.setPosition( val ); | 203 | mediaPlayerState.setPosition( val ); |
204 | } | 204 | } |
205 | 205 | ||
206 | void VideoWidget::setPosition( long i ) { | 206 | void VideoWidget::setPosition( long i ) { |
207 | updateSlider( i, mediaPlayerState.length() ); | 207 | updateSlider( i, mediaPlayerState.length() ); |
208 | } | 208 | } |
@@ -316,110 +316,110 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | |||
316 | makeVisible(); | 316 | makeVisible(); |
317 | } | 317 | } |
318 | mouseMoveEvent( event ); | 318 | mouseMoveEvent( event ); |
319 | } | 319 | } |
320 | 320 | ||
321 | void VideoWidget::showEvent( QShowEvent* ) { | 321 | void VideoWidget::showEvent( QShowEvent* ) { |
322 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 322 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
323 | mouseMoveEvent( &event ); | 323 | mouseMoveEvent( &event ); |
324 | } | 324 | } |
325 | 325 | ||
326 | 326 | ||
327 | void VideoWidget::backToNormal() { | 327 | void VideoWidget::backToNormal() { |
328 | mediaPlayerState.setFullscreen( FALSE ); | 328 | mediaPlayerState.setFullscreen( FALSE ); |
329 | makeVisible(); | 329 | makeVisible(); |
330 | } | 330 | } |
331 | 331 | ||
332 | void VideoWidget::makeVisible() { | 332 | void VideoWidget::makeVisible() { |
333 | if ( mediaPlayerState.isFullscreen() ) { | 333 | if ( mediaPlayerState.isFullscreen() ) { |
334 | setBackgroundMode( QWidget::NoBackground ); | 334 | setBackgroundMode( QWidget::NoBackground ); |
335 | showFullScreen(); | 335 | showFullScreen(); |
336 | resize( qApp->desktop()->size() ); | 336 | resize( qApp->desktop()->size() ); |
337 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 337 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
338 | 338 | ||
339 | slider->hide(); | 339 | slider->hide(); |
340 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 340 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
341 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 341 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
342 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 342 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
343 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 343 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
344 | 344 | ||
345 | } else { | 345 | } else { |
346 | showNormal(); | 346 | showNormal(); |
347 | showMaximized(); | 347 | showMaximized(); |
348 | setBackgroundPixmap( pixBg ); | 348 | setBackgroundPixmap( backgroundPixmap ); |
349 | QWidget *d = QApplication::desktop(); | 349 | QWidget *d = QApplication::desktop(); |
350 | int w = d->width(); | 350 | int w = d->width(); |
351 | int h = d->height(); | 351 | int h = d->height(); |
352 | 352 | ||
353 | if(w>h) { | 353 | if(w>h) { |
354 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 354 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
355 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 355 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
356 | } else { | 356 | } else { |
357 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 357 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
358 | } | 358 | } |
359 | 359 | ||
360 | if ( !mediaPlayerState.isSeekable() ) { | 360 | if ( !mediaPlayerState.isSeekable() ) { |
361 | if( !slider->isHidden()) { | 361 | if( !slider->isHidden()) { |
362 | slider->hide(); | 362 | slider->hide(); |
363 | } | 363 | } |
364 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 364 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
365 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 365 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
366 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 366 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
367 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 367 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
368 | } else { | 368 | } else { |
369 | slider->show(); | 369 | slider->show(); |
370 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 370 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
371 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 371 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
372 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 372 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
373 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 373 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
374 | } | 374 | } |
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
378 | 378 | ||
379 | 379 | ||
380 | 380 | ||
381 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 381 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
382 | QPainter p( this ); | 382 | QPainter p( this ); |
383 | 383 | ||
384 | if ( mediaPlayerState.isFullscreen() ) { | 384 | if ( mediaPlayerState.isFullscreen() ) { |
385 | // Clear the background | 385 | // Clear the background |
386 | p.setBrush( QBrush( Qt::black ) ); | 386 | p.setBrush( QBrush( Qt::black ) ); |
387 | } else { | 387 | } else { |
388 | if ( !pe->erased() ) { | 388 | if ( !pe->erased() ) { |
389 | // Combine with background and double buffer | 389 | // Combine with background and double buffer |
390 | QPixmap pix( pe->rect().size() ); | 390 | QPixmap pix( pe->rect().size() ); |
391 | QPainter p( &pix ); | 391 | QPainter p( &pix ); |
392 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 392 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
393 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 393 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); |
394 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { | 394 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
395 | paintButton( p, buttons[ i ] ); | 395 | paintButton( p, buttons[ i ] ); |
396 | } | 396 | } |
397 | QPainter p2( this ); | 397 | QPainter p2( this ); |
398 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 398 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
399 | } else { | 399 | } else { |
400 | QPainter p( this ); | 400 | QPainter p( this ); |
401 | for ( unsigned int i = 0; i < buttons.count(); i++ ) | 401 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
402 | paintButton( p, buttons[ i ] ); | 402 | paintButton( p, buttons[ i ] ); |
403 | } | 403 | } |
404 | //slider->repaint( TRUE ); | 404 | //slider->repaint( TRUE ); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | 407 | ||
408 | 408 | ||
409 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 409 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
410 | switch ( e->key() ) { | 410 | switch ( e->key() ) { |
411 | ////////////////////////////// Zaurus keys | 411 | ////////////////////////////// Zaurus keys |
412 | case Key_Home: | 412 | case Key_Home: |
413 | break; | 413 | break; |
414 | case Key_F9: //activity | 414 | case Key_F9: //activity |
415 | break; | 415 | break; |
416 | case Key_F10: //contacts | 416 | case Key_F10: //contacts |
417 | // hide(); | 417 | // hide(); |
418 | break; | 418 | break; |
419 | case Key_F11: //menu | 419 | case Key_F11: //menu |
420 | break; | 420 | break; |
421 | case Key_F12: //home | 421 | case Key_F12: //home |
422 | break; | 422 | break; |
423 | case Key_F13: //mail | 423 | case Key_F13: //mail |
424 | break; | 424 | break; |
425 | case Key_Space: { | 425 | case Key_Space: { |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index a271120..9d5239b 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -68,52 +68,51 @@ public slots: | |||
68 | void sliderPressed( ); | 68 | void sliderPressed( ); |
69 | void sliderReleased( ); | 69 | void sliderReleased( ); |
70 | void setFullscreen( bool b ); | 70 | void setFullscreen( bool b ); |
71 | void makeVisible(); | 71 | void makeVisible(); |
72 | void backToNormal(); | 72 | void backToNormal(); |
73 | void setPosition( long ); | 73 | void setPosition( long ); |
74 | 74 | ||
75 | public: | 75 | public: |
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 | ||
80 | signals: | 80 | signals: |
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 | ||
88 | protected: | 88 | protected: |
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 | ||
98 | private: | 98 | private: |
99 | // Ticker songInfo; | 99 | // Ticker songInfo; |
100 | QPixmap pixBg; | ||
101 | QImage imgUp; | 100 | QImage imgUp; |
102 | QImage imgDn; | 101 | QImage imgDn; |
103 | QString skin; | 102 | QString skin; |
104 | 103 | ||
105 | 104 | ||
106 | void setToggleButton( int, bool ); | 105 | void setToggleButton( int, bool ); |
107 | 106 | ||
108 | QString backgroundPix; | 107 | QString backgroundPix; |
109 | QSlider *slider; | 108 | QSlider *slider; |
110 | QImage *currentFrame; | 109 | QImage *currentFrame; |
111 | int scaledWidth; | 110 | int scaledWidth; |
112 | int scaledHeight; | 111 | int scaledHeight; |
113 | XineVideoWidget* videoFrame; | 112 | XineVideoWidget* videoFrame; |
114 | }; | 113 | }; |
115 | 114 | ||
116 | #endif // VIDEO_WIDGET_H | 115 | #endif // VIDEO_WIDGET_H |
117 | 116 | ||
118 | 117 | ||
119 | 118 | ||