summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-07 19:30:13 (UTC)
committer harlekin <harlekin>2002-08-07 19:30:13 (UTC)
commitc80f0885bf402b6dd4ea637ad1b7d8b3ebd69300 (patch) (side-by-side diff)
tree558e8528408f0ab27d644554279f646723c6dad9
parent7effde67fd121736ec658e690858c6c54bd6d125 (diff)
downloadopie-c80f0885bf402b6dd4ea637ad1b7d8b3ebd69300.zip
opie-c80f0885bf402b6dd4ea637ad1b7d8b3ebd69300.tar.gz
opie-c80f0885bf402b6dd4ea637ad1b7d8b3ebd69300.tar.bz2
added volume handling for audio gui and other small fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp52
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h4
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp29
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/volumecontrol.cpp59
-rw-r--r--noncore/multimedia/opieplayer2/volumecontrol.h47
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[] = {
{ FALSE, FALSE, FALSE }, // stop
- { TRUE, FALSE, FALSE }, // pause
+ { FALSE, FALSE, FALSE }, // pause
{ FALSE, FALSE, FALSE }, // next
@@ -344,6 +344,2 @@ void AudioWidget::paintButton( QPainter *p, int i ) {
void AudioWidget::timerEvent( QTimerEvent * ) {
-// static int frame = 0;
-// if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) {
-// frame = frame >= 7 ? 0 : frame + 1;
-// }
}
@@ -373,3 +369,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
return;
- case AudioVolumeDown: emit lessClicked(); return;
+ case AudioVolumeDown:
+ emit lessClicked();
+ return;
}
@@ -382,4 +380,6 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
audioButtons[i].isHeld = FALSE;
- if ( !audioButtons[i].isToggle )
+ if ( !audioButtons[i].isToggle ) {
setToggleButton( i, FALSE );
+ qDebug("button toggled3 %d",i);
+ }
switch (i) {
@@ -387,3 +387,3 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
- case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return;
+ case AudioPause: mediaPlayerState->setPaused( audioButtons[i].isDown); return;
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 @@
#include "audiowidget.h"
+#include "volumecontrol.h"
@@ -41,2 +42,4 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name )
+ volControl = new VolumeControl;
+
}
@@ -44,2 +47,4 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name )
MediaPlayer::~MediaPlayer() {
+ delete xineControl;
+ delete volControl;
}
@@ -73,3 +78,3 @@ void MediaPlayer::setPlaying( bool play ) {
}
-
+
xineControl->play( currentFile->file() );
@@ -94,3 +99,3 @@ void MediaPlayer::setPlaying( bool play ) {
audioUI->setTickerText( currentFile->file( ) );
-
+
}
@@ -127,5 +132,3 @@ void MediaPlayer::startDecreasingVolume() {
startTimer( 100 );
- // da kommt demnächst osound denk ich mal
- /////////////////////////// lets just move those change volume here
- // AudioDevice::decreaseVolume();
+ volControl->decVol(2);
}
@@ -136,3 +139,3 @@ void MediaPlayer::startIncreasingVolume() {
startTimer( 100 );
- // AudioDevice::increaseVolume();
+ volControl->incVol(2);
}
@@ -156,16 +159,17 @@ void MediaPlayer::stopChangingVolume() {
void MediaPlayer::timerEvent( QTimerEvent * ) {
- // if ( volumeDirection == +1 )
- // AudioDevice::increaseVolume();
- // else if ( volumeDirection == -1 )
- // AudioDevice::decreaseVolume();
+ if ( volumeDirection == +1 ) {
+ volControl->incVol(2);
+ } else if ( volumeDirection == -1 ) {
+ volControl->decVol(2);
+ }
-// Display an on-screen display volume
- unsigned int l, r, v; bool m;
-// TODO FIXME
-// AudioDevice::getVolume( l, r, m );
-// v = ((l + r) * 11) / (2*0xFFFF);
+ // TODO FIXME
+ int v;
+ v = volControl->getVolume();
+ v = v / 10;
- if ( drawnOnScreenDisplay && onScreenDisplayVolume == v )
- return;
+ if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
+ return;
+ }
@@ -175,4 +179,5 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
if ( drawnOnScreenDisplay ) {
- if ( onScreenDisplayVolume > v )
- audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
+ if ( onScreenDisplayVolume > v ) {
+ audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
+ }
}
@@ -193,6 +198,7 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
for ( unsigned int i = 0; i < 10; i++ ) {
- if ( v > i )
- p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
- else
- p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
+ if ( v > i ) {
+ p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
+ } else {
+ p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
+ }
}
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 @@
class DocLnk;
-
+class VolumeControl;
@@ -40,3 +40,3 @@ private:
XineControl *xineControl;
-
+ VolumeControl *volControl;
};
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\
videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \
- frame.h lib.h xinevideowidget.h \
+ frame.h lib.h xinevideowidget.h volumecontrol.h\
alphablend.h yuv2rgb.h
@@ -11,3 +11,3 @@ SOURCES = main.cpp \
videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \
- frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp \
+ frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp\
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 )
scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0);
- scaleButton->addTo(pmView);
+ //scaleButton->addTo(pmView);
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 @@
#include <qpe/resource.h>
-#include <qpe/mediaplayerplugininterface.h>
#include <qpe/config.h>
@@ -89,3 +88,2 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
QString Button0aPix, Button0bPix, controlsPix;
- //backgroundPix=cfg.readEntry( "backgroundPix", "opieplayer/metalFinish");
Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a");
@@ -108,3 +106,5 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
slider->setMaxValue( 1 );
- slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
+
+ slider->setBackgroundPixmap( *this->backgroundPixmap () ); //Resource::loadPixmap( backgroundPix ) );
+ slider->setBackgroundOrigin( QWidget::ParentOrigin);
slider->setFocusPolicy( QWidget::NoFocus );
@@ -114,3 +114,3 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
- connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
+ connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
@@ -246,3 +246,5 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
setToggleButton( i, FALSE );
+ qDebug("button toggled3 %d",i);
}
+
}
@@ -321,17 +323,2 @@ void VideoWidget::closeEvent( QCloseEvent* ) {
-bool VideoWidget::playVideo() {
- bool result = FALSE;
-
- int stream = 0;
-
- int sw = 240;
- int sh = 320;
- int dd = QPixmap::defaultDepth();
- int w = height();
- int h = width();
-
- return true;
-}
-
-
@@ -391,4 +378,4 @@ XineVideoWidget* VideoWidget::vidWidget() {
void VideoWidget::setFullscreen ( bool b )
-{
+{
setToggleButton( VideoFullscreen, b );
-} \ No newline at end of file
+}
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:
- bool playVideo();
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 @@
+
+#include <qpe/qpeapplication.h>
+#include <qpe/config.h>
+#include "qpe/qcopenvelope_qws.h"
+#include <qmessagebox.h>
+
+#include "volumecontrol.h"
+
+int VolumeControl::getVolume() {
+ int volumePerc;
+ Config cfg( "qpe" );
+ cfg. setGroup( "Volume" );
+ volumePerc = cfg. readNumEntry( "VolumePercent", 50 );
+ m_volumePerc = volumePerc;
+ return volumePerc;
+}
+
+
+void VolumeControl::setVolume( int volumePerc ) {
+ Config cfg("qpe");
+ cfg.setGroup("Volume");
+
+ if ( volumePerc > 100 ) {
+ volumePerc = 100;
+ }
+ if ( volumePerc < 0 ) {
+ volumePerc = 0;
+ }
+
+ m_volumePerc = volumePerc;
+ cfg.writeEntry("VolumePercent", volumePerc );
+ QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
+}
+
+
+void VolumeControl::incVol( int ammount ) {
+ int oldVol = getVolume();
+ setVolume( oldVol + ammount);
+}
+
+void VolumeControl::decVol( int ammount ) {
+ int oldVol = getVolume();
+ setVolume( oldVol - ammount);
+}
+
+
+VolumeControl::VolumeControl( ) {
+ getVolume();
+}
+
+VolumeControl::~VolumeControl() {
+ QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
+}
+
+
+
+
+
+
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 @@
+/*************
+ * this is only a quick hack and will be later replaced by osound
+ *
+ **********/
+
+
+#ifndef VOLUMECONTROL_H
+#define VOLUMECONTROL_H
+
+
+
+#include <qobject.h>
+
+class VolumeControl : public QObject {
+ Q_OBJECT
+public:
+ VolumeControl();
+ ~VolumeControl();
+
+ // increase by "ammount"
+ void incVol( int ammount );
+ void decVol( int ammount );
+
+ /**
+ * Get the volume in percent
+ * @return volume percentage
+ */
+ int getVolume();
+
+public slots:
+
+ /**
+ * Set the volume in percent
+ * @value volumePerc between 0 and 100
+ */
+ void setVolume( int volumePerc );
+
+
+
+private:
+
+ int m_volumePerc;
+
+};
+
+#endif
+