-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 11 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 2 |
4 files changed, 13 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 56203e0..604ed3a 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -23,567 +23,568 @@ | |||
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 | 37 | ||
38 | #include <qwidget.h> | 38 | #include <qwidget.h> |
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | #include <qbutton.h> | 40 | #include <qbutton.h> |
41 | #include <qpainter.h> | 41 | #include <qpainter.h> |
42 | #include <qframe.h> | 42 | #include <qframe.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | 44 | ||
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | #include <stdio.h> | 46 | #include <stdio.h> |
47 | 47 | ||
48 | #include "audiowidget.h" | 48 | #include "audiowidget.h" |
49 | #include "mediaplayerstate.h" | 49 | #include "mediaplayerstate.h" |
50 | 50 | ||
51 | extern MediaPlayerState *mediaPlayerState; | 51 | extern MediaPlayerState *mediaPlayerState; |
52 | 52 | ||
53 | static const int xo = -2; // movable x offset | 53 | static const int xo = -2; // movable x offset |
54 | static const int yo = 22; // movable y offset | 54 | static const int yo = 22; // movable y offset |
55 | 55 | ||
56 | 56 | ||
57 | Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { | 57 | Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { |
58 | setFrameStyle( WinPanel | Sunken ); | 58 | setFrameStyle( WinPanel | Sunken ); |
59 | setText( "No Song" ); | 59 | setText( "No Song" ); |
60 | } | 60 | } |
61 | 61 | ||
62 | Ticker::~Ticker() { | 62 | Ticker::~Ticker() { |
63 | } | 63 | } |
64 | 64 | ||
65 | void Ticker::setText( const QString& text ) { | 65 | void Ticker::setText( const QString& text ) { |
66 | pos = 0; // reset it everytime the text is changed | 66 | pos = 0; // reset it everytime the text is changed |
67 | scrollText = text; | 67 | scrollText = text; |
68 | pixelLen = fontMetrics().width( scrollText ); | 68 | pixelLen = fontMetrics().width( scrollText ); |
69 | killTimers(); | 69 | killTimers(); |
70 | if ( pixelLen > width() ) { | 70 | if ( pixelLen > width() ) { |
71 | startTimer( 50 ); | 71 | startTimer( 50 ); |
72 | } | 72 | } |
73 | update(); | 73 | update(); |
74 | } | 74 | } |
75 | 75 | ||
76 | 76 | ||
77 | void Ticker::timerEvent( QTimerEvent * ) { | 77 | void Ticker::timerEvent( QTimerEvent * ) { |
78 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | 78 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; |
79 | scroll( -1, 0, contentsRect() ); | 79 | scroll( -1, 0, contentsRect() ); |
80 | repaint( FALSE ); | 80 | repaint( FALSE ); |
81 | } | 81 | } |
82 | 82 | ||
83 | void Ticker::drawContents( QPainter *p ) { | 83 | void Ticker::drawContents( QPainter *p ) { |
84 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | 84 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) |
85 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | 85 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); |
86 | QPixmap pm( width(), height() ); | 86 | QPixmap pm( width(), height() ); |
87 | pm.fill( colorGroup().base() ); | 87 | pm.fill( colorGroup().base() ); |
88 | QPainter pmp( &pm ); | 88 | QPainter pmp( &pm ); |
89 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { | 89 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { |
90 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | 90 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); |
91 | } | 91 | } |
92 | p->drawPixmap( 0, 0, pm ); | 92 | p->drawPixmap( 0, 0, pm ); |
93 | } | 93 | } |
94 | 94 | ||
95 | struct MediaButton { | 95 | struct MediaButton { |
96 | bool isToggle, isHeld, isDown; | 96 | bool isToggle, isHeld, isDown; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | //Layout information for the audioButtons (and if it is a toggle button or not) | 99 | //Layout information for the audioButtons (and if it is a toggle button or not) |
100 | MediaButton audioButtons[] = { | 100 | MediaButton audioButtons[] = { |
101 | { TRUE, FALSE, FALSE }, // play | 101 | { TRUE, FALSE, FALSE }, // play |
102 | { FALSE, FALSE, FALSE }, // stop | 102 | { FALSE, FALSE, FALSE }, // stop |
103 | { FALSE, FALSE, FALSE }, // next | 103 | { FALSE, FALSE, FALSE }, // next |
104 | { FALSE, FALSE, FALSE }, // previous | 104 | { FALSE, FALSE, FALSE }, // previous |
105 | { FALSE, FALSE, FALSE }, // volume up | 105 | { FALSE, FALSE, FALSE }, // volume up |
106 | { FALSE, FALSE, FALSE }, // volume down | 106 | { FALSE, FALSE, FALSE }, // volume down |
107 | { TRUE, FALSE, FALSE }, // repeat/loop | 107 | { TRUE, FALSE, FALSE }, // repeat/loop |
108 | { FALSE, FALSE, FALSE }, // playlist | 108 | { FALSE, FALSE, FALSE }, // playlist |
109 | { FALSE, FALSE, FALSE }, // forward | 109 | { FALSE, FALSE, FALSE }, // forward |
110 | { FALSE, FALSE, FALSE } // back | 110 | { FALSE, FALSE, FALSE } // back |
111 | }; | 111 | }; |
112 | 112 | ||
113 | const char *skin_mask_file_names[10] = { | 113 | const char *skin_mask_file_names[10] = { |
114 | "play", "stop", "next", "prev", "up", | 114 | "play", "stop", "next", "prev", "up", |
115 | "down", "loop", "playlist", "forward", "back" | 115 | "down", "loop", "playlist", "forward", "back" |
116 | }; | 116 | }; |
117 | 117 | ||
118 | 118 | ||
119 | static void changeTextColor( QWidget *w ) { | 119 | static void changeTextColor( QWidget *w ) { |
120 | QPalette p = w->palette(); | 120 | QPalette p = w->palette(); |
121 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 121 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
122 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 122 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
123 | w->setPalette( p ); | 123 | w->setPalette( p ); |
124 | } | 124 | } |
125 | 125 | ||
126 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 126 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
127 | 127 | ||
128 | 128 | ||
129 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 129 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
130 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | 130 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { |
131 | setCaption( tr("OpiePlayer") ); | 131 | setCaption( tr("OpiePlayer") ); |
132 | 132 | ||
133 | Config cfg("OpiePlayer"); | 133 | Config cfg("OpiePlayer"); |
134 | cfg.setGroup("Options"); | 134 | cfg.setGroup("Options"); |
135 | skin = cfg.readEntry("Skin","default"); | 135 | skin = cfg.readEntry("Skin","default"); |
136 | //skin = "scaleTest"; | 136 | //skin = "scaleTest"; |
137 | // color of background, frame, degree of transparency | 137 | // color of background, frame, degree of transparency |
138 | 138 | ||
139 | QString skinPath = "opieplayer2/skins/" + skin; | 139 | QString skinPath = "opieplayer2/skins/" + skin; |
140 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 140 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
141 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 141 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
142 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 142 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
143 | 143 | ||
144 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 144 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
145 | imgButtonMask->fill( 0 ); | 145 | imgButtonMask->fill( 0 ); |
146 | 146 | ||
147 | for ( int i = 0; i < 10; i++ ) { | 147 | for ( int i = 0; i < 10; i++ ) { |
148 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; | 148 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; |
149 | masks[i] = new QBitmap( filename ); | 149 | masks[i] = new QBitmap( filename ); |
150 | 150 | ||
151 | if ( !masks[i]->isNull() ) { | 151 | if ( !masks[i]->isNull() ) { |
152 | QImage imgMask = masks[i]->convertToImage(); | 152 | QImage imgMask = masks[i]->convertToImage(); |
153 | uchar **dest = imgButtonMask->jumpTable(); | 153 | uchar **dest = imgButtonMask->jumpTable(); |
154 | for ( int y = 0; y < imgUp->height(); y++ ) { | 154 | for ( int y = 0; y < imgUp->height(); y++ ) { |
155 | uchar *line = dest[y]; | 155 | uchar *line = dest[y]; |
156 | for ( int x = 0; x < imgUp->width(); x++ ) | 156 | for ( int x = 0; x < imgUp->width(); x++ ) |
157 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 157 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
158 | line[x] = i + 1; | 158 | line[x] = i + 1; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | } | 162 | } |
163 | 163 | ||
164 | for ( int i = 0; i < 10; i++ ) { | 164 | for ( int i = 0; i < 10; i++ ) { |
165 | buttonPixUp[i] = NULL; | 165 | buttonPixUp[i] = NULL; |
166 | buttonPixDown[i] = NULL; | 166 | buttonPixDown[i] = NULL; |
167 | } | 167 | } |
168 | 168 | ||
169 | setBackgroundPixmap( *pixBg ); | 169 | setBackgroundPixmap( *pixBg ); |
170 | 170 | ||
171 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 171 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
172 | changeTextColor( &songInfo ); | 172 | changeTextColor( &songInfo ); |
173 | 173 | ||
174 | slider.setFixedHeight( 20 ); | 174 | slider.setFixedHeight( 20 ); |
175 | slider.setMinValue( 0 ); | 175 | slider.setMinValue( 0 ); |
176 | slider.setMaxValue( 1 ); | 176 | slider.setMaxValue( 1 ); |
177 | slider.setFocusPolicy( QWidget::NoFocus ); | 177 | slider.setFocusPolicy( QWidget::NoFocus ); |
178 | slider.setBackgroundPixmap( *pixBg ); | 178 | slider.setBackgroundPixmap( *pixBg ); |
179 | 179 | ||
180 | time.setFocusPolicy( QWidget::NoFocus ); | 180 | time.setFocusPolicy( QWidget::NoFocus ); |
181 | time.setAlignment( Qt::AlignCenter ); | 181 | time.setAlignment( Qt::AlignCenter ); |
182 | time.setFrame(FALSE); | 182 | time.setFrame(FALSE); |
183 | changeTextColor( &time ); | 183 | changeTextColor( &time ); |
184 | 184 | ||
185 | resizeEvent( NULL ); | 185 | resizeEvent( NULL ); |
186 | 186 | ||
187 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 187 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
188 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 188 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
189 | 189 | ||
190 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 190 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
191 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 191 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
192 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 192 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
193 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 193 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
194 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 194 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
195 | 195 | ||
196 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 196 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
197 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 197 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
198 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 198 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
199 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 199 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
200 | 200 | ||
201 | 201 | ||
202 | 202 | ||
203 | // Intialise state | 203 | // Intialise state |
204 | setLength( mediaPlayerState->length() ); | 204 | setLength( mediaPlayerState->length() ); |
205 | setPosition( mediaPlayerState->position() ); | 205 | setPosition( mediaPlayerState->position() ); |
206 | setLooping( mediaPlayerState->fullscreen() ); | 206 | setLooping( mediaPlayerState->fullscreen() ); |
207 | // setPaused( mediaPlayerState->paused() ); | 207 | // setPaused( mediaPlayerState->paused() ); |
208 | setPlaying( mediaPlayerState->playing() ); | 208 | setPlaying( mediaPlayerState->playing() ); |
209 | 209 | ||
210 | } | 210 | } |
211 | 211 | ||
212 | AudioWidget::~AudioWidget() { | 212 | AudioWidget::~AudioWidget() { |
213 | 213 | ||
214 | for ( int i = 0; i < 10; i++ ) { | 214 | for ( int i = 0; i < 10; i++ ) { |
215 | delete buttonPixUp[i]; | 215 | delete buttonPixUp[i]; |
216 | delete buttonPixDown[i]; | 216 | delete buttonPixDown[i]; |
217 | } | 217 | } |
218 | delete pixBg; | 218 | delete pixBg; |
219 | delete imgUp; | 219 | delete imgUp; |
220 | delete imgDn; | 220 | delete imgDn; |
221 | delete imgButtonMask; | 221 | delete imgButtonMask; |
222 | for ( int i = 0; i < 10; i++ ) { | 222 | for ( int i = 0; i < 10; i++ ) { |
223 | delete masks[i]; | 223 | delete masks[i]; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 227 | QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
228 | QPixmap pix( img.width(), img.height() ); | 228 | QPixmap pix( img.width(), img.height() ); |
229 | QPainter p( &pix ); | 229 | QPainter p( &pix ); |
230 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 230 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
231 | p.drawImage( 0, 0, img ); | 231 | p.drawImage( 0, 0, img ); |
232 | return new QPixmap( pix ); | 232 | return new QPixmap( pix ); |
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) | 236 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) |
237 | { | 237 | { |
238 | QPixmap *pixmap = new QPixmap( pix ); | 238 | QPixmap *pixmap = new QPixmap( pix ); |
239 | pixmap->setMask( mask ); | 239 | pixmap->setMask( mask ); |
240 | return pixmap; | 240 | return pixmap; |
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
244 | 244 | ||
245 | void AudioWidget::resizeEvent( QResizeEvent * ) { | 245 | void AudioWidget::resizeEvent( QResizeEvent * ) { |
246 | int h = height(); | 246 | int h = height(); |
247 | int w = width(); | 247 | int w = width(); |
248 | 248 | ||
249 | songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); | 249 | songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); |
250 | slider.setFixedWidth( w - 110 ); | 250 | slider.setFixedWidth( w - 110 ); |
251 | slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); | 251 | slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); |
252 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 252 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
253 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 253 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
254 | 254 | ||
255 | xoff = ( w - imgUp->width() ) / 2; | 255 | xoff = ( w - imgUp->width() ) / 2; |
256 | yoff = (( h - imgUp->height() ) / 2) - 10; | 256 | yoff = (( h - imgUp->height() ) / 2) - 10; |
257 | QPoint p( xoff, yoff ); | 257 | QPoint p( xoff, yoff ); |
258 | 258 | ||
259 | QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); | 259 | QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); |
260 | QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); | 260 | QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); |
261 | 261 | ||
262 | for ( int i = 0; i < 10; i++ ) { | 262 | for ( int i = 0; i < 10; i++ ) { |
263 | if ( !masks[i]->isNull() ) { | 263 | if ( !masks[i]->isNull() ) { |
264 | delete buttonPixUp[i]; | 264 | delete buttonPixUp[i]; |
265 | delete buttonPixDown[i]; | 265 | delete buttonPixDown[i]; |
266 | buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); | 266 | buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); |
267 | buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); | 267 | buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | delete pixUp; | 271 | delete pixUp; |
272 | delete pixDn; | 272 | delete pixDn; |
273 | } | 273 | } |
274 | 274 | ||
275 | static bool audioSliderBeingMoved = FALSE; | 275 | static bool audioSliderBeingMoved = FALSE; |
276 | 276 | ||
277 | 277 | ||
278 | void AudioWidget::sliderPressed() { | 278 | void AudioWidget::sliderPressed() { |
279 | audioSliderBeingMoved = TRUE; | 279 | audioSliderBeingMoved = TRUE; |
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
283 | void AudioWidget::sliderReleased() { | 283 | void AudioWidget::sliderReleased() { |
284 | audioSliderBeingMoved = FALSE; | 284 | audioSliderBeingMoved = FALSE; |
285 | if ( slider.width() == 0 ) | 285 | if ( slider.width() == 0 ) |
286 | return; | 286 | return; |
287 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); | 287 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); |
288 | mediaPlayerState->setPosition( val ); | 288 | mediaPlayerState->setPosition( val ); |
289 | } | 289 | } |
290 | 290 | ||
291 | void AudioWidget::setPosition( long i ) { | 291 | void AudioWidget::setPosition( long i ) { |
292 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 292 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
293 | updateSlider( i, mediaPlayerState->length() ); | 293 | updateSlider( i, mediaPlayerState->length() ); |
294 | } | 294 | } |
295 | 295 | ||
296 | 296 | ||
297 | void AudioWidget::setLength( long max ) { | 297 | void AudioWidget::setLength( long max ) { |
298 | updateSlider( mediaPlayerState->position(), max ); | 298 | updateSlider( mediaPlayerState->position(), max ); |
299 | } | 299 | } |
300 | 300 | ||
301 | 301 | ||
302 | void AudioWidget::setView( char view ) { | 302 | void AudioWidget::setView( char view ) { |
303 | 303 | ||
304 | // this isnt working for some reason | 304 | // this isnt working for some reason |
305 | 305 | ||
306 | if ( mediaPlayerState->streaming() ) { | 306 | if ( mediaPlayerState->streaming() ) { |
307 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 307 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
308 | if( !slider.isHidden()) { | 308 | if( !slider.isHidden()) { |
309 | slider.hide(); | 309 | slider.hide(); |
310 | } | 310 | } |
311 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 311 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
312 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 312 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
313 | } else { | 313 | } else { |
314 | // this stops the slider from being moved, thus | 314 | // this stops the slider from being moved, thus |
315 | // does not stop stream when it reaches the end | 315 | // does not stop stream when it reaches the end |
316 | slider.show(); | 316 | slider.show(); |
317 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 317 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
318 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 318 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
319 | } | 319 | } |
320 | 320 | ||
321 | if ( view == 'a' ) { | 321 | if ( view == 'a' ) { |
322 | // startTimer( 150 ); | 322 | // startTimer( 150 ); |
323 | showMaximized(); | 323 | showMaximized(); |
324 | } else { | 324 | } else { |
325 | killTimers(); | 325 | killTimers(); |
326 | hide(); | 326 | hide(); |
327 | } | 327 | } |
328 | qApp->processEvents(); | 328 | qApp->processEvents(); |
329 | } | 329 | } |
330 | 330 | ||
331 | 331 | ||
332 | static QString timeAsString( long length ) { | 332 | static QString timeAsString( long length ) { |
333 | int minutes = length / 60; | 333 | int minutes = length / 60; |
334 | int seconds = length % 60; | 334 | int seconds = length % 60; |
335 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 335 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
336 | } | 336 | } |
337 | 337 | ||
338 | void AudioWidget::updateSlider( long i, long max ) { | 338 | void AudioWidget::updateSlider( long i, long max ) { |
339 | 339 | ||
340 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 340 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
341 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 341 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
342 | 342 | ||
343 | if ( max == 0 ) { | 343 | if ( max == 0 ) { |
344 | return; | 344 | return; |
345 | } | 345 | } |
346 | // Will flicker too much if we don't do this | 346 | // Will flicker too much if we don't do this |
347 | // Scale to something reasonable | 347 | // Scale to something reasonable |
348 | int width = slider.width(); | 348 | int width = slider.width(); |
349 | int val = int((double)i * width / max); | 349 | int val = int((double)i * width / max); |
350 | if ( !audioSliderBeingMoved ) { | 350 | if ( !audioSliderBeingMoved ) { |
351 | if ( slider.value() != val ) { | 351 | if ( slider.value() != val ) { |
352 | slider.setValue( val ); | 352 | slider.setValue( val ); |
353 | } | 353 | } |
354 | 354 | ||
355 | if ( slider.maxValue() != width ) { | 355 | if ( slider.maxValue() != width ) { |
356 | slider.setMaxValue( width ); | 356 | slider.setMaxValue( width ); |
357 | } | 357 | } |
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | 361 | ||
362 | void AudioWidget::setToggleButton( int i, bool down ) { | 362 | void AudioWidget::setToggleButton( int i, bool down ) { |
363 | qDebug("setToggleButton %d", i); | 363 | qDebug("setToggleButton %d", i); |
364 | if ( down != audioButtons[i].isDown ) { | 364 | if ( down != audioButtons[i].isDown ) { |
365 | toggleButton( i ); | 365 | toggleButton( i ); |
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | void AudioWidget::toggleButton( int i ) { | 370 | void AudioWidget::toggleButton( int i ) { |
371 | audioButtons[i].isDown = !audioButtons[i].isDown; | 371 | audioButtons[i].isDown = !audioButtons[i].isDown; |
372 | QPainter p(this); | 372 | QPainter p(this); |
373 | paintButton ( &p, i ); | 373 | paintButton ( &p, i ); |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | void AudioWidget::paintButton( QPainter *p, int i ) { | 377 | void AudioWidget::paintButton( QPainter *p, int i ) { |
378 | if ( audioButtons[i].isDown ) { | 378 | if ( audioButtons[i].isDown ) { |
379 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 379 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
380 | } else { | 380 | } else { |
381 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 381 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
382 | } | 382 | } |
383 | } | 383 | } |
384 | 384 | ||
385 | 385 | ||
386 | void AudioWidget::skipFor() { | 386 | void AudioWidget::skipFor() { |
387 | skipDirection = +1; | 387 | skipDirection = +1; |
388 | startTimer( 50 ); | 388 | startTimer( 50 ); |
389 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | 389 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); |
390 | } | 390 | } |
391 | 391 | ||
392 | void AudioWidget::skipBack() { | 392 | void AudioWidget::skipBack() { |
393 | skipDirection = -1; | 393 | skipDirection = -1; |
394 | startTimer( 50 ); | 394 | startTimer( 50 ); |
395 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | 395 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); |
396 | } | 396 | } |
397 | 397 | ||
398 | 398 | ||
399 | 399 | ||
400 | void AudioWidget::stopSkip() { | 400 | void AudioWidget::stopSkip() { |
401 | killTimers(); | 401 | killTimers(); |
402 | } | 402 | } |
403 | 403 | ||
404 | 404 | ||
405 | void AudioWidget::timerEvent( QTimerEvent * ) { | 405 | void AudioWidget::timerEvent( QTimerEvent * ) { |
406 | if ( skipDirection == +1 ) { | 406 | if ( skipDirection == +1 ) { |
407 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | 407 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); |
408 | } else if ( skipDirection == -1 ) { | 408 | } else if ( skipDirection == -1 ) { |
409 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | 409 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); |
410 | } | 410 | } |
411 | } | 411 | } |
412 | 412 | ||
413 | 413 | ||
414 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 414 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
415 | for ( int i = 0; i < numButtons; i++ ) { | 415 | for ( int i = 0; i < numButtons; i++ ) { |
416 | if ( event->state() == QMouseEvent::LeftButton ) { | 416 | if ( event->state() == QMouseEvent::LeftButton ) { |
417 | // The test to see if the mouse click is inside the button or not | 417 | // The test to see if the mouse click is inside the button or not |
418 | int x = event->pos().x() - xoff; | 418 | int x = event->pos().x() - xoff; |
419 | int y = event->pos().y() - yoff; | 419 | int y = event->pos().y() - yoff; |
420 | 420 | ||
421 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 421 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
422 | && y < imgButtonMask->height() | 422 | && y < imgButtonMask->height() |
423 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 423 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
424 | 424 | ||
425 | if ( isOnButton && !audioButtons[i].isHeld ) { | 425 | if ( isOnButton && !audioButtons[i].isHeld ) { |
426 | audioButtons[i].isHeld = TRUE; | 426 | audioButtons[i].isHeld = TRUE; |
427 | toggleButton(i); | 427 | toggleButton(i); |
428 | switch (i) { | 428 | switch (i) { |
429 | case AudioVolumeUp: | 429 | case AudioVolumeUp: |
430 | emit moreClicked(); | 430 | emit moreClicked(); |
431 | return; | 431 | return; |
432 | case AudioVolumeDown: | 432 | case AudioVolumeDown: |
433 | emit lessClicked(); | 433 | emit lessClicked(); |
434 | return; | 434 | return; |
435 | case AudioForward: | 435 | case AudioForward: |
436 | emit forwardClicked(); | 436 | emit forwardClicked(); |
437 | return; | 437 | return; |
438 | case AudioBack: | 438 | case AudioBack: |
439 | emit backClicked(); | 439 | emit backClicked(); |
440 | return; | 440 | return; |
441 | } | 441 | } |
442 | } | 442 | } |
443 | else if ( !isOnButton && audioButtons[i].isHeld ) { | 443 | else if ( !isOnButton && audioButtons[i].isHeld ) { |
444 | audioButtons[i].isHeld = FALSE; | 444 | audioButtons[i].isHeld = FALSE; |
445 | toggleButton(i); | 445 | toggleButton(i); |
446 | } | 446 | } |
447 | } else { | 447 | } else { |
448 | if ( audioButtons[i].isHeld ) { | 448 | if ( audioButtons[i].isHeld ) { |
449 | audioButtons[i].isHeld = FALSE; | 449 | audioButtons[i].isHeld = FALSE; |
450 | if ( !audioButtons[i].isToggle ) { | 450 | if ( !audioButtons[i].isToggle ) { |
451 | setToggleButton( i, FALSE ); | 451 | setToggleButton( i, FALSE ); |
452 | } | 452 | } |
453 | switch (i) { | 453 | switch (i) { |
454 | case AudioPlay: | 454 | case AudioPlay: |
455 | if( mediaPlayerState->isPaused ) { | 455 | if( mediaPlayerState->isPaused ) { |
456 | // setToggleButton( i, FALSE ); | 456 | // setToggleButton( i, FALSE ); |
457 | mediaPlayerState->setPaused( FALSE ); | 457 | mediaPlayerState->setPaused( FALSE ); |
458 | return; | 458 | return; |
459 | } else if( !mediaPlayerState->isPaused ) { | 459 | } else if( !mediaPlayerState->isPaused ) { |
460 | // setToggleButton( i, TRUE ); | 460 | // setToggleButton( i, TRUE ); |
461 | mediaPlayerState->setPaused( TRUE ); | 461 | mediaPlayerState->setPaused( TRUE ); |
462 | return; | 462 | return; |
463 | } else { | 463 | } else { |
464 | // setToggleButton( i, TRUE ); | 464 | // setToggleButton( i, TRUE ); |
465 | // mediaPlayerState->setPlaying( videoButtons[i].isDown ); | 465 | // mediaPlayerState->setPlaying( videoButtons[i].isDown ); |
466 | } | 466 | } |
467 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 467 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
468 | case AudioNext: mediaPlayerState->setNext(); return; | 468 | case AudioNext: mediaPlayerState->setNext(); return; |
469 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 469 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
470 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 470 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
471 | case AudioVolumeUp: emit moreReleased(); return; | 471 | case AudioVolumeUp: emit moreReleased(); return; |
472 | case AudioVolumeDown: emit lessReleased(); return; | 472 | case AudioVolumeDown: emit lessReleased(); return; |
473 | case AudioPlayList: mediaPlayerState->setList(); return; | 473 | case AudioPlayList: mediaPlayerState->setList(); return; |
474 | case AudioForward: emit forwardReleased(); return; | 474 | case AudioForward: emit forwardReleased(); return; |
475 | case AudioBack: emit backReleased(); return; | 475 | case AudioBack: emit backReleased(); return; |
476 | } | 476 | } |
477 | } | 477 | } |
478 | } | 478 | } |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | 482 | ||
483 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 483 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
484 | mouseMoveEvent( event ); | 484 | mouseMoveEvent( event ); |
485 | } | 485 | } |
486 | 486 | ||
487 | 487 | ||
488 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 488 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
489 | mouseMoveEvent( event ); | 489 | mouseMoveEvent( event ); |
490 | } | 490 | } |
491 | 491 | ||
492 | 492 | ||
493 | void AudioWidget::showEvent( QShowEvent* ) { | 493 | void AudioWidget::showEvent( QShowEvent* ) { |
494 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 494 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
495 | mouseMoveEvent( &event ); | 495 | mouseMoveEvent( &event ); |
496 | } | 496 | } |
497 | 497 | ||
498 | 498 | ||
499 | void AudioWidget::closeEvent( QCloseEvent* ) { | 499 | void AudioWidget::closeEvent( QCloseEvent* ) { |
500 | mediaPlayerState->setList(); | 500 | mediaPlayerState->setList(); |
501 | } | 501 | } |
502 | 502 | ||
503 | 503 | ||
504 | void AudioWidget::paintEvent( QPaintEvent * pe) { | 504 | void AudioWidget::paintEvent( QPaintEvent * pe) { |
505 | if ( !pe->erased() ) { | 505 | if ( !pe->erased() ) { |
506 | // Combine with background and double buffer | 506 | // Combine with background and double buffer |
507 | QPixmap pix( pe->rect().size() ); | 507 | QPixmap pix( pe->rect().size() ); |
508 | QPainter p( &pix ); | 508 | QPainter p( &pix ); |
509 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 509 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
510 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 510 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
511 | for ( int i = 0; i < numButtons; i++ ) | 511 | for ( int i = 0; i < numButtons; i++ ) |
512 | paintButton( &p, i ); | 512 | paintButton( &p, i ); |
513 | QPainter p2( this ); | 513 | QPainter p2( this ); |
514 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 514 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
515 | } else { | 515 | } else { |
516 | QPainter p( this ); | 516 | QPainter p( this ); |
517 | for ( int i = 0; i < numButtons; i++ ) | 517 | for ( int i = 0; i < numButtons; i++ ) |
518 | paintButton( &p, i ); | 518 | paintButton( &p, i ); |
519 | } | 519 | } |
520 | } | 520 | } |
521 | 521 | ||
522 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) | 522 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) |
523 | { | 523 | { |
524 | switch ( e->key() ) { | 524 | switch ( e->key() ) { |
525 | ////////////////////////////// Zaurus keys | 525 | ////////////////////////////// Zaurus keys |
526 | case Key_Home: | 526 | case Key_Home: |
527 | break; | 527 | break; |
528 | case Key_F9: //activity | 528 | case Key_F9: //activity |
529 | hide(); | 529 | hide(); |
530 | // qDebug("Audio F9"); | 530 | // qDebug("Audio F9"); |
531 | break; | 531 | break; |
532 | case Key_F10: //contacts | 532 | case Key_F10: //contacts |
533 | break; | 533 | break; |
534 | case Key_F11: //menu | 534 | case Key_F11: //menu |
535 | mediaPlayerState->toggleBlank(); | ||
535 | break; | 536 | break; |
536 | case Key_F12: //home | 537 | case Key_F12: //home |
537 | break; | 538 | break; |
538 | case Key_F13: //mail | 539 | case Key_F13: //mail |
539 | mediaPlayerState->toggleBlank(); | 540 | mediaPlayerState->toggleBlank(); |
540 | break; | 541 | break; |
541 | case Key_Space: { | 542 | case Key_Space: { |
542 | if(mediaPlayerState->playing()) { | 543 | if(mediaPlayerState->playing()) { |
543 | // toggleButton(1); | 544 | // toggleButton(1); |
544 | mediaPlayerState->setPlaying(FALSE); | 545 | mediaPlayerState->setPlaying(FALSE); |
545 | // toggleButton(1); | 546 | // toggleButton(1); |
546 | } else { | 547 | } else { |
547 | // toggleButton(0); | 548 | // toggleButton(0); |
548 | mediaPlayerState->setPlaying(TRUE); | 549 | mediaPlayerState->setPlaying(TRUE); |
549 | // toggleButton(0); | 550 | // toggleButton(0); |
550 | } | 551 | } |
551 | } | 552 | } |
552 | break; | 553 | break; |
553 | case Key_Down: | 554 | case Key_Down: |
554 | // toggleButton(6); | 555 | // toggleButton(6); |
555 | emit lessClicked(); | 556 | emit lessClicked(); |
556 | emit lessReleased(); | 557 | emit lessReleased(); |
557 | // toggleButton(6); | 558 | // toggleButton(6); |
558 | break; | 559 | break; |
559 | case Key_Up: | 560 | case Key_Up: |
560 | // toggleButton(5); | 561 | // toggleButton(5); |
561 | emit moreClicked(); | 562 | emit moreClicked(); |
562 | emit moreReleased(); | 563 | emit moreReleased(); |
563 | // toggleButton(5); | 564 | // toggleButton(5); |
564 | break; | 565 | break; |
565 | case Key_Right: | 566 | case Key_Right: |
566 | // toggleButton(3); | 567 | // toggleButton(3); |
567 | mediaPlayerState->setNext(); | 568 | mediaPlayerState->setNext(); |
568 | // toggleButton(3); | 569 | // toggleButton(3); |
569 | break; | 570 | break; |
570 | case Key_Left: | 571 | case Key_Left: |
571 | // toggleButton(4); | 572 | // toggleButton(4); |
572 | mediaPlayerState->setPrev(); | 573 | mediaPlayerState->setPrev(); |
573 | // toggleButton(4); | 574 | // toggleButton(4); |
574 | break; | 575 | break; |
575 | case Key_Escape: { | 576 | case Key_Escape: { |
576 | #if defined(QT_QWS_IPAQ) | 577 | #if defined(QT_QWS_IPAQ) |
577 | if( mediaPlayerState->isPaused ) { | 578 | if( mediaPlayerState->isPaused ) { |
578 | setToggleButton( i, FALSE ); | 579 | setToggleButton( i, FALSE ); |
579 | mediaPlayerState->setPaused( FALSE ); | 580 | mediaPlayerState->setPaused( FALSE ); |
580 | } else if( !mediaPlayerState->isPaused ) { | 581 | } else if( !mediaPlayerState->isPaused ) { |
581 | setToggleButton( i, TRUE ); | 582 | setToggleButton( i, TRUE ); |
582 | mediaPlayerState->setPaused( TRUE ); | 583 | mediaPlayerState->setPaused( TRUE ); |
583 | } | 584 | } |
584 | #endif | 585 | #endif |
585 | } | 586 | } |
586 | break; | 587 | break; |
587 | 588 | ||
588 | }; | 589 | }; |
589 | } | 590 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 858b51f..87f4f0c 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,294 +1,297 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/qcopenvelope_qws.h> | 5 | #include <qpe/qcopenvelope_qws.h> |
6 | 6 | ||
7 | #include <qmainwindow.h> | 7 | #include <qmainwindow.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qwidgetstack.h> | 9 | #include <qwidgetstack.h> |
10 | #include <qfile.h> | 10 | #include <qfile.h> |
11 | 11 | ||
12 | #include "mediaplayer.h" | 12 | #include "mediaplayer.h" |
13 | #include "playlistwidget.h" | 13 | #include "playlistwidget.h" |
14 | #include "audiowidget.h" | 14 | #include "audiowidget.h" |
15 | #include "videowidget.h" | 15 | #include "videowidget.h" |
16 | #include "volumecontrol.h" | 16 | #include "volumecontrol.h" |
17 | 17 | ||
18 | #include "mediaplayerstate.h" | 18 | #include "mediaplayerstate.h" |
19 | 19 | ||
20 | // for setBacklight() | 20 | // for setBacklight() |
21 | #include <linux/fb.h> | 21 | #include <linux/fb.h> |
22 | #include <sys/file.h> | 22 | #include <sys/file.h> |
23 | #include <sys/ioctl.h> | 23 | #include <sys/ioctl.h> |
24 | 24 | ||
25 | 25 | ||
26 | extern AudioWidget *audioUI; | 26 | extern AudioWidget *audioUI; |
27 | extern VideoWidget *videoUI; | 27 | extern VideoWidget *videoUI; |
28 | extern PlayListWidget *playList; | 28 | extern PlayListWidget *playList; |
29 | extern MediaPlayerState *mediaPlayerState; | 29 | extern MediaPlayerState *mediaPlayerState; |
30 | 30 | ||
31 | 31 | ||
32 | #define FBIOBLANK 0x4611 | ||
33 | |||
32 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 34 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
33 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 35 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
34 | 36 | ||
35 | 37 | ||
36 | // xineControl = new XineControl(); | 38 | // xineControl = new XineControl(); |
37 | // QPEApplication::grabKeyboard(); // EVIL | 39 | // QPEApplication::grabKeyboard(); // EVIL |
38 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 40 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
39 | 41 | ||
40 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 42 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
41 | 43 | ||
42 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 44 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
43 | 45 | ||
44 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 46 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
45 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 47 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
46 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | 48 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); |
47 | 49 | ||
48 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 50 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
49 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 51 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
50 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 52 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
51 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 53 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
52 | 54 | ||
53 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 55 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
54 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 56 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
55 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 57 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
56 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 58 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
57 | 59 | ||
58 | volControl = new VolumeControl; | 60 | volControl = new VolumeControl; |
59 | xineControl = new XineControl(); | 61 | xineControl = new XineControl(); |
60 | } | 62 | } |
61 | 63 | ||
62 | MediaPlayer::~MediaPlayer() { | 64 | MediaPlayer::~MediaPlayer() { |
63 | delete xineControl; | 65 | delete xineControl; |
64 | delete volControl; | 66 | delete volControl; |
65 | } | 67 | } |
66 | 68 | ||
67 | void MediaPlayer::pauseCheck( bool b ) { | 69 | void MediaPlayer::pauseCheck( bool b ) { |
68 | if ( b && !mediaPlayerState->playing() ) { | 70 | if ( b && !mediaPlayerState->playing() ) { |
69 | mediaPlayerState->setPaused( FALSE ); | 71 | mediaPlayerState->setPaused( FALSE ); |
70 | } | 72 | } |
71 | } | 73 | } |
72 | 74 | ||
73 | void MediaPlayer::play() { | 75 | void MediaPlayer::play() { |
74 | mediaPlayerState->setPlaying( FALSE ); | 76 | mediaPlayerState->setPlaying( FALSE ); |
75 | mediaPlayerState->setPlaying( TRUE ); | 77 | mediaPlayerState->setPlaying( TRUE ); |
76 | } | 78 | } |
77 | 79 | ||
78 | void MediaPlayer::setPlaying( bool play ) { | 80 | void MediaPlayer::setPlaying( bool play ) { |
79 | if ( !play ) { | 81 | if ( !play ) { |
80 | return; | 82 | return; |
81 | } | 83 | } |
82 | 84 | ||
83 | if ( mediaPlayerState->paused() ) { | 85 | if ( mediaPlayerState->paused() ) { |
84 | mediaPlayerState->setPaused( FALSE ); | 86 | mediaPlayerState->setPaused( FALSE ); |
85 | return; | 87 | return; |
86 | } | 88 | } |
87 | 89 | ||
88 | const DocLnk *playListCurrent = playList->current(); | 90 | const DocLnk *playListCurrent = playList->current(); |
89 | if ( playListCurrent != NULL ) { | 91 | if ( playListCurrent != NULL ) { |
90 | currentFile = playListCurrent; | 92 | currentFile = playListCurrent; |
91 | } | 93 | } |
92 | 94 | ||
93 | xineControl->play( currentFile->file() ); | 95 | xineControl->play( currentFile->file() ); |
94 | 96 | ||
95 | xineControl->length(); | 97 | xineControl->length(); |
96 | long seconds = mediaPlayerState->length();// | 98 | long seconds = mediaPlayerState->length();// |
97 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 99 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
98 | qDebug(time); | 100 | qDebug(time); |
99 | 101 | ||
100 | QString tickerText; | 102 | QString tickerText; |
101 | if( currentFile->file().left(4) == "http" ) | 103 | if( currentFile->file().left(4) == "http" ) |
102 | tickerText= tr( " File: " ) + currentFile->name(); | 104 | tickerText= tr( " File: " ) + currentFile->name(); |
103 | else | 105 | else |
104 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | 106 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; |
105 | 107 | ||
106 | audioUI->setTickerText( currentFile->file( ) ); | 108 | audioUI->setTickerText( currentFile->file( ) ); |
107 | 109 | ||
108 | } | 110 | } |
109 | 111 | ||
110 | 112 | ||
111 | void MediaPlayer::prev() { | 113 | void MediaPlayer::prev() { |
112 | if ( playList->prev() ) { | 114 | if ( playList->prev() ) { |
113 | play(); | 115 | play(); |
114 | } else if ( mediaPlayerState->looping() ) { | 116 | } else if ( mediaPlayerState->looping() ) { |
115 | if ( playList->last() ) { | 117 | if ( playList->last() ) { |
116 | play(); | 118 | play(); |
117 | } | 119 | } |
118 | } else { | 120 | } else { |
119 | mediaPlayerState->setList(); | 121 | mediaPlayerState->setList(); |
120 | } | 122 | } |
121 | } | 123 | } |
122 | 124 | ||
123 | 125 | ||
124 | void MediaPlayer::next() { | 126 | void MediaPlayer::next() { |
125 | if ( playList->next() ) { | 127 | if ( playList->next() ) { |
126 | play(); | 128 | play(); |
127 | } else if ( mediaPlayerState->looping() ) { | 129 | } else if ( mediaPlayerState->looping() ) { |
128 | if ( playList->first() ) { | 130 | if ( playList->first() ) { |
129 | play(); | 131 | play(); |
130 | } | 132 | } |
131 | } else { | 133 | } else { |
132 | mediaPlayerState->setList(); | 134 | mediaPlayerState->setList(); |
133 | } | 135 | } |
134 | } | 136 | } |
135 | 137 | ||
136 | 138 | ||
137 | void MediaPlayer::startDecreasingVolume() { | 139 | void MediaPlayer::startDecreasingVolume() { |
138 | volumeDirection = -1; | 140 | volumeDirection = -1; |
139 | startTimer( 100 ); | 141 | startTimer( 100 ); |
140 | volControl->decVol(2); | 142 | volControl->decVol(2); |
141 | } | 143 | } |
142 | 144 | ||
143 | 145 | ||
144 | void MediaPlayer::startIncreasingVolume() { | 146 | void MediaPlayer::startIncreasingVolume() { |
145 | volumeDirection = +1; | 147 | volumeDirection = +1; |
146 | startTimer( 100 ); | 148 | startTimer( 100 ); |
147 | volControl->incVol(2); | 149 | volControl->incVol(2); |
148 | } | 150 | } |
149 | 151 | ||
150 | 152 | ||
151 | bool drawnOnScreenDisplay = FALSE; | 153 | bool drawnOnScreenDisplay = FALSE; |
152 | unsigned int onScreenDisplayVolume = 0; | 154 | unsigned int onScreenDisplayVolume = 0; |
153 | const int yoff = 110; | 155 | const int yoff = 110; |
154 | 156 | ||
155 | void MediaPlayer::stopChangingVolume() { | 157 | void MediaPlayer::stopChangingVolume() { |
156 | killTimers(); | 158 | killTimers(); |
157 | // Get rid of the on-screen display stuff | 159 | // Get rid of the on-screen display stuff |
158 | drawnOnScreenDisplay = FALSE; | 160 | drawnOnScreenDisplay = FALSE; |
159 | onScreenDisplayVolume = 0; | 161 | onScreenDisplayVolume = 0; |
160 | int w=0; | 162 | int w=0; |
161 | int h=0; | 163 | int h=0; |
162 | if( !xineControl->hasVideo()) { | 164 | if( !xineControl->hasVideo()) { |
163 | w = audioUI->width(); | 165 | w = audioUI->width(); |
164 | h = audioUI->height(); | 166 | h = audioUI->height(); |
165 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 167 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
166 | } else { | 168 | } else { |
167 | w = videoUI->width(); | 169 | w = videoUI->width(); |
168 | h = videoUI->height(); | 170 | h = videoUI->height(); |
169 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 171 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
170 | } | 172 | } |
171 | } | 173 | } |
172 | 174 | ||
173 | 175 | ||
174 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 176 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
175 | if ( volumeDirection == +1 ) { | 177 | if ( volumeDirection == +1 ) { |
176 | volControl->incVol(2); | 178 | volControl->incVol(2); |
177 | } else if ( volumeDirection == -1 ) { | 179 | } else if ( volumeDirection == -1 ) { |
178 | volControl->decVol(2); | 180 | volControl->decVol(2); |
179 | } | 181 | } |
180 | 182 | ||
181 | 183 | ||
182 | // TODO FIXME | 184 | // TODO FIXME |
183 | unsigned int v; | 185 | unsigned int v; |
184 | v = volControl->getVolume(); | 186 | v = volControl->getVolume(); |
185 | v = v / 10; | 187 | v = v / 10; |
186 | 188 | ||
187 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 189 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
188 | return; | 190 | return; |
189 | } | 191 | } |
190 | 192 | ||
191 | int w=0; int h=0; | 193 | int w=0; int h=0; |
192 | if( !xineControl->hasVideo()) { | 194 | if( !xineControl->hasVideo()) { |
193 | w = audioUI->width(); | 195 | w = audioUI->width(); |
194 | h = audioUI->height(); | 196 | h = audioUI->height(); |
195 | 197 | ||
196 | if ( drawnOnScreenDisplay ) { | 198 | if ( drawnOnScreenDisplay ) { |
197 | if ( onScreenDisplayVolume > v ) { | 199 | if ( onScreenDisplayVolume > v ) { |
198 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 200 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
199 | } | 201 | } |
200 | } | 202 | } |
201 | drawnOnScreenDisplay = TRUE; | 203 | drawnOnScreenDisplay = TRUE; |
202 | onScreenDisplayVolume = v; | 204 | onScreenDisplayVolume = v; |
203 | QPainter p( audioUI ); | 205 | QPainter p( audioUI ); |
204 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 206 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
205 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 207 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
206 | 208 | ||
207 | QFont f; | 209 | QFont f; |
208 | f.setPixelSize( 20 ); | 210 | f.setPixelSize( 20 ); |
209 | f.setBold( TRUE ); | 211 | f.setBold( TRUE ); |
210 | p.setFont( f ); | 212 | p.setFont( f ); |
211 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 213 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
212 | 214 | ||
213 | for ( unsigned int i = 0; i < 10; i++ ) { | 215 | for ( unsigned int i = 0; i < 10; i++ ) { |
214 | if ( v > i ) { | 216 | if ( v > i ) { |
215 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 217 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
216 | } else { | 218 | } else { |
217 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 219 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
218 | } | 220 | } |
219 | } | 221 | } |
220 | } else { | 222 | } else { |
221 | w = videoUI->width(); | 223 | w = videoUI->width(); |
222 | h = videoUI->height(); | 224 | h = videoUI->height(); |
223 | 225 | ||
224 | if ( drawnOnScreenDisplay ) { | 226 | if ( drawnOnScreenDisplay ) { |
225 | if ( onScreenDisplayVolume > v ) { | 227 | if ( onScreenDisplayVolume > v ) { |
226 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 228 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
227 | } | 229 | } |
228 | } | 230 | } |
229 | drawnOnScreenDisplay = TRUE; | 231 | drawnOnScreenDisplay = TRUE; |
230 | onScreenDisplayVolume = v; | 232 | onScreenDisplayVolume = v; |
231 | QPainter p( videoUI ); | 233 | QPainter p( videoUI ); |
232 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 234 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
233 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 235 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
234 | 236 | ||
235 | QFont f; | 237 | QFont f; |
236 | f.setPixelSize( 20 ); | 238 | f.setPixelSize( 20 ); |
237 | f.setBold( TRUE ); | 239 | f.setBold( TRUE ); |
238 | p.setFont( f ); | 240 | p.setFont( f ); |
239 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 241 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
240 | 242 | ||
241 | for ( unsigned int i = 0; i < 10; i++ ) { | 243 | for ( unsigned int i = 0; i < 10; i++ ) { |
242 | if ( v > i ) { | 244 | if ( v > i ) { |
243 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 245 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
244 | } else { | 246 | } else { |
245 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 247 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
246 | } | 248 | } |
247 | } | 249 | } |
248 | } | 250 | } |
249 | } | 251 | } |
250 | 252 | ||
251 | 253 | ||
252 | void MediaPlayer::blank( bool b ) { | 254 | void MediaPlayer::blank( bool b ) { |
253 | fd=open("/dev/fb0",O_RDWR); | 255 | fd=open("/dev/fb0",O_RDWR); |
254 | if (fd != -1) { | 256 | if (fd != -1) { |
255 | 257 | if ( b ) { | |
256 | if ( !b ) { | ||
257 | qDebug("do blanking"); | 258 | qDebug("do blanking"); |
258 | ioctl( fd, FBIOBLANK, 3 ); | 259 | ioctl( fd, FBIOBLANK, 3 ); |
259 | isBlanked = TRUE; | 260 | isBlanked = TRUE; |
260 | } else { | 261 | } else { |
261 | qDebug("do unblanking"); | 262 | qDebug("do unblanking"); |
262 | ioctl( fd, FBIOBLANK, 0); | 263 | ioctl( fd, FBIOBLANK, 0); |
263 | isBlanked = FALSE; | 264 | isBlanked = FALSE; |
264 | } | 265 | } |
265 | close( fd ); | 266 | close( fd ); |
267 | } else { | ||
268 | qDebug("<< /dev/fb0 could not be opend >>"); | ||
266 | } | 269 | } |
267 | } | 270 | } |
268 | 271 | ||
269 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 272 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
270 | switch ( e->key() ) { | 273 | switch ( e->key() ) { |
271 | ////////////////////////////// Zaurus keys | 274 | ////////////////////////////// Zaurus keys |
272 | case Key_Home: | 275 | case Key_Home: |
273 | break; | 276 | break; |
274 | case Key_F9: //activity | 277 | case Key_F9: //activity |
275 | break; | 278 | break; |
276 | case Key_F10: //contacts | 279 | case Key_F10: //contacts |
277 | break; | 280 | break; |
278 | case Key_F11: //menu | 281 | case Key_F11: //menu |
279 | break; | 282 | break; |
280 | case Key_F12: //home | 283 | case Key_F12: //home |
281 | qDebug("Blank here"); | 284 | qDebug("Blank here"); |
282 | // mediaPlayerState->toggleBlank(); | 285 | // mediaPlayerState->toggleBlank(); |
283 | break; | 286 | break; |
284 | case Key_F13: //mail | 287 | case Key_F13: //mail |
285 | qDebug("Blank here"); | 288 | qDebug("Blank here"); |
286 | // mediaPlayerState->toggleBlank(); | 289 | // mediaPlayerState->toggleBlank(); |
287 | break; | 290 | break; |
288 | } | 291 | } |
289 | } | 292 | } |
290 | 293 | ||
291 | void MediaPlayer::cleanUp() { | 294 | void MediaPlayer::cleanUp() { |
292 | // QPEApplication::grabKeyboard(); | 295 | // QPEApplication::grabKeyboard(); |
293 | // QPEApplication::ungrabKeyboard(); | 296 | // QPEApplication::ungrabKeyboard(); |
294 | } | 297 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 6aafb88..6833e07 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -1,281 +1,281 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | #include <qvaluelist.h> | 4 | #include <qvaluelist.h> |
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include "mediaplayerstate.h" | 7 | #include "mediaplayerstate.h" |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | //#define MediaPlayerDebug(x) qDebug x | 11 | //#define MediaPlayerDebug(x) qDebug x |
12 | #define MediaPlayerDebug(x) | 12 | #define MediaPlayerDebug(x) |
13 | 13 | ||
14 | 14 | ||
15 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 15 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
16 | : QObject( parent, name ) { | 16 | : QObject( parent, name ) { |
17 | Config cfg( "OpiePlayer" ); | 17 | Config cfg( "OpiePlayer" ); |
18 | readConfig( cfg ); | 18 | readConfig( cfg ); |
19 | 19 | ||
20 | } | 20 | } |
21 | 21 | ||
22 | 22 | ||
23 | MediaPlayerState::~MediaPlayerState() { | 23 | MediaPlayerState::~MediaPlayerState() { |
24 | Config cfg( "OpiePlayer" ); | 24 | Config cfg( "OpiePlayer" ); |
25 | writeConfig( cfg ); | 25 | writeConfig( cfg ); |
26 | 26 | ||
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | void MediaPlayerState::readConfig( Config& cfg ) { | 30 | void MediaPlayerState::readConfig( Config& cfg ) { |
31 | cfg.setGroup("Options"); | 31 | cfg.setGroup("Options"); |
32 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); | 32 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); |
33 | isScaled = cfg.readBoolEntry( "Scaling" ); | 33 | isScaled = cfg.readBoolEntry( "Scaling" ); |
34 | isLooping = cfg.readBoolEntry( "Looping" ); | 34 | isLooping = cfg.readBoolEntry( "Looping" ); |
35 | isShuffled = cfg.readBoolEntry( "Shuffle" ); | 35 | isShuffled = cfg.readBoolEntry( "Shuffle" ); |
36 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); | 36 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); |
37 | usePlaylist = TRUE; | 37 | usePlaylist = TRUE; |
38 | isPlaying = FALSE; | 38 | isPlaying = FALSE; |
39 | isPaused = FALSE; | 39 | isPaused = FALSE; |
40 | curPosition = 0; | 40 | curPosition = 0; |
41 | curLength = 0; | 41 | curLength = 0; |
42 | curView = 'l'; | 42 | curView = 'l'; |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 46 | void MediaPlayerState::writeConfig( Config& cfg ) const { |
47 | cfg.setGroup("Options"); | 47 | cfg.setGroup("Options"); |
48 | cfg.writeEntry("FullScreen", isFullscreen ); | 48 | cfg.writeEntry("FullScreen", isFullscreen ); |
49 | cfg.writeEntry("Scaling", isScaled ); | 49 | cfg.writeEntry("Scaling", isScaled ); |
50 | cfg.writeEntry("Looping", isLooping ); | 50 | cfg.writeEntry("Looping", isLooping ); |
51 | cfg.writeEntry("Shuffle", isShuffled ); | 51 | cfg.writeEntry("Shuffle", isShuffled ); |
52 | cfg.writeEntry("UsePlayList", usePlaylist ); | 52 | cfg.writeEntry("UsePlayList", usePlaylist ); |
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | // public stuff | 56 | // public stuff |
57 | 57 | ||
58 | 58 | ||
59 | bool MediaPlayerState::streaming() { | 59 | bool MediaPlayerState::streaming() { |
60 | return isStreaming; | 60 | return isStreaming; |
61 | } | 61 | } |
62 | 62 | ||
63 | bool MediaPlayerState::fullscreen() { | 63 | bool MediaPlayerState::fullscreen() { |
64 | return isFullscreen; | 64 | return isFullscreen; |
65 | } | 65 | } |
66 | 66 | ||
67 | bool MediaPlayerState::scaled() { | 67 | bool MediaPlayerState::scaled() { |
68 | return isScaled; | 68 | return isScaled; |
69 | } | 69 | } |
70 | 70 | ||
71 | bool MediaPlayerState::looping() { | 71 | bool MediaPlayerState::looping() { |
72 | return isLooping; | 72 | return isLooping; |
73 | } | 73 | } |
74 | 74 | ||
75 | bool MediaPlayerState::shuffled() { | 75 | bool MediaPlayerState::shuffled() { |
76 | return isShuffled; | 76 | return isShuffled; |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | bool MediaPlayerState:: playlist() { | 80 | bool MediaPlayerState:: playlist() { |
81 | return usePlaylist; | 81 | return usePlaylist; |
82 | } | 82 | } |
83 | 83 | ||
84 | bool MediaPlayerState::paused() { | 84 | bool MediaPlayerState::paused() { |
85 | return isPaused; | 85 | return isPaused; |
86 | } | 86 | } |
87 | 87 | ||
88 | bool MediaPlayerState::playing() { | 88 | bool MediaPlayerState::playing() { |
89 | return isPlaying; | 89 | return isPlaying; |
90 | } | 90 | } |
91 | 91 | ||
92 | bool MediaPlayerState::stop() { | 92 | bool MediaPlayerState::stop() { |
93 | return isStoped; | 93 | return isStoped; |
94 | } | 94 | } |
95 | 95 | ||
96 | long MediaPlayerState::position() { | 96 | long MediaPlayerState::position() { |
97 | return curPosition; | 97 | return curPosition; |
98 | } | 98 | } |
99 | 99 | ||
100 | long MediaPlayerState::length() { | 100 | long MediaPlayerState::length() { |
101 | return curLength; | 101 | return curLength; |
102 | } | 102 | } |
103 | 103 | ||
104 | char MediaPlayerState::view() { | 104 | char MediaPlayerState::view() { |
105 | return curView; | 105 | return curView; |
106 | } | 106 | } |
107 | 107 | ||
108 | // slots | 108 | // slots |
109 | void MediaPlayerState::setIsStreaming( bool b ) { | 109 | void MediaPlayerState::setIsStreaming( bool b ) { |
110 | 110 | ||
111 | if ( isStreaming == b ) { | 111 | if ( isStreaming == b ) { |
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | isStreaming = b; | 114 | isStreaming = b; |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | void MediaPlayerState::setBlank( bool b ) { | 118 | void MediaPlayerState::setFullscreen( bool b ) { |
119 | if ( isFullscreen == b ) { | 119 | if ( isFullscreen == b ) { |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | isFullscreen = b; | 122 | isFullscreen = b; |
123 | emit fullscreenToggled(b); | 123 | emit fullscreenToggled(b); |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | void MediaPlayerState::setFullscreen( bool b ) { | 127 | void MediaPlayerState::setBlanked( bool b ) { |
128 | if ( isBlanked == b ) { | 128 | if ( isBlanked == b ) { |
129 | return; | 129 | return; |
130 | } | 130 | } |
131 | isBlanked = b; | 131 | isBlanked = b; |
132 | emit blankToggled(b); | 132 | emit blankToggled(b); |
133 | } | 133 | } |
134 | 134 | ||
135 | 135 | ||
136 | void MediaPlayerState::setScaled( bool b ) { | 136 | void MediaPlayerState::setScaled( bool b ) { |
137 | if ( isScaled == b ) { | 137 | if ( isScaled == b ) { |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | isScaled = b; | 140 | isScaled = b; |
141 | emit scaledToggled(b); | 141 | emit scaledToggled(b); |
142 | } | 142 | } |
143 | 143 | ||
144 | void MediaPlayerState::setLooping( bool b ) { | 144 | void MediaPlayerState::setLooping( bool b ) { |
145 | if ( isLooping == b ) { | 145 | if ( isLooping == b ) { |
146 | return; | 146 | return; |
147 | } | 147 | } |
148 | isLooping = b; | 148 | isLooping = b; |
149 | emit loopingToggled(b); | 149 | emit loopingToggled(b); |
150 | } | 150 | } |
151 | 151 | ||
152 | void MediaPlayerState::setShuffled( bool b ) { | 152 | void MediaPlayerState::setShuffled( bool b ) { |
153 | if ( isShuffled == b ) { | 153 | if ( isShuffled == b ) { |
154 | return; | 154 | return; |
155 | } | 155 | } |
156 | isShuffled = b; | 156 | isShuffled = b; |
157 | emit shuffledToggled(b); | 157 | emit shuffledToggled(b); |
158 | } | 158 | } |
159 | 159 | ||
160 | void MediaPlayerState::setPlaylist( bool b ) { | 160 | void MediaPlayerState::setPlaylist( bool b ) { |
161 | if ( usePlaylist == b ) { | 161 | if ( usePlaylist == b ) { |
162 | return; | 162 | return; |
163 | } | 163 | } |
164 | usePlaylist = b; | 164 | usePlaylist = b; |
165 | emit playlistToggled(b); | 165 | emit playlistToggled(b); |
166 | } | 166 | } |
167 | 167 | ||
168 | void MediaPlayerState::setPaused( bool b ) { | 168 | void MediaPlayerState::setPaused( bool b ) { |
169 | if ( isPaused == b ) { | 169 | if ( isPaused == b ) { |
170 | isPaused = FALSE; | 170 | isPaused = FALSE; |
171 | emit pausedToggled(FALSE); | 171 | emit pausedToggled(FALSE); |
172 | return; | 172 | return; |
173 | } | 173 | } |
174 | isPaused = b; | 174 | isPaused = b; |
175 | emit pausedToggled(b); | 175 | emit pausedToggled(b); |
176 | } | 176 | } |
177 | 177 | ||
178 | void MediaPlayerState::setPlaying( bool b ) { | 178 | void MediaPlayerState::setPlaying( bool b ) { |
179 | if ( isPlaying == b ) { | 179 | if ( isPlaying == b ) { |
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | isPlaying = b; | 182 | isPlaying = b; |
183 | isStoped = !b; | 183 | isStoped = !b; |
184 | emit playingToggled(b); | 184 | emit playingToggled(b); |
185 | } | 185 | } |
186 | 186 | ||
187 | void MediaPlayerState::setStop( bool b ) { | 187 | void MediaPlayerState::setStop( bool b ) { |
188 | if ( isStoped == b ) { | 188 | if ( isStoped == b ) { |
189 | return; | 189 | return; |
190 | } | 190 | } |
191 | isStoped = b; | 191 | isStoped = b; |
192 | emit stopToggled(b); | 192 | emit stopToggled(b); |
193 | } | 193 | } |
194 | 194 | ||
195 | void MediaPlayerState::setPosition( long p ) { | 195 | void MediaPlayerState::setPosition( long p ) { |
196 | if ( curPosition == p ) { | 196 | if ( curPosition == p ) { |
197 | return; | 197 | return; |
198 | } | 198 | } |
199 | curPosition = p; | 199 | curPosition = p; |
200 | emit positionChanged(p); | 200 | emit positionChanged(p); |
201 | } | 201 | } |
202 | 202 | ||
203 | void MediaPlayerState::updatePosition( long p ){ | 203 | void MediaPlayerState::updatePosition( long p ){ |
204 | if ( curPosition == p ) { | 204 | if ( curPosition == p ) { |
205 | return; | 205 | return; |
206 | } | 206 | } |
207 | curPosition = p; | 207 | curPosition = p; |
208 | emit positionUpdated(p); | 208 | emit positionUpdated(p); |
209 | } | 209 | } |
210 | 210 | ||
211 | void MediaPlayerState::setLength( long l ) { | 211 | void MediaPlayerState::setLength( long l ) { |
212 | if ( curLength == l ) { | 212 | if ( curLength == l ) { |
213 | return; | 213 | return; |
214 | } | 214 | } |
215 | curLength = l; | 215 | curLength = l; |
216 | emit lengthChanged(l); | 216 | emit lengthChanged(l); |
217 | } | 217 | } |
218 | 218 | ||
219 | void MediaPlayerState::setView( char v ) { | 219 | void MediaPlayerState::setView( char v ) { |
220 | if ( curView == v ) { | 220 | if ( curView == v ) { |
221 | return; | 221 | return; |
222 | } | 222 | } |
223 | curView = v; | 223 | curView = v; |
224 | emit viewChanged(v); | 224 | emit viewChanged(v); |
225 | } | 225 | } |
226 | 226 | ||
227 | void MediaPlayerState::setPrev(){ | 227 | void MediaPlayerState::setPrev(){ |
228 | emit prev(); | 228 | emit prev(); |
229 | } | 229 | } |
230 | 230 | ||
231 | void MediaPlayerState::setNext() { | 231 | void MediaPlayerState::setNext() { |
232 | emit next(); | 232 | emit next(); |
233 | } | 233 | } |
234 | 234 | ||
235 | void MediaPlayerState::setList() { | 235 | void MediaPlayerState::setList() { |
236 | setPlaying( FALSE ); | 236 | setPlaying( FALSE ); |
237 | setView('l'); | 237 | setView('l'); |
238 | } | 238 | } |
239 | 239 | ||
240 | void MediaPlayerState::setVideo() { | 240 | void MediaPlayerState::setVideo() { |
241 | setView('v'); | 241 | setView('v'); |
242 | } | 242 | } |
243 | 243 | ||
244 | void MediaPlayerState::setAudio() { | 244 | void MediaPlayerState::setAudio() { |
245 | setView('a'); | 245 | setView('a'); |
246 | } | 246 | } |
247 | 247 | ||
248 | void MediaPlayerState::toggleFullscreen() { | 248 | void MediaPlayerState::toggleFullscreen() { |
249 | setFullscreen( !isFullscreen ); | 249 | setFullscreen( !isFullscreen ); |
250 | } | 250 | } |
251 | 251 | ||
252 | void MediaPlayerState::toggleScaled() { | 252 | void MediaPlayerState::toggleScaled() { |
253 | setScaled( !isScaled); | 253 | setScaled( !isScaled); |
254 | } | 254 | } |
255 | 255 | ||
256 | void MediaPlayerState::toggleLooping() { | 256 | void MediaPlayerState::toggleLooping() { |
257 | setLooping( !isLooping); | 257 | setLooping( !isLooping); |
258 | } | 258 | } |
259 | 259 | ||
260 | void MediaPlayerState::toggleShuffled() { | 260 | void MediaPlayerState::toggleShuffled() { |
261 | setShuffled( !isShuffled); | 261 | setShuffled( !isShuffled); |
262 | } | 262 | } |
263 | 263 | ||
264 | void MediaPlayerState::togglePlaylist() { | 264 | void MediaPlayerState::togglePlaylist() { |
265 | setPlaylist( !usePlaylist); | 265 | setPlaylist( !usePlaylist); |
266 | } | 266 | } |
267 | 267 | ||
268 | void MediaPlayerState::togglePaused() { | 268 | void MediaPlayerState::togglePaused() { |
269 | setPaused( !isPaused); | 269 | setPaused( !isPaused); |
270 | } | 270 | } |
271 | 271 | ||
272 | void MediaPlayerState::togglePlaying() { | 272 | void MediaPlayerState::togglePlaying() { |
273 | setPlaying( !isPlaying); | 273 | setPlaying( !isPlaying); |
274 | } | 274 | } |
275 | 275 | ||
276 | void MediaPlayerState::toggleBlank() { | 276 | void MediaPlayerState::toggleBlank() { |
277 | setBlank( !isBlanked); | 277 | setBlanked( !isBlanked); |
278 | } | 278 | } |
279 | 279 | ||
280 | 280 | ||
281 | 281 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 3baffd3..b3431d7 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -1,135 +1,135 @@ | |||
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 MEDIA_PLAYER_STATE_H | 34 | #ifndef MEDIA_PLAYER_STATE_H |
35 | #define MEDIA_PLAYER_STATE_H | 35 | #define MEDIA_PLAYER_STATE_H |
36 | 36 | ||
37 | 37 | ||
38 | #include <qobject.h> | 38 | #include <qobject.h> |
39 | 39 | ||
40 | 40 | ||
41 | class MediaPlayerDecoder; | 41 | class MediaPlayerDecoder; |
42 | class Config; | 42 | class Config; |
43 | 43 | ||
44 | 44 | ||
45 | class MediaPlayerState : public QObject { | 45 | class MediaPlayerState : public QObject { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
48 | MediaPlayerState( QObject *parent, const char *name ); | 48 | MediaPlayerState( QObject *parent, const char *name ); |
49 | ~MediaPlayerState(); | 49 | ~MediaPlayerState(); |
50 | 50 | ||
51 | bool isPaused; | 51 | bool isPaused; |
52 | bool isPlaying; | 52 | bool isPlaying; |
53 | bool isStoped; | 53 | bool isStoped; |
54 | bool streaming(); | 54 | bool streaming(); |
55 | bool fullscreen(); | 55 | bool fullscreen(); |
56 | bool scaled(); | 56 | bool scaled(); |
57 | bool looping(); | 57 | bool looping(); |
58 | bool shuffled(); | 58 | bool shuffled(); |
59 | bool playlist(); | 59 | bool playlist(); |
60 | bool paused(); | 60 | bool paused(); |
61 | bool playing(); | 61 | bool playing(); |
62 | bool stop(); | 62 | bool stop(); |
63 | long position(); | 63 | long position(); |
64 | long length(); | 64 | long length(); |
65 | char view(); | 65 | char view(); |
66 | 66 | ||
67 | public slots: | 67 | public slots: |
68 | void setIsStreaming( bool b ); | 68 | void setIsStreaming( bool b ); |
69 | void setFullscreen( bool b ); | 69 | void setFullscreen( bool b ); |
70 | void setScaled( bool b ); | 70 | void setScaled( bool b ); |
71 | void setLooping( bool b ); | 71 | void setLooping( bool b ); |
72 | void setShuffled( bool b ); | 72 | void setShuffled( bool b ); |
73 | void setPlaylist( bool b ); | 73 | void setPlaylist( bool b ); |
74 | void setPaused( bool b ); | 74 | void setPaused( bool b ); |
75 | void setPlaying( bool b ); | 75 | void setPlaying( bool b ); |
76 | void setStop( bool b ); | 76 | void setStop( bool b ); |
77 | void setPosition( long p ); | 77 | void setPosition( long p ); |
78 | void updatePosition( long p ); | 78 | void updatePosition( long p ); |
79 | void setLength( long l ); | 79 | void setLength( long l ); |
80 | void setView( char v ); | 80 | void setView( char v ); |
81 | void setBlank( bool b ); | 81 | void setBlanked( bool b ); |
82 | 82 | ||
83 | void setPrev(); | 83 | void setPrev(); |
84 | void setNext(); | 84 | void setNext(); |
85 | void setList(); | 85 | void setList(); |
86 | void setVideo(); | 86 | void setVideo(); |
87 | void setAudio(); | 87 | void setAudio(); |
88 | 88 | ||
89 | void toggleFullscreen(); | 89 | void toggleFullscreen(); |
90 | void toggleScaled(); | 90 | void toggleScaled(); |
91 | void toggleLooping(); | 91 | void toggleLooping(); |
92 | void toggleShuffled(); | 92 | void toggleShuffled(); |
93 | void togglePlaylist(); | 93 | void togglePlaylist(); |
94 | void togglePaused(); | 94 | void togglePaused(); |
95 | void togglePlaying(); | 95 | void togglePlaying(); |
96 | void toggleBlank(); | 96 | void toggleBlank(); |
97 | 97 | ||
98 | signals: | 98 | signals: |
99 | void fullscreenToggled( bool ); | 99 | void fullscreenToggled( bool ); |
100 | void scaledToggled( bool ); | 100 | void scaledToggled( bool ); |
101 | void loopingToggled( bool ); | 101 | void loopingToggled( bool ); |
102 | void shuffledToggled( bool ); | 102 | void shuffledToggled( bool ); |
103 | void playlistToggled( bool ); | 103 | void playlistToggled( bool ); |
104 | void pausedToggled( bool ); | 104 | void pausedToggled( bool ); |
105 | void playingToggled( bool ); | 105 | void playingToggled( bool ); |
106 | void stopToggled( bool ); | 106 | void stopToggled( bool ); |
107 | void positionChanged( long ); // When the slider is moved | 107 | void positionChanged( long ); // When the slider is moved |
108 | void positionUpdated( long ); // When the media file progresses | 108 | void positionUpdated( long ); // When the media file progresses |
109 | void lengthChanged( long ); | 109 | void lengthChanged( long ); |
110 | void viewChanged( char ); | 110 | void viewChanged( char ); |
111 | void blankToggled( bool ); | 111 | void blankToggled( bool ); |
112 | void prev(); | 112 | void prev(); |
113 | void next(); | 113 | void next(); |
114 | 114 | ||
115 | private: | 115 | private: |
116 | bool isStreaming; | 116 | bool isStreaming; |
117 | bool isFullscreen; | 117 | bool isFullscreen; |
118 | bool isScaled; | 118 | bool isScaled; |
119 | bool isBlanked; | 119 | bool isBlanked; |
120 | bool isLooping; | 120 | bool isLooping; |
121 | bool isShuffled; | 121 | bool isShuffled; |
122 | bool usePlaylist; | 122 | bool usePlaylist; |
123 | long curPosition; | 123 | long curPosition; |
124 | long curLength; | 124 | long curLength; |
125 | char curView; | 125 | char curView; |
126 | 126 | ||
127 | void readConfig( Config& cfg ); | 127 | void readConfig( Config& cfg ); |
128 | void writeConfig( Config& cfg ) const; | 128 | void writeConfig( Config& cfg ) const; |
129 | 129 | ||
130 | 130 | ||
131 | }; | 131 | }; |
132 | 132 | ||
133 | 133 | ||
134 | #endif // MEDIA_PLAYER_STATE_H | 134 | #endif // MEDIA_PLAYER_STATE_H |
135 | 135 | ||