summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/config.in4
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp9
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/opie-mediaplayer2.control4
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro9
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp69
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h7
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h4
11 files changed, 67 insertions, 58 deletions
diff --git a/noncore/multimedia/opieplayer2/config.in b/noncore/multimedia/opieplayer2/config.in
index 27142a8..2272a9b 100644
--- a/noncore/multimedia/opieplayer2/config.in
+++ b/noncore/multimedia/opieplayer2/config.in
@@ -1,6 +1,4 @@
1 config OPIEPLAYER2 1 config OPIEPLAYER2
2 boolean "opie-mediaplayer2 (streaming capable media player for mp3, mpeg, wav, ogg, quicktime, divx and more)" 2 boolean "opieplayer2"
3 default "n" 3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
5 comment "opie-mediaplayer2-skin-default-landscape automatically selected"
6 depends OPIEPLAYER2
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 11ad745..00cfa33 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,9 +1,9 @@
1 /* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
@@ -82,17 +82,17 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
82 if ( !QFile::exists(configPath) ) { 82 if ( !QFile::exists(configPath) ) {
83 QFile f(configPath); 83 QFile f(configPath);
84 f.open(IO_WriteOnly); 84 f.open(IO_WriteOnly);
85 QTextStream ts( &f ); 85 QTextStream ts( &f );
86 ts << "misc.memcpy_method:glibc\n"; 86 ts << "misc.memcpy_method:glibc\n";
87 ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; 87 ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n";
88 ts << "codec.ffmpeg_pp_quality:3\n"; 88 ts << "codec.ffmpeg_pp_quality:3\n";
89 ts << "audio.num_buffers:50\n"; 89 ts << "audio.num_buffers:50\n";
90 ts << "audio.size_buffers:4160\n"; 90 ts << "audio.size_buffers:4096\n";
91 ts << "video.num_buffers:20\n"; 91 ts << "video.num_buffers:20\n";
92 ts << "video.size_buffers:4096\n"; 92 ts << "video.size_buffers:4096\n";
93 ts << "audio.out_num_audio_buf:16\n"; 93 ts << "audio.out_num_audio_buf:16\n";
94 ts << "audio.out_size_audio_buf:8096\n"; 94 ts << "audio.out_size_audio_buf:8096\n";
95 ts << "audio.out_size_zero_buf:1024\n"; 95 ts << "audio.out_size_zero_buf:1024\n";
96 ts << "audio.passthrough_offset:0\n"; 96 ts << "audio.passthrough_offset:0\n";
97 f.close(); 97 f.close();
98 } 98 }
@@ -265,17 +265,17 @@ int Lib::currentTime() const {
265} 265}
266 266
267int Lib::length() const { 267int Lib::length() const {
268 assert( m_initialized ); 268 assert( m_initialized );
269 269
270 int pos, time, length; 270 int pos, time, length;
271/* dilb: patch to solve the wrong stream length reported to the GUI*/ 271/* dilb: patch to solve the wrong stream length reported to the GUI*/
272 int iRetVal=0, iTestLoop=0; 272 int iRetVal=0, iTestLoop=0;
273 273
274 do 274 do
275 { 275 {
276 iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); 276 iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length );
277 if (iRetVal) 277 if (iRetVal)
278 {/* if the function didn't return 0, then pos, time and length are valid.*/ 278 {/* if the function didn't return 0, then pos, time and length are valid.*/
279 return length/1000; 279 return length/1000;
280 } 280 }
281 /*don't poll too much*/ 281 /*don't poll too much*/
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp
index f87cee8..b0a22b2 100644
--- a/noncore/multimedia/opieplayer2/main.cpp
+++ b/noncore/multimedia/opieplayer2/main.cpp
@@ -1,22 +1,29 @@
1 1
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include "mediaplayerstate.h" 3#include "mediaplayerstate.h"
4#include "playlistwidget.h" 4#include "playlistwidget.h"
5#include "mediaplayer.h" 5#include "mediaplayer.h"
6 6
7
8
9#include <opie/oapplicationfactory.h>
10
11OPIE_EXPORT_APP( OApplicationFactory<PlayListWidget> )
12
13#if 0
7int main(int argc, char **argv) { 14int main(int argc, char **argv) {
8 QPEApplication a(argc,argv); 15 QPEApplication a(argc,argv);
9 16
10 MediaPlayerState st( 0, "mediaPlayerState" ); 17 MediaPlayerState st( 0, "mediaPlayerState" );
11 PlayListWidget pl( st, 0, "playList" ); 18 PlayListWidget pl( st, 0, "playList" );
12 pl.showMaximized(); 19 pl.showMaximized();
13 MediaPlayer mp( pl, st, 0, "mediaPlayer" ); 20 MediaPlayer mp( pl, st, 0, "mediaPlayer" );
14 QObject::connect( &pl, SIGNAL( skinSelected() ), 21 QObject::connect( &pl, SIGNAL( skinSelected() ),
15 &mp, SLOT( reloadSkins() ) ); 22 &mp, SLOT( reloadSkins() ) );
16 23
17 a.showMainDocumentWidget(&pl); 24 a.showMainDocumentWidget(&pl);
18 25
19 return a.exec(); 26 return a.exec();
20} 27}
21 28#endif
22 29
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 4c9afca..9f51006 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -278,17 +278,16 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
278 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 278 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
279 } 279 }
280 } 280 }
281 } 281 }
282} 282}
283 283
284 284
285void MediaPlayer::blank( bool b ) { 285void MediaPlayer::blank( bool b ) {
286// ### FIXME use ODevice::inst()->setDisplayStatus( b );
287 fd=open("/dev/fb0",O_RDWR); 286 fd=open("/dev/fb0",O_RDWR);
288#ifdef QT_QWS_SL5XXX 287#ifdef QT_QWS_SL5XXX
289 fl= open( "/dev/fl", O_RDWR ); 288 fl= open( "/dev/fl", O_RDWR );
290#endif 289#endif
291 if (fd != -1) { 290 if (fd != -1) {
292 if ( b ) { 291 if ( b ) {
293 qDebug("do blanking"); 292 qDebug("do blanking");
294#ifdef QT_QWS_SL5XXX 293#ifdef QT_QWS_SL5XXX
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index b1f88c9..f193001 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -21,18 +21,16 @@
21*/ 21*/
22 22
23#include <assert.h> 23#include <assert.h>
24 24
25#include "mediawidget.h" 25#include "mediawidget.h"
26#include "playlistwidget.h" 26#include "playlistwidget.h"
27#include "skin.h" 27#include "skin.h"
28 28
29#include <assert.h>
30
31MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 29MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
32 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) 30 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
33{ 31{
34 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 32 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
35 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 33 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
36 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 34 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
37 this, SLOT( setLength( long ) ) ); 35 this, SLOT( setLength( long ) ) );
38 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 36 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
index 8e68c57..3e3e856 100644
--- a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
+++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
@@ -1,11 +1,11 @@
1Package: opie-mediaplayer2 1Package: opie-mediaplayer2
2Files: plugins/application/libopieplayer2.so* bin/opieplayer2 apps/Applications/mediaplayer.desktop pics/opieplayer2/add_to_playlist.png pics/opieplayer2/cut.png pics/opieplayer2/delete.png pics/opieplayer2/down.png pics/opieplayer2/loop.png pics/opieplayer2/MPEGPlayer.png pics/opieplayer2/musicfile.png pics/opieplayer2/playlist2.png pics/opieplayer2/play.png pics/opieplayer2/remove_from_playlist.png pics/opieplayer2/shuffle.png pics/opieplayer2/up.png pics/opieplayer2/videofile.png 2Files: plugins/application/libopieplayer2.so* bin/opieplayer2 apps/Applications/mediaplayer.desktop pics/opieplayer2/add_to_playlist.png pics/opieplayer2/cut.png pics/opieplayer2/delete.png pics/opieplayer2/down.png pics/opieplayer2/loop.png pics/opieplayer2/MPEGPlayer.png pics/opieplayer2/musicfile.png pics/opieplayer2/playlist2.png pics/opieplayer2/play.png pics/opieplayer2/remove_from_playlist.png pics/opieplayer2/shuffle.png pics/opieplayer2/up.png pics/opieplayer2/videofile.png
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org> 5Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal, libopie1, zlib1g, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs 7Depends: task-opie-minimal, libopie1, zlib1g, libstdc++2.10-glibc2.2, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs
8Description: The Opie media player II 8Description: The Opie media player
9 The mediaplayer for Opie. It plays mp3, mpeg, wav, ogg, quicktime, divx and 9 The mediaplayer for Opie. It plays mp3, mpeg, wav, ogg, quicktime, divx and
10 more. Also it is streaming capable. 10 more. Also it is streaming capable.
11Version: $QPE_VERSION$EXTRAVERSION 11Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro
index 5dabbab..46e14a0 100644
--- a/noncore/multimedia/opieplayer2/opieplayer2.pro
+++ b/noncore/multimedia/opieplayer2/opieplayer2.pro
@@ -1,11 +1,9 @@
1TEMPLATE = app 1CONFIG = qt warn_on release quick-app
2CONFIG = qt warn_on release
3DESTDIR = $(OPIEDIR)/bin
4HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \ 2HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \
5 videowidget.h audiowidget.h playlistwidget.h om3u.h mediaplayer.h inputDialog.h \ 3 videowidget.h audiowidget.h playlistwidget.h om3u.h mediaplayer.h inputDialog.h \
6 frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\ 4 frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\
7 alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h \ 5 alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h \
8 skin.h 6 skin.h
9SOURCES = main.cpp \ 7SOURCES = main.cpp \
10 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \ 8 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \
11 videowidget.cpp audiowidget.cpp playlistwidget.cpp om3u.cpp mediaplayer.cpp inputDialog.cpp \ 9 videowidget.cpp audiowidget.cpp playlistwidget.cpp om3u.cpp mediaplayer.cpp inputDialog.cpp \
@@ -16,21 +14,16 @@ SOURCES = main.cpp \
16 skin.cpp 14 skin.cpp
17TARGET = opieplayer2 15TARGET = opieplayer2
18INCLUDEPATH += $(OPIEDIR)/include 16INCLUDEPATH += $(OPIEDIR)/include
19DEPENDPATH += $(OPIEDIR)/include 17DEPENDPATH += $(OPIEDIR)/include
20LIBS += -lqpe -lpthread -lopie -lxine -lstdc++ 18LIBS += -lqpe -lpthread -lopie -lxine -lstdc++
21MOC_DIR = qpeobj 19MOC_DIR = qpeobj
22OBJECTS_DIR = qpeobj 20OBJECTS_DIR = qpeobj
23 21
24#INCLUDEPATH += $(OPIEDIR)/include
25#DEPENDPATH += $(OPIEDIR)/include
26
27
28
29TRANSLATIONS = ../../../i18n/de/opieplayer2.ts \ 22TRANSLATIONS = ../../../i18n/de/opieplayer2.ts \
30 ../../../i18n/nl/opieplayer2.ts \ 23 ../../../i18n/nl/opieplayer2.ts \
31 ../../../i18n/da/opieplayer2.ts \ 24 ../../../i18n/da/opieplayer2.ts \
32 ../../../i18n/xx/opieplayer2.ts \ 25 ../../../i18n/xx/opieplayer2.ts \
33 ../../../i18n/en/opieplayer2.ts \ 26 ../../../i18n/en/opieplayer2.ts \
34 ../../../i18n/es/opieplayer2.ts \ 27 ../../../i18n/es/opieplayer2.ts \
35 ../../../i18n/fr/opieplayer2.ts \ 28 ../../../i18n/fr/opieplayer2.ts \
36 ../../../i18n/hu/opieplayer2.ts \ 29 ../../../i18n/hu/opieplayer2.ts \
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index a1a1016..9a9e1ec 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -34,40 +34,45 @@
34#include <qtoolbar.h> 34#include <qtoolbar.h>
35 35
36#include <opie/ofiledialog.h> 36#include <opie/ofiledialog.h>
37 37
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39 39
40#include "playlistselection.h" 40#include "playlistselection.h"
41#include "playlistwidget.h" 41#include "playlistwidget.h"
42#include "mediaplayer.h"
42#include "mediaplayerstate.h" 43#include "mediaplayerstate.h"
43#include "inputDialog.h" 44#include "inputDialog.h"
44#include "om3u.h" 45#include "om3u.h"
45#include "playlistfileview.h" 46#include "playlistfileview.h"
46 47
47//only needed for the random play 48//only needed for the random play
48#include <assert.h> 49#include <assert.h>
49 50
50PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 51PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl )
51 : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) 52 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 )
52{ 53{
54 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" );
55 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer");
56
57
53 58
54 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 59 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
55 "opieplayer2/add_to_playlist", 60 "opieplayer2/add_to_playlist",
56 this , SLOT(addSelected() ) ); 61 this , SLOT(addSelected() ) );
57 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 62 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
58 "opieplayer2/remove_from_playlist", 63 "opieplayer2/remove_from_playlist",
59 this , SLOT(removeSelected() ) ); 64 this , SLOT(removeSelected() ) );
60 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 65 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
61 this , SLOT( btnPlay( bool) ), TRUE ); 66 this , SLOT( btnPlay( bool) ), TRUE );
62 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 67 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
63 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 68 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
64 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 69 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
65 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 70 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
66 71
67 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 72 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
68 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 73 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
69 this, SLOT( addAllMusicToList() ) ); 74 this, SLOT( addAllMusicToList() ) );
70 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 75 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
71 this, SLOT( addAllVideoToList() ) ); 76 this, SLOT( addAllVideoToList() ) );
72 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 77 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
73 this, SLOT( addAllToList() ) ); 78 this, SLOT( addAllToList() ) );
@@ -81,21 +86,21 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
81 this, SLOT(writem3u() ) ); 86 this, SLOT(writem3u() ) );
82 pmPlayList->insertSeparator(-1); 87 pmPlayList->insertSeparator(-1);
83 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 88 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
84 audioView, SLOT( scanFiles() ) ); 89 audioView, SLOT( scanFiles() ) );
85 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 90 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
86 videoView, SLOT( scanFiles() ) ); 91 videoView, SLOT( scanFiles() ) );
87 92
88 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 93 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
89 &mediaPlayerState, SLOT( toggleFullscreen() ) ); 94 mediaPlayerState, SLOT( toggleFullscreen() ) );
90 95
91 Config cfg( "OpiePlayer" ); 96 Config cfg( "OpiePlayer" );
92 bool b= cfg.readBoolEntry("FullScreen", 0); 97 bool b= cfg.readBoolEntry("FullScreen", 0);
93 mediaPlayerState.setFullscreen( b ); 98 mediaPlayerState->setFullscreen( b );
94 pmView->setItemChecked( -16, b ); 99 pmView->setItemChecked( -16, b );
95 100
96 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 101 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
97 d->selectedFiles, SLOT(moveSelectedUp() ) ); 102 d->selectedFiles, SLOT(moveSelectedUp() ) );
98 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 103 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
99 d->selectedFiles, SLOT(removeSelected() ) ); 104 d->selectedFiles, SLOT(removeSelected() ) );
100 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 105 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
101 d->selectedFiles, SLOT(moveSelectedDown() ) ); 106 d->selectedFiles, SLOT(moveSelectedDown() ) );
@@ -120,26 +125,29 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
120 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 125 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
121 this,SLOT( playIt( QListViewItem *) ) ); 126 this,SLOT( playIt( QListViewItem *) ) );
122 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 127 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
123 this, SLOT( addToSelection( QListViewItem *) ) ); 128 this, SLOT( addToSelection( QListViewItem *) ) );
124 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 129 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
125 this, SLOT( loadList( const DocLnk & ) ) ); 130 this, SLOT( loadList( const DocLnk & ) ) );
126 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 131 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
127 this, SLOT( tabChanged( QWidget* ) ) ); 132 this, SLOT( tabChanged( QWidget* ) ) );
128 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 133 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ),
129 d->tbPlay, SLOT( setOn( bool ) ) ); 134 d->tbPlay, SLOT( setOn( bool ) ) );
130 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 135 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
131 d->tbLoop, SLOT( setOn( bool ) ) ); 136 d->tbLoop, SLOT( setOn( bool ) ) );
132 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 137 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
133 d->tbShuffle, SLOT( setOn( bool ) ) ); 138 d->tbShuffle, SLOT( setOn( bool ) ) );
134 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 139 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
135 this, SLOT( playIt( QListViewItem *) ) ); 140 this, SLOT( playIt( QListViewItem *) ) );
136 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 141 connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
137 &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 142 mediaPlayerState, SLOT( setVideoGamma( int ) ) );
143
144 connect( this, SIGNAL(skinSelected() ),
145 m_mp, SLOT( reloadSkins() ) );
138 146
139 // see which skins are installed 147 // see which skins are installed
140 populateSkinsMenu(); 148 populateSkinsMenu();
141 initializeStates(); 149 initializeStates();
142 150
143 channel = new QCopChannel( "QPE/Application/opieplayer2", this ); 151 channel = new QCopChannel( "QPE/Application/opieplayer2", this );
144 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 152 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
145 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 153 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
@@ -150,23 +158,24 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
150 loadList(DocLnk( currentPlaylist ) ); 158 loadList(DocLnk( currentPlaylist ) );
151 159
152 tabWidget->showPage( playListTab ); 160 tabWidget->showPage( playListTab );
153} 161}
154 162
155 163
156PlayListWidget::~PlayListWidget() { 164PlayListWidget::~PlayListWidget() {
157 delete d; 165 delete d;
166 delete m_mp;
158} 167}
159 168
160 169
161void PlayListWidget::initializeStates() { 170void PlayListWidget::initializeStates() {
162 d->tbPlay->setOn( mediaPlayerState.isPlaying() ); 171 d->tbPlay->setOn( mediaPlayerState->isPlaying() );
163 d->tbLoop->setOn( mediaPlayerState.isLooping() ); 172 d->tbLoop->setOn( mediaPlayerState->isLooping() );
164 d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); 173 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
165 d->playListFrame->show(); 174 d->playListFrame->show();
166} 175}
167 176
168void PlayListWidget::writeDefaultPlaylist() { 177void PlayListWidget::writeDefaultPlaylist() {
169 178
170 Config config( "OpiePlayer" ); 179 Config config( "OpiePlayer" );
171 config.setGroup( "PlayList" ); 180 config.setGroup( "PlayList" );
172 QString filename=QPEApplication::documentDir() + "/default.m3u"; 181 QString filename=QPEApplication::documentDir() + "/default.m3u";
@@ -336,18 +345,18 @@ void PlayListWidget::setDocument( const QString& fileref ) {
336 clearList(); 345 clearList();
337 DocLnk lnk; 346 DocLnk lnk;
338 lnk.setName( fileInfo.baseName() ); //sets name 347 lnk.setName( fileInfo.baseName() ); //sets name
339 lnk.setFile( fileref ); //sets file name 348 lnk.setFile( fileref ); //sets file name
340 addToSelection( lnk ); 349 addToSelection( lnk );
341 writeCurrentM3u(); 350 writeCurrentM3u();
342 351
343 d->setDocumentUsed = TRUE; 352 d->setDocumentUsed = TRUE;
344 mediaPlayerState.setPlaying( FALSE ); 353 mediaPlayerState->setPlaying( FALSE );
345 mediaPlayerState.setPlaying( TRUE ); 354 mediaPlayerState->setPlaying( TRUE );
346 } 355 }
347} 356}
348 357
349 358
350void PlayListWidget::useSelectedDocument() { 359void PlayListWidget::useSelectedDocument() {
351 d->setDocumentUsed = FALSE; 360 d->setDocumentUsed = FALSE;
352} 361}
353 362
@@ -361,48 +370,48 @@ const DocLnk *PlayListWidget::current() const { // this is fugly
361 lnk = d->selectedFiles->current(); 370 lnk = d->selectedFiles->current();
362 } 371 }
363 assert( lnk ); 372 assert( lnk );
364 return lnk; 373 return lnk;
365} 374}
366 375
367 376
368bool PlayListWidget::prev() { 377bool PlayListWidget::prev() {
369 if ( mediaPlayerState.isShuffled() ) { 378 if ( mediaPlayerState->isShuffled() ) {
370 const DocLnk *cur = current(); 379 const DocLnk *cur = current();
371 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 380 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
372 for ( int i = 0; i < j; i++ ) { 381 for ( int i = 0; i < j; i++ ) {
373 if ( !d->selectedFiles->next() ) 382 if ( !d->selectedFiles->next() )
374 d->selectedFiles->first(); 383 d->selectedFiles->first();
375 } 384 }
376 if ( cur == current() ) 385 if ( cur == current() )
377 if ( !d->selectedFiles->next() ) { 386 if ( !d->selectedFiles->next() ) {
378 d->selectedFiles->first(); 387 d->selectedFiles->first();
379 } 388 }
380 return TRUE; 389 return TRUE;
381 } else { 390 } else {
382 if ( !d->selectedFiles->prev() ) { 391 if ( !d->selectedFiles->prev() ) {
383 if ( mediaPlayerState.isLooping() ) { 392 if ( mediaPlayerState->isLooping() ) {
384 return d->selectedFiles->last(); 393 return d->selectedFiles->last();
385 } else { 394 } else {
386 return FALSE; 395 return FALSE;
387 } 396 }
388 } 397 }
389 return TRUE; 398 return TRUE;
390 } 399 }
391} 400}
392 401
393 402
394bool PlayListWidget::next() { 403bool PlayListWidget::next() {
395//qDebug("<<<<<<<<<<<<next()"); 404//qDebug("<<<<<<<<<<<<next()");
396 if ( mediaPlayerState.isShuffled() ) { 405 if ( mediaPlayerState->isShuffled() ) {
397 return prev(); 406 return prev();
398 } else { 407 } else {
399 if ( !d->selectedFiles->next() ) { 408 if ( !d->selectedFiles->next() ) {
400 if ( mediaPlayerState.isLooping() ) { 409 if ( mediaPlayerState->isLooping() ) {
401 return d->selectedFiles->first(); 410 return d->selectedFiles->first();
402 } else { 411 } else {
403 return FALSE; 412 return FALSE;
404 } 413 }
405 } 414 }
406 return TRUE; 415 return TRUE;
407 } 416 }
408} 417}
@@ -458,18 +467,18 @@ void PlayListWidget::addSelected() {
458void PlayListWidget::removeSelected() { 467void PlayListWidget::removeSelected() {
459 d->selectedFiles->removeSelected( ); 468 d->selectedFiles->removeSelected( );
460 writeCurrentM3u(); 469 writeCurrentM3u();
461} 470}
462 471
463 472
464void PlayListWidget::playIt( QListViewItem *it) { 473void PlayListWidget::playIt( QListViewItem *it) {
465 if(!it) return; 474 if(!it) return;
466 mediaPlayerState.setPlaying(FALSE); 475 mediaPlayerState->setPlaying(FALSE);
467 mediaPlayerState.setPlaying(TRUE); 476 mediaPlayerState->setPlaying(TRUE);
468 d->selectedFiles->unSelect(); 477 d->selectedFiles->unSelect();
469} 478}
470 479
471 480
472void PlayListWidget::addToSelection( QListViewItem *it) { 481void PlayListWidget::addToSelection( QListViewItem *it) {
473 d->setDocumentUsed = FALSE; 482 d->setDocumentUsed = FALSE;
474 483
475 if(it) { 484 if(it) {
@@ -560,17 +569,17 @@ void PlayListWidget::tabChanged(QWidget *) {
560 } 569 }
561 break; 570 break;
562 }; 571 };
563} 572}
564 573
565 574
566void PlayListWidget::btnPlay(bool b) { 575void PlayListWidget::btnPlay(bool b) {
567// mediaPlayerState->setPlaying(false); 576// mediaPlayerState->setPlaying(false);
568 mediaPlayerState.setPlaying(b); 577 mediaPlayerState->setPlaying(b);
569 insanityBool=FALSE; 578 insanityBool=FALSE;
570} 579}
571 580
572void PlayListWidget::deletePlaylist() { 581void PlayListWidget::deletePlaylist() {
573 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 582 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
574 (tr("You really want to delete\nthis playlist?")), 583 (tr("You really want to delete\nthis playlist?")),
575 (tr("Yes")), (tr("No")), 0 )){ 584 (tr("Yes")), (tr("No")), 0 )){
576 case 0: // Yes clicked, 585 case 0: // Yes clicked,
@@ -904,18 +913,18 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
904 } 913 }
905} 914}
906 915
907void PlayListWidget::pmViewActivated(int index) { 916void PlayListWidget::pmViewActivated(int index) {
908// qDebug("%d", index); 917// qDebug("%d", index);
909 switch(index) { 918 switch(index) {
910 case -16: 919 case -16:
911 { 920 {
912 mediaPlayerState.toggleFullscreen(); 921 mediaPlayerState->toggleFullscreen();
913 bool b=mediaPlayerState.isFullscreen(); 922 bool b=mediaPlayerState->isFullscreen();
914 pmView->setItemChecked( index, b); 923 pmView->setItemChecked( index, b);
915 Config cfg( "OpiePlayer" ); 924 Config cfg( "OpiePlayer" );
916 cfg.writeEntry( "FullScreen", b ); 925 cfg.writeEntry( "FullScreen", b );
917 } 926 }
918 break; 927 break;
919 }; 928 };
920} 929}
921 930
@@ -991,27 +1000,27 @@ QString PlayListWidget::currentFileListPathName() const {
991 1000
992 1001
993void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { 1002void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
994 qDebug("qcop message "+msg ); 1003 qDebug("qcop message "+msg );
995 QDataStream stream ( data, IO_ReadOnly ); 1004 QDataStream stream ( data, IO_ReadOnly );
996 if ( msg == "play()" ) { //plays current selection 1005 if ( msg == "play()" ) { //plays current selection
997 btnPlay( true); 1006 btnPlay( true);
998 } else if ( msg == "stop()" ) { 1007 } else if ( msg == "stop()" ) {
999 mediaPlayerState.setPlaying( false); 1008 mediaPlayerState->setPlaying( false);
1000 } else if ( msg == "togglePause()" ) { 1009 } else if ( msg == "togglePause()" ) {
1001 mediaPlayerState.togglePaused(); 1010 mediaPlayerState->togglePaused();
1002 } else if ( msg == "next()" ) { //select next in list 1011 } else if ( msg == "next()" ) { //select next in list
1003 mediaPlayerState.setNext(); 1012 mediaPlayerState->setNext();
1004 } else if ( msg == "prev()" ) { //select previous in list 1013 } else if ( msg == "prev()" ) { //select previous in list
1005 mediaPlayerState.setPrev(); 1014 mediaPlayerState->setPrev();
1006 } else if ( msg == "toggleLooping()" ) { //loop or not loop 1015 } else if ( msg == "toggleLooping()" ) { //loop or not loop
1007 mediaPlayerState.toggleLooping(); 1016 mediaPlayerState->toggleLooping();
1008 } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled 1017 } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled
1009 mediaPlayerState.toggleShuffled(); 1018 mediaPlayerState->toggleShuffled();
1010 } else if ( msg == "volUp()" ) { //volume more 1019 } else if ( msg == "volUp()" ) { //volume more
1011// emit moreClicked(); 1020// emit moreClicked();
1012// emit moreReleased(); 1021// emit moreReleased();
1013 } else if ( msg == "volDown()" ) { //volume less 1022 } else if ( msg == "volDown()" ) { //volume less
1014// emit lessClicked(); 1023// emit lessClicked();
1015// emit lessReleased(); 1024// emit lessReleased();
1016 } else if ( msg == "play(QString)" ) { //play this now 1025 } else if ( msg == "play(QString)" ) { //play this now
1017 QString file; 1026 QString file;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index fc305cd..29f3e8d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -42,16 +42,18 @@
42#include "playlistwidgetgui.h" 42#include "playlistwidgetgui.h"
43 43
44class Config; 44class Config;
45class QListViewItem; 45class QListViewItem;
46class QListView; 46class QListView;
47class QPoint; 47class QPoint;
48class QAction; 48class QAction;
49class QLabel; 49class QLabel;
50class MediaPlayerState;
51class MediaPlayer;
50 52
51class PlayListWidget : public PlayListWidgetGui { 53class PlayListWidget : public PlayListWidgetGui {
52 Q_OBJECT 54 Q_OBJECT
53public: 55public:
54 enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 56 enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
55 enum { TabTypeCount = 4 }; 57 enum { TabTypeCount = 4 };
56 58
57 struct Entry 59 struct Entry
@@ -60,17 +62,18 @@ public:
60 : name( _name ), file( _fileName ) {} 62 : name( _name ), file( _fileName ) {}
61 Entry( const QString &_fileName ) 63 Entry( const QString &_fileName )
62 : name( _fileName ), file( _fileName ) {} 64 : name( _fileName ), file( _fileName ) {}
63 65
64 QString name; 66 QString name;
65 QString file; 67 QString file;
66 }; 68 };
67 69
68 PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 70 static QString appName() { return QString::fromLatin1("opieplayer2"); }
71 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags = 0 );
69 ~PlayListWidget(); 72 ~PlayListWidget();
70 73
71 // retrieve the current playlist entry (media file link) 74 // retrieve the current playlist entry (media file link)
72 const DocLnk *current() const; 75 const DocLnk *current() const;
73 void useSelectedDocument(); 76 void useSelectedDocument();
74 TabType currentTab() const; 77 TabType currentTab() const;
75 78
76 Entry currentEntry() const; 79 Entry currentEntry() const;
@@ -127,12 +130,14 @@ private slots:
127 void playSelected(); 130 void playSelected();
128 131
129private: 132private:
130 bool fromSetDocument; 133 bool fromSetDocument;
131 bool insanityBool; 134 bool insanityBool;
132 QString setDocFileRef, currentPlayList; 135 QString setDocFileRef, currentPlayList;
133 int selected; 136 int selected;
134 QListView *currentFileListView; 137 QListView *currentFileListView;
138
139 MediaPlayer *m_mp;
135}; 140};
136 141
137#endif // PLAY_LIST_WIDGET_H 142#endif // PLAY_LIST_WIDGET_H
138 143
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 293bf45..fec91ea 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -41,18 +41,18 @@
41#include "playlistselection.h" 41#include "playlistselection.h"
42#include "playlistwidget.h" 42#include "playlistwidget.h"
43#include "mediaplayerstate.h" 43#include "mediaplayerstate.h"
44#include "inputDialog.h" 44#include "inputDialog.h"
45#include "playlistfileview.h" 45#include "playlistfileview.h"
46 46
47#include "mediaplayerstate.h" 47#include "mediaplayerstate.h"
48 48
49PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name ) 49PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name )
50 : QMainWindow( parent, name ), mediaPlayerState( _mediaPlayerState ) { 50 : QMainWindow( parent, name ) {
51 51
52 d = new PlayListWidgetPrivate; 52 d = new PlayListWidgetPrivate;
53 d->setDocumentUsed = FALSE; 53 d->setDocumentUsed = FALSE;
54 54
55 setBackgroundMode( PaletteButton ); 55 setBackgroundMode( PaletteButton );
56 setToolBarsMovable( FALSE ); 56 setToolBarsMovable( FALSE );
57 57
58 // Create Toolbar 58 // Create Toolbar
@@ -181,14 +181,14 @@ void PlayListWidgetGui::setView( char view ) {
181 else 181 else
182 hide(); 182 hide();
183} 183}
184 184
185 185
186void PlayListWidgetGui::setActiveWindow() { 186void PlayListWidgetGui::setActiveWindow() {
187 // qDebug("SETTING active window"); 187 // qDebug("SETTING active window");
188 // When we get raised we need to ensure that it switches views 188 // When we get raised we need to ensure that it switches views
189 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); 189 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType();
190 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate 190 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
191 mediaPlayerState.setDisplayType( origDisplayType ); // now switch back 191 mediaPlayerState->setDisplayType( origDisplayType ); // now switch back
192} 192}
193 193
194 194
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index c0cd37a..5706d14 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -88,17 +88,17 @@ public:
88 connect( this, SIGNAL( activated() ), handler, slot ); 88 connect( this, SIGNAL( activated() ), handler, slot );
89 addTo( parent ); 89 addTo( parent );
90 } 90 }
91}; 91};
92 92
93class PlayListWidgetGui : public QMainWindow { 93class PlayListWidgetGui : public QMainWindow {
94 Q_OBJECT 94 Q_OBJECT
95public: 95public:
96 PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 ); 96 PlayListWidgetGui( QWidget* parent=0, const char* name=0 );
97 ~PlayListWidgetGui(); 97 ~PlayListWidgetGui();
98 98
99protected: 99protected:
100 QTabWidget * tabWidget; 100 QTabWidget * tabWidget;
101 PlayListFileView *audioView, *videoView; 101 PlayListFileView *audioView, *videoView;
102 QListView *playlistView; 102 QListView *playlistView;
103 QLabel *libString; 103 QLabel *libString;
104 QPopupMenu *pmView ; 104 QPopupMenu *pmView ;
@@ -117,13 +117,13 @@ protected:
117 PlayListWidgetPrivate *d; // Private implementation data 117 PlayListWidgetPrivate *d; // Private implementation data
118 QVBox *vbox1; 118 QVBox *vbox1;
119 QVBox *vbox5; 119 QVBox *vbox5;
120 QToolBar *bar; 120 QToolBar *bar;
121 QWidget *playListTab; 121 QWidget *playListTab;
122 void setActiveWindow(); // need to handle this to show the right view 122 void setActiveWindow(); // need to handle this to show the right view
123 void setView( char ); 123 void setView( char );
124 124
125 MediaPlayerState &mediaPlayerState; 125 MediaPlayerState *mediaPlayerState;
126}; 126};
127 127
128#endif 128#endif
129 129