-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 52 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opieplayer2.pro | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 29 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/volumecontrol.cpp | 59 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/volumecontrol.h | 47 |
9 files changed, 156 insertions, 58 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 0e9e7ea..955169c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -59,25 +59,25 @@ void Ticker::drawContents( QPainter *p ) { | |||
59 | } | 59 | } |
60 | p->drawPixmap( 0, 0, pm ); | 60 | p->drawPixmap( 0, 0, pm ); |
61 | } | 61 | } |
62 | 62 | ||
63 | struct MediaButton { | 63 | struct MediaButton { |
64 | bool isToggle, isHeld, isDown; | 64 | bool isToggle, isHeld, isDown; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | //Layout information for the audioButtons (and if it is a toggle button or not) | 67 | //Layout information for the audioButtons (and if it is a toggle button or not) |
68 | MediaButton audioButtons[] = { | 68 | MediaButton audioButtons[] = { |
69 | { TRUE, FALSE, FALSE }, // play | 69 | { TRUE, FALSE, FALSE }, // play |
70 | { FALSE, FALSE, FALSE }, // stop | 70 | { FALSE, FALSE, FALSE }, // stop |
71 | { TRUE, FALSE, FALSE }, // pause | 71 | { FALSE, FALSE, FALSE }, // pause |
72 | { FALSE, FALSE, FALSE }, // next | 72 | { FALSE, FALSE, FALSE }, // next |
73 | { FALSE, FALSE, FALSE }, // previous | 73 | { FALSE, FALSE, FALSE }, // previous |
74 | { FALSE, FALSE, FALSE }, // volume up | 74 | { FALSE, FALSE, FALSE }, // volume up |
75 | { FALSE, FALSE, FALSE }, // volume down | 75 | { FALSE, FALSE, FALSE }, // volume down |
76 | { TRUE, FALSE, FALSE }, // repeat/loop | 76 | { TRUE, FALSE, FALSE }, // repeat/loop |
77 | { FALSE, FALSE, FALSE }, // playlist | 77 | { FALSE, FALSE, FALSE }, // playlist |
78 | { FALSE, FALSE, FALSE }, // forward | 78 | { FALSE, FALSE, FALSE }, // forward |
79 | { FALSE, FALSE, FALSE } // back | 79 | { FALSE, FALSE, FALSE } // back |
80 | }; | 80 | }; |
81 | 81 | ||
82 | const char *skin_mask_file_names[11] = { | 82 | const char *skin_mask_file_names[11] = { |
83 | "play", "stop", "pause", "next", "prev", "up", | 83 | "play", "stop", "pause", "next", "prev", "up", |
@@ -333,28 +333,24 @@ void AudioWidget::toggleButton( int i ) { | |||
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | void AudioWidget::paintButton( QPainter *p, int i ) { | 336 | void AudioWidget::paintButton( QPainter *p, int i ) { |
337 | if ( audioButtons[i].isDown ) | 337 | if ( audioButtons[i].isDown ) |
338 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 338 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
339 | else | 339 | else |
340 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 340 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
344 | void AudioWidget::timerEvent( QTimerEvent * ) { | 344 | void AudioWidget::timerEvent( QTimerEvent * ) { |
345 | // static int frame = 0; | ||
346 | // if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { | ||
347 | // frame = frame >= 7 ? 0 : frame + 1; | ||
348 | // } | ||
349 | } | 345 | } |
350 | 346 | ||
351 | 347 | ||
352 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 348 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
353 | for ( int i = 0; i < numButtons; i++ ) { | 349 | for ( int i = 0; i < numButtons; i++ ) { |
354 | if ( event->state() == QMouseEvent::LeftButton ) { | 350 | if ( event->state() == QMouseEvent::LeftButton ) { |
355 | 351 | ||
356 | // The test to see if the mouse click is inside the button or not | 352 | // The test to see if the mouse click is inside the button or not |
357 | int x = event->pos().x() - xoff; | 353 | int x = event->pos().x() - xoff; |
358 | int y = event->pos().y() - yoff; | 354 | int y = event->pos().y() - yoff; |
359 | 355 | ||
360 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 356 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
@@ -362,39 +358,43 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
362 | 358 | ||
363 | if ( isOnButton && i == AudioVolumeUp ) | 359 | if ( isOnButton && i == AudioVolumeUp ) |
364 | qDebug("on up"); | 360 | qDebug("on up"); |
365 | 361 | ||
366 | if ( isOnButton && !audioButtons[i].isHeld ) { | 362 | if ( isOnButton && !audioButtons[i].isHeld ) { |
367 | audioButtons[i].isHeld = TRUE; | 363 | audioButtons[i].isHeld = TRUE; |
368 | toggleButton(i); | 364 | toggleButton(i); |
369 | switch (i) { | 365 | switch (i) { |
370 | case AudioVolumeUp: | 366 | case AudioVolumeUp: |
371 | qDebug("more clicked"); | 367 | qDebug("more clicked"); |
372 | emit moreClicked(); | 368 | emit moreClicked(); |
373 | return; | 369 | return; |
374 | case AudioVolumeDown: emit lessClicked(); return; | 370 | case AudioVolumeDown: |
371 | emit lessClicked(); | ||
372 | return; | ||
375 | } | 373 | } |
376 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 374 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
377 | audioButtons[i].isHeld = FALSE; | 375 | audioButtons[i].isHeld = FALSE; |
378 | toggleButton(i); | 376 | toggleButton(i); |
379 | } | 377 | } |
380 | } else { | 378 | } else { |
381 | if ( audioButtons[i].isHeld ) { | 379 | if ( audioButtons[i].isHeld ) { |
382 | audioButtons[i].isHeld = FALSE; | 380 | audioButtons[i].isHeld = FALSE; |
383 | if ( !audioButtons[i].isToggle ) | 381 | if ( !audioButtons[i].isToggle ) { |
384 | setToggleButton( i, FALSE ); | 382 | setToggleButton( i, FALSE ); |
383 | qDebug("button toggled3 %d",i); | ||
384 | } | ||
385 | switch (i) { | 385 | switch (i) { |
386 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; | 386 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; |
387 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 387 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
388 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; | 388 | case AudioPause: mediaPlayerState->setPaused( audioButtons[i].isDown); return; |
389 | case AudioNext: mediaPlayerState->setNext(); return; | 389 | case AudioNext: mediaPlayerState->setNext(); return; |
390 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 390 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
391 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 391 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
392 | case AudioVolumeUp: emit moreReleased(); return; | 392 | case AudioVolumeUp: emit moreReleased(); return; |
393 | case AudioVolumeDown: emit lessReleased(); return; | 393 | case AudioVolumeDown: emit lessReleased(); return; |
394 | case AudioPlayList: mediaPlayerState->setList(); return; | 394 | case AudioPlayList: mediaPlayerState->setList(); return; |
395 | } | 395 | } |
396 | } | 396 | } |
397 | } | 397 | } |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 5411a64..8d8e4e5 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -2,24 +2,25 @@ | |||
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 | 5 | ||
6 | #include <qmainwindow.h> | 6 | #include <qmainwindow.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qwidgetstack.h> | 8 | #include <qwidgetstack.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | 10 | ||
11 | #include "mediaplayer.h" | 11 | #include "mediaplayer.h" |
12 | #include "playlistwidget.h" | 12 | #include "playlistwidget.h" |
13 | #include "audiowidget.h" | 13 | #include "audiowidget.h" |
14 | #include "volumecontrol.h" | ||
14 | 15 | ||
15 | #include "mediaplayerstate.h" | 16 | #include "mediaplayerstate.h" |
16 | 17 | ||
17 | 18 | ||
18 | 19 | ||
19 | extern AudioWidget *audioUI; | 20 | extern AudioWidget *audioUI; |
20 | extern PlayListWidget *playList; | 21 | extern PlayListWidget *playList; |
21 | extern MediaPlayerState *mediaPlayerState; | 22 | extern MediaPlayerState *mediaPlayerState; |
22 | 23 | ||
23 | 24 | ||
24 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 25 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
25 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 26 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
@@ -30,27 +31,31 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
30 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 31 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
31 | 32 | ||
32 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 33 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
33 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 34 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
34 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 35 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
35 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 36 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
36 | 37 | ||
37 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 38 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
38 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 39 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
39 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 40 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
40 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 41 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
41 | 42 | ||
43 | volControl = new VolumeControl; | ||
44 | |||
42 | } | 45 | } |
43 | 46 | ||
44 | MediaPlayer::~MediaPlayer() { | 47 | MediaPlayer::~MediaPlayer() { |
48 | delete xineControl; | ||
49 | delete volControl; | ||
45 | } | 50 | } |
46 | 51 | ||
47 | void MediaPlayer::pauseCheck( bool b ) { | 52 | void MediaPlayer::pauseCheck( bool b ) { |
48 | // Only pause if playing | 53 | // Only pause if playing |
49 | if ( b && !mediaPlayerState->playing() ) { | 54 | if ( b && !mediaPlayerState->playing() ) { |
50 | mediaPlayerState->setPaused( FALSE ); | 55 | mediaPlayerState->setPaused( FALSE ); |
51 | } | 56 | } |
52 | } | 57 | } |
53 | 58 | ||
54 | void MediaPlayer::play() { | 59 | void MediaPlayer::play() { |
55 | mediaPlayerState->setPlaying( FALSE ); | 60 | mediaPlayerState->setPlaying( FALSE ); |
56 | mediaPlayerState->setPlaying( TRUE ); | 61 | mediaPlayerState->setPlaying( TRUE ); |
@@ -62,46 +67,46 @@ void MediaPlayer::setPlaying( bool play ) { | |||
62 | return; | 67 | return; |
63 | } | 68 | } |
64 | 69 | ||
65 | if ( mediaPlayerState->paused() ) { | 70 | if ( mediaPlayerState->paused() ) { |
66 | mediaPlayerState->setPaused( FALSE ); | 71 | mediaPlayerState->setPaused( FALSE ); |
67 | return; | 72 | return; |
68 | } | 73 | } |
69 | 74 | ||
70 | const DocLnk *playListCurrent = playList->current(); | 75 | const DocLnk *playListCurrent = playList->current(); |
71 | if ( playListCurrent != NULL ) { | 76 | if ( playListCurrent != NULL ) { |
72 | currentFile = playListCurrent; | 77 | currentFile = playListCurrent; |
73 | } | 78 | } |
74 | 79 | ||
75 | xineControl->play( currentFile->file() ); | 80 | xineControl->play( currentFile->file() ); |
76 | 81 | ||
77 | xineControl->length(); | 82 | xineControl->length(); |
78 | long seconds = mediaPlayerState->length();// | 83 | long seconds = mediaPlayerState->length();// |
79 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 84 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
80 | qDebug(time); | 85 | qDebug(time); |
81 | 86 | ||
82 | QString tickerText; | 87 | QString tickerText; |
83 | if( currentFile->file().left(4) == "http" ) | 88 | if( currentFile->file().left(4) == "http" ) |
84 | tickerText= tr( " File: " ) + currentFile->name(); | 89 | tickerText= tr( " File: " ) + currentFile->name(); |
85 | else | 90 | else |
86 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | 91 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; |
87 | 92 | ||
88 | // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); | 93 | // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); |
89 | 94 | ||
90 | // if ( !fileInfo.isEmpty() ) | 95 | // if ( !fileInfo.isEmpty() ) |
91 | // tickerText += ", " + fileInfo; | 96 | // tickerText += ", " + fileInfo; |
92 | // audioUI->setTickerText( tickerText + "." ); | 97 | // audioUI->setTickerText( tickerText + "." ); |
93 | 98 | ||
94 | audioUI->setTickerText( currentFile->file( ) ); | 99 | audioUI->setTickerText( currentFile->file( ) ); |
95 | 100 | ||
96 | } | 101 | } |
97 | 102 | ||
98 | 103 | ||
99 | void MediaPlayer::prev() { | 104 | void MediaPlayer::prev() { |
100 | if ( playList->prev() ) { | 105 | if ( playList->prev() ) { |
101 | play(); | 106 | play(); |
102 | } else if ( mediaPlayerState->looping() ) { | 107 | } else if ( mediaPlayerState->looping() ) { |
103 | if ( playList->last() ) { | 108 | if ( playList->last() ) { |
104 | play(); | 109 | play(); |
105 | } | 110 | } |
106 | } else { | 111 | } else { |
107 | mediaPlayerState->setList(); | 112 | mediaPlayerState->setList(); |
@@ -116,94 +121,95 @@ void MediaPlayer::next() { | |||
116 | if ( playList->first() ) { | 121 | if ( playList->first() ) { |
117 | play(); | 122 | play(); |
118 | } | 123 | } |
119 | } else { | 124 | } else { |
120 | mediaPlayerState->setList(); | 125 | mediaPlayerState->setList(); |
121 | } | 126 | } |
122 | } | 127 | } |
123 | 128 | ||
124 | 129 | ||
125 | void MediaPlayer::startDecreasingVolume() { | 130 | void MediaPlayer::startDecreasingVolume() { |
126 | volumeDirection = -1; | 131 | volumeDirection = -1; |
127 | startTimer( 100 ); | 132 | startTimer( 100 ); |
128 | // da kommt demnächst osound denk ich mal | 133 | volControl->decVol(2); |
129 | /////////////////////////// lets just move those change volume here | ||
130 | // AudioDevice::decreaseVolume(); | ||
131 | } | 134 | } |
132 | 135 | ||
133 | 136 | ||
134 | void MediaPlayer::startIncreasingVolume() { | 137 | void MediaPlayer::startIncreasingVolume() { |
135 | volumeDirection = +1; | 138 | volumeDirection = +1; |
136 | startTimer( 100 ); | 139 | startTimer( 100 ); |
137 | // AudioDevice::increaseVolume(); | 140 | volControl->incVol(2); |
138 | } | 141 | } |
139 | 142 | ||
140 | 143 | ||
141 | bool drawnOnScreenDisplay = FALSE; | 144 | bool drawnOnScreenDisplay = FALSE; |
142 | unsigned int onScreenDisplayVolume = 0; | 145 | unsigned int onScreenDisplayVolume = 0; |
143 | const int yoff = 110; | 146 | const int yoff = 110; |
144 | 147 | ||
145 | void MediaPlayer::stopChangingVolume() { | 148 | void MediaPlayer::stopChangingVolume() { |
146 | killTimers(); | 149 | killTimers(); |
147 | // Get rid of the on-screen display stuff | 150 | // Get rid of the on-screen display stuff |
148 | drawnOnScreenDisplay = FALSE; | 151 | drawnOnScreenDisplay = FALSE; |
149 | onScreenDisplayVolume = 0; | 152 | onScreenDisplayVolume = 0; |
150 | int w = audioUI->width(); | 153 | int w = audioUI->width(); |
151 | int h = audioUI->height(); | 154 | int h = audioUI->height(); |
152 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 155 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
153 | } | 156 | } |
154 | 157 | ||
155 | 158 | ||
156 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 159 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
157 | // if ( volumeDirection == +1 ) | 160 | if ( volumeDirection == +1 ) { |
158 | // AudioDevice::increaseVolume(); | 161 | volControl->incVol(2); |
159 | // else if ( volumeDirection == -1 ) | 162 | } else if ( volumeDirection == -1 ) { |
160 | // AudioDevice::decreaseVolume(); | 163 | volControl->decVol(2); |
164 | } | ||
161 | 165 | ||
162 | // Display an on-screen display volume | ||
163 | unsigned int l, r, v; bool m; | ||
164 | 166 | ||
165 | // TODO FIXME | 167 | // TODO FIXME |
166 | // AudioDevice::getVolume( l, r, m ); | 168 | int v; |
167 | // v = ((l + r) * 11) / (2*0xFFFF); | 169 | v = volControl->getVolume(); |
170 | v = v / 10; | ||
168 | 171 | ||
169 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) | 172 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
170 | return; | 173 | return; |
174 | } | ||
171 | 175 | ||
172 | int w = audioUI->width(); | 176 | int w = audioUI->width(); |
173 | int h = audioUI->height(); | 177 | int h = audioUI->height(); |
174 | 178 | ||
175 | if ( drawnOnScreenDisplay ) { | 179 | if ( drawnOnScreenDisplay ) { |
176 | if ( onScreenDisplayVolume > v ) | 180 | if ( onScreenDisplayVolume > v ) { |
177 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 181 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
182 | } | ||
178 | } | 183 | } |
179 | 184 | ||
180 | drawnOnScreenDisplay = TRUE; | 185 | drawnOnScreenDisplay = TRUE; |
181 | onScreenDisplayVolume = v; | 186 | onScreenDisplayVolume = v; |
182 | 187 | ||
183 | QPainter p( audioUI ); | 188 | QPainter p( audioUI ); |
184 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 189 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
185 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 190 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
186 | 191 | ||
187 | QFont f; | 192 | QFont f; |
188 | f.setPixelSize( 20 ); | 193 | f.setPixelSize( 20 ); |
189 | f.setBold( TRUE ); | 194 | f.setBold( TRUE ); |
190 | p.setFont( f ); | 195 | p.setFont( f ); |
191 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 196 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
192 | 197 | ||
193 | for ( unsigned int i = 0; i < 10; i++ ) { | 198 | for ( unsigned int i = 0; i < 10; i++ ) { |
194 | if ( v > i ) | 199 | if ( v > i ) { |
195 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 200 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
196 | else | 201 | } else { |
197 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 202 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
203 | } | ||
198 | } | 204 | } |
199 | } | 205 | } |
200 | 206 | ||
201 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 207 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
202 | switch ( e->key() ) { | 208 | switch ( e->key() ) { |
203 | ////////////////////////////// Zaurus keys | 209 | ////////////////////////////// Zaurus keys |
204 | case Key_Home: | 210 | case Key_Home: |
205 | break; | 211 | break; |
206 | case Key_F9: //activity | 212 | case Key_F9: //activity |
207 | break; | 213 | break; |
208 | case Key_F10: //contacts | 214 | case Key_F10: //contacts |
209 | break; | 215 | break; |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 7b79066..16213b5 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h | |||
@@ -1,25 +1,25 @@ | |||
1 | 1 | ||
2 | #ifndef MEDIA_PLAYER_H | 2 | #ifndef MEDIA_PLAYER_H |
3 | #define MEDIA_PLAYER_H | 3 | #define MEDIA_PLAYER_H |
4 | 4 | ||
5 | #include <qmainwindow.h> | 5 | #include <qmainwindow.h> |
6 | #include <qframe.h> | 6 | #include <qframe.h> |
7 | #include <qpe/qlibrary.h> | 7 | #include <qpe/qlibrary.h> |
8 | #include <qpe/mediaplayerplugininterface.h> | 8 | #include <qpe/mediaplayerplugininterface.h> |
9 | 9 | ||
10 | #include "xinecontrol.h" | 10 | #include "xinecontrol.h" |
11 | 11 | ||
12 | class DocLnk; | 12 | class DocLnk; |
13 | 13 | class VolumeControl; | |
14 | 14 | ||
15 | class MediaPlayer : public QObject { | 15 | class MediaPlayer : public QObject { |
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | public: | 17 | public: |
18 | MediaPlayer( QObject *parent, const char *name ); | 18 | MediaPlayer( QObject *parent, const char *name ); |
19 | ~MediaPlayer(); | 19 | ~MediaPlayer(); |
20 | 20 | ||
21 | private slots: | 21 | private slots: |
22 | void setPlaying( bool ); | 22 | void setPlaying( bool ); |
23 | void pauseCheck( bool ); | 23 | void pauseCheck( bool ); |
24 | void play(); | 24 | void play(); |
25 | void next(); | 25 | void next(); |
@@ -29,18 +29,18 @@ private slots: | |||
29 | void stopChangingVolume(); | 29 | void stopChangingVolume(); |
30 | void cleanUp(); | 30 | void cleanUp(); |
31 | 31 | ||
32 | protected: | 32 | protected: |
33 | void timerEvent( QTimerEvent *e ); | 33 | void timerEvent( QTimerEvent *e ); |
34 | void keyReleaseEvent( QKeyEvent *e); | 34 | void keyReleaseEvent( QKeyEvent *e); |
35 | void doBlank(); | 35 | void doBlank(); |
36 | void doUnblank(); | 36 | void doUnblank(); |
37 | private: | 37 | private: |
38 | int volumeDirection; | 38 | int volumeDirection; |
39 | const DocLnk *currentFile; | 39 | const DocLnk *currentFile; |
40 | XineControl *xineControl; | 40 | XineControl *xineControl; |
41 | 41 | VolumeControl *volControl; | |
42 | }; | 42 | }; |
43 | 43 | ||
44 | 44 | ||
45 | #endif // MEDIA_PLAYER_H | 45 | #endif // MEDIA_PLAYER_H |
46 | 46 | ||
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index fee9242..edc4624 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro | |||
@@ -1,23 +1,23 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | #release | 3 | #release |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ | 5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ |
6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ | 6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ |
7 | frame.h lib.h xinevideowidget.h \ | 7 | frame.h lib.h xinevideowidget.h volumecontrol.h\ |
8 | alphablend.h yuv2rgb.h | 8 | alphablend.h yuv2rgb.h |
9 | SOURCES = main.cpp \ | 9 | SOURCES = main.cpp \ |
10 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ | 10 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ |
11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ | 11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ |
12 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp \ | 12 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp\ |
13 | alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S | 13 | alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S |
14 | TARGET = opieplayer2 | 14 | TARGET = opieplayer2 |
15 | INCLUDEPATH += $(OPIEDIR)/include | 15 | INCLUDEPATH += $(OPIEDIR)/include |
16 | DEPENDPATH += $(OPIEDIR)/include | 16 | DEPENDPATH += $(OPIEDIR)/include |
17 | LIBS += -lqpe -lpthread -lopie -lxine -lxineutils | 17 | LIBS += -lqpe -lpthread -lopie -lxine -lxineutils |
18 | MOC_DIR=qpeobj | 18 | MOC_DIR=qpeobj |
19 | OBJECTS_DIR=qpeobj | 19 | OBJECTS_DIR=qpeobj |
20 | 20 | ||
21 | INCLUDEPATH += $(OPIEDIR)/include | 21 | INCLUDEPATH += $(OPIEDIR)/include |
22 | DEPENDPATH += $(OPIEDIR)/include | 22 | DEPENDPATH += $(OPIEDIR)/include |
23 | 23 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 9065d63..b43d9f7 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -155,25 +155,25 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
155 | pmPlayList->insertSeparator(-1); | 155 | pmPlayList->insertSeparator(-1); |
156 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 156 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
157 | pmPlayList->insertSeparator(-1); | 157 | pmPlayList->insertSeparator(-1); |
158 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 158 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
159 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 159 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
160 | 160 | ||
161 | QPopupMenu *pmView = new QPopupMenu( this ); | 161 | QPopupMenu *pmView = new QPopupMenu( this ); |
162 | menu->insertItem( tr( "View" ), pmView ); | 162 | menu->insertItem( tr( "View" ), pmView ); |
163 | 163 | ||
164 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 164 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
165 | fullScreenButton->addTo(pmView); | 165 | fullScreenButton->addTo(pmView); |
166 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); | 166 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); |
167 | scaleButton->addTo(pmView); | 167 | //scaleButton->addTo(pmView); |
168 | 168 | ||
169 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 169 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
170 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 170 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
171 | 171 | ||
172 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 172 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
173 | 173 | ||
174 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 174 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
175 | // tabWidget->setTabShape(QTabWidget::Triangular); | 175 | // tabWidget->setTabShape(QTabWidget::Triangular); |
176 | 176 | ||
177 | QWidget *pTab; | 177 | QWidget *pTab; |
178 | pTab = new QWidget( tabWidget, "pTab" ); | 178 | pTab = new QWidget( tabWidget, "pTab" ); |
179 | tabWidget->insertTab( pTab,"Playlist"); | 179 | tabWidget->insertTab( pTab,"Playlist"); |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index af06079..188b18d 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -23,25 +23,24 @@ | |||
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/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/mediaplayerplugininterface.h> | ||
36 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
37 | 36 | ||
38 | #include <qwidget.h> | 37 | #include <qwidget.h> |
39 | #include <qpainter.h> | 38 | #include <qpainter.h> |
40 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
41 | #include <qslider.h> | 40 | #include <qslider.h> |
42 | #include <qdrawutil.h> | 41 | #include <qdrawutil.h> |
43 | #include "videowidget.h" | 42 | #include "videowidget.h" |
44 | #include "mediaplayerstate.h" | 43 | #include "mediaplayerstate.h" |
45 | 44 | ||
46 | 45 | ||
47 | #ifdef Q_WS_QWS | 46 | #ifdef Q_WS_QWS |
@@ -78,50 +77,51 @@ MediaButton videoButtons[] = { | |||
78 | 77 | ||
79 | 78 | ||
80 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 79 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
81 | 80 | ||
82 | 81 | ||
83 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 82 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
84 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 83 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
85 | setCaption( tr("OpiePlayer - Video") ); | 84 | setCaption( tr("OpiePlayer - Video") ); |
86 | Config cfg("OpiePlayer"); | 85 | Config cfg("OpiePlayer"); |
87 | cfg.setGroup("VideoWidget"); | 86 | cfg.setGroup("VideoWidget"); |
88 | 87 | ||
89 | QString Button0aPix, Button0bPix, controlsPix; | 88 | QString Button0aPix, Button0bPix, controlsPix; |
90 | //backgroundPix=cfg.readEntry( "backgroundPix", "opieplayer/metalFinish"); | ||
91 | Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a"); | 89 | Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a"); |
92 | Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b"); | 90 | Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b"); |
93 | controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" ); | 91 | controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" ); |
94 | 92 | ||
95 | cfg.setGroup("AudioWidget"); | 93 | cfg.setGroup("AudioWidget"); |
96 | QString skin = cfg.readEntry("Skin","default"); | 94 | QString skin = cfg.readEntry("Skin","default"); |
97 | QString skinPath = "opieplayer/skins/" + skin; | 95 | QString skinPath = "opieplayer/skins/" + skin; |
98 | backgroundPix = QString("%1/background").arg(skinPath) ; | 96 | backgroundPix = QString("%1/background").arg(skinPath) ; |
99 | 97 | ||
100 | setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); | 98 | setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); |
101 | pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); | 99 | pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); |
102 | pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); | 100 | pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); |
103 | pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); | 101 | pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); |
104 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); | 102 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); |
105 | 103 | ||
106 | slider = new QSlider( Qt::Horizontal, this ); | 104 | slider = new QSlider( Qt::Horizontal, this ); |
107 | slider->setMinValue( 0 ); | 105 | slider->setMinValue( 0 ); |
108 | slider->setMaxValue( 1 ); | 106 | slider->setMaxValue( 1 ); |
109 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 107 | |
108 | slider->setBackgroundPixmap( *this->backgroundPixmap () ); //Resource::loadPixmap( backgroundPix ) ); | ||
109 | slider->setBackgroundOrigin( QWidget::ParentOrigin); | ||
110 | slider->setFocusPolicy( QWidget::NoFocus ); | 110 | slider->setFocusPolicy( QWidget::NoFocus ); |
111 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 111 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
112 | 112 | ||
113 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 113 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
114 | 114 | ||
115 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 115 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
116 | 116 | ||
117 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 117 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
118 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 118 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
119 | 119 | ||
120 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 120 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
121 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 121 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
122 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 122 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
123 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 123 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
124 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 124 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
125 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 125 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
126 | 126 | ||
127 | // Intialise state | 127 | // Intialise state |
@@ -235,25 +235,27 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
235 | QPoint dXY = center - event->pos(); | 235 | QPoint dXY = center - event->pos(); |
236 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | 236 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); |
237 | bool isOnButton = dist <= (radius * radius); | 237 | bool isOnButton = dist <= (radius * radius); |
238 | if ( isOnButton != videoButtons[i].isHeld ) { | 238 | if ( isOnButton != videoButtons[i].isHeld ) { |
239 | videoButtons[i].isHeld = isOnButton; | 239 | videoButtons[i].isHeld = isOnButton; |
240 | toggleButton(i); | 240 | toggleButton(i); |
241 | } | 241 | } |
242 | } else { | 242 | } else { |
243 | if ( videoButtons[i].isHeld ) { | 243 | if ( videoButtons[i].isHeld ) { |
244 | videoButtons[i].isHeld = FALSE; | 244 | videoButtons[i].isHeld = FALSE; |
245 | if ( !videoButtons[i].isToggle ) | 245 | if ( !videoButtons[i].isToggle ) |
246 | setToggleButton( i, FALSE ); | 246 | setToggleButton( i, FALSE ); |
247 | qDebug("button toggled3 %d",i); | ||
247 | } | 248 | } |
249 | |||
248 | } | 250 | } |
249 | switch (i) { | 251 | switch (i) { |
250 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | 252 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; |
251 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | 253 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; |
252 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | 254 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; |
253 | case VideoNext: mediaPlayerState->setNext(); return; | 255 | case VideoNext: mediaPlayerState->setNext(); return; |
254 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 256 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
255 | case VideoPlayList: mediaPlayerState->setList(); return; | 257 | case VideoPlayList: mediaPlayerState->setList(); return; |
256 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 258 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
257 | } | 259 | } |
258 | 260 | ||
259 | } | 261 | } |
@@ -310,39 +312,24 @@ void VideoWidget::paintEvent( QPaintEvent * ) { | |||
310 | } | 312 | } |
311 | // draw the slider | 313 | // draw the slider |
312 | slider->repaint( TRUE ); | 314 | slider->repaint( TRUE ); |
313 | } | 315 | } |
314 | } | 316 | } |
315 | 317 | ||
316 | 318 | ||
317 | void VideoWidget::closeEvent( QCloseEvent* ) { | 319 | void VideoWidget::closeEvent( QCloseEvent* ) { |
318 | mediaPlayerState->setList(); | 320 | mediaPlayerState->setList(); |
319 | } | 321 | } |
320 | 322 | ||
321 | 323 | ||
322 | bool VideoWidget::playVideo() { | ||
323 | bool result = FALSE; | ||
324 | |||
325 | int stream = 0; | ||
326 | |||
327 | int sw = 240; | ||
328 | int sh = 320; | ||
329 | int dd = QPixmap::defaultDepth(); | ||
330 | int w = height(); | ||
331 | int h = width(); | ||
332 | |||
333 | return true; | ||
334 | } | ||
335 | |||
336 | |||
337 | 324 | ||
338 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) | 325 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) |
339 | { | 326 | { |
340 | switch ( e->key() ) { | 327 | switch ( e->key() ) { |
341 | ////////////////////////////// Zaurus keys | 328 | ////////////////////////////// Zaurus keys |
342 | case Key_Home: | 329 | case Key_Home: |
343 | break; | 330 | break; |
344 | case Key_F9: //activity | 331 | case Key_F9: //activity |
345 | break; | 332 | break; |
346 | case Key_F10: //contacts | 333 | case Key_F10: //contacts |
347 | // hide(); | 334 | // hide(); |
348 | break; | 335 | break; |
@@ -380,15 +367,15 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) | |||
380 | break; | 367 | break; |
381 | case Key_Escape: | 368 | case Key_Escape: |
382 | break; | 369 | break; |
383 | 370 | ||
384 | }; | 371 | }; |
385 | } | 372 | } |
386 | XineVideoWidget* VideoWidget::vidWidget() { | 373 | XineVideoWidget* VideoWidget::vidWidget() { |
387 | return videoFrame; | 374 | return videoFrame; |
388 | } | 375 | } |
389 | 376 | ||
390 | 377 | ||
391 | void VideoWidget::setFullscreen ( bool b ) | 378 | void VideoWidget::setFullscreen ( bool b ) |
392 | { | 379 | { |
393 | setToggleButton( VideoFullscreen, b ); | 380 | setToggleButton( VideoFullscreen, b ); |
394 | } \ No newline at end of file | 381 | } |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index fc53f89..04e810e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -47,25 +47,24 @@ enum VideoButtons { | |||
47 | VideoPause, | 47 | VideoPause, |
48 | VideoNext, | 48 | VideoNext, |
49 | VideoPlayList, | 49 | VideoPlayList, |
50 | VideoFullscreen | 50 | VideoFullscreen |
51 | }; | 51 | }; |
52 | 52 | ||
53 | class VideoWidget : public QWidget { | 53 | class VideoWidget : public QWidget { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | public: | 55 | public: |
56 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 56 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
57 | ~VideoWidget(); | 57 | ~VideoWidget(); |
58 | 58 | ||
59 | bool playVideo(); | ||
60 | XineVideoWidget* vidWidget(); | 59 | XineVideoWidget* vidWidget(); |
61 | public slots: | 60 | public slots: |
62 | void updateSlider( long, long ); | 61 | void updateSlider( long, long ); |
63 | void sliderPressed( ); | 62 | void sliderPressed( ); |
64 | void sliderReleased( ); | 63 | void sliderReleased( ); |
65 | void setPaused( bool b) { setToggleButton( VideoPause, b ); } | 64 | void setPaused( bool b) { setToggleButton( VideoPause, b ); } |
66 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } | 65 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } |
67 | void setFullscreen( bool b ); | 66 | void setFullscreen( bool b ); |
68 | void makeVisible(); | 67 | void makeVisible(); |
69 | void setPosition( long ); | 68 | void setPosition( long ); |
70 | void setLength( long ); | 69 | void setLength( long ); |
71 | void setView( char ); | 70 | void setView( char ); |
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.cpp b/noncore/multimedia/opieplayer2/volumecontrol.cpp new file mode 100644 index 0000000..b8ec0df --- a/dev/null +++ b/noncore/multimedia/opieplayer2/volumecontrol.cpp | |||
@@ -0,0 +1,59 @@ | |||
1 | |||
2 | #include <qpe/qpeapplication.h> | ||
3 | #include <qpe/config.h> | ||
4 | #include "qpe/qcopenvelope_qws.h" | ||
5 | #include <qmessagebox.h> | ||
6 | |||
7 | #include "volumecontrol.h" | ||
8 | |||
9 | int VolumeControl::getVolume() { | ||
10 | int volumePerc; | ||
11 | Config cfg( "qpe" ); | ||
12 | cfg. setGroup( "Volume" ); | ||
13 | volumePerc = cfg. readNumEntry( "VolumePercent", 50 ); | ||
14 | m_volumePerc = volumePerc; | ||
15 | return volumePerc; | ||
16 | } | ||
17 | |||
18 | |||
19 | void VolumeControl::setVolume( int volumePerc ) { | ||
20 | Config cfg("qpe"); | ||
21 | cfg.setGroup("Volume"); | ||
22 | |||
23 | if ( volumePerc > 100 ) { | ||
24 | volumePerc = 100; | ||
25 | } | ||
26 | if ( volumePerc < 0 ) { | ||
27 | volumePerc = 0; | ||
28 | } | ||
29 | |||
30 | m_volumePerc = volumePerc; | ||
31 | cfg.writeEntry("VolumePercent", volumePerc ); | ||
32 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; | ||
33 | } | ||
34 | |||
35 | |||
36 | void VolumeControl::incVol( int ammount ) { | ||
37 | int oldVol = getVolume(); | ||
38 | setVolume( oldVol + ammount); | ||
39 | } | ||
40 | |||
41 | void VolumeControl::decVol( int ammount ) { | ||
42 | int oldVol = getVolume(); | ||
43 | setVolume( oldVol - ammount); | ||
44 | } | ||
45 | |||
46 | |||
47 | VolumeControl::VolumeControl( ) { | ||
48 | getVolume(); | ||
49 | } | ||
50 | |||
51 | VolumeControl::~VolumeControl() { | ||
52 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; | ||
53 | } | ||
54 | |||
55 | |||
56 | |||
57 | |||
58 | |||
59 | |||
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.h b/noncore/multimedia/opieplayer2/volumecontrol.h new file mode 100644 index 0000000..37be398 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/volumecontrol.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /************* | ||
2 | * this is only a quick hack and will be later replaced by osound | ||
3 | * | ||
4 | **********/ | ||
5 | |||
6 | |||
7 | #ifndef VOLUMECONTROL_H | ||
8 | #define VOLUMECONTROL_H | ||
9 | |||
10 | |||
11 | |||
12 | #include <qobject.h> | ||
13 | |||
14 | class VolumeControl : public QObject { | ||
15 | Q_OBJECT | ||
16 | public: | ||
17 | VolumeControl(); | ||
18 | ~VolumeControl(); | ||
19 | |||
20 | // increase by "ammount" | ||
21 | void incVol( int ammount ); | ||
22 | void decVol( int ammount ); | ||
23 | |||
24 | /** | ||
25 | * Get the volume in percent | ||
26 | * @return volume percentage | ||
27 | */ | ||
28 | int getVolume(); | ||
29 | |||
30 | public slots: | ||
31 | |||
32 | /** | ||
33 | * Set the volume in percent | ||
34 | * @value volumePerc between 0 and 100 | ||
35 | */ | ||
36 | void setVolume( int volumePerc ); | ||
37 | |||
38 | |||
39 | |||
40 | private: | ||
41 | |||
42 | int m_volumePerc; | ||
43 | |||
44 | }; | ||
45 | |||
46 | #endif | ||
47 | |||