author | bipolar <bipolar> | 2002-03-03 17:13:17 (UTC) |
---|---|---|
committer | bipolar <bipolar> | 2002-03-03 17:13:17 (UTC) |
commit | a99347380a9006ec81a9dba2340d6aaab690a86e (patch) (side-by-side diff) | |
tree | 73fdc2eff476fba2113172ed881dd64a4031def6 | |
parent | 0e245156b28b70be5cd98a58a9256fe5e2739562 (diff) | |
download | opie-a99347380a9006ec81a9dba2340d6aaab690a86e.zip opie-a99347380a9006ec81a9dba2340d6aaab690a86e.tar.gz opie-a99347380a9006ec81a9dba2340d6aaab690a86e.tar.bz2 |
commited by ljp (llornkcor) reverted to qpe's interface for compatibility. Added playlist features:
save, remove, and have different ones. Uncommented code for background image and added opielogo.
25 files changed, 353 insertions, 133 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 9a10eb4..5fef792 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp @@ -189,2 +189,3 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { + qDebug("creating new audio device"); d = new AudioDevicePrivate; @@ -193,3 +194,3 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { d->bytesPerSample = bps; -// qDebug("%d",bps); + qDebug("%d",bps); int format=0; @@ -199,3 +200,3 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { -// qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); + qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); diff --git a/core/multimedia/opieplayer/inputDialog.cpp b/core/multimedia/opieplayer/inputDialog.cpp new file mode 100644 index 0000000..b443747 --- a/dev/null +++ b/core/multimedia/opieplayer/inputDialog.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'inputDialog.ui' +** +** Created: Sat Mar 2 07:55:03 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "inputDialog.h" + +#include <qlineedit.h> +#include <qlayout.h> +#include <qvariant.h> +#include <qtooltip.h> +#include <qwhatsthis.h> + +/* + * Constructs a InputDialog which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "InputDialog" ); + resize( 234, 50 ); + setMaximumSize( QSize( 240, 50 ) ); + setCaption( tr(name ) ); + + LineEdit1 = new QLineEdit( this, "LineEdit1" ); + LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +InputDialog::~InputDialog() +{ + inputText= LineEdit1->text(); + +} + diff --git a/core/multimedia/opieplayer/inputDialog.h b/core/multimedia/opieplayer/inputDialog.h new file mode 100644 index 0000000..26d5cd0 --- a/dev/null +++ b/core/multimedia/opieplayer/inputDialog.h @@ -0,0 +1,31 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'inputDialog.ui' +** +** Created: Sat Mar 2 07:54:46 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef INPUTDIALOG_H +#define INPUTDIALOG_H + +#include <qvariant.h> +#include <qdialog.h> +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QLineEdit; + +class InputDialog : public QDialog +{ + Q_OBJECT + +public: + InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~InputDialog(); + QString inputText; + QLineEdit* LineEdit1; + +}; + +#endif // INPUTDIALOG_H diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.h b/core/multimedia/opieplayer/libmad/libmadplugin.h index d163458..b240b77 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.h +++ b/core/multimedia/opieplayer/libmad/libmadplugin.h @@ -23,4 +23,4 @@ #include <qstring.h> -//#include <qpe/mediaplayerplugininterface.h> -#include "../mediaplayerplugininterface.h" +#include <qpe/mediaplayerplugininterface.h> +/* #include "../mediaplayerplugininterface.h" */ @@ -55,3 +55,3 @@ public: bool audioSetSample( long sample, int stream ); - int audioBitsPerSample(int) {return 0;} +/* int audioBitsPerSample(int) {return 0;} */ long audioGetSample( int stream ); diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp index 028c658..67779e8 100644 --- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp +++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h index bc864ee..9b35b90 100644 --- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.h +++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.h @@ -22,4 +22,4 @@ -//#include <qpe/mediaplayerplugininterface.h> -#include "../mediaplayerplugininterface.h" +#include <qpe/mediaplayerplugininterface.h> +//#include "../mediaplayerplugininterface.h" diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h index bd31706..b573e84 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3plugin.h @@ -26,4 +26,3 @@ #include "mpeg3protos.h" -//#include <qpe/mediaplayerplugininterface.h> -#include "../mediaplayerplugininterface.h" +#include <qpe/mediaplayerplugininterface.h> @@ -53,3 +52,3 @@ public: int audioFrequency( int stream ) { return file ? mpeg3_sample_rate( file, stream ) : 0; } - int audioBitsPerSample(int) { return 0;} +/* int audioBitsPerSample(int) { return 0;} */ int audioSamples( int stream ) { return file ? mpeg3_audio_samples( file, stream ) : 0; } diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp index e7216af..bf3f372 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h index a2f5211..ef3743e 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.h @@ -22,4 +22,4 @@ -//#include <qpe/mediaplayerplugininterface.h> -#include "../mediaplayerplugininterface.h" +#include <qpe/mediaplayerplugininterface.h> +//#include "../mediaplayerplugininterface.h" diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 90a7cc6..cb8de8a 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp @@ -36,3 +36,3 @@ #include "audiodevice.h" -#include "mediaplayerplugininterface.h" +#include <qpe/mediaplayerplugininterface.h> #include "mediaplayerstate.h" @@ -103,3 +103,3 @@ LoopControl::LoopControl( QObject *parent, const char *name ) connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); - +//qDebug("starting loopcontrol"); audioMutex = new Mutex; @@ -120,2 +120,3 @@ LoopControl::LoopControl( QObject *parent, const char *name ) #endif +//qDebug("create audio thread"); pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); @@ -222,4 +223,4 @@ void LoopControl::startAudio() { +//qDebug("start audio"); audioMutex->lock(); - if ( moreAudio ) { @@ -238,10 +239,10 @@ void LoopControl::startAudio() { - if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { - usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); - } - else if ( sampleWaitTime <= -5000 ) { - qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); - //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); - currentSample = sampleWeShouldBeAt; - } +// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { +// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); +// } +// else if ( sampleWaitTime <= -5000 ) { +// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); +// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); +// currentSample = sampleWeShouldBeAt; +// } @@ -393,4 +394,9 @@ bool LoopControl::init( const QString& filename ) { audioSampleCounter = 0; - - int bits_per_sample = mediaPlayerState->curDecoder()->audioBitsPerSample( astream); + int bits_per_sample; + if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { + bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); + qDebug("using stupid hack"); + } else { + bits_per_sample=0; + } @@ -439,3 +445,3 @@ bool LoopControl::init( const QString& filename ) { void LoopControl::play() { - + qDebug("LC- play"); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) diff --git a/core/multimedia/opieplayer/main.cpp b/core/multimedia/opieplayer/main.cpp index 720a1ca..4f43ff6 100644 --- a/core/multimedia/opieplayer/main.cpp +++ b/core/multimedia/opieplayer/main.cpp @@ -49,3 +49,3 @@ int main(int argc, char **argv) { - pl.setCaption( MediaPlayer::tr("Media Player") ); + pl.setCaption( MediaPlayer::tr("OpiePlayer") ); a.showMainDocumentWidget(&pl); diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp index ce42c2c..c971a3c 100644 --- a/core/multimedia/opieplayer/mediaplayer.cpp +++ b/core/multimedia/opieplayer/mediaplayer.cpp @@ -78,3 +78,2 @@ void MediaPlayer::play() { void MediaPlayer::setPlaying( bool play ) { - if ( !play ) { @@ -91,3 +90,2 @@ void MediaPlayer::setPlaying( bool play ) { const DocLnk *playListCurrent = playList->current(); - if ( playListCurrent != NULL ) { @@ -96,3 +94,2 @@ void MediaPlayer::setPlaying( bool play ) { } - if ( currentFile == NULL ) { @@ -102,3 +99,2 @@ void MediaPlayer::setPlaying( bool play ) { } - if ( !QFile::exists( currentFile->file() ) ) { @@ -120,3 +116,2 @@ void MediaPlayer::setPlaying( bool play ) { } - long seconds = loopControl->totalPlaytime(); diff --git a/core/multimedia/opieplayer/mediaplayer.h b/core/multimedia/opieplayer/mediaplayer.h index 73f8124..d6e90cb 100644 --- a/core/multimedia/opieplayer/mediaplayer.h +++ b/core/multimedia/opieplayer/mediaplayer.h diff --git a/core/multimedia/opieplayer/mediaplayerplugininterface.h b/core/multimedia/opieplayer/mediaplayerplugininterface.h index 339b2e4..97e4066 100644 --- a/core/multimedia/opieplayer/mediaplayerplugininterface.h +++ b/core/multimedia/opieplayer/mediaplayerplugininterface.h @@ -25,4 +25,8 @@ #ifndef QT_NO_COMPONENT -// {c0093632-b44c-4cf7-a279-d82fe8a8890c} +# ifndef IID_OpiePlayerPlugin +// {F56F6CE0-1333-41FD-9B46-C0AF44D0B006} +# define IID_OpiePlayerPlugin QUuid( 0xF56F6CE0, 0x1333, 0x41FD, 0x9B, 0x46, 0xC0, 0xAF, 0x44, 0xD0, 0xB0, 0x06); +# endif # ifndef IID_MediaPlayerPlugin +// {c0093632-b44c-4cf7-a279-d82fe8a8890c} # define IID_MediaPlayerPlugin QUuid( 0xc0093632, 0xb44c, 0x4cf7, 0xa2, 0x79, 0xd8, 0x2f, 0xe8, 0xa8, 0x89, 0x0c ) @@ -95,3 +99,5 @@ public: virtual long getPlayTime() { return -1; } +#ifdef IID_OpiePlayerPlugin virtual int audioBitsPerSample( int stream ) = 0; +#endif }; @@ -108,2 +114,9 @@ struct MediaPlayerPluginInterface : public QUnknownInterface +#ifdef IID_OpiePlayerPlugin +struct OpiePlayerPluginInterface : public QUnknownInterface +{ + virtual MediaPlayerDecoder *decoder() = 0; + virtual MediaPlayerEncoder *encoder() = 0; +}; +#endif diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp index 13741f6..a960c49 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.cpp +++ b/core/multimedia/opieplayer/mediaplayerstate.cpp @@ -25,3 +25,3 @@ #include <qdir.h> -#include "mediaplayerplugininterface.h" +#include <qpe/mediaplayerplugininterface.h> #include "mediaplayerstate.h" @@ -29,2 +29,3 @@ + #ifdef QT_NO_COMPONENT @@ -62,2 +63,3 @@ void MediaPlayerState::readConfig( Config& cfg ) { usePlaylist = cfg.readBoolEntry( "UsePlayList" ); + usePlaylist = TRUE; isPlaying = FALSE; @@ -123,3 +125,3 @@ MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { void MediaPlayerState::loadPlugins() { - + qDebug("load plugins"); #ifndef QT_NO_COMPONENT @@ -140,4 +142,3 @@ void MediaPlayerState::loadPlugins() { QLibrary *lib = new QLibrary( path + "/" + *it ); - - MediaPlayerDebug(( "querying: %s", QString( path + "/" + *it ).latin1() )); +// qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); @@ -145,3 +146,3 @@ void MediaPlayerState::loadPlugins() { - MediaPlayerDebug(( "loading: %s", QString( path + "/" + *it ).latin1() )); +// qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); diff --git a/core/multimedia/opieplayer/mediaplayerstate.h b/core/multimedia/opieplayer/mediaplayerstate.h index e82c263..ad273f1 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.h +++ b/core/multimedia/opieplayer/mediaplayerstate.h @@ -1,5 +1,5 @@ /********************************************************************** -** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** Copyright (C) 2000 Trolltech AS. All rights reserved. ** -** This file is part of the Qtopia Environment. +** This file is part of Qtopia Environment. ** @@ -22,2 +22,3 @@ + #include <qobject.h> @@ -35,2 +36,3 @@ public: + bool fullscreen() { return isFullscreen; } @@ -107,2 +109,3 @@ private: MediaPlayerDecoder *libmpeg3decoder; +// MediaPlayerDecoder *libwavdecoder; diff --git a/core/multimedia/opieplayer/mpegplayer.pro b/core/multimedia/opieplayer/mpegplayer.pro index 41f2de0..5bea541 100644 --- a/core/multimedia/opieplayer/mpegplayer.pro +++ b/core/multimedia/opieplayer/mpegplayer.pro @@ -5,6 +5,6 @@ DESTDIR = $(OPIEDIR)/bin HEADERS = loopcontrol.h mediaplayerplugininterface.h playlistselection.h mediaplayerstate.h \ - videowidget.h audiowidget.h playlistwidget.h mediaplayer.h audiodevice.h + videowidget.h audiowidget.h playlistwidget.h mediaplayer.h audiodevice.h inputDialog.h SOURCES = main.cpp \ loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \ - videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp audiodevice.cpp + videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp audiodevice.cpp inputDialog.cpp TARGET = mpegplayer @@ -21,2 +21,5 @@ LIBS += -lqpe -lpthread +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include + TRANSLATIONS = ../i18n/de/mpegplayer.ts diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index 2c62e86..d70df51 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp @@ -57,4 +57,4 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) // #endif - addColumn("Title",236); - setAllColumnsShowFocus( TRUE ); +// addColumn("Title",236); +// setAllColumnsShowFocus( TRUE ); addColumn( tr( "Playlist Selection" ) ); diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 202f351..7862d8d 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -19,2 +19,3 @@ **********************************************************************/ +// code added by L. J. Potter Sat 03-02-2002 06:17:54 @@ -42,2 +43,5 @@ #include <qpoint.h> +#include <qlineedit.h> +#include <qpushbutton.h> + //#include <qtimer.h> @@ -48,2 +52,5 @@ +#include "fileBrowser.h" +#include "inputDialog.h" + #include <stdlib.h> @@ -121,7 +128,21 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) bar->setLabel( tr( "Play Operations" ) ); - d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),"mpegplayer/add_to_playlist",this , SLOT(addSelected()) ); - d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", this , SLOT(removeSelected()) ); - d->tbPlay = new ToolButton( bar, tr( "Play" ),"mpegplayer/play", mediaPlayerState, SLOT( setPlaying(bool)), TRUE ); - d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); - d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); +// d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", +// this , SLOT( addSelected()) ); + tbDeletePlaylist = new QPushButton( Resource::loadIconSet("close"),"",bar,"close"); + tbDeletePlaylist->setFlat(TRUE); + tbDeletePlaylist->setFixedSize(20,20); + connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); + + d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", + this , SLOT(addSelected()) ); + d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", + this , SLOT(removeSelected()) ); +// d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); + d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", + this , SLOT( btnPlay(bool) ), TRUE ); + d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", + mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); + d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", + mediaPlayerState, SLOT(setLooping(bool)), TRUE ); + tbDeletePlaylist->hide(); @@ -134,3 +155,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); - new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); + // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); @@ -230,2 +251,13 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) } + +//playlists list + QWidget *LTab; + LTab = new QWidget( tabWidget, "LTab" ); + playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy + playLists->setMinimumSize(233,260);; + tabWidget->insertTab(LTab,"Lists"); + connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); +// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); + + // add the library area @@ -233,17 +265,15 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) -// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); -// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); - connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); - connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); + connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), + this, SLOT( fauxPlay( QListViewItem *) ) ); + connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), + this, SLOT( fauxPlay( QListViewItem *)) ); - connect( audioView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), - this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); - connect( videoView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), - this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); +// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); +// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); + connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); + connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); - // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); - // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); @@ -251,10 +281,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); - -// connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setOn( bool ) ) ); -// connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), scaleButton, SLOT( setEnabled( bool ) ) ); -// connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setEnabled( bool ) ) ); - connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); - connect( d->selectedFiles, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); + connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); @@ -289,2 +314,5 @@ void PlayListWidget::initializeStates() { // setPlaylist( mediaPlayerState->playlist() ); + setPlaylist( true); + d->selectedFiles->first(); + } @@ -304,3 +332,2 @@ void PlayListWidget::readConfig( Config& cfg ) { d->selectedFiles->addToSelection( lnk ); - } @@ -341,2 +368,4 @@ void PlayListWidget::writeConfig( Config& cfg ) const { cfg.writeEntry("NumberOfFiles", noOfFiles ); + + } @@ -345,2 +374,3 @@ void PlayListWidget::writeConfig( Config& cfg ) const { void PlayListWidget::addToSelection( const DocLnk& lnk ) { + qDebug("add"); d->setDocumentUsed = FALSE; @@ -353,12 +383,2 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { -void PlayListWidget::addToSelection( QListViewItem *it ,const QPoint & p, int index) { - qDebug("add"); -// d->selectedFiles->addToSelection( lnk ); - // } -// else -// mediaPlayerState->setPlaying( TRUE ); -// -} - - void PlayListWidget::clearList() { @@ -428,9 +448,13 @@ void PlayListWidget::useSelectedDocument() { const DocLnk *PlayListWidget::current() { - if ( mediaPlayerState->playlist() ) + +// qDebug("in Playlist widget ::current"); + if ( mediaPlayerState->playlist() ) { return d->selectedFiles->current(); + } else if ( d->setDocumentUsed && d->current ) { return d->current; - } else + } else { return d->files->selected(); } +} @@ -503,5 +527,20 @@ bool PlayListWidget::last() { void PlayListWidget::saveList() { + QString filename; -// pseudo code -// filename = QLineEdit->getText(); + InputDialog *fileDlg; + fileDlg=new InputDialog(this,"Save Playlist",TRUE, 0); + fileDlg->exec(); + if( fileDlg->result() == 1 ) { + filename = fileDlg->LineEdit1->text();//+".playlist"; + qDebug("saving playlist "+filename+".playlist"); + +// DocLnk *lnk; +// lnk.setName( filename); //sets file name +// // lnk.setComment(title); +// lnk.setFile( filename+".playlist"); //sets File property +// lnk.setType("player/plain");// hey is this a REGISTERED mime type?!?!? ;D +// lnk.setIcon("MPEGPlayer"); +// if(!lnk.writeLink()) +// qDebug("Writing doclink did not work"); + Config cfg( filename + ".playlist" ); @@ -509,10 +548,23 @@ void PlayListWidget::saveList() { } + DocLnk lnk; + lnk.setName( filename); //sets file name +// lnk.setComment(title); + lnk.setFile(QPEApplication::qpeDir()+"Settings/"+filename+".playlist.conf"); //sets File property + lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D + lnk.setIcon("MPEGPlayer"); + if(!lnk.writeLink()) + qDebug("Writing doclink did not work"); + if(fileDlg) + delete fileDlg; +} -void PlayListWidget::loadList() { - QString filename; -// pseudo code -// filename = FileSelector->openFile( "*.playlist" ); - Config cfg( filename + ".playlist" ); + +void PlayListWidget::loadList( const DocLnk & lnk) { + + clearList(); + Config cfg( lnk.file()); readConfig( cfg ); + tabWidget->setCurrentPage(0); + setCaption("OpiePlayer: "+lnk.name()); } @@ -536,5 +588,4 @@ void PlayListWidget::setView( char view ) { void PlayListWidget::addSelected() { -// QMessageBox::message("Note","Bozo the clown thinks\nthere's something actually here"); - int tabPage=tabWidget->currentPageIndex(); - switch (tabPage) { + + switch (tabWidget->currentPageIndex()) { case 0: //playlist @@ -559,3 +610,3 @@ void PlayListWidget::playIt( QListViewItem *it) { // d->setDocumentUsed = FALSE; - mediaPlayerState->setPlaying(true); + mediaPlayerState->setPlaying(TRUE); } @@ -566,8 +617,9 @@ void PlayListWidget::addToSelection( QListViewItem *it) { if(it) { - qDebug("add to selection"); - int tabPage=tabWidget->currentPageIndex(); - switch (tabPage) { +// qDebug("add to selection"); + switch (tabWidget->currentPageIndex()) { case 1: { +// qDebug("case 1"); QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { +// qDebug(dit.current()->name()); if( dit.current()->name() == it->text(0)) { @@ -579,5 +631,6 @@ void PlayListWidget::addToSelection( QListViewItem *it) { case 2: { +// qDebug("case 2"); QListIterator<DocLnk> dit( vFiles.children() ); for ( ; dit.current(); ++dit ) { - qDebug(dit.current()->name()); +// qDebug(dit.current()->name()); if( dit.current()->name() == it->text(0)) { @@ -598,6 +651,7 @@ void PlayListWidget::tabChanged(QWidget *widg) { - int tabPage=tabWidget->currentPageIndex(); - switch (tabPage) { + switch ( tabWidget->currentPageIndex()) { case 0: { + if( !tbDeletePlaylist->isHidden()) + tbDeletePlaylist->hide(); d->tbRemoveFromList->setEnabled(TRUE); @@ -608,2 +662,4 @@ void PlayListWidget::tabChanged(QWidget *widg) { { + if( !tbDeletePlaylist->isHidden()) + tbDeletePlaylist->hide(); d->tbRemoveFromList->setEnabled(FALSE); @@ -614,2 +670,4 @@ void PlayListWidget::tabChanged(QWidget *widg) { { + if( !tbDeletePlaylist->isHidden()) + tbDeletePlaylist->hide(); d->tbRemoveFromList->setEnabled(FALSE); @@ -618,2 +676,9 @@ void PlayListWidget::tabChanged(QWidget *widg) { break; + case 3: + { + if( tbDeletePlaylist->isHidden()) + tbDeletePlaylist->show(); + playLists->reread(); + } + break; }; @@ -621,29 +686,77 @@ void PlayListWidget::tabChanged(QWidget *widg) { -// void PlayListWidget::cancelMenuTimer() { -// if( menuTimer->isActive() ) -// menuTimer->stop(); -// } +/* + list is right clicked*/ +void PlayListWidget::fauxPlay(QListViewItem *it) { -// void PlayListWidget::showFileMenu() { - -// } + switch (tabWidget->currentPageIndex()) { + case 0: //playlist + break; + case 1: { //audio + QListIterator<DocLnk> dit( files.children() ); + for ( ; dit.current(); ++dit ) { +// qDebug(dit.current()->name()); + if( dit.current()->name() == it->text(0)) { + d->selectedFiles->addToSelection( **dit ); + } + } + } + break; + case 2: { // video + QListIterator<DocLnk> dit( vFiles.children() ); + for ( ; dit.current(); ++dit ) { +// qDebug(dit.current()->name()); + if( dit.current()->name() == it->text(0)) { + d->selectedFiles->addToSelection( **dit ); + } + } + } + break; + }; + mediaPlayerState->setPlaying( TRUE ); +// tabWidget->setCurrentPage(0); + d->selectedFiles->removeSelected(); +} -// void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) -// { -// // QListView::contentsMousePressEvent( e ); -// menuTimer->start( 750, TRUE ); -// } +/* + play button is pressed*/ +void PlayListWidget::btnPlay(bool b) { // this is fugly + switch ( tabWidget->currentPageIndex()) { + case 0: + { + mediaPlayerState->setPlaying(b); + } + break; + case 1: + { + addToSelection( audioView->selectedItem() ); + mediaPlayerState->setPlaying(b); + d->selectedFiles->removeSelected( ); + tabWidget->setCurrentPage(1); + } + break; + case 2: + { + addToSelection( videoView->selectedItem() ); + mediaPlayerState->setPlaying(b); + d->selectedFiles->removeSelected( ); + tabWidget->setCurrentPage(2); + } + break; + }; +} -// void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) -// { -// // QListView::contentsMouseReleaseEvent( e ); -// menuTimer->stop(); -// } -// // void PlayListWidget::setFullScreen() { -// mediaPlayerState->toggleFullscreen( ); -// } +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()); + playLists->reread(); + break; + case 1: // Cancel + break; + }; -// void PlayListWidget::setScaled() { -// mediaPlayerState->toggleScaled(); -// } +} diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 5b05f11..46272a0 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h @@ -25,2 +25,5 @@ #include <qtabwidget.h> +#include <fileselector.h> +#include <qpushbutton.h> + /* #include <qtimer.h> */ @@ -51,3 +54,4 @@ public: /* QTimer * menuTimer; */ - + FileSelector* playLists; + QPushButton *tbDeletePlaylist; public slots: @@ -56,3 +60,2 @@ public slots: void addToSelection( QListViewItem* ); // Add a media file to the playlist - void addToSelection( QListViewItem*, const QPoint&,int ); // Add a media file to the playlist void setActiveWindow(); // need to handle this to show the right view @@ -65,4 +68,7 @@ public slots: void saveList(); // Save the playlist - void loadList(); // Load a playlist + void loadList( const DocLnk &); // Load a playlist void playIt( QListViewItem *); + void fauxPlay(QListViewItem *); + void btnPlay(bool); + void deletePlaylist(); bool first(); diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 1f128a4..be838c4 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp @@ -20,3 +20,3 @@ #include <qpe/resource.h> -#include "mediaplayerplugininterface.h" +#include <qpe/mediaplayerplugininterface.h> #include <qwidget.h> diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp index 7ac63c0..4a0da16 100644 --- a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp @@ -72,3 +72,3 @@ public: - // expands out samples to the frequency of 44kHz + // expands out samples to the frequency of 44kHz //not any more bool add( short *output, long count, long& done, bool stereo ) @@ -90,2 +90,4 @@ public: samples_due += chunkdata.samplesPerSec; + printf("samples due %d\r", samples_due); + fflush(stdout); while ( count && (samples_due > chunkdata.samplesPerSec) ) { @@ -330,10 +332,10 @@ bool WavPlugin::audioReadSamples( short *output, int channels, long samples, lon double WavPlugin::getTime() { -// qDebug( "WavPlugin::getTime" ); - return 0.0; +// qDebug( "WavPlugin::getTime" ); //this is a stupid hack here!! + return d->chunkdata.wBitsPerSample; /*0.0*/; } -int WavPlugin::audioBitsPerSample( int ) { -// qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample ); - return d->chunkdata.wBitsPerSample; // -} +// int WavPlugin::audioBitsPerSample( int ) { +// // qDebug( "WavPlugin::audioFormat %d", d->chunkdata.wBitsPerSample ); +// return d->chunkdata.wBitsPerSample; // +// } diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.h b/core/multimedia/opieplayer/wavplugin/wavplugin.h index 6ae6e06..1c8ba14 100644 --- a/core/multimedia/opieplayer/wavplugin/wavplugin.h +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.h @@ -26,3 +26,4 @@ #include <qapplication.h> -#include "../mediaplayerplugininterface.h" +/* #include "../mediaplayerplugininterface.h" */ +#include <qpe/mediaplayerplugininterface.h> @@ -55,3 +56,3 @@ public: int audioFrequency( int stream ); - int audioBitsPerSample( int stream ); +/* int audioBitsPerSample( int stream ); */ int audioSamples( int stream ); diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp index 2923180..c232d7b 100644 --- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp +++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h index 10f9305..fb1fa73 100644 --- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h +++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.h @@ -22,3 +22,4 @@ -#include "../mediaplayerplugininterface.h" + +/* #include "../mediaplayerplugininterface.h" */ |