author | simon <simon> | 2002-12-09 16:39:32 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 16:39:32 (UTC) |
commit | 1bb6aa52f2db85f65f75278310c328218caeae65 (patch) (unidiff) | |
tree | 1983547bac0da80bde93554038a57713feb715c1 /noncore/multimedia/opieplayer2/mediawidget.cpp | |
parent | 1ae041fba55e218a2523de441bec6ec3a1eecf02 (diff) | |
download | opie-1bb6aa52f2db85f65f75278310c328218caeae65.zip opie-1bb6aa52f2db85f65f75278310c328218caeae65.tar.gz opie-1bb6aa52f2db85f65f75278310c328218caeae65.tar.bz2 |
- removing duplicated code in VideoWidget
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediawidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index c0ebd63..7eb75e6 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -48,61 +48,66 @@ void MediaWidget::paintEvent( QPaintEvent *pe ) | |||
48 | { | 48 | { |
49 | QPainter p( this ); | 49 | QPainter p( this ); |
50 | 50 | ||
51 | if ( mediaPlayerState.isFullscreen() ) { | 51 | if ( mediaPlayerState.isFullscreen() ) { |
52 | // Clear the background | 52 | // Clear the background |
53 | p.setBrush( QBrush( Qt::black ) ); | 53 | p.setBrush( QBrush( Qt::black ) ); |
54 | return; | 54 | return; |
55 | } | 55 | } |
56 | 56 | ||
57 | if ( !pe->erased() ) { | 57 | if ( !pe->erased() ) { |
58 | // Combine with background and double buffer | 58 | // Combine with background and double buffer |
59 | QPixmap pix( pe->rect().size() ); | 59 | QPixmap pix( pe->rect().size() ); |
60 | QPainter p( &pix ); | 60 | QPainter p( &pix ); |
61 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 61 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
62 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); | 62 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); |
63 | paintAllButtons( p ); | 63 | paintAllButtons( p ); |
64 | QPainter p2( this ); | 64 | QPainter p2( this ); |
65 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 65 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
66 | } else { | 66 | } else { |
67 | QPainter p( this ); | 67 | QPainter p( this ); |
68 | paintAllButtons( p ); | 68 | paintAllButtons( p ); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | void MediaWidget::makeVisible() | ||
73 | { | ||
74 | } | ||
75 | |||
72 | void MediaWidget::handleCommand( Command command, bool buttonDown ) | 76 | void MediaWidget::handleCommand( Command command, bool buttonDown ) |
73 | { | 77 | { |
74 | switch ( command ) { | 78 | switch ( command ) { |
75 | case Play: mediaPlayerState.togglePaused(); | 79 | case Play: mediaPlayerState.togglePaused(); |
76 | case Stop: mediaPlayerState.setPlaying(FALSE); return; | 80 | case Stop: mediaPlayerState.setPlaying(FALSE); return; |
77 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 81 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
78 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 82 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
79 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; | 83 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; |
80 | case VolumeUp: emit moreReleased(); return; | 84 | case VolumeUp: emit moreReleased(); return; |
81 | case VolumeDown: emit lessReleased(); return; | 85 | case VolumeDown: emit lessReleased(); return; |
82 | case PlayList: mediaPlayerState.setList(); return; | 86 | case PlayList: mediaPlayerState.setList(); return; |
83 | case Forward: emit forwardReleased(); return; | 87 | case Forward: emit forwardReleased(); return; |
84 | case Back: emit backReleased(); return; | 88 | case Back: emit backReleased(); return; |
89 | case FullScreen: mediaPlayerState.setFullscreen( true ); makeVisible(); return; | ||
85 | default: assert( false ); | 90 | default: assert( false ); |
86 | } | 91 | } |
87 | } | 92 | } |
88 | 93 | ||
89 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const | 94 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const |
90 | { | 95 | { |
91 | return ( position.x() > 0 && position.y() > 0 && | 96 | return ( position.x() > 0 && position.y() > 0 && |
92 | position.x() < buttonMask.width() && | 97 | position.x() < buttonMask.width() && |
93 | position.y() < buttonMask.height() && | 98 | position.y() < buttonMask.height() && |
94 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); | 99 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); |
95 | } | 100 | } |
96 | 101 | ||
97 | void MediaWidget::paintAllButtons( QPainter &p ) | 102 | void MediaWidget::paintAllButtons( QPainter &p ) |
98 | { | 103 | { |
99 | for ( ButtonVector::const_iterator it = buttons.begin(); | 104 | for ( ButtonVector::const_iterator it = buttons.begin(); |
100 | it != buttons.end(); ++it ) | 105 | it != buttons.end(); ++it ) |
101 | paintButton( p, *it ); | 106 | paintButton( p, *it ); |
102 | } | 107 | } |
103 | 108 | ||
104 | void MediaWidget::paintButton( const Button &button ) | 109 | void MediaWidget::paintButton( const Button &button ) |
105 | { | 110 | { |
106 | QPainter p( this ); | 111 | QPainter p( this ); |
107 | paintButton( p, button ); | 112 | paintButton( p, button ); |
108 | } | 113 | } |