summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer3/audiowidget.cpp125
-rw-r--r--noncore/multimedia/opieplayer3/audiowidget.h46
-rw-r--r--noncore/multimedia/opieplayer3/config.in6
-rw-r--r--noncore/multimedia/opieplayer3/mwindow.cpp320
-rw-r--r--noncore/multimedia/opieplayer3/mwindow.h120
-rw-r--r--noncore/multimedia/opieplayer3/opieplayer3.pro26
-rw-r--r--noncore/multimedia/opieplayer3/playlist.cpp210
-rw-r--r--noncore/multimedia/opieplayer3/playlist.h100
-rw-r--r--noncore/multimedia/opieplayer3/videowidget.cpp122
-rw-r--r--noncore/multimedia/opieplayer3/videowidget.h53
10 files changed, 1128 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer3/audiowidget.cpp b/noncore/multimedia/opieplayer3/audiowidget.cpp
new file mode 100644
index 0000000..7ba6274
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/audiowidget.cpp
@@ -0,0 +1,125 @@
+#include "audiowidget.h"
+#include "../opieplayer2/lib.h"
+#include "../opieplayer2/threadutil.h"
+
+#include <opie2/odebug.h>
+
+#include <qlayout.h>
+#include <qtextview.h>
+#include <qslider.h>
+#include <qlabel.h>
+
+AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f)
+ :QWidget(parent,name,f)
+{
+ m_xineLib = 0;
+
+ m_MainLayout = new QVBoxLayout(this);
+ m_MainLayout->setAutoAdd(true);
+ m_InfoBox = new QTextView(this);
+ m_PosSlider = new QSlider(QSlider::Horizontal,this);
+ m_PosSlider->setTickInterval(60);
+ connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int)));
+ connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int)));
+ connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed()));
+ connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased()));
+ m_pressed = false;
+ m_uppos=0;
+}
+
+AudioWidget::~AudioWidget()
+{
+}
+
+void AudioWidget::slotNewPos(int pos)
+{
+ if (!m_xineLib) return;
+ if (m_uppos==pos) return;
+ m_xineLib->seekTo(pos);
+}
+
+void AudioWidget::sliderPressed()
+{
+ m_pressed = true;
+}
+
+void AudioWidget::sliderReleased()
+{
+ m_pressed = false;
+}
+
+void AudioWidget::closeEvent(QCloseEvent*e)
+{
+ odebug << "AudioWidget::closeEvent(QCloseEvent*e)" << oendl;
+ if (m_xineLib) {
+ m_xineLib->stop();
+ }
+ QWidget::closeEvent(e);
+}
+
+void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
+{
+ m_current = aLnk;
+ if (m_xineLib != aLib) {
+ disconnect(m_xineLib);
+ m_xineLib = aLib;
+ }
+ if (!m_xineLib) {
+ return;
+ }
+ m_uppos=0;
+ m_PosSlider->setValue(0);
+ m_xineLib->setShowVideo(false);
+ m_xineLib->play(m_current.file());
+ // title
+ QString title = m_xineLib->metaInfo(0);
+ // artist
+ QString artist = m_xineLib->metaInfo(2);
+ // album
+ QString album = m_xineLib->metaInfo(4);
+
+ int l = m_xineLib->length();
+ m_PosSlider->setRange(0,l);
+ QString laenge="";
+ int h = l/3600;
+ l-=h*3600;
+ int m = l/60;
+ l-=m*60;
+ if (h>0) {
+ laenge+=QString("%1 h").arg(h);
+ }
+ if (m>0) {
+ if (!laenge.isEmpty()) laenge+=" ";
+ laenge+=QString("%1 m").arg(m);
+ }
+ if (l>0) {
+ if (!laenge.isEmpty()) laenge+=" ";
+ laenge+=QString("%1 s").arg(l);
+ }
+ QString text = "<qt>";
+ if (artist.length()) {
+ text+="<H2><center>"+artist+"</center></h2>";
+ }
+ if (title.length()) {
+ text+="<H2><center>"+title+"</center></h2>";
+ }
+ if (album.length()) {
+ text+="<H2><center>"+album+"</center></h2>";
+ }
+ text+="<h3><center>"+laenge+"</center></h3>";
+ m_InfoBox->setText(text);
+}
+
+void AudioWidget::stopPlaying()
+{
+ if (m_xineLib) {
+ m_xineLib->stop();
+ }
+}
+
+void AudioWidget::updatePos(int val)
+{
+ if (m_pressed) return;
+ m_uppos = val;
+ m_PosSlider->setValue(val);
+}
diff --git a/noncore/multimedia/opieplayer3/audiowidget.h b/noncore/multimedia/opieplayer3/audiowidget.h
new file mode 100644
index 0000000..07b51b6
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/audiowidget.h
@@ -0,0 +1,46 @@
+#ifndef _audiowidget_h
+#define _audiowidget_h
+
+#include <qwidget.h>
+
+#include <qpe/applnk.h>
+
+namespace XINE {
+ class Lib;
+}
+
+class QVBoxLayout;
+class QTextView;
+class QSlider;
+class QLabel;
+
+class AudioWidget:public QWidget
+{
+ Q_OBJECT
+public:
+ AudioWidget( QWidget * parent=0, const char * name=0, WFlags f=0 );
+ virtual ~AudioWidget();
+
+ void playFile(const DocLnk&,XINE::Lib*);
+
+public slots:
+ virtual void stopPlaying();
+ virtual void updatePos(int);
+
+protected:
+ XINE::Lib*m_xineLib;
+ DocLnk m_current;
+ QVBoxLayout*m_MainLayout;
+ QTextView*m_InfoBox;
+ QSlider*m_PosSlider;
+ bool m_pressed;
+ int m_uppos;
+
+protected slots:
+ virtual void closeEvent(QCloseEvent*e);
+ virtual void slotNewPos(int pos);
+ virtual void sliderPressed();
+ virtual void sliderReleased();
+};
+
+#endif
diff --git a/noncore/multimedia/opieplayer3/config.in b/noncore/multimedia/opieplayer3/config.in
new file mode 100644
index 0000000..f2465a8
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/config.in
@@ -0,0 +1,6 @@
+ config OPIEPLAYER3
+ boolean "opieplayer3 (multimedia player based on libxine)"
+ default "n"
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBXINE_DEP
+ comment "opieplayer2 requires libopie2core, libopie2ui and libxine"
+ depends !( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBXINE_DEP )
diff --git a/noncore/multimedia/opieplayer3/mwindow.cpp b/noncore/multimedia/opieplayer3/mwindow.cpp
new file mode 100644
index 0000000..dab910a
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/mwindow.cpp
@@ -0,0 +1,320 @@
+/*
+ This file is part of the Opie Project
+
+ Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
+ Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
+ Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
+ =.
+ .=l.
+ .>+-=
+ _;:, .> :=|. This program is free software; you can
+.> <`_, > . <= redistribute it and/or modify it under
+:`=1 )Y*s>-.-- : the terms of the GNU General Public
+.="- .-=="i, .._ License as published by the Free Software
+ - . .-<_> .<> Foundation; either version 2 of the License,
+ ._= =} : or (at your option) any later version.
+ .%`+i> _;_.
+ .i_,=:_. -<s. This program is distributed in the hope that
+ + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
+ : .. .:, . . . without even the implied warranty of
+ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
+ _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.= = ; Library General Public License for more
+++= -. .` .: details.
+ : = ...= . :.=-
+ -. .:....=;==+<; You should have received a copy of the GNU
+ -_. . . )=. = Library General Public License along with
+ -- :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include "mwindow.h"
+#include "playlist.h"
+#include "audiowidget.h"
+#include "videowidget.h"
+#include "../opieplayer2/lib.h"
+
+#include <opie2/oapplicationfactory.h>
+#include <opie2/owidgetstack.h>
+#include <opie2/ofileselector.h>
+#include <opie2/odebug.h>
+
+#include <qpe/resource.h>
+
+#include <qfileinfo.h>
+#include <qfile.h>
+#include <qtoolbar.h>
+#include <qpopupmenu.h>
+#include <qmenubar.h>
+#include <qtimer.h>
+
+OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
+
+using namespace Opie::Ui;
+
+PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f)
+ : QMainWindow(w,name,f)
+{
+ setCaption( QObject::tr("Opie Mediaplayer 3" ) );
+ setupActions();
+ setupToolBar();
+ setupMenu();
+
+ m_stack = new OWidgetStack(this);
+ m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen);
+ setCentralWidget(m_stack );
+ m_playList = new PlaylistView(m_stack,"playlist");
+ m_stack->addWidget(m_playList,stack_list);
+
+ m_sfl = new OFileSelector("video/*;audio/*",m_stack);
+ m_stack->addWidget(m_sfl,stack_file);
+ connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &)));
+ m_AudioPlayer = new AudioWidget(m_stack);
+ m_stack->addWidget(m_AudioPlayer,stack_audio);
+ connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int)));
+ m_VideoPlayer = new VideoWidget(m_stack);
+ m_stack->addWidget(m_VideoPlayer,stack_video);
+ connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int)));
+ connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked()));
+
+ m_stack->raiseWidget(stack_list);
+ m_PlayLib = 0;
+ m_LastItem = 0;
+}
+
+void PMainWindow::checkLib()
+{
+ if (m_PlayLib == 0) {
+ m_PlayLib = new XINE::Lib(XINE::Lib::InitializeImmediately);
+ m_PlayLib->ensureInitialized();
+ connect(m_PlayLib,SIGNAL(stopped()),this,SLOT(slotStopped()));
+ }
+}
+
+PMainWindow::~PMainWindow()
+{
+ if (m_PlayLib) {
+ m_PlayLib->stop();
+ delete m_PlayLib;
+ }
+}
+
+void PMainWindow::fileSelected(const DocLnk&)
+{
+}
+
+void PMainWindow::slotAppendFiles()
+{
+ m_stack->raiseWidget(m_sfl);
+}
+
+void PMainWindow::slotShowList()
+{
+ m_stack->raiseWidget(m_playList);
+}
+
+void PMainWindow::slotPlayList()
+{
+ if (m_playing && m_LastItem && m_PlayLib) {
+ if (!m_LastItem->isVideo()) {
+ m_stack->raiseWidget(stack_audio);
+ } else {
+ m_stack->raiseWidget(stack_video);
+ }
+ return;
+ }
+
+ m_LastItem = m_playList->currentItem();
+ if (!m_LastItem) {
+ slotPlayNext();
+ return;
+ }
+ //m_VideoPlayer->setFullScreen(a_ShowFull->isOn());
+ slotPlayCurrent();
+}
+
+void PMainWindow::hideVideo()
+{
+ if (m_VideoPlayer->isVisible() && a_ShowFull->isOn()) {
+ m_VideoPlayer->showNormal();
+ m_VideoPlayer->hide();
+ }
+}
+
+void PMainWindow::slotPlayCurrent()
+{
+ if (!m_LastItem) {
+ if (m_PlayLib) m_PlayLib->stop();
+ hideVideo();
+ m_stack->raiseWidget(stack_list);
+ return;
+ }
+ checkLib();
+ m_CurrentPos = 0;
+ m_playList->setCurrentItem(m_LastItem);
+ odebug << "Pos: " << m_PlayLib->currentTime() << oendl;
+ if (!m_LastItem->isVideo()) {
+ hideVideo();
+ m_playing = true;
+ QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) );
+ m_stack->raiseWidget(stack_audio);
+ m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib);
+ } else {
+ m_playing = true;
+ QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) );
+ setupVideo(a_ShowFull->isOn());
+ m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib);
+ }
+}
+
+void PMainWindow::slotPlayNext()
+{
+ PlaylistItem*item = m_playList->nextItem(m_LastItem);
+ if (!item) return;
+ m_LastItem = item;
+ slotPlayCurrent();
+}
+
+void PMainWindow::slotGoNext()
+{
+ m_LastItem = m_playList->nextItem(m_LastItem);
+ slotPlayCurrent();
+}
+
+void PMainWindow::slotPlayPrevious()
+{
+ PlaylistItem*item = m_playList->prevItem(m_LastItem);
+ if (!item) return;
+ m_LastItem = item;
+ slotPlayCurrent();
+}
+
+void PMainWindow::slotUserStop()
+{
+ if (!m_playing || !m_PlayLib) return;
+ m_playing = false;
+ m_PlayLib->stop();
+ hideVideo();
+ m_stack->raiseWidget(stack_list);
+}
+
+void PMainWindow::slotStopped()
+{
+ if (!m_playing) return;
+ m_playing = false;
+ slotGoNext();
+}
+
+void PMainWindow::slotCheckPos()
+{
+ if (!m_playing) return;
+ emit sigPos(m_PlayLib->currentTime());
+ QTimer::singleShot( 1000, this, SLOT( slotCheckPos() ) );
+}
+
+void PMainWindow::slotRemoveFiles()
+{
+ slotUserStop();
+ PlaylistItem* Item = m_playList->currentItem();
+ m_stack->raiseWidget(stack_list);
+ m_playList->removeFromList(Item);
+}
+
+void PMainWindow::setupActions()
+{
+ a_appendFiles = new QAction(tr("Open file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false );
+ connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles()));
+ a_showPlaylist = new QAction(tr("Show playlist"),Resource::loadIconSet( "txt" ), 0, 0, this, 0, false );
+ connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList()));
+ a_removeFiles = new QAction(tr("Remove file"),Resource::loadIconSet( "opieplayer2/remove_from_playlist" ), 0, 0, this, 0, false );
+ connect(a_removeFiles,SIGNAL(activated()),this,SLOT(slotRemoveFiles()));
+
+ playersGroup = new QActionGroup(this,"playgroup",false);
+
+ a_playAction = new QAction(tr("Play list"),Resource::loadIconSet( "opieplayer2/play" ), 0, 0, this, 0, false );
+ connect(a_playAction,SIGNAL(activated()),this,SLOT(slotPlayList()));
+ a_playNext = new QAction(tr("Play next in list"),Resource::loadIconSet( "fastforward" ), 0, 0, this, 0, false );
+ connect(a_playNext,SIGNAL(activated()),this,SLOT(slotPlayNext()));
+ a_playPrevious = new QAction(tr("Play previous in list"),Resource::loadIconSet( "fastback" ), 0, 0, this, 0, false );
+ connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious()));
+ a_ShowFull = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true );
+ connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool)));
+ a_stopPlay = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "stop" ), 0, 0, this, 0, false );
+ connect(a_stopPlay,SIGNAL(activated()),this,SLOT(slotUserStop()));
+
+ playersGroup->insert(a_playPrevious);
+ playersGroup->insert(a_playAction);
+ playersGroup->insert(a_stopPlay);
+ playersGroup->insert(a_playNext);
+ //playersGroup->insert(a_ShowFull);
+}
+
+void PMainWindow::setupToolBar()
+{
+ setToolBarsMovable( false );
+ m_toolBar = new QToolBar( this );
+ //m_menuBar = new QMenuBar(m_toolBar);
+ m_menuBar=menuBar();
+ addToolBar(m_toolBar);
+ m_toolBar->setHorizontalStretchable( true );
+ a_appendFiles->addTo(m_toolBar);
+ a_removeFiles->addTo(m_toolBar);
+ a_showPlaylist->addTo(m_toolBar);
+ a_ShowFull->addTo(m_toolBar);
+ playersGroup->addTo(m_toolBar);
+}
+
+void PMainWindow::setupVideo(bool full)
+{
+ if (full) {
+ m_VideoPlayer->setBackgroundColor(black);
+ m_VideoPlayer->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0));
+ m_VideoPlayer->setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height());
+ m_VideoPlayer->showFullScreen();
+ } else {
+ m_VideoPlayer->hide();
+ m_stack->addWidget(m_VideoPlayer,stack_video);
+ m_stack->raiseWidget(stack_video);
+ }
+ m_VideoPlayer->fullScreen(full);
+ m_VideoPlayer->disconnect(this);
+ connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked()));
+}
+
+void PMainWindow::slotVideoclicked()
+{
+ odebug << "PMainWindow::slotVideoclicked()" << oendl;
+ if (a_ShowFull->isOn()) {
+ a_ShowFull->setOn(false);
+ slotToggleFull(false);
+ }
+}
+
+void PMainWindow::slotToggleFull(bool how)
+{
+ if (m_PlayLib && m_VideoPlayer->isVisible() && m_PlayLib->isShowingVideo()) {
+ m_PlayLib->pause(true);
+ setupVideo(how);
+ m_PlayLib->pause(false);
+ }
+}
+
+void PMainWindow::setupMenu()
+{
+ fileMenu = new QPopupMenu( m_menuBar );
+ m_menuBar->insertItem( tr( "Playlist" ), fileMenu );
+ a_appendFiles->addTo(fileMenu);
+ a_removeFiles->addTo(fileMenu);
+
+ dispMenu = new QPopupMenu( m_menuBar );
+ m_menuBar->insertItem( tr( "Show" ), dispMenu );
+ a_showPlaylist->addTo(dispMenu);
+ a_ShowFull->addTo(dispMenu);
+ playMenu = new QPopupMenu(m_menuBar);
+ m_menuBar->insertItem(tr("Playing"),playMenu);
+
+ playersGroup->addTo(playMenu);
+}
diff --git a/noncore/multimedia/opieplayer3/mwindow.h b/noncore/multimedia/opieplayer3/mwindow.h
new file mode 100644
index 0000000..28f820f
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/mwindow.h
@@ -0,0 +1,120 @@
+/*
+ This file is part of the Opie Project
+
+ Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
+ Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
+ Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
+ =.
+ .=l.
+ .>+-=
+ _;:, .> :=|. This program is free software; you can
+.> <`_, > . <= redistribute it and/or modify it under
+:`=1 )Y*s>-.-- : the terms of the GNU General Public
+.="- .-=="i, .._ License as published by the Free Software
+ - . .-<_> .<> Foundation; either version 2 of the License,
+ ._= =} : or (at your option) any later version.
+ .%`+i> _;_.
+ .i_,=:_. -<s. This program is distributed in the hope that
+ + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
+ : .. .:, . . . without even the implied warranty of
+ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
+ _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.= = ; Library General Public License for more
+++= -. .` .: details.
+ : = ...= . :.=-
+ -. .:....=;==+<; You should have received a copy of the GNU
+ -_. . . )=. = Library General Public License along with
+ -- :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef _mwindow_h
+#define _mwindow_h
+
+#include <qmainwindow.h>
+
+#include <qpe/applnk.h>
+
+#include <qaction.h>
+
+namespace Opie {
+namespace Ui {
+ class OWidgetStack;
+ class OFileSelector;
+}
+}
+
+namespace XINE {
+ class Lib;
+}
+
+class PlaylistView;
+class QToolBar;
+class QPopupMenu;
+class QMenuBar;
+class AudioWidget;
+class VideoWidget;
+class PlaylistItem;
+
+class PMainWindow : public QMainWindow {
+ Q_OBJECT
+public:
+ static QString appName() { return QString::fromLatin1("opie-mediaplayer3" ); }
+ PMainWindow(QWidget*, const char*, WFlags );
+ virtual ~PMainWindow();
+
+public slots:
+ virtual void slotVideoclicked();
+protected:
+ static const int stack_list = 0;
+ static const int stack_file = 1;
+ static const int stack_audio = 2;
+ static const int stack_video = 3;
+ Opie::Ui::OWidgetStack *m_stack;
+ Opie::Ui::OFileSelector*m_sfl;
+ PlaylistView*m_playList;
+ AudioWidget*m_AudioPlayer;
+ VideoWidget*m_VideoPlayer;
+
+ QAction*a_appendFiles,*a_removeFiles,*a_showPlaylist,*a_playAction,*a_deleteItem,*a_stopAction;
+ QAction*a_playNext,*a_playPrevious,*a_ShowFull,*a_stopPlay;
+ QActionGroup*playersGroup;
+ QToolBar*m_toolBar;
+ QPopupMenu *fileMenu,*dispMenu,*playMenu;
+ QMenuBar*m_menuBar;
+ XINE::Lib*m_PlayLib;
+
+ void setupActions();
+ void setupToolBar();
+ void setupMenu();
+ void checkLib();
+ void setupVideo(bool full);
+ void hideVideo();
+
+ bool m_playing:1;
+ int m_CurrentPos;
+ PlaylistItem*m_LastItem;
+
+protected slots:
+ virtual void fileSelected(const DocLnk&);
+ virtual void slotAppendFiles();
+ virtual void slotRemoveFiles();
+ virtual void slotShowList();
+ virtual void slotPlayList();
+ virtual void slotPlayNext();
+ virtual void slotPlayPrevious();
+ virtual void slotPlayCurrent();
+ virtual void slotStopped();
+ virtual void slotCheckPos();
+ virtual void slotToggleFull(bool);
+ virtual void slotUserStop();
+ virtual void slotGoNext();
+
+signals:
+ void sigPos(int);
+};
+
+#endif
diff --git a/noncore/multimedia/opieplayer3/opieplayer3.pro b/noncore/multimedia/opieplayer3/opieplayer3.pro
new file mode 100644
index 0000000..1c7149f
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/opieplayer3.pro
@@ -0,0 +1,26 @@
+CONFIG = qt warn_on quick-app
+HEADERS = mwindow.h playlist.h ../opieplayer2/lib.h ../opieplayer2/threadutil.h \
+ ../opieplayer2/alphablend.h ../opieplayer2/yuv2rgb.h \
+ audiowidget.h ../opieplayer2/xinevideowidget.h \
+ videowidget.h
+SOURCES = mwindow.cpp playlist.cpp ../opieplayer2/lib.cpp ../opieplayer2/threadutil.cpp \
+ ../opieplayer2/nullvideo.c \
+ ../opieplayer2/alphablend.c ../opieplayer2/yuv2rgb.c \
+ audiowidget.cpp ../opieplayer2/xinevideowidget.cpp \
+ videowidget.cpp ../opieplayer2/yuv2rgb_arm2.c ../opieplayer2/yuv2rgb_arm4l.S
+
+TARGET = opie-mediaplayer3
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDPATH += $(OPIEDIR)/include
+LIBS += -lqpe -lpthread -lopiecore2 -lopieui2 -lqtaux2 -lxine
+MOC_DIR = qpeobj
+OBJECTS_DIR = qpeobj
+
+include( $(OPIEDIR)/include.pro )
+
+!isEmpty( LIBXINE_INC_DIR ) {
+ INCLUDEPATH = $$LIBXINE_INC_DIR $$INCLUDEPATH
+}
+!isEmpty( LIBXINE_LIB_DIR ) {
+ LIBS = -L$$LIBXINE_LIB_DIR $$LIBS
+}
diff --git a/noncore/multimedia/opieplayer3/playlist.cpp b/noncore/multimedia/opieplayer3/playlist.cpp
new file mode 100644
index 0000000..272a71e
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/playlist.cpp
@@ -0,0 +1,210 @@
+/*
+ This file is part of the Opie Project
+
+ Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
+ Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
+ Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
+ =.
+ .=l.
+ .>+-=
+ _;:, .> :=|. This program is free software; you can
+.> <`_, > . <= redistribute it and/or modify it under
+:`=1 )Y*s>-.-- : the terms of the GNU General Public
+.="- .-=="i, .._ License as published by the Free Software
+ - . .-<_> .<> Foundation; either version 2 of the License,
+ ._= =} : or (at your option) any later version.
+ .%`+i> _;_.
+ .i_,=:_. -<s. This program is distributed in the hope that
+ + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
+ : .. .:, . . . without even the implied warranty of
+ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
+ _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.= = ; Library General Public License for more
+++= -. .` .: details.
+ : = ...= . :.=-
+ -. .:....=;==+<; You should have received a copy of the GNU
+ -_. . . )=. = Library General Public License along with
+ -- :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+#include "playlist.h"
+#include "../opieplayer2/lib.h"
+
+#include <opie2/odebug.h>
+#include <opie2/oresource.h>
+
+#include <qpe/resource.h>
+
+#include <qfileinfo.h>
+
+PlaylistItem::PlaylistItem(const DocLnk& aLink,PlaylistView*parent)
+ :QListViewItem(parent),m_Content(aLink),m_video(false)
+{
+}
+
+PlaylistItem::PlaylistItem(const DocLnk&aLink,PlaylistView*parent,PlaylistItem*after)
+ :QListViewItem(parent,after),m_Content(aLink),m_video(false)
+{
+}
+
+void PlaylistItem::Video(bool y)
+{
+ m_video=y;
+ if (m_video) {
+ setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/videofile"));
+ } else {
+ setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/musicfile"));
+ }
+}
+
+PlaylistItem::~PlaylistItem()
+{
+}
+
+/* PlaylistView Methods */
+PlaylistView::PlaylistView(QWidget *parent, const char *name)
+ : QListView(parent,name)
+{
+// columnLabels << tr("FullName");
+ columnLabels << tr(""); // icon
+ columnLabels << tr("File");
+ columnLabels << tr("Playtime");
+ columnLabels << tr("Artist");
+ columnLabels << tr("Album");
+ columnLabels << tr("Title");
+ columnLabels << tr("Type");
+ columnLabels << tr("Size");
+ for (QStringList::Iterator it = columnLabels.begin(); it != columnLabels.end(); ++it) {
+ addColumn(*it);
+ }
+ m_Infolib=0;
+ setAllColumnsShowFocus(true);
+ setSelectionMode(Single);
+ setSorting(-1);
+ m_lastItem = 0;
+}
+
+PlaylistView::~PlaylistView()
+{
+ if (m_Infolib) delete m_Infolib;
+}
+
+void PlaylistView::checkLib()
+{
+ if (!m_Infolib) {
+ m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately);
+ m_Infolib->ensureInitialized();
+ }
+}
+
+void PlaylistView::slotAddFile(const DocLnk&aLink)
+{
+ QFileInfo fileInfo(aLink.file());
+ if (!fileInfo.exists()) return;
+ checkLib();
+
+ m_Infolib->stop();
+
+ if (m_lastItem) {
+ m_lastItem = new PlaylistItem(aLink,this,m_lastItem);
+ } else {
+ m_lastItem = new PlaylistItem(aLink,this);
+ }
+ m_lastItem->setExpandable(false);
+ m_lastItem->setText(1,aLink.name());
+ int i = m_Infolib->setfile(aLink.file());
+ odebug << "File set: " << i << oendl;
+ if (i<1) {
+ return;
+ }
+
+ QString codec = m_Infolib->metaInfo(6);
+ if (codec.isEmpty()) {
+ codec = m_Infolib->metaInfo(7);
+ }
+ // codec
+ m_lastItem->setText(COL_TYPE,codec);
+ // title
+ m_lastItem->setText(COL_TITLE,m_Infolib->metaInfo(0));
+ // artist
+ m_lastItem->setText(COL_ARTIST,m_Infolib->metaInfo(2));
+ // album
+ m_lastItem->setText(COL_ALBUM,m_Infolib->metaInfo(4));
+ int l = m_Infolib->length();
+ int h = l/3600;
+ l-=h*3600;
+ int m = l/60;
+ l-=m*60;
+ codec = "";
+ if (h>0) {
+ codec+=QString("%1 h").arg(h);
+ }
+ if (m>0) {
+ if (!codec.isEmpty()) codec+=" ";
+ codec+=QString("%1 m").arg(m);
+ }
+ if (l>0) {
+ if (!codec.isEmpty()) codec+=" ";
+ codec+=QString("%1 s").arg(l);
+ }
+ // time
+ m_lastItem->setText(COL_TIME,codec);
+ m_lastItem->Video(m_Infolib->hasVideo());
+ m_items.append(m_lastItem);
+}
+
+void PlaylistView::removeFromList(PlaylistItem*Item)
+{
+ if (!Item)return;
+ t_itemlist::Iterator iter;
+ iter = m_items.find(Item);
+ if (iter!=m_items.end()) {
+ m_items.remove(iter);
+ }
+ delete Item;
+}
+
+XINE::Lib*PlaylistView::getXine()
+{
+ checkLib();
+ return m_Infolib;
+}
+
+void PlaylistView::setCurrentItem(PlaylistItem*aItem)
+{
+ setSelected(aItem,true);
+}
+
+PlaylistItem* PlaylistView::currentItem()const
+{
+ QListViewItem*it = selectedItem();
+ if (!it) return 0;
+ return (PlaylistItem*)it;
+}
+
+PlaylistItem* PlaylistView::nextItem(PlaylistItem*parent)const
+{
+ if (m_items.count()==0) return 0;
+ if (!parent) return m_items[0];
+ for (unsigned j=0; j<m_items.count()-1;++j) {
+ if (m_items[j]==parent) {
+ return m_items[j+1];
+ }
+ }
+ return 0;
+}
+
+PlaylistItem* PlaylistView::prevItem(PlaylistItem*parent)const
+{
+ if (m_items.count()==0) return 0;
+ if (!parent) return m_items[m_items.count()-1];
+ for (unsigned j=m_items.count()-1; j>0;--j) {
+ if (m_items[j]==parent) {
+ return m_items[j-1];
+ }
+ }
+ return 0;
+}
diff --git a/noncore/multimedia/opieplayer3/playlist.h b/noncore/multimedia/opieplayer3/playlist.h
new file mode 100644
index 0000000..ad4c472
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/playlist.h
@@ -0,0 +1,100 @@
+/*
+ This file is part of the Opie Project
+
+ Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
+ Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
+ Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
+ =.
+ .=l.
+ .>+-=
+ _;:, .> :=|. This program is free software; you can
+.> <`_, > . <= redistribute it and/or modify it under
+:`=1 )Y*s>-.-- : the terms of the GNU General Public
+.="- .-=="i, .._ License as published by the Free Software
+ - . .-<_> .<> Foundation; either version 2 of the License,
+ ._= =} : or (at your option) any later version.
+ .%`+i> _;_.
+ .i_,=:_. -<s. This program is distributed in the hope that
+ + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
+ : .. .:, . . . without even the implied warranty of
+ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
+ _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.= = ; Library General Public License for more
+++= -. .` .: details.
+ : = ...= . :.=-
+ -. .:....=;==+<; You should have received a copy of the GNU
+ -_. . . )=. = Library General Public License along with
+ -- :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+#ifndef __playlist_h
+#define __playlist_h
+
+#include <qpe/applnk.h>
+
+#include <qlistview.h>
+#include <qstringlist.h>
+
+namespace XINE {
+ class Lib;
+}
+
+class PlaylistView;
+
+class PlaylistItem:public QListViewItem
+{
+public:
+ PlaylistItem(const DocLnk&aLink,PlaylistView*parent);
+ PlaylistItem(const DocLnk&aLink,PlaylistView*parent,PlaylistItem*after);
+ virtual ~PlaylistItem();
+
+ const DocLnk&Lnk()const{return m_Content;}
+ void Video(bool y);
+ bool isVideo()const{return m_video;}
+
+protected:
+ DocLnk m_Content;
+ bool m_video:1;
+};
+
+typedef QValueList<PlaylistItem*> t_itemlist;
+
+class PlaylistView:public QListView
+{
+ Q_OBJECT
+public:
+ PlaylistView( QWidget *parent = 0, const char *name = 0);
+ virtual ~PlaylistView();
+ XINE::Lib*getXine();
+ PlaylistItem* currentItem()const;
+ void setCurrentItem(PlaylistItem*);
+ PlaylistItem* nextItem(PlaylistItem*parent)const;
+ PlaylistItem* prevItem(PlaylistItem*parent)const;
+
+ void removeFromList(PlaylistItem*Item);
+
+ enum itemcolumns{
+ COL_ICON=0,
+ COL_FILE=1,
+ COL_TIME=2,
+ COL_ARTIST=3,
+ COL_ALBUM=4,
+ COL_TITLE=5,
+ COL_TYPE=6,
+ COL_SIZE=7
+ };
+public slots:
+ virtual void slotAddFile(const DocLnk&);
+
+protected:
+ void checkLib();
+ QStringList columnLabels;
+ XINE::Lib*m_Infolib;
+ PlaylistItem*m_lastItem;
+ t_itemlist m_items;
+};
+
+#endif
diff --git a/noncore/multimedia/opieplayer3/videowidget.cpp b/noncore/multimedia/opieplayer3/videowidget.cpp
new file mode 100644
index 0000000..c5c63c7
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/videowidget.cpp
@@ -0,0 +1,122 @@
+#include "videowidget.h"
+#include "../opieplayer2/lib.h"
+#include "../opieplayer2/threadutil.h"
+#include "../opieplayer2/xinevideowidget.h"
+
+#include <opie2/odebug.h>
+
+#include <qpe/qpeapplication.h>
+
+#include <qlayout.h>
+#include <qslider.h>
+#include <qlabel.h>
+
+VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f)
+ :QWidget(parent,name,f)
+{
+ m_xineLib = 0;
+
+ m_MainLayout = new QVBoxLayout(this);
+ m_MainLayout->setAutoAdd(true);
+ m_Videodisplay = new XineVideoWidget(this,"videodisp");
+ m_PosSlider = new QSlider(QSlider::Horizontal,this);
+ m_PosSlider->setTickInterval(60);
+ connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int)));
+ connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int)));
+ connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed()));
+ connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased()));
+ connect(m_Videodisplay,SIGNAL(videoResized ( const QSize & )),this,SLOT(slot_Videoresized(const QSize&)));
+ connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked()));
+ m_pressed = false;
+ m_uppos=0;
+}
+
+VideoWidget::~VideoWidget()
+{
+}
+
+void VideoWidget::slotClicked()
+{
+ odebug << "clicked " << oendl;
+ emit videoclicked();
+}
+
+void VideoWidget::closeEvent(QCloseEvent*e)
+{
+}
+
+void VideoWidget::slotNewPos(int pos)
+{
+ if (!m_xineLib) return;
+ if (m_uppos==pos) return;
+ m_xineLib->seekTo(pos);
+}
+
+void VideoWidget::sliderPressed()
+{
+ m_pressed = true;
+}
+
+void VideoWidget::sliderReleased()
+{
+ m_pressed = false;
+}
+
+void VideoWidget::fullScreen(bool how)
+{
+ if (how) {
+ m_PosSlider->hide();
+ } else {
+ m_PosSlider->show();
+ }
+}
+
+void VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
+{
+ m_current = aLnk;
+ if (m_xineLib != aLib) {
+ disconnect(m_xineLib);
+ m_xineLib = aLib;
+ if (aLib) m_xineLib->setWidget(m_Videodisplay);
+ }
+ if (!m_xineLib) {
+ return;
+ }
+ connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped()));
+ m_uppos=0;
+ m_PosSlider->setValue(0);
+ m_xineLib->setWidget(m_Videodisplay);
+ m_xineLib->setShowVideo(true);
+ m_xineLib->resize(m_Videodisplay->size());
+ m_xineLib->play(m_current.file());
+ int l = m_xineLib->length();
+ m_PosSlider->setRange(0,l);
+ m_PosSlider->setPageStep(l/10);
+}
+
+void VideoWidget::stopPlaying()
+{
+ if (m_xineLib) {
+ m_xineLib->stop();
+ }
+}
+
+void VideoWidget::slotStopped()
+{
+// check fullscreen here!
+}
+
+void VideoWidget::slot_Videoresized(const QSize&s)
+{
+ odebug << "Videoresized: " << s << oendl;
+ if (m_xineLib) {
+ m_xineLib->resize(s);
+ }
+}
+
+void VideoWidget::updatePos(int val)
+{
+ if (m_pressed) return;
+ m_uppos = val;
+ m_PosSlider->setValue(val);
+}
diff --git a/noncore/multimedia/opieplayer3/videowidget.h b/noncore/multimedia/opieplayer3/videowidget.h
new file mode 100644
index 0000000..f181980
--- a/dev/null
+++ b/noncore/multimedia/opieplayer3/videowidget.h
@@ -0,0 +1,53 @@
+#ifndef __videowidget_h
+#define __videowidget_h
+#include <qwidget.h>
+
+#include <qpe/applnk.h>
+
+namespace XINE {
+ class Lib;
+}
+
+class QVBoxLayout;
+class QSlider;
+class QLabel;
+class XineVideoWidget;
+
+class VideoWidget:public QWidget
+{
+ Q_OBJECT
+public:
+ VideoWidget( QWidget * parent=0, const char * name=0, WFlags f=0 );
+ virtual ~VideoWidget();
+
+ void playFile(const DocLnk&,XINE::Lib*);
+ void fullScreen(bool how);
+
+signals:
+ void videoclicked();
+
+public slots:
+ virtual void stopPlaying();
+ virtual void updatePos(int);
+
+protected:
+ XINE::Lib*m_xineLib;
+ DocLnk m_current;
+ QVBoxLayout*m_MainLayout;
+ XineVideoWidget*m_Videodisplay;
+ QWidget * m_holder;
+ QSlider*m_PosSlider;
+ bool m_pressed:1;
+ int m_uppos;
+
+protected slots:
+ virtual void closeEvent(QCloseEvent*e);
+ virtual void slotNewPos(int pos);
+ virtual void sliderPressed();
+ virtual void sliderReleased();
+ virtual void slot_Videoresized(const QSize&);
+ virtual void slotStopped();
+ virtual void slotClicked();
+};
+
+#endif