author | harlekin <harlekin> | 2002-08-21 00:20:22 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-21 00:20:22 (UTC) |
commit | c198ae0217f761418f7170d08a94da3864e47583 (patch) (side-by-side diff) | |
tree | 096790ff5389ea30f61912f72338e5642edaa667 | |
parent | 491f95a2c6a5676f08520e494e125ba8b20e0eae (diff) | |
download | opie-c198ae0217f761418f7170d08a94da3864e47583.zip opie-c198ae0217f761418f7170d08a94da3864e47583.tar.gz opie-c198ae0217f761418f7170d08a94da3864e47583.tar.bz2 |
fixes
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 19 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 2 |
3 files changed, 17 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index c187f52..b2143a0 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp @@ -77,68 +77,69 @@ Lib::Lib(XineVideoWidget* widget) { if ( !QFile(str).exists() ) { QFile f(str); f.open(IO_WriteOnly); QTextStream ts( &f ); ts << "misc.memcpy_method:glibc\n"; f.close(); } m_config = xine_config_file_init( str.data() ); // allocate oss for sound // and fb for framebuffer m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; m_videoOutput = ::init_video_out_plugin( m_config, NULL ); if (m_wid != 0 ) { printf("!0\n" ); resize ( m_wid-> size ( )); ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); m_wid-> setImage ( new QImage ( Resource::loadImage(""))); m_wid->repaint(); } null_display_handler( m_videoOutput, xine_display_frame, this ); m_xine = xine_init( m_videoOutput, m_audioOutput, m_config ); // install the event handler xine_register_event_listener( m_xine, xine_event_handler, this ); } Lib::~Lib() { - delete m_config; + free( m_config ); xine_remove_event_listener( m_xine, xine_event_handler ); xine_exit( m_xine ); - delete m_videoOutput; + /* FIXME either free or delete but valgrind bitches against both */ + //free( m_videoOutput ); //delete m_audioOutput; } void Lib::resize ( const QSize &s ) { if ( s. width ( ) && s. height ( )) { ::null_set_gui_width( m_videoOutput, s. width() ); ::null_set_gui_height(m_videoOutput, s. height() ); } } QCString Lib::version() { QCString str( xine_get_str_version() ); return str; }; int Lib::majorVersion() { return xine_get_major_version(); } int Lib::minorVersion() { return xine_get_minor_version(); }; int Lib::subVersion() { return xine_get_sub_version(); } int Lib::play( const QString& fileName, int startPos, int start_time ) { QString str = fileName.stripWhiteSpace(); //workaround OpiePlayer bug diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 75e2979..098322b 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -1,40 +1,41 @@ #define QTOPIA_INTERNAL_FSLP #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/fileselector.h> #include <qpe/qpeapplication.h> #include <qpe/lnkproperties.h> #include <qpe/storage.h> +#include <qpe/mimetype.h> #include <qpe/applnk.h> #include <qpopupmenu.h> #include <qpe/config.h> #include <qpe/global.h> #include <qpe/resource.h> #include <qaction.h> #include <qcursor.h> #include <qimage.h> #include <qfile.h> #include <qdir.h> #include <qlayout.h> #include <qlabel.h> #include <qlist.h> #include <qlistbox.h> #include <qmainwindow.h> #include <qmessagebox.h> #include <qtoolbutton.h> #include <qtabwidget.h> #include <qlistview.h> #include <qpoint.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qregexp.h> #include <qtextstream.h> #include "playlistselection.h" #include "playlistwidget.h" #include "mediaplayerstate.h" #include "inputDialog.h" @@ -278,68 +279,72 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); connect( audioView, SIGNAL( returnPressed( QListViewItem *)), this,SLOT( playIt( QListViewItem *)) ); connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); connect( videoView, SIGNAL( returnPressed( QListViewItem *)), this,SLOT( playIt( QListViewItem *)) ); connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); setCentralWidget( vbox5 ); readConfig( cfg ); QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); loadList(DocLnk( currentPlaylist)); setCaption(tr("OpiePlayer: ")+ currentPlaylist ); initializeStates(); } PlayListWidget::~PlayListWidget() { - if ( d->current ) { - delete d->current; - } - delete d; +/* fixing symptoms and not sources is entirely stupid - zecke */ +// Config cfg( "OpiePlayer" ); +// writeConfig( cfg ); + + if ( d->current ) { + delete d->current; + } + delete d; } void PlayListWidget::initializeStates() { d->tbPlay->setOn( mediaPlayerState->playing() ); d->tbLoop->setOn( mediaPlayerState->looping() ); d->tbShuffle->setOn( mediaPlayerState->shuffled() ); setPlaylist( true); } void PlayListWidget::readConfig( Config& cfg ) { cfg.setGroup("PlayList"); QString currentString = cfg.readEntry("current", "" ); int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); for ( int i = 0; i < noOfFiles; i++ ) { QString entryName; entryName.sprintf( "File%i", i + 1 ); QString linkFile = cfg.readEntry( entryName ); if(QFileInfo( linkFile).exists() ) { DocLnk lnk( linkFile ); if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) { d->selectedFiles->addToSelection( lnk ); } } } d->selectedFiles->setSelectedItem( currentString); } void PlayListWidget::writeConfig( Config& cfg ) const { @@ -923,69 +928,71 @@ void PlayListWidget::populateVideoView() { videoView->clear(); QString storage; for ( ; Vdit.current(); ++Vdit ) { for( ; it.current(); ++it ){ const QString name = (*it)->name(); const QString path = (*it)->path(); if( Vdit.current()->file().find(path) != -1 ) storage=name; } QListViewItem * newItem; if ( QFile( Vdit.current()->file()).exists() ) { newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); } } } void PlayListWidget::openFile() { QString filename, name; InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { filename = fileDlg->text(); qDebug("Selected filename is "+filename); if(filename.right(3) == "m3u") { readm3u( filename ); } else if(filename.right(3) == "pls") { readPls( filename ); } else { + /* FIXME ....... AUDIO/X-MPEGURL is bad*/ DocLnk lnk; lnk.setName(filename); //sets file name lnk.setFile(filename); //sets File property - lnk.setType("audio/x-mpegurl"); + //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() ); + lnk.setType( MimeType( QFile::encodeName(filename) ).id() ); lnk.setExec("opieplayer"); lnk.setIcon("opieplayer2/MPEGPlayer"); if(!lnk.writeLink()) { qDebug("Writing doclink did not work"); } d->selectedFiles->addToSelection( lnk); } } if(fileDlg) { delete fileDlg; } } void PlayListWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_F9: //activity // if(audioUI->isHidden()) // audioUI->showMaximized(); break; case Key_F10: //contacts // if( videoUI->isHidden()) // videoUI->showMaximized(); break; case Key_F11: //menu break; case Key_F12: //home // doBlank(); break; case Key_F13: //mail @@ -1207,41 +1214,41 @@ void PlayListWidget::pmViewActivated(int index) { }; } void PlayListWidget::populateSkinsMenu() { int item=0; defaultSkinIndex=0; QString skinName; Config cfg( "OpiePlayer" ); cfg.setGroup("Options"); QString skin = cfg.readEntry("Skin","default"); QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); skinsDir.setFilter( QDir::Dirs); skinsDir.setSorting(QDir::Name); const QFileInfoList *skinslist = skinsDir.entryInfoList(); QFileInfoListIterator it( *skinslist ); QFileInfo *fi; while ( (fi=it.current()) ) { skinName = fi->fileName(); qDebug( fi->fileName()); if( skinName != "." && skinName != ".." && skinName !="CVS") item = skinsMenu->insertItem( fi->fileName()); if( skinName == "default") defaultSkinIndex = item; if( skinName == skin) skinsMenu->setItemChecked( item, TRUE); ++it; } } void PlayListWidget::skinsMenuActivated(int item) { - for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { + for(uint i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { skinsMenu->setItemChecked( i, FALSE); } skinsMenu->setItemChecked( item, TRUE); Config cfg( "OpiePlayer" ); cfg.setGroup("Options"); cfg.writeEntry("Skin", skinsMenu->text( item)); } diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 53837c7..ffda2e4 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -350,65 +350,65 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { } void VideoWidget::mousePressEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { if ( mediaPlayerState->fullscreen() ) { mediaPlayerState->setFullscreen( FALSE ); makeVisible(); } mouseMoveEvent( event ); } void VideoWidget::showEvent( QShowEvent* ) { QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); mouseMoveEvent( &event ); } void VideoWidget::backToNormal() { mediaPlayerState->setFullscreen( FALSE ); makeVisible(); } void VideoWidget::makeVisible() { if ( mediaPlayerState->fullscreen() ) { setBackgroundMode( QWidget::NoBackground ); showFullScreen(); resize( qApp->desktop()->size() ); slider->hide(); videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); - + qApp->processEvents(); } else { showNormal(); showMaximized(); setBackgroundPixmap( *pixBg ); if ( mediaPlayerState->streaming() ) { slider->hide(); disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } else { slider->show(); connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); qApp->processEvents(); } } void VideoWidget::paintEvent( QPaintEvent * pe) { QPainter p( this ); if ( mediaPlayerState->fullscreen() ) { // Clear the background p.setBrush( QBrush( Qt::black ) ); } else { if ( !pe->erased() ) { // Combine with background and double buffer QPixmap pix( pe->rect().size() ); QPainter p( &pix ); p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |