-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 | |||
@@ -70,3 +70,3 @@ MediaButton audioButtons[] = { | |||
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 |
@@ -344,6 +344,2 @@ void AudioWidget::paintButton( QPainter *p, int i ) { | |||
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 | } |
@@ -373,3 +369,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
373 | return; | 369 | return; |
374 | case AudioVolumeDown: emit lessClicked(); return; | 370 | case AudioVolumeDown: |
371 | emit lessClicked(); | ||
372 | return; | ||
375 | } | 373 | } |
@@ -382,4 +380,6 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
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) { |
@@ -387,3 +387,3 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
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; |
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 | |||
@@ -13,2 +13,3 @@ | |||
13 | #include "audiowidget.h" | 13 | #include "audiowidget.h" |
14 | #include "volumecontrol.h" | ||
14 | 15 | ||
@@ -41,2 +42,4 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
41 | 42 | ||
43 | volControl = new VolumeControl; | ||
44 | |||
42 | } | 45 | } |
@@ -44,2 +47,4 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
44 | MediaPlayer::~MediaPlayer() { | 47 | MediaPlayer::~MediaPlayer() { |
48 | delete xineControl; | ||
49 | delete volControl; | ||
45 | } | 50 | } |
@@ -73,3 +78,3 @@ void MediaPlayer::setPlaying( bool play ) { | |||
73 | } | 78 | } |
74 | 79 | ||
75 | xineControl->play( currentFile->file() ); | 80 | xineControl->play( currentFile->file() ); |
@@ -94,3 +99,3 @@ void MediaPlayer::setPlaying( bool play ) { | |||
94 | audioUI->setTickerText( currentFile->file( ) ); | 99 | audioUI->setTickerText( currentFile->file( ) ); |
95 | 100 | ||
96 | } | 101 | } |
@@ -127,5 +132,3 @@ void MediaPlayer::startDecreasingVolume() { | |||
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 | } |
@@ -136,3 +139,3 @@ void MediaPlayer::startIncreasingVolume() { | |||
136 | startTimer( 100 ); | 139 | startTimer( 100 ); |
137 | // AudioDevice::increaseVolume(); | 140 | volControl->incVol(2); |
138 | } | 141 | } |
@@ -156,16 +159,17 @@ void MediaPlayer::stopChangingVolume() { | |||
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 | ||
@@ -175,4 +179,5 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
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 | } |
@@ -193,6 +198,7 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
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 | } |
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 | |||
@@ -12,3 +12,3 @@ | |||
12 | class DocLnk; | 12 | class DocLnk; |
13 | 13 | class VolumeControl; | |
14 | 14 | ||
@@ -40,3 +40,3 @@ private: | |||
40 | XineControl *xineControl; | 40 | XineControl *xineControl; |
41 | 41 | VolumeControl *volControl; | |
42 | }; | 42 | }; |
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 | |||
@@ -6,3 +6,3 @@ 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 |
@@ -11,3 +11,3 @@ SOURCES = main.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 |
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 | |||
@@ -166,3 +166,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
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 | ||
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 | |||
@@ -34,3 +34,2 @@ | |||
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> |
@@ -89,3 +88,2 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
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"); |
@@ -108,3 +106,5 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
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 ); |
@@ -114,3 +114,3 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
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 | ||
@@ -246,3 +246,5 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
246 | setToggleButton( i, FALSE ); | 246 | setToggleButton( i, FALSE ); |
247 | qDebug("button toggled3 %d",i); | ||
247 | } | 248 | } |
249 | |||
248 | } | 250 | } |
@@ -321,17 +323,2 @@ void VideoWidget::closeEvent( QCloseEvent* ) { | |||
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 | ||
@@ -391,4 +378,4 @@ XineVideoWidget* VideoWidget::vidWidget() { | |||
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 | |||
@@ -58,3 +58,2 @@ public: | |||
58 | 58 | ||
59 | bool playVideo(); | ||
60 | XineVideoWidget* vidWidget(); | 59 | XineVideoWidget* vidWidget(); |
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 | |||