summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-13 04:46:12 (UTC)
committer llornkcor <llornkcor>2002-06-13 04:46:12 (UTC)
commit7ab4c2b4684287ac5f629445abcedb34ebfce9f3 (patch) (side-by-side diff)
tree28a17efdd2ac4a3b2193b27e14dbd96740fffc66
parent7239ae505999b64c74479c460daba256baf82798 (diff)
downloadopie-7ab4c2b4684287ac5f629445abcedb34ebfce9f3.zip
opie-7ab4c2b4684287ac5f629445abcedb34ebfce9f3.tar.gz
opie-7ab4c2b4684287ac5f629445abcedb34ebfce9f3.tar.bz2
bugfix: menu select play works again
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp4
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp25
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h2
3 files changed, 14 insertions, 17 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index e0989d0..3262e38 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -10,24 +10,25 @@
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
// L.J.Potter added better error code Fri 02-15-2002 14:37:47
+
#include <stdlib.h>
#include <stdio.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include "audiodevice.h"
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include "qpe/qcopenvelope_qws.h"
#endif
#ifdef Q_WS_WIN
#include <windows.h>
@@ -179,40 +180,40 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
// qDebug( "setting volume to: 0x%x", volume );
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
// Send notification that the volume has changed
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted;
#endif
}
AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
qDebug("creating new audio device");
+ QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE;
d = new AudioDevicePrivate;
d->frequency = f;
d->channels = chs;
d->bytesPerSample = bps;
qDebug("%d",bps);
int format=0;
if( bps == 8) format = AFMT_U8;
else if( bps <= 0) format = AFMT_S16_LE;
else format = AFMT_S16_LE;
qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format);
connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
int fragments = 0x10000 * 8 + sound_fragment_shift;
int capabilities = 0;
- QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE;
#ifdef KEEP_DEVICE_OPEN
if ( AudioDevicePrivate::dspFd == 0 ) {
#endif
if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) {
perror("open(\"/dev/dsp\") sending to /dev/null instead");
d->handle = ::open( "/dev/null", O_WRONLY );
}
#ifdef KEEP_DEVICE_OPEN
AudioDevicePrivate::dspFd = d->handle;
} else {
d->handle = AudioDevicePrivate::dspFd;
@@ -255,25 +256,24 @@ AudioDevice::~AudioDevice() {
qDebug("destryo audiodevice");
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE;
#ifdef Q_OS_WIN32
waveOutClose( (HWAVEOUT)d->handle );
#else
# ifndef KEEP_DEVICE_OPEN
close( d->handle ); // Now it should be safe to shut the handle
# endif
delete d->unwrittenBuffer;
delete d;
#endif
- QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE;
}
void AudioDevice::volumeChanged( bool muted )
{
AudioDevicePrivate::muted = muted;
}
void AudioDevice::write( char *buffer, unsigned int length )
{
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 930560e..d7447b7 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -831,47 +831,43 @@ void PlayListWidget::tabChanged(QWidget *widg) {
void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
mediaPlayerState->setPlaying(b);
}
break;
case 1:
{
-// if(audioView->selectedItem()) {
- addToSelection( audioView->selectedItem() );
+ addToSelection( audioView->currentItem() );
mediaPlayerState->setPlaying(b);
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(1);
d->selectedFiles->unSelect();
insanityBool=FALSE;
// audioView->clearSelection();
-// }
}
break;
case 2:
{
-// if(videoView->selectedItem() ) {
- addToSelection( videoView->selectedItem() );
+ addToSelection( videoView->currentItem() );
mediaPlayerState->setPlaying(b);
qApp->processEvents();
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(2);
d->selectedFiles->unSelect();
insanityBool=FALSE;
// videoView->clearSelection();
-// }
}
break;
};
}
void PlayListWidget::deletePlaylist() {
switch( QMessageBox::information( this, (tr("Remove Playlist?")),
(tr("You really want to delete\nthis playlist?")),
(tr("Yes")), (tr("No")), 0 )){
case 0: // Yes clicked,
QFile().remove(playLists->selected()->file());
QFile().remove(playLists->selected()->linkFile());
@@ -879,34 +875,35 @@ void PlayListWidget::deletePlaylist() {
break;
case 1: // Cancel
break;
};
}
void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
{
switch (mouse) {
case 1:
break;
case 2:{
- QPopupMenu m;
- m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
- m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
- m.insertSeparator();
- if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
- m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
+
+ QPopupMenu m;
+ m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
+ m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
+ m.insertSeparator();
+ if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
+ m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
- m.exec( QCursor::pos() );
+ m.exec( QCursor::pos() );
}
- break;
+ break;
};
}
void PlayListWidget::playSelected()
{
btnPlay( TRUE);
// d->selectedFiles->unSelect();
}
void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
{
switch (mouse) {
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index 6569f35..5837ed3 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -48,25 +48,25 @@ public:
DocLnkSet vFiles;
QListView *audioView, *videoView, *playlistView;
QLabel *libString;
bool fromSetDocument;
bool insanityBool;
QString setDocFileRef;
// retrieve the current playlist entry (media file link)
const DocLnk *current();
void useSelectedDocument();
/* QTimer * menuTimer; */
FileSelector* playLists;
QPushButton *tbDeletePlaylist;
- int fd;
+ int fd, selected;
public slots:
bool first();
bool last();
bool next();
bool prev();
/* void setFullScreen(); */
/* void setScaled(); */
protected:
/* void contentsMousePressEvent( QMouseEvent * e ); */
/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
void keyReleaseEvent( QKeyEvent *e);
void keyPressEvent( QKeyEvent *e);