-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 22 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 6 |
2 files changed, 10 insertions, 18 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index fe7ddc1..2081b4f 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -1,495 +1,487 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
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 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <opie/oticker.h> | 37 | #include <opie/oticker.h> |
38 | 38 | ||
39 | #include <qwidget.h> | 39 | #include <qwidget.h> |
40 | #include <qpixmap.h> | 40 | #include <qpixmap.h> |
41 | #include <qbutton.h> | 41 | #include <qbutton.h> |
42 | #include <qpainter.h> | 42 | #include <qpainter.h> |
43 | #include <qframe.h> | 43 | #include <qframe.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qdir.h> | 45 | #include <qdir.h> |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | #include <stdio.h> | 47 | #include <stdio.h> |
48 | 48 | ||
49 | #include "audiowidget.h" | 49 | #include "audiowidget.h" |
50 | #include "mediaplayerstate.h" | 50 | #include "mediaplayerstate.h" |
51 | #include "playlistwidget.h" | 51 | #include "playlistwidget.h" |
52 | 52 | ||
53 | namespace | 53 | namespace |
54 | { | 54 | { |
55 | 55 | ||
56 | const int xo = -2; // movable x offset | 56 | const int xo = -2; // movable x offset |
57 | const int yo = 22; // movable y offset | 57 | const int yo = 22; // movable y offset |
58 | 58 | ||
59 | const char * const skin_mask_file_names[10] = { | 59 | const char * const skin_mask_file_names[10] = { |
60 | "play", "stop", "next", "prev", "up", | 60 | "play", "stop", "next", "prev", "up", |
61 | "down", "loop", "playlist", "forward", "back" | 61 | "down", "loop", "playlist", "forward", "back" |
62 | }; | 62 | }; |
63 | 63 | ||
64 | void changeTextColor( QWidget * w) { | 64 | void changeTextColor( QWidget * w) { |
65 | QPalette p = w->palette(); | 65 | QPalette p = w->palette(); |
66 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 66 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
67 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 67 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
68 | w->setPalette( p ); | 68 | w->setPalette( p ); |
69 | } | 69 | } |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : | 73 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
74 | 74 | ||
75 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), | 75 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), |
76 | audioSliderBeingMoved( false ) | 76 | audioSliderBeingMoved( false ) |
77 | { | 77 | { |
78 | 78 | ||
79 | Button defaultButton; | 79 | Button defaultButton; |
80 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; | 80 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; |
81 | Button toggleButton; | 81 | Button toggleButton; |
82 | toggleButton.isToggle = true; | 82 | toggleButton.isToggle = true; |
83 | toggleButton.isHeld = toggleButton.isDown = false; | 83 | toggleButton.isHeld = toggleButton.isDown = false; |
84 | 84 | ||
85 | buttons.reserve( 10 ); | 85 | buttons.reserve( 10 ); |
86 | buttons.push_back( toggleButton ); // play | 86 | buttons.push_back( toggleButton ); // play |
87 | buttons.push_back( defaultButton ); // stop | 87 | buttons.push_back( defaultButton ); // stop |
88 | buttons.push_back( defaultButton ); // next | 88 | buttons.push_back( defaultButton ); // next |
89 | buttons.push_back( defaultButton ); // previous | 89 | buttons.push_back( defaultButton ); // previous |
90 | buttons.push_back( defaultButton ); // volume up | 90 | buttons.push_back( defaultButton ); // volume up |
91 | buttons.push_back( defaultButton ); // volume down | 91 | buttons.push_back( defaultButton ); // volume down |
92 | buttons.push_back( toggleButton ); // repeat/loop | 92 | buttons.push_back( toggleButton ); // repeat/loop |
93 | buttons.push_back( defaultButton ); // playlist | 93 | buttons.push_back( defaultButton ); // playlist |
94 | buttons.push_back( defaultButton ); // forward | 94 | buttons.push_back( defaultButton ); // forward |
95 | buttons.push_back( defaultButton ); // back | 95 | buttons.push_back( defaultButton ); // back |
96 | 96 | ||
97 | setCaption( tr("OpiePlayer") ); | 97 | setCaption( tr("OpiePlayer") ); |
98 | 98 | ||
99 | Config cfg("OpiePlayer"); | 99 | Config cfg("OpiePlayer"); |
100 | cfg.setGroup("Options"); | 100 | cfg.setGroup("Options"); |
101 | skin = cfg.readEntry("Skin","default"); | 101 | skin = cfg.readEntry("Skin","default"); |
102 | //skin = "scaleTest"; | 102 | //skin = "scaleTest"; |
103 | // color of background, frame, degree of transparency | 103 | // color of background, frame, degree of transparency |
104 | 104 | ||
105 | QString skinPath = "opieplayer2/skins/" + skin; | 105 | QString skinPath = "opieplayer2/skins/" + skin; |
106 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 106 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
107 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 107 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
108 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 108 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
109 | 109 | ||
110 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 110 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
111 | buttonMask.fill( 0 ); | 111 | buttonMask.fill( 0 ); |
112 | 112 | ||
113 | masks.reserve( 10 ); | 113 | masks.reserve( 10 ); |
114 | 114 | ||
115 | for ( uint i = 0; i < masks.capacity(); i++ ) { | 115 | for ( uint i = 0; i < masks.capacity(); i++ ) { |
116 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); | 116 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); |
117 | masks.push_back( QBitmap( filename ) ); | 117 | masks.push_back( QBitmap( filename ) ); |
118 | 118 | ||
119 | if ( !masks[i].isNull() ) { | 119 | if ( !masks[i].isNull() ) { |
120 | QImage imgMask = masks[i].convertToImage(); | 120 | QImage imgMask = masks[i].convertToImage(); |
121 | uchar **dest = buttonMask.jumpTable(); | 121 | uchar **dest = buttonMask.jumpTable(); |
122 | for ( int y = 0; y < imgUp.height(); y++ ) { | 122 | for ( int y = 0; y < imgUp.height(); y++ ) { |
123 | uchar *line = dest[y]; | 123 | uchar *line = dest[y]; |
124 | for ( int x = 0; x < imgUp.width(); x++ ) | 124 | for ( int x = 0; x < imgUp.width(); x++ ) |
125 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 125 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
126 | line[x] = i + 1; | 126 | line[x] = i + 1; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | } | 130 | } |
131 | 131 | ||
132 | for ( int i = 0; i < 10; i++ ) { | 132 | buttonPixUp.resize( masks.size(), QPixmap() ); |
133 | buttonPixUp[i] = 0l; | 133 | buttonPixDown.resize( masks.size(), QPixmap() ); |
134 | buttonPixDown[i] = 0l; | ||
135 | } | ||
136 | 134 | ||
137 | setBackgroundPixmap( pixBg ); | 135 | setBackgroundPixmap( pixBg ); |
138 | 136 | ||
139 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 137 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
140 | // changeTextColor( &songInfo ); | 138 | // changeTextColor( &songInfo ); |
141 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 139 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
142 | // songInfo.setFrameStyle( QFrame::NoFrame); | 140 | // songInfo.setFrameStyle( QFrame::NoFrame); |
143 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 141 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
144 | // songInfo.setForegroundColor(Qt::white); | 142 | // songInfo.setForegroundColor(Qt::white); |
145 | 143 | ||
146 | slider.setFixedHeight( 20 ); | 144 | slider.setFixedHeight( 20 ); |
147 | slider.setMinValue( 0 ); | 145 | slider.setMinValue( 0 ); |
148 | slider.setMaxValue( 1 ); | 146 | slider.setMaxValue( 1 ); |
149 | slider.setFocusPolicy( QWidget::NoFocus ); | 147 | slider.setFocusPolicy( QWidget::NoFocus ); |
150 | slider.setBackgroundPixmap( pixBg ); | 148 | slider.setBackgroundPixmap( pixBg ); |
151 | 149 | ||
152 | // Config cofg("qpe"); | 150 | // Config cofg("qpe"); |
153 | // cofg.setGroup("Appearance"); | 151 | // cofg.setGroup("Appearance"); |
154 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | 152 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); |
155 | 153 | ||
156 | time.setFocusPolicy( QWidget::NoFocus ); | 154 | time.setFocusPolicy( QWidget::NoFocus ); |
157 | time.setAlignment( Qt::AlignCenter ); | 155 | time.setAlignment( Qt::AlignCenter ); |
158 | 156 | ||
159 | // time.setFrame(FALSE); | 157 | // time.setFrame(FALSE); |
160 | // changeTextColor( &time ); | 158 | // changeTextColor( &time ); |
161 | 159 | ||
162 | resizeEvent( NULL ); | 160 | resizeEvent( NULL ); |
163 | 161 | ||
164 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 162 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
165 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 163 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
166 | 164 | ||
167 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 165 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
168 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 166 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
169 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 167 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
170 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 168 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
171 | 169 | ||
172 | // Intialise state | 170 | // Intialise state |
173 | setLength( mediaPlayerState.length() ); | 171 | setLength( mediaPlayerState.length() ); |
174 | setPosition( mediaPlayerState.position() ); | 172 | setPosition( mediaPlayerState.position() ); |
175 | setLooping( mediaPlayerState.isFullscreen() ); | 173 | setLooping( mediaPlayerState.isFullscreen() ); |
176 | // setPaused( mediaPlayerState->paused() ); | 174 | // setPaused( mediaPlayerState->paused() ); |
177 | setPlaying( mediaPlayerState.isPlaying() ); | 175 | setPlaying( mediaPlayerState.isPlaying() ); |
178 | 176 | ||
179 | } | 177 | } |
180 | 178 | ||
181 | AudioWidget::~AudioWidget() { | 179 | AudioWidget::~AudioWidget() { |
182 | 180 | ||
183 | for ( int i = 0; i < 10; i++ ) { | ||
184 | delete buttonPixUp[i]; | ||
185 | delete buttonPixDown[i]; | ||
186 | } | ||
187 | // mediaPlayerState->setPlaying(false); | 181 | // mediaPlayerState->setPlaying(false); |
188 | } | 182 | } |
189 | 183 | ||
190 | namespace { | 184 | namespace { |
191 | 185 | ||
192 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 186 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
193 | QPixmap pix( img.width(), img.height() ); | 187 | QPixmap pix( img.width(), img.height() ); |
194 | QPainter p( &pix ); | 188 | QPainter p( &pix ); |
195 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 189 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
196 | p.drawImage( 0, 0, img ); | 190 | p.drawImage( 0, 0, img ); |
197 | return pix; | 191 | return pix; |
198 | } | 192 | } |
199 | 193 | ||
200 | 194 | ||
201 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { | 195 | QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { |
202 | QPixmap *pixmap = new QPixmap( pix ); | 196 | QPixmap pixmap( pix ); |
203 | pixmap->setMask( mask ); | 197 | pixmap.setMask( mask ); |
204 | return pixmap; | 198 | return pixmap; |
205 | } | 199 | } |
206 | 200 | ||
207 | }; | 201 | }; |
208 | 202 | ||
209 | void AudioWidget::resizeEvent( QResizeEvent * ) { | 203 | void AudioWidget::resizeEvent( QResizeEvent * ) { |
210 | int h = height(); | 204 | int h = height(); |
211 | int w = width(); | 205 | int w = width(); |
212 | 206 | ||
213 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 207 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
214 | slider.setFixedWidth( w - 110 ); | 208 | slider.setFixedWidth( w - 110 ); |
215 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 209 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
216 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 210 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
217 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 211 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
218 | 212 | ||
219 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; | 213 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; |
220 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; | 214 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; |
221 | QPoint p = upperLeftOfButtonMask; | 215 | QPoint p = upperLeftOfButtonMask; |
222 | 216 | ||
223 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); | 217 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); |
224 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); | 218 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); |
225 | 219 | ||
226 | for ( int i = 0; i < 10; i++ ) { | 220 | for ( int i = 0; i < 10; i++ ) { |
227 | if ( !masks[i].isNull() ) { | 221 | if ( !masks[i].isNull() ) { |
228 | delete buttonPixUp[i]; | ||
229 | delete buttonPixDown[i]; | ||
230 | buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); | 222 | buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); |
231 | buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); | 223 | buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); |
232 | } | 224 | } |
233 | } | 225 | } |
234 | } | 226 | } |
235 | 227 | ||
236 | void AudioWidget::sliderPressed() { | 228 | void AudioWidget::sliderPressed() { |
237 | audioSliderBeingMoved = TRUE; | 229 | audioSliderBeingMoved = TRUE; |
238 | } | 230 | } |
239 | 231 | ||
240 | 232 | ||
241 | void AudioWidget::sliderReleased() { | 233 | void AudioWidget::sliderReleased() { |
242 | audioSliderBeingMoved = FALSE; | 234 | audioSliderBeingMoved = FALSE; |
243 | if ( slider.width() == 0 ) | 235 | if ( slider.width() == 0 ) |
244 | return; | 236 | return; |
245 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); | 237 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
246 | mediaPlayerState.setPosition( val ); | 238 | mediaPlayerState.setPosition( val ); |
247 | } | 239 | } |
248 | 240 | ||
249 | void AudioWidget::setPosition( long i ) { | 241 | void AudioWidget::setPosition( long i ) { |
250 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 242 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
251 | updateSlider( i, mediaPlayerState.length() ); | 243 | updateSlider( i, mediaPlayerState.length() ); |
252 | } | 244 | } |
253 | 245 | ||
254 | 246 | ||
255 | void AudioWidget::setLength( long max ) { | 247 | void AudioWidget::setLength( long max ) { |
256 | updateSlider( mediaPlayerState.position(), max ); | 248 | updateSlider( mediaPlayerState.position(), max ); |
257 | } | 249 | } |
258 | 250 | ||
259 | 251 | ||
260 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | 252 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { |
261 | if ( mediaType == MediaPlayerState::Audio ) { | 253 | if ( mediaType == MediaPlayerState::Audio ) { |
262 | // startTimer( 150 ); | 254 | // startTimer( 150 ); |
263 | showMaximized(); | 255 | showMaximized(); |
264 | return; | 256 | return; |
265 | } | 257 | } |
266 | 258 | ||
267 | killTimers(); | 259 | killTimers(); |
268 | hide(); | 260 | hide(); |
269 | } | 261 | } |
270 | 262 | ||
271 | 263 | ||
272 | void AudioWidget::setSeekable( bool isSeekable ) { | 264 | void AudioWidget::setSeekable( bool isSeekable ) { |
273 | 265 | ||
274 | if ( !isSeekable ) { | 266 | if ( !isSeekable ) { |
275 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 267 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
276 | if( !slider.isHidden()) { | 268 | if( !slider.isHidden()) { |
277 | slider.hide(); | 269 | slider.hide(); |
278 | } | 270 | } |
279 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 271 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
280 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 272 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
281 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 273 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
282 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 274 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
283 | } else { | 275 | } else { |
284 | // this stops the slider from being moved, thus | 276 | // this stops the slider from being moved, thus |
285 | // does not stop stream when it reaches the end | 277 | // does not stop stream when it reaches the end |
286 | slider.show(); | 278 | slider.show(); |
287 | qDebug( " CONNECT SET POSTION " ); | 279 | qDebug( " CONNECT SET POSTION " ); |
288 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 280 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
289 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 281 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
290 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 282 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
291 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 283 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
292 | } | 284 | } |
293 | } | 285 | } |
294 | 286 | ||
295 | 287 | ||
296 | static QString timeAsString( long length ) { | 288 | static QString timeAsString( long length ) { |
297 | int minutes = length / 60; | 289 | int minutes = length / 60; |
298 | int seconds = length % 60; | 290 | int seconds = length % 60; |
299 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 291 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
300 | } | 292 | } |
301 | 293 | ||
302 | void AudioWidget::updateSlider( long i, long max ) { | 294 | void AudioWidget::updateSlider( long i, long max ) { |
303 | 295 | ||
304 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 296 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
305 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 297 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
306 | 298 | ||
307 | if ( max == 0 ) { | 299 | if ( max == 0 ) { |
308 | return; | 300 | return; |
309 | } | 301 | } |
310 | // Will flicker too much if we don't do this | 302 | // Will flicker too much if we don't do this |
311 | // Scale to something reasonable | 303 | // Scale to something reasonable |
312 | int width = slider.width(); | 304 | int width = slider.width(); |
313 | int val = int((double)i * width / max); | 305 | int val = int((double)i * width / max); |
314 | if ( !audioSliderBeingMoved ) { | 306 | if ( !audioSliderBeingMoved ) { |
315 | if ( slider.value() != val ) { | 307 | if ( slider.value() != val ) { |
316 | slider.setValue( val ); | 308 | slider.setValue( val ); |
317 | } | 309 | } |
318 | 310 | ||
319 | if ( slider.maxValue() != width ) { | 311 | if ( slider.maxValue() != width ) { |
320 | slider.setMaxValue( width ); | 312 | slider.setMaxValue( width ); |
321 | } | 313 | } |
322 | } | 314 | } |
323 | } | 315 | } |
324 | 316 | ||
325 | 317 | ||
326 | void AudioWidget::setToggleButton( int i, bool down ) { | 318 | void AudioWidget::setToggleButton( int i, bool down ) { |
327 | qDebug("setToggleButton %d", i); | 319 | qDebug("setToggleButton %d", i); |
328 | if ( down != buttons[i].isDown ) { | 320 | if ( down != buttons[i].isDown ) { |
329 | toggleButton( i ); | 321 | toggleButton( i ); |
330 | } | 322 | } |
331 | } | 323 | } |
332 | 324 | ||
333 | void AudioWidget::paintButton( QPainter &p, int i ) { | 325 | void AudioWidget::paintButton( QPainter &p, int i ) { |
334 | if ( buttons[i].isDown ) { | 326 | if ( buttons[i].isDown ) { |
335 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); | 327 | p.drawPixmap( upperLeftOfButtonMask, buttonPixDown[i] ); |
336 | } else { | 328 | } else { |
337 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); | 329 | p.drawPixmap( upperLeftOfButtonMask, buttonPixUp[i] ); |
338 | } | 330 | } |
339 | } | 331 | } |
340 | 332 | ||
341 | 333 | ||
342 | void AudioWidget::skipFor() { | 334 | void AudioWidget::skipFor() { |
343 | skipDirection = +1; | 335 | skipDirection = +1; |
344 | startTimer( 50 ); | 336 | startTimer( 50 ); |
345 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 337 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
346 | } | 338 | } |
347 | 339 | ||
348 | void AudioWidget::skipBack() { | 340 | void AudioWidget::skipBack() { |
349 | skipDirection = -1; | 341 | skipDirection = -1; |
350 | startTimer( 50 ); | 342 | startTimer( 50 ); |
351 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 343 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
352 | } | 344 | } |
353 | 345 | ||
354 | 346 | ||
355 | 347 | ||
356 | void AudioWidget::stopSkip() { | 348 | void AudioWidget::stopSkip() { |
357 | killTimers(); | 349 | killTimers(); |
358 | } | 350 | } |
359 | 351 | ||
360 | 352 | ||
361 | void AudioWidget::timerEvent( QTimerEvent * ) { | 353 | void AudioWidget::timerEvent( QTimerEvent * ) { |
362 | if ( skipDirection == +1 ) { | 354 | if ( skipDirection == +1 ) { |
363 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 355 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
364 | } else if ( skipDirection == -1 ) { | 356 | } else if ( skipDirection == -1 ) { |
365 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 357 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
366 | } | 358 | } |
367 | } | 359 | } |
368 | 360 | ||
369 | 361 | ||
370 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 362 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
371 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { | 363 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
372 | if ( event->state() == QMouseEvent::LeftButton ) { | 364 | if ( event->state() == QMouseEvent::LeftButton ) { |
373 | // The test to see if the mouse click is inside the button or not | 365 | // The test to see if the mouse click is inside the button or not |
374 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 366 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
375 | 367 | ||
376 | if ( isOnButton && !buttons[i].isHeld ) { | 368 | if ( isOnButton && !buttons[i].isHeld ) { |
377 | buttons[i].isHeld = TRUE; | 369 | buttons[i].isHeld = TRUE; |
378 | toggleButton(i); | 370 | toggleButton(i); |
379 | switch (i) { | 371 | switch (i) { |
380 | case VolumeUp: | 372 | case VolumeUp: |
381 | emit moreClicked(); | 373 | emit moreClicked(); |
382 | return; | 374 | return; |
383 | case VolumeDown: | 375 | case VolumeDown: |
384 | emit lessClicked(); | 376 | emit lessClicked(); |
385 | return; | 377 | return; |
386 | case Forward: | 378 | case Forward: |
387 | emit forwardClicked(); | 379 | emit forwardClicked(); |
388 | return; | 380 | return; |
389 | case Back: | 381 | case Back: |
390 | emit backClicked(); | 382 | emit backClicked(); |
391 | return; | 383 | return; |
392 | } | 384 | } |
393 | } else if ( !isOnButton && buttons[i].isHeld ) { | 385 | } else if ( !isOnButton && buttons[i].isHeld ) { |
394 | buttons[i].isHeld = FALSE; | 386 | buttons[i].isHeld = FALSE; |
395 | toggleButton(i); | 387 | toggleButton(i); |
396 | } | 388 | } |
397 | } else { | 389 | } else { |
398 | if ( buttons[i].isHeld ) { | 390 | if ( buttons[i].isHeld ) { |
399 | buttons[i].isHeld = FALSE; | 391 | buttons[i].isHeld = FALSE; |
400 | if ( !buttons[i].isToggle ) { | 392 | if ( !buttons[i].isToggle ) { |
401 | setToggleButton( i, FALSE ); | 393 | setToggleButton( i, FALSE ); |
402 | } | 394 | } |
403 | qDebug("mouseEvent %d", i); | 395 | qDebug("mouseEvent %d", i); |
404 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); | 396 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); |
405 | } | 397 | } |
406 | } | 398 | } |
407 | } | 399 | } |
408 | } | 400 | } |
409 | 401 | ||
410 | 402 | ||
411 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 403 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
412 | mouseMoveEvent( event ); | 404 | mouseMoveEvent( event ); |
413 | } | 405 | } |
414 | 406 | ||
415 | 407 | ||
416 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 408 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
417 | mouseMoveEvent( event ); | 409 | mouseMoveEvent( event ); |
418 | } | 410 | } |
419 | 411 | ||
420 | 412 | ||
421 | void AudioWidget::showEvent( QShowEvent* ) { | 413 | void AudioWidget::showEvent( QShowEvent* ) { |
422 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 414 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
423 | mouseMoveEvent( &event ); | 415 | mouseMoveEvent( &event ); |
424 | } | 416 | } |
425 | 417 | ||
426 | 418 | ||
427 | void AudioWidget::paintEvent( QPaintEvent * pe ) { | 419 | void AudioWidget::paintEvent( QPaintEvent * pe ) { |
428 | if ( !pe->erased() ) { | 420 | if ( !pe->erased() ) { |
429 | // Combine with background and double buffer | 421 | // Combine with background and double buffer |
430 | QPixmap pix( pe->rect().size() ); | 422 | QPixmap pix( pe->rect().size() ); |
431 | QPainter p( &pix ); | 423 | QPainter p( &pix ); |
432 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 424 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
433 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 425 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
434 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 426 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
435 | paintButton( p, i ); | 427 | paintButton( p, i ); |
436 | QPainter p2( this ); | 428 | QPainter p2( this ); |
437 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 429 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
438 | } else { | 430 | } else { |
439 | QPainter p( this ); | 431 | QPainter p( this ); |
440 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 432 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
441 | paintButton( p, i ); | 433 | paintButton( p, i ); |
442 | } | 434 | } |
443 | } | 435 | } |
444 | 436 | ||
445 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | 437 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
446 | switch ( e->key() ) { | 438 | switch ( e->key() ) { |
447 | ////////////////////////////// Zaurus keys | 439 | ////////////////////////////// Zaurus keys |
448 | case Key_Home: | 440 | case Key_Home: |
449 | break; | 441 | break; |
450 | case Key_F9: //activity | 442 | case Key_F9: //activity |
451 | hide(); | 443 | hide(); |
452 | // qDebug("Audio F9"); | 444 | // qDebug("Audio F9"); |
453 | break; | 445 | break; |
454 | case Key_F10: //contacts | 446 | case Key_F10: //contacts |
455 | break; | 447 | break; |
456 | case Key_F11: //menu | 448 | case Key_F11: //menu |
457 | mediaPlayerState.toggleBlank(); | 449 | mediaPlayerState.toggleBlank(); |
458 | break; | 450 | break; |
459 | case Key_F12: //home | 451 | case Key_F12: //home |
460 | break; | 452 | break; |
461 | case Key_F13: //mail | 453 | case Key_F13: //mail |
462 | mediaPlayerState.toggleBlank(); | 454 | mediaPlayerState.toggleBlank(); |
463 | break; | 455 | break; |
464 | case Key_Space: { | 456 | case Key_Space: { |
465 | mediaPlayerState.togglePaused(); | 457 | mediaPlayerState.togglePaused(); |
466 | } | 458 | } |
467 | break; | 459 | break; |
468 | case Key_Down: | 460 | case Key_Down: |
469 | // toggleButton(6); | 461 | // toggleButton(6); |
470 | emit lessClicked(); | 462 | emit lessClicked(); |
471 | emit lessReleased(); | 463 | emit lessReleased(); |
472 | // toggleButton(6); | 464 | // toggleButton(6); |
473 | break; | 465 | break; |
474 | case Key_Up: | 466 | case Key_Up: |
475 | // toggleButton(5); | 467 | // toggleButton(5); |
476 | emit moreClicked(); | 468 | emit moreClicked(); |
477 | emit moreReleased(); | 469 | emit moreReleased(); |
478 | // toggleButton(5); | 470 | // toggleButton(5); |
479 | break; | 471 | break; |
480 | case Key_Right: | 472 | case Key_Right: |
481 | // toggleButton(3); | 473 | // toggleButton(3); |
482 | mediaPlayerState.setNext(); | 474 | mediaPlayerState.setNext(); |
483 | // toggleButton(3); | 475 | // toggleButton(3); |
484 | break; | 476 | break; |
485 | case Key_Left: | 477 | case Key_Left: |
486 | // toggleButton(4); | 478 | // toggleButton(4); |
487 | mediaPlayerState.setPrev(); | 479 | mediaPlayerState.setPrev(); |
488 | // toggleButton(4); | 480 | // toggleButton(4); |
489 | break; | 481 | break; |
490 | case Key_Escape: { | 482 | case Key_Escape: { |
491 | } | 483 | } |
492 | break; | 484 | break; |
493 | 485 | ||
494 | }; | 486 | }; |
495 | } | 487 | } |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index bc7262c..73ce1e5 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -1,117 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
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 <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 | ||
50 | class QPixmap; | 50 | class QPixmap; |
51 | 51 | ||
52 | class AudioWidget : public MediaWidget { | 52 | class AudioWidget : public MediaWidget { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | public: | 54 | public: |
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 | public slots: | 58 | public slots: |
59 | void updateSlider( long, long ); | 59 | void updateSlider( long, long ); |
60 | void sliderPressed( ); | 60 | void sliderPressed( ); |
61 | void sliderReleased( ); | 61 | void sliderReleased( ); |
62 | void setLooping( bool b) { setToggleButton( Loop, b ); } | 62 | void setLooping( bool b) { setToggleButton( Loop, b ); } |
63 | void setPosition( long ); | 63 | void setPosition( long ); |
64 | void setSeekable( bool ); | 64 | void setSeekable( bool ); |
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 | typedef std::vector<QBitmap> MaskVector; | 94 | typedef std::vector<QBitmap> MaskVector; |
95 | typedef std::vector<QPixmap> PixmapVector; | ||
95 | 96 | ||
96 | void setToggleButton( int, bool ); | 97 | void setToggleButton( int, bool ); |
97 | virtual void paintButton( QPainter &p, int i ); | 98 | virtual void paintButton( QPainter &p, int i ); |
98 | int skipDirection; | 99 | int skipDirection; |
99 | QString skin; | 100 | QString skin; |
100 | QPixmap pixBg; | 101 | QPixmap pixBg; |
101 | QImage imgUp; | 102 | QImage imgUp; |
102 | QImage imgDn; | 103 | QImage imgDn; |
103 | MaskVector masks; | 104 | MaskVector masks; |
104 | QPixmap *buttonPixUp[10]; | 105 | PixmapVector buttonPixUp; |
105 | QPixmap *buttonPixDown[10]; | 106 | PixmapVector buttonPixDown; |
106 | 107 | ||
107 | QPixmap *pixmaps[4]; | ||
108 | OTicker songInfo; | 108 | OTicker songInfo; |
109 | QSlider slider; | 109 | QSlider slider; |
110 | QLineEdit time; | 110 | QLineEdit time; |
111 | bool isStreaming : 1; | 111 | bool isStreaming : 1; |
112 | bool audioSliderBeingMoved : 1; | 112 | bool audioSliderBeingMoved : 1; |
113 | }; | 113 | }; |
114 | 114 | ||
115 | 115 | ||
116 | #endif // AUDIO_WIDGET_H | 116 | #endif // AUDIO_WIDGET_H |
117 | 117 | ||