summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-21 00:20:22 (UTC)
committer harlekin <harlekin>2002-08-21 00:20:22 (UTC)
commitc198ae0217f761418f7170d08a94da3864e47583 (patch) (unidiff)
tree096790ff5389ea30f61912f72338e5642edaa667
parent491f95a2c6a5676f08520e494e125ba8b20e0eae (diff)
downloadopie-c198ae0217f761418f7170d08a94da3864e47583.zip
opie-c198ae0217f761418f7170d08a94da3864e47583.tar.gz
opie-c198ae0217f761418f7170d08a94da3864e47583.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp19
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp2
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
@@ -13,196 +13,197 @@
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <stdio.h> 34#include <stdio.h>
35#include <stdlib.h> 35#include <stdlib.h>
36#include <qimage.h> 36#include <qimage.h>
37#include <qtextstream.h> 37#include <qtextstream.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39 39
40#include <qfile.h> 40#include <qfile.h>
41 41
42#include <qgfx_qws.h> 42#include <qgfx_qws.h>
43#include <qdirectpainter_qws.h> 43#include <qdirectpainter_qws.h>
44 44
45#include "xinevideowidget.h" 45#include "xinevideowidget.h"
46#include "frame.h" 46#include "frame.h"
47#include "lib.h" 47#include "lib.h"
48 48
49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
50 int width, int height,int bytes ); 50 int width, int height,int bytes );
51 51
52extern "C" { 52extern "C" {
53 vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); 53 vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video);
54 int null_is_showing_video( vo_driver_t* self ); 54 int null_is_showing_video( vo_driver_t* self );
55 void null_set_show_video( vo_driver_t* self, int show ); 55 void null_set_show_video( vo_driver_t* self, int show );
56 int null_is_fullscreen( vo_driver_t* self ); 56 int null_is_fullscreen( vo_driver_t* self );
57 void null_set_fullscreen( vo_driver_t* self, int screen ); 57 void null_set_fullscreen( vo_driver_t* self, int screen );
58 int null_is_scaling( vo_driver_t* self ); 58 int null_is_scaling( vo_driver_t* self );
59 void null_set_scaling( vo_driver_t* self, int scale ); 59 void null_set_scaling( vo_driver_t* self, int scale );
60 void null_set_gui_width( vo_driver_t* self, int width ); 60 void null_set_gui_width( vo_driver_t* self, int width );
61 void null_set_gui_height( vo_driver_t* self, int height ); 61 void null_set_gui_height( vo_driver_t* self, int height );
62 void null_set_mode( vo_driver_t* self, int depth, int rgb ); 62 void null_set_mode( vo_driver_t* self, int depth, int rgb );
63 void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data); 63 void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data);
64} 64}
65 65
66using namespace XINE; 66using namespace XINE;
67 67
68Lib::Lib(XineVideoWidget* widget) { 68Lib::Lib(XineVideoWidget* widget) {
69 m_video = false; 69 m_video = false;
70 m_wid = widget; 70 m_wid = widget;
71 printf("Lib"); 71 printf("Lib");
72 QCString str( getenv("HOME") ); 72 QCString str( getenv("HOME") );
73 str += "/Settings/opiexine.cf"; 73 str += "/Settings/opiexine.cf";
74 // get the configuration 74 // get the configuration
75 75
76 // not really OO, should be an extra class, later 76 // not really OO, should be an extra class, later
77 if ( !QFile(str).exists() ) { 77 if ( !QFile(str).exists() ) {
78 QFile f(str); 78 QFile f(str);
79 f.open(IO_WriteOnly); 79 f.open(IO_WriteOnly);
80 QTextStream ts( &f ); 80 QTextStream ts( &f );
81 ts << "misc.memcpy_method:glibc\n"; 81 ts << "misc.memcpy_method:glibc\n";
82 f.close(); 82 f.close();
83 } 83 }
84 84
85 m_config = xine_config_file_init( str.data() ); 85 m_config = xine_config_file_init( str.data() );
86 86
87 // allocate oss for sound 87 // allocate oss for sound
88 // and fb for framebuffer 88 // and fb for framebuffer
89 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; 89 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ;
90 m_videoOutput = ::init_video_out_plugin( m_config, NULL ); 90 m_videoOutput = ::init_video_out_plugin( m_config, NULL );
91 if (m_wid != 0 ) { 91 if (m_wid != 0 ) {
92 printf("!0\n" ); 92 printf("!0\n" );
93 resize ( m_wid-> size ( )); 93 resize ( m_wid-> size ( ));
94 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 94 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
95 m_wid-> setImage ( new QImage ( Resource::loadImage(""))); 95 m_wid-> setImage ( new QImage ( Resource::loadImage("")));
96 m_wid->repaint(); 96 m_wid->repaint();
97 } 97 }
98 null_display_handler( m_videoOutput, 98 null_display_handler( m_videoOutput,
99 xine_display_frame, 99 xine_display_frame,
100 this ); 100 this );
101 101
102 m_xine = xine_init( m_videoOutput, 102 m_xine = xine_init( m_videoOutput,
103 m_audioOutput, m_config ); 103 m_audioOutput, m_config );
104 // install the event handler 104 // install the event handler
105 xine_register_event_listener( m_xine, xine_event_handler, this ); 105 xine_register_event_listener( m_xine, xine_event_handler, this );
106} 106}
107 107
108Lib::~Lib() { 108Lib::~Lib() {
109 delete m_config; 109 free( m_config );
110 xine_remove_event_listener( m_xine, xine_event_handler ); 110 xine_remove_event_listener( m_xine, xine_event_handler );
111 xine_exit( m_xine ); 111 xine_exit( m_xine );
112 delete m_videoOutput; 112 /* FIXME either free or delete but valgrind bitches against both */
113 //free( m_videoOutput );
113 //delete m_audioOutput; 114 //delete m_audioOutput;
114 115
115} 116}
116 117
117void Lib::resize ( const QSize &s ) 118void Lib::resize ( const QSize &s )
118{ 119{
119 if ( s. width ( ) && s. height ( )) { 120 if ( s. width ( ) && s. height ( )) {
120 ::null_set_gui_width( m_videoOutput, s. width() ); 121 ::null_set_gui_width( m_videoOutput, s. width() );
121 ::null_set_gui_height(m_videoOutput, s. height() ); 122 ::null_set_gui_height(m_videoOutput, s. height() );
122 } 123 }
123} 124}
124 125
125QCString Lib::version() { 126QCString Lib::version() {
126 QCString str( xine_get_str_version() ); 127 QCString str( xine_get_str_version() );
127 return str; 128 return str;
128}; 129};
129 130
130int Lib::majorVersion() { 131int Lib::majorVersion() {
131 return xine_get_major_version(); 132 return xine_get_major_version();
132} 133}
133int Lib::minorVersion() { 134int Lib::minorVersion() {
134 return xine_get_minor_version(); 135 return xine_get_minor_version();
135}; 136};
136 137
137int Lib::subVersion() { 138int Lib::subVersion() {
138 return xine_get_sub_version(); 139 return xine_get_sub_version();
139} 140}
140int Lib::play( const QString& fileName, 141int Lib::play( const QString& fileName,
141 int startPos, 142 int startPos,
142 int start_time ) { 143 int start_time ) {
143 QString str = fileName.stripWhiteSpace(); 144 QString str = fileName.stripWhiteSpace();
144 //workaround OpiePlayer bug 145 //workaround OpiePlayer bug
145 //f (str.right(1) == QString::fromLatin1("/") ) 146 //f (str.right(1) == QString::fromLatin1("/") )
146 // str = str.mid( str.length() -1 ); 147 // str = str.mid( str.length() -1 );
147 return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), 148 return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(),
148 startPos, start_time); 149 startPos, start_time);
149} 150}
150void Lib::stop() { 151void Lib::stop() {
151 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 152 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
152 xine_stop(m_xine ); 153 xine_stop(m_xine );
153} 154}
154void Lib::pause(){ 155void Lib::pause(){
155 xine_set_speed( m_xine, SPEED_PAUSE ); 156 xine_set_speed( m_xine, SPEED_PAUSE );
156} 157}
157int Lib::speed() { 158int Lib::speed() {
158 return xine_get_speed( m_xine ); 159 return xine_get_speed( m_xine );
159} 160}
160void Lib::setSpeed( int speed ) { 161void Lib::setSpeed( int speed ) {
161 xine_set_speed( m_xine, speed ); 162 xine_set_speed( m_xine, speed );
162} 163}
163int Lib::status(){ 164int Lib::status(){
164 return xine_get_status( m_xine ); 165 return xine_get_status( m_xine );
165} 166}
166int Lib::currentPosition(){ 167int Lib::currentPosition(){
167 return xine_get_current_position( m_xine ); 168 return xine_get_current_position( m_xine );
168} 169}
169int Lib::currentTime() { 170int Lib::currentTime() {
170 return xine_get_current_time( m_xine ); 171 return xine_get_current_time( m_xine );
171}; 172};
172int Lib::length() { 173int Lib::length() {
173 return xine_get_stream_length( m_xine ); 174 return xine_get_stream_length( m_xine );
174} 175}
175bool Lib::isSeekable() { 176bool Lib::isSeekable() {
176 return xine_is_stream_seekable(m_xine); 177 return xine_is_stream_seekable(m_xine);
177} 178}
178Frame Lib::currentFrame() { 179Frame Lib::currentFrame() {
179 Frame frame; 180 Frame frame;
180 return frame; 181 return frame;
181}; 182};
182int Lib::error() { 183int Lib::error() {
183 return xine_get_error( m_xine ); 184 return xine_get_error( m_xine );
184}; 185};
185void Lib::handleXineEvent( xine_event_t* t ) { 186void Lib::handleXineEvent( xine_event_t* t ) {
186 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) 187 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED )
187 emit stopped(); 188 emit stopped();
188} 189}
189void Lib::setShowVideo( bool video ) { 190void Lib::setShowVideo( bool video ) {
190 m_video = video; 191 m_video = video;
191 ::null_set_show_video( m_videoOutput, video ); 192 ::null_set_show_video( m_videoOutput, video );
192} 193}
193bool Lib::isShowingVideo() { 194bool Lib::isShowingVideo() {
194 return ::null_is_showing_video( m_videoOutput ); 195 return ::null_is_showing_video( m_videoOutput );
195} 196}
196void Lib::showVideoFullScreen( bool fullScreen ) { 197void Lib::showVideoFullScreen( bool fullScreen ) {
197 ::null_set_fullscreen( m_videoOutput, fullScreen ); 198 ::null_set_fullscreen( m_videoOutput, fullScreen );
198} 199}
199bool Lib::isVideoFullScreen() { 200bool Lib::isVideoFullScreen() {
200 return ::null_is_fullscreen( m_videoOutput ); 201 return ::null_is_fullscreen( m_videoOutput );
201} 202}
202void Lib::setScaling( bool scale ) { 203void Lib::setScaling( bool scale ) {
203 ::null_set_scaling( m_videoOutput, scale ); 204 ::null_set_scaling( m_videoOutput, scale );
204} 205}
205bool Lib::isScaling() { 206bool Lib::isScaling() {
206 return ::null_is_scaling( m_videoOutput ); 207 return ::null_is_scaling( m_videoOutput );
207} 208}
208void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { 209void Lib::xine_event_handler( void* user_data, xine_event_t* t ) {
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,104 +1,105 @@
1 1
2#define QTOPIA_INTERNAL_FSLP 2#define QTOPIA_INTERNAL_FSLP
3#include <qpe/qpemenubar.h> 3#include <qpe/qpemenubar.h>
4#include <qpe/qpetoolbar.h> 4#include <qpe/qpetoolbar.h>
5#include <qpe/fileselector.h> 5#include <qpe/fileselector.h>
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7#include <qpe/lnkproperties.h> 7#include <qpe/lnkproperties.h>
8#include <qpe/storage.h> 8#include <qpe/storage.h>
9#include <qpe/mimetype.h>
9 10
10#include <qpe/applnk.h> 11#include <qpe/applnk.h>
11#include <qpopupmenu.h> 12#include <qpopupmenu.h>
12#include <qpe/config.h> 13#include <qpe/config.h>
13#include <qpe/global.h> 14#include <qpe/global.h>
14#include <qpe/resource.h> 15#include <qpe/resource.h>
15#include <qaction.h> 16#include <qaction.h>
16#include <qcursor.h> 17#include <qcursor.h>
17#include <qimage.h> 18#include <qimage.h>
18#include <qfile.h> 19#include <qfile.h>
19#include <qdir.h> 20#include <qdir.h>
20#include <qlayout.h> 21#include <qlayout.h>
21#include <qlabel.h> 22#include <qlabel.h>
22#include <qlist.h> 23#include <qlist.h>
23#include <qlistbox.h> 24#include <qlistbox.h>
24#include <qmainwindow.h> 25#include <qmainwindow.h>
25#include <qmessagebox.h> 26#include <qmessagebox.h>
26#include <qtoolbutton.h> 27#include <qtoolbutton.h>
27#include <qtabwidget.h> 28#include <qtabwidget.h>
28#include <qlistview.h> 29#include <qlistview.h>
29#include <qpoint.h> 30#include <qpoint.h>
30#include <qlineedit.h> 31#include <qlineedit.h>
31#include <qpushbutton.h> 32#include <qpushbutton.h>
32#include <qregexp.h> 33#include <qregexp.h>
33#include <qtextstream.h> 34#include <qtextstream.h>
34 35
35 36
36#include "playlistselection.h" 37#include "playlistselection.h"
37#include "playlistwidget.h" 38#include "playlistwidget.h"
38#include "mediaplayerstate.h" 39#include "mediaplayerstate.h"
39 40
40#include "inputDialog.h" 41#include "inputDialog.h"
41 42
42#include <stdlib.h> 43#include <stdlib.h>
43#include "audiowidget.h" 44#include "audiowidget.h"
44#include "videowidget.h" 45#include "videowidget.h"
45 46
46#define BUTTONS_ON_TOOLBAR 47#define BUTTONS_ON_TOOLBAR
47#define SIDE_BUTTONS 48#define SIDE_BUTTONS
48#define CAN_SAVE_LOAD_PLAYLISTS 49#define CAN_SAVE_LOAD_PLAYLISTS
49 50
50extern MediaPlayerState *mediaPlayerState; 51extern MediaPlayerState *mediaPlayerState;
51 52
52 53
53class PlayListWidgetPrivate { 54class PlayListWidgetPrivate {
54public: 55public:
55 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 56 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
56 QFrame *playListFrame; 57 QFrame *playListFrame;
57 FileSelector *files; 58 FileSelector *files;
58 PlayListSelection *selectedFiles; 59 PlayListSelection *selectedFiles;
59 bool setDocumentUsed; 60 bool setDocumentUsed;
60 DocLnk *current; 61 DocLnk *current;
61}; 62};
62 63
63 64
64class ToolButton : public QToolButton { 65class ToolButton : public QToolButton {
65public: 66public:
66 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 67 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
67 : QToolButton( parent, name ) { 68 : QToolButton( parent, name ) {
68 setTextLabel( name ); 69 setTextLabel( name );
69 setPixmap( Resource::loadPixmap( icon ) ); 70 setPixmap( Resource::loadPixmap( icon ) );
70 setAutoRaise( TRUE ); 71 setAutoRaise( TRUE );
71 setFocusPolicy( QWidget::NoFocus ); 72 setFocusPolicy( QWidget::NoFocus );
72 setToggleButton( t ); 73 setToggleButton( t );
73 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 74 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
74 QPEMenuToolFocusManager::manager()->addWidget( this ); 75 QPEMenuToolFocusManager::manager()->addWidget( this );
75 } 76 }
76}; 77};
77 78
78 79
79class MenuItem : public QAction { 80class MenuItem : public QAction {
80public: 81public:
81 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 82 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
82 : QAction( text, QString::null, 0, 0 ) { 83 : QAction( text, QString::null, 0, 0 ) {
83 connect( this, SIGNAL( activated() ), handler, slot ); 84 connect( this, SIGNAL( activated() ), handler, slot );
84 addTo( parent ); 85 addTo( parent );
85 } 86 }
86}; 87};
87 88
88 89
89PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 90PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
90 : QMainWindow( parent, name, fl ) { 91 : QMainWindow( parent, name, fl ) {
91 92
92 d = new PlayListWidgetPrivate; 93 d = new PlayListWidgetPrivate;
93 d->setDocumentUsed = FALSE; 94 d->setDocumentUsed = FALSE;
94 d->current = NULL; 95 d->current = NULL;
95 fromSetDocument = FALSE; 96 fromSetDocument = FALSE;
96 insanityBool=FALSE; 97 insanityBool=FALSE;
97 audioScan = FALSE; 98 audioScan = FALSE;
98 videoScan = FALSE; 99 videoScan = FALSE;
99 100
100 setBackgroundMode( PaletteButton ); 101 setBackgroundMode( PaletteButton );
101 102
102// setCaption( tr("OpiePlayer") ); 103// setCaption( tr("OpiePlayer") );
103// setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) ); 104// setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) );
104 105
@@ -214,196 +215,200 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
214 audioView = new QListView( aTab, "Audioview" ); 215 audioView = new QListView( aTab, "Audioview" );
215 audioView->addColumn( tr("Title"),140); 216 audioView->addColumn( tr("Title"),140);
216 audioView->addColumn(tr("Size"), -1); 217 audioView->addColumn(tr("Size"), -1);
217 audioView->addColumn(tr("Media"),-1); 218 audioView->addColumn(tr("Media"),-1);
218 audioView->setColumnAlignment(1, Qt::AlignRight); 219 audioView->setColumnAlignment(1, Qt::AlignRight);
219 audioView->setColumnAlignment(2, Qt::AlignRight); 220 audioView->setColumnAlignment(2, Qt::AlignRight);
220 audioView->setAllColumnsShowFocus(TRUE); 221 audioView->setAllColumnsShowFocus(TRUE);
221 audioView->setSorting(0,TRUE); 222 audioView->setSorting(0,TRUE);
222 223
223 audioView->setMultiSelection( TRUE ); 224 audioView->setMultiSelection( TRUE );
224 audioView->setSelectionMode( QListView::Extended); 225 audioView->setSelectionMode( QListView::Extended);
225 226
226 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 227 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
227 228
228 tabWidget->insertTab(aTab,tr("Audio")); 229 tabWidget->insertTab(aTab,tr("Audio"));
229 230
230 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 231 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
231 232
232 QWidget *vTab; 233 QWidget *vTab;
233 vTab = new QWidget( tabWidget, "vTab" ); 234 vTab = new QWidget( tabWidget, "vTab" );
234 235
235 QGridLayout *Vlayout = new QGridLayout( vTab ); 236 QGridLayout *Vlayout = new QGridLayout( vTab );
236 Vlayout->setSpacing( 2); 237 Vlayout->setSpacing( 2);
237 Vlayout->setMargin( 2); 238 Vlayout->setMargin( 2);
238 239
239 videoView = new QListView( vTab, "Videoview" ); 240 videoView = new QListView( vTab, "Videoview" );
240 241
241 videoView->addColumn(tr("Title"),140); 242 videoView->addColumn(tr("Title"),140);
242 videoView->addColumn(tr("Size"),-1); 243 videoView->addColumn(tr("Size"),-1);
243 videoView->addColumn(tr("Media"),-1); 244 videoView->addColumn(tr("Media"),-1);
244 videoView->setColumnAlignment(1, Qt::AlignRight); 245 videoView->setColumnAlignment(1, Qt::AlignRight);
245 videoView->setColumnAlignment(2, Qt::AlignRight); 246 videoView->setColumnAlignment(2, Qt::AlignRight);
246 videoView->setAllColumnsShowFocus(TRUE); 247 videoView->setAllColumnsShowFocus(TRUE);
247 videoView->setSorting(0,TRUE); 248 videoView->setSorting(0,TRUE);
248 249
249 videoView->setMultiSelection( TRUE ); 250 videoView->setMultiSelection( TRUE );
250 videoView->setSelectionMode( QListView::Extended); 251 videoView->setSelectionMode( QListView::Extended);
251 252
252 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 253 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
253 254
254 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 255 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
255 256
256 tabWidget->insertTab( vTab,tr("Video")); 257 tabWidget->insertTab( vTab,tr("Video"));
257 258
258 //playlists list 259 //playlists list
259 QWidget *LTab; 260 QWidget *LTab;
260 LTab = new QWidget( tabWidget, "LTab" ); 261 LTab = new QWidget( tabWidget, "LTab" );
261 QGridLayout *Llayout = new QGridLayout( LTab ); 262 QGridLayout *Llayout = new QGridLayout( LTab );
262 Llayout->setSpacing( 2); 263 Llayout->setSpacing( 2);
263 Llayout->setMargin( 2); 264 Llayout->setMargin( 2);
264 265
265 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 266 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
266 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 267 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
267 268
268 tabWidget->insertTab(LTab,tr("Lists")); 269 tabWidget->insertTab(LTab,tr("Lists"));
269 270
270 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 271 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
271 272
272 connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); 273 connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) );
273 274
274 connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); 275 connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) );
275 276
276 // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); 277 // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) );
277 278
278 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 279 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
279 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 280 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
280 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 281 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
281 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 282 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
282 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 283 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
283 this,SLOT( playIt( QListViewItem *)) ); 284 this,SLOT( playIt( QListViewItem *)) );
284 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 285 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
285 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 286 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
286 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 287 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
287 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 288 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
288 this,SLOT( playIt( QListViewItem *)) ); 289 this,SLOT( playIt( QListViewItem *)) );
289 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 290 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
290 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 291 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
291 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 292 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
292 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 293 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
293 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 294 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
294 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 295 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
295 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 296 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
296 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 297 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
297 298
298 setCentralWidget( vbox5 ); 299 setCentralWidget( vbox5 );
299 300
300 readConfig( cfg ); 301 readConfig( cfg );
301 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 302 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
302 loadList(DocLnk( currentPlaylist)); 303 loadList(DocLnk( currentPlaylist));
303 setCaption(tr("OpiePlayer: ")+ currentPlaylist ); 304 setCaption(tr("OpiePlayer: ")+ currentPlaylist );
304 305
305 initializeStates(); 306 initializeStates();
306} 307}
307 308
308 309
309PlayListWidget::~PlayListWidget() { 310PlayListWidget::~PlayListWidget() {
310 if ( d->current ) { 311/* fixing symptoms and not sources is entirely stupid - zecke */
311 delete d->current; 312// Config cfg( "OpiePlayer" );
312 } 313// writeConfig( cfg );
313 delete d; 314
315 if ( d->current ) {
316 delete d->current;
317 }
318 delete d;
314} 319}
315 320
316 321
317void PlayListWidget::initializeStates() { 322void PlayListWidget::initializeStates() {
318 323
319 d->tbPlay->setOn( mediaPlayerState->playing() ); 324 d->tbPlay->setOn( mediaPlayerState->playing() );
320 d->tbLoop->setOn( mediaPlayerState->looping() ); 325 d->tbLoop->setOn( mediaPlayerState->looping() );
321 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 326 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
322 setPlaylist( true); 327 setPlaylist( true);
323} 328}
324 329
325 330
326void PlayListWidget::readConfig( Config& cfg ) { 331void PlayListWidget::readConfig( Config& cfg ) {
327 cfg.setGroup("PlayList"); 332 cfg.setGroup("PlayList");
328 QString currentString = cfg.readEntry("current", "" ); 333 QString currentString = cfg.readEntry("current", "" );
329 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 334 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
330 for ( int i = 0; i < noOfFiles; i++ ) { 335 for ( int i = 0; i < noOfFiles; i++ ) {
331 QString entryName; 336 QString entryName;
332 entryName.sprintf( "File%i", i + 1 ); 337 entryName.sprintf( "File%i", i + 1 );
333 QString linkFile = cfg.readEntry( entryName ); 338 QString linkFile = cfg.readEntry( entryName );
334 if(QFileInfo( linkFile).exists() ) { 339 if(QFileInfo( linkFile).exists() ) {
335 DocLnk lnk( linkFile ); 340 DocLnk lnk( linkFile );
336 if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) { 341 if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) {
337 d->selectedFiles->addToSelection( lnk ); 342 d->selectedFiles->addToSelection( lnk );
338 } 343 }
339 } 344 }
340 } 345 }
341 d->selectedFiles->setSelectedItem( currentString); 346 d->selectedFiles->setSelectedItem( currentString);
342} 347}
343 348
344 349
345void PlayListWidget::writeConfig( Config& cfg ) const { 350void PlayListWidget::writeConfig( Config& cfg ) const {
346 351
347 d->selectedFiles->writeCurrent( cfg); 352 d->selectedFiles->writeCurrent( cfg);
348 cfg.setGroup("PlayList"); 353 cfg.setGroup("PlayList");
349 int noOfFiles = 0; 354 int noOfFiles = 0;
350 d->selectedFiles->first(); 355 d->selectedFiles->first();
351 do { 356 do {
352 const DocLnk *lnk = d->selectedFiles->current(); 357 const DocLnk *lnk = d->selectedFiles->current();
353 if ( lnk ) { 358 if ( lnk ) {
354 QString entryName; 359 QString entryName;
355 entryName.sprintf( "File%i", noOfFiles + 1 ); 360 entryName.sprintf( "File%i", noOfFiles + 1 );
356 cfg.writeEntry( entryName, lnk->linkFile() ); 361 cfg.writeEntry( entryName, lnk->linkFile() );
357 // if this link does exist, add it so we have the file 362 // if this link does exist, add it so we have the file
358 // next time... 363 // next time...
359 if ( !QFile::exists( lnk->linkFile() ) ) { 364 if ( !QFile::exists( lnk->linkFile() ) ) {
360 // the way writing lnks doesn't really check for out 365 // the way writing lnks doesn't really check for out
361 // of disk space, but check it anyway. 366 // of disk space, but check it anyway.
362 if ( !lnk->writeLink() ) { 367 if ( !lnk->writeLink() ) {
363 QMessageBox::critical( 0, tr("Out of space"), 368 QMessageBox::critical( 0, tr("Out of space"),
364 tr( "There was a problem saving " 369 tr( "There was a problem saving "
365 "the playlist.\n" 370 "the playlist.\n"
366 "Your playlist " 371 "Your playlist "
367 "may be missing some entries\n" 372 "may be missing some entries\n"
368 "the next time you start it." ) 373 "the next time you start it." )
369 ); 374 );
370 } 375 }
371 } 376 }
372 noOfFiles++; 377 noOfFiles++;
373 } 378 }
374 } 379 }
375 while ( d->selectedFiles->next() ); 380 while ( d->selectedFiles->next() );
376 cfg.writeEntry("NumberOfFiles", noOfFiles ); 381 cfg.writeEntry("NumberOfFiles", noOfFiles );
377} 382}
378 383
379 384
380void PlayListWidget::addToSelection( const DocLnk& lnk ) { 385void PlayListWidget::addToSelection( const DocLnk& lnk ) {
381 d->setDocumentUsed = FALSE; 386 d->setDocumentUsed = FALSE;
382 if ( mediaPlayerState->playlist() ) { 387 if ( mediaPlayerState->playlist() ) {
383 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) 388 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
384 d->selectedFiles->addToSelection( lnk ); 389 d->selectedFiles->addToSelection( lnk );
385 } 390 }
386 else 391 else
387 mediaPlayerState->setPlaying( TRUE ); 392 mediaPlayerState->setPlaying( TRUE );
388} 393}
389 394
390 395
391void PlayListWidget::clearList() { 396void PlayListWidget::clearList() {
392 while ( first() ) { 397 while ( first() ) {
393 d->selectedFiles->removeSelected(); 398 d->selectedFiles->removeSelected();
394 } 399 }
395} 400}
396 401
397 402
398void PlayListWidget::addAllToList() { 403void PlayListWidget::addAllToList() {
399 DocLnkSet filesAll; 404 DocLnkSet filesAll;
400 Global::findDocuments(&filesAll, "video/*;audio/*"); 405 Global::findDocuments(&filesAll, "video/*;audio/*");
401 QListIterator<DocLnk> Adit( filesAll.children() ); 406 QListIterator<DocLnk> Adit( filesAll.children() );
402 for ( ; Adit.current(); ++Adit ) { 407 for ( ; Adit.current(); ++Adit ) {
403 if(QFileInfo(Adit.current()->file()).exists()) { 408 if(QFileInfo(Adit.current()->file()).exists()) {
404 d->selectedFiles->addToSelection( **Adit ); 409 d->selectedFiles->addToSelection( **Adit );
405 } 410 }
406 } 411 }
407} 412}
408 413
409 414
@@ -859,197 +864,199 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi
859 }; 864 };
860} 865}
861 866
862 867
863void PlayListWidget::scanForAudio() { 868void PlayListWidget::scanForAudio() {
864// qDebug("scan for audio"); 869// qDebug("scan for audio");
865 files.detachChildren(); 870 files.detachChildren();
866 QListIterator<DocLnk> sdit( files.children() ); 871 QListIterator<DocLnk> sdit( files.children() );
867 for ( ; sdit.current(); ++sdit ) { 872 for ( ; sdit.current(); ++sdit ) {
868 delete sdit.current(); 873 delete sdit.current();
869 } 874 }
870 Global::findDocuments(&files, "audio/*"); 875 Global::findDocuments(&files, "audio/*");
871 audioScan = TRUE; 876 audioScan = TRUE;
872} 877}
873 878
874void PlayListWidget::scanForVideo() { 879void PlayListWidget::scanForVideo() {
875// qDebug("scan for video"); 880// qDebug("scan for video");
876 vFiles.detachChildren(); 881 vFiles.detachChildren();
877 QListIterator<DocLnk> sdit( vFiles.children() ); 882 QListIterator<DocLnk> sdit( vFiles.children() );
878 for ( ; sdit.current(); ++sdit ) { 883 for ( ; sdit.current(); ++sdit ) {
879 delete sdit.current(); 884 delete sdit.current();
880 } 885 }
881 Global::findDocuments(&vFiles, "video/*"); 886 Global::findDocuments(&vFiles, "video/*");
882 videoScan = TRUE; 887 videoScan = TRUE;
883} 888}
884 889
885void PlayListWidget::populateAudioView() { 890void PlayListWidget::populateAudioView() {
886 891
887 audioView->clear(); 892 audioView->clear();
888 StorageInfo storageInfo; 893 StorageInfo storageInfo;
889 const QList<FileSystem> &fs = storageInfo.fileSystems(); 894 const QList<FileSystem> &fs = storageInfo.fileSystems();
890 if(!audioScan) scanForAudio(); 895 if(!audioScan) scanForAudio();
891 896
892 QListIterator<DocLnk> dit( files.children() ); 897 QListIterator<DocLnk> dit( files.children() );
893 QListIterator<FileSystem> it ( fs ); 898 QListIterator<FileSystem> it ( fs );
894 899
895 QString storage; 900 QString storage;
896 for ( ; dit.current(); ++dit ) { 901 for ( ; dit.current(); ++dit ) {
897 for( ; it.current(); ++it ){ 902 for( ; it.current(); ++it ){
898 const QString name = (*it)->name(); 903 const QString name = (*it)->name();
899 const QString path = (*it)->path(); 904 const QString path = (*it)->path();
900 if(dit.current()->file().find(path) != -1 ) storage=name; 905 if(dit.current()->file().find(path) != -1 ) storage=name;
901 } 906 }
902 907
903 QListViewItem * newItem; 908 QListViewItem * newItem;
904 if ( QFile( dit.current()->file()).exists() ) { 909 if ( QFile( dit.current()->file()).exists() ) {
905 // qDebug(dit.current()->name()); 910 // qDebug(dit.current()->name());
906 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 911 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
907 QString::number( QFile( dit.current()->file()).size() ), storage); 912 QString::number( QFile( dit.current()->file()).size() ), storage);
908 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" )); 913 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" ));
909 } 914 }
910 } 915 }
911 916
912} 917}
913 918
914void PlayListWidget::populateVideoView() { 919void PlayListWidget::populateVideoView() {
915 videoView->clear(); 920 videoView->clear();
916 StorageInfo storageInfo; 921 StorageInfo storageInfo;
917 const QList<FileSystem> &fs = storageInfo.fileSystems(); 922 const QList<FileSystem> &fs = storageInfo.fileSystems();
918 923
919 if(!videoScan ) scanForVideo(); 924 if(!videoScan ) scanForVideo();
920 925
921 QListIterator<DocLnk> Vdit( vFiles.children() ); 926 QListIterator<DocLnk> Vdit( vFiles.children() );
922 QListIterator<FileSystem> it ( fs ); 927 QListIterator<FileSystem> it ( fs );
923 videoView->clear(); 928 videoView->clear();
924 QString storage; 929 QString storage;
925 for ( ; Vdit.current(); ++Vdit ) { 930 for ( ; Vdit.current(); ++Vdit ) {
926 for( ; it.current(); ++it ){ 931 for( ; it.current(); ++it ){
927 const QString name = (*it)->name(); 932 const QString name = (*it)->name();
928 const QString path = (*it)->path(); 933 const QString path = (*it)->path();
929 if( Vdit.current()->file().find(path) != -1 ) storage=name; 934 if( Vdit.current()->file().find(path) != -1 ) storage=name;
930 } 935 }
931 936
932 QListViewItem * newItem; 937 QListViewItem * newItem;
933 if ( QFile( Vdit.current()->file()).exists() ) { 938 if ( QFile( Vdit.current()->file()).exists() ) {
934 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 939 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
935 QString::number( QFile( Vdit.current()->file()).size() ), storage); 940 QString::number( QFile( Vdit.current()->file()).size() ), storage);
936 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); 941 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ));
937 } 942 }
938 } 943 }
939} 944}
940 945
941void PlayListWidget::openFile() { 946void PlayListWidget::openFile() {
942 QString filename, name; 947 QString filename, name;
943 InputDialog *fileDlg; 948 InputDialog *fileDlg;
944 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 949 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
945 fileDlg->exec(); 950 fileDlg->exec();
946 if( fileDlg->result() == 1 ) { 951 if( fileDlg->result() == 1 ) {
947 filename = fileDlg->text(); 952 filename = fileDlg->text();
948 953
949 qDebug("Selected filename is "+filename); 954 qDebug("Selected filename is "+filename);
950 if(filename.right(3) == "m3u") { 955 if(filename.right(3) == "m3u") {
951 readm3u( filename ); 956 readm3u( filename );
952 } else if(filename.right(3) == "pls") { 957 } else if(filename.right(3) == "pls") {
953 readPls( filename ); 958 readPls( filename );
954 } else { 959 } else {
960 /* FIXME ....... AUDIO/X-MPEGURL is bad*/
955 DocLnk lnk; 961 DocLnk lnk;
956 962
957 lnk.setName(filename); //sets file name 963 lnk.setName(filename); //sets file name
958 lnk.setFile(filename); //sets File property 964 lnk.setFile(filename); //sets File property
959 lnk.setType("audio/x-mpegurl"); 965 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() );
966 lnk.setType( MimeType( QFile::encodeName(filename) ).id() );
960 lnk.setExec("opieplayer"); 967 lnk.setExec("opieplayer");
961 lnk.setIcon("opieplayer2/MPEGPlayer"); 968 lnk.setIcon("opieplayer2/MPEGPlayer");
962 969
963 if(!lnk.writeLink()) { 970 if(!lnk.writeLink()) {
964 qDebug("Writing doclink did not work"); 971 qDebug("Writing doclink did not work");
965 } 972 }
966 d->selectedFiles->addToSelection( lnk); 973 d->selectedFiles->addToSelection( lnk);
967 } 974 }
968 } 975 }
969 if(fileDlg) { 976 if(fileDlg) {
970 delete fileDlg; 977 delete fileDlg;
971 } 978 }
972} 979}
973 980
974void PlayListWidget::keyReleaseEvent( QKeyEvent *e) 981void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
975{ 982{
976 switch ( e->key() ) { 983 switch ( e->key() ) {
977 ////////////////////////////// Zaurus keys 984 ////////////////////////////// Zaurus keys
978 case Key_F9: //activity 985 case Key_F9: //activity
979 // if(audioUI->isHidden()) 986 // if(audioUI->isHidden())
980 // audioUI->showMaximized(); 987 // audioUI->showMaximized();
981 break; 988 break;
982 case Key_F10: //contacts 989 case Key_F10: //contacts
983 // if( videoUI->isHidden()) 990 // if( videoUI->isHidden())
984 // videoUI->showMaximized(); 991 // videoUI->showMaximized();
985 break; 992 break;
986 case Key_F11: //menu 993 case Key_F11: //menu
987 break; 994 break;
988 case Key_F12: //home 995 case Key_F12: //home
989 // doBlank(); 996 // doBlank();
990 break; 997 break;
991 case Key_F13: //mail 998 case Key_F13: //mail
992 // doUnblank(); 999 // doUnblank();
993 break; 1000 break;
994 case Key_Q: //add to playlist 1001 case Key_Q: //add to playlist
995 addSelected(); 1002 addSelected();
996 break; 1003 break;
997 case Key_R: //remove from playlist 1004 case Key_R: //remove from playlist
998 removeSelected(); 1005 removeSelected();
999 break; 1006 break;
1000 // case Key_P: //play 1007 // case Key_P: //play
1001 // qDebug("Play"); 1008 // qDebug("Play");
1002 // playSelected(); 1009 // playSelected();
1003 // break; 1010 // break;
1004 case Key_Space: 1011 case Key_Space:
1005 // playSelected(); puh 1012 // playSelected(); puh
1006 break; 1013 break;
1007 case Key_1: 1014 case Key_1:
1008 tabWidget->setCurrentPage(0); 1015 tabWidget->setCurrentPage(0);
1009 break; 1016 break;
1010 case Key_2: 1017 case Key_2:
1011 tabWidget->setCurrentPage(1); 1018 tabWidget->setCurrentPage(1);
1012 break; 1019 break;
1013 case Key_3: 1020 case Key_3:
1014 tabWidget->setCurrentPage(2); 1021 tabWidget->setCurrentPage(2);
1015 break; 1022 break;
1016 case Key_4: 1023 case Key_4:
1017 tabWidget->setCurrentPage(3); 1024 tabWidget->setCurrentPage(3);
1018 break; 1025 break;
1019 case Key_Down: 1026 case Key_Down:
1020 if ( !d->selectedFiles->next() ) 1027 if ( !d->selectedFiles->next() )
1021 d->selectedFiles->first(); 1028 d->selectedFiles->first();
1022 1029
1023 break; 1030 break;
1024 case Key_Up: 1031 case Key_Up:
1025 if ( !d->selectedFiles->prev() ) 1032 if ( !d->selectedFiles->prev() )
1026 // d->selectedFiles->last(); 1033 // d->selectedFiles->last();
1027 1034
1028 break; 1035 break;
1029 1036
1030 } 1037 }
1031} 1038}
1032 1039
1033void PlayListWidget::keyPressEvent( QKeyEvent *) 1040void PlayListWidget::keyPressEvent( QKeyEvent *)
1034{ 1041{
1035 // qDebug("Key press"); 1042 // qDebug("Key press");
1036 // switch ( e->key() ) { 1043 // switch ( e->key() ) {
1037 // ////////////////////////////// Zaurus keys 1044 // ////////////////////////////// Zaurus keys
1038 // case Key_A: //add to playlist 1045 // case Key_A: //add to playlist
1039 // qDebug("Add"); 1046 // qDebug("Add");
1040 // addSelected(); 1047 // addSelected();
1041 // break; 1048 // break;
1042 // case Key_R: //remove from playlist 1049 // case Key_R: //remove from playlist
1043 // removeSelected(); 1050 // removeSelected();
1044 // break; 1051 // break;
1045 // case Key_P: //play 1052 // case Key_P: //play
1046 // qDebug("Play"); 1053 // qDebug("Play");
1047 // playSelected(); 1054 // playSelected();
1048 // break; 1055 // break;
1049 // case Key_Space: 1056 // case Key_Space:
1050 // qDebug("Play"); 1057 // qDebug("Play");
1051 // playSelected(); 1058 // playSelected();
1052 // break; 1059 // break;
1053 // } 1060 // }
1054} 1061}
1055 1062
@@ -1143,105 +1150,105 @@ void PlayListWidget::writem3u() {
1143} 1150}
1144 1151
1145void PlayListWidget::readPls(const QString &filename) { 1152void PlayListWidget::readPls(const QString &filename) {
1146 1153
1147 qDebug("pls filename is "+filename); 1154 qDebug("pls filename is "+filename);
1148 QFile f(filename); 1155 QFile f(filename);
1149 1156
1150 if(f.open(IO_ReadOnly)) { 1157 if(f.open(IO_ReadOnly)) {
1151 QTextStream t(&f); 1158 QTextStream t(&f);
1152 QString s;//, first, second; 1159 QString s;//, first, second;
1153 int i=0; 1160 int i=0;
1154 while ( !t.atEnd()) { 1161 while ( !t.atEnd()) {
1155 s=t.readLine(); 1162 s=t.readLine();
1156 if(s.left(4) == "File") { 1163 if(s.left(4) == "File") {
1157 s=s.right(s.length() - 6); 1164 s=s.right(s.length() - 6);
1158 s.replace(QRegExp("%20")," "); 1165 s.replace(QRegExp("%20")," ");
1159 qDebug("adding "+s+" to playlist"); 1166 qDebug("adding "+s+" to playlist");
1160 // numberofentries=2 1167 // numberofentries=2
1161 // File1=http 1168 // File1=http
1162 // Title 1169 // Title
1163 // Length 1170 // Length
1164 // Version 1171 // Version
1165 // File2=http 1172 // File2=http
1166 s=s.replace( QRegExp("\\"),"/"); 1173 s=s.replace( QRegExp("\\"),"/");
1167 DocLnk lnk( s ); 1174 DocLnk lnk( s );
1168 QFileInfo f(s); 1175 QFileInfo f(s);
1169 QString name = f.baseName(); 1176 QString name = f.baseName();
1170 if(name.left(4)=="http") 1177 if(name.left(4)=="http")
1171 name = s.right( s.length() - 7); 1178 name = s.right( s.length() - 7);
1172 else 1179 else
1173 name=s; 1180 name=s;
1174 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1181 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1175 lnk.setName( name); 1182 lnk.setName( name);
1176 if(s.at(s.length()-4) == '.') // if this is probably a file 1183 if(s.at(s.length()-4) == '.') // if this is probably a file
1177 lnk.setFile( s); 1184 lnk.setFile( s);
1178 else { //if its a url 1185 else { //if its a url
1179 if( name.right(1).find('/') == -1) 1186 if( name.right(1).find('/') == -1)
1180 s+="/"; 1187 s+="/";
1181 lnk.setFile( s); 1188 lnk.setFile( s);
1182 } 1189 }
1183 lnk.setType("audio/x-mpegurl"); 1190 lnk.setType("audio/x-mpegurl");
1184 1191
1185 qDebug("DocLnk add "+name); 1192 qDebug("DocLnk add "+name);
1186 d->selectedFiles->addToSelection( lnk); 1193 d->selectedFiles->addToSelection( lnk);
1187 } 1194 }
1188 } 1195 }
1189 i++; 1196 i++;
1190 } 1197 }
1191} 1198}
1192 1199
1193void PlayListWidget::pmViewActivated(int index) { 1200void PlayListWidget::pmViewActivated(int index) {
1194// qDebug("%d", index); 1201// qDebug("%d", index);
1195 switch(index) { 1202 switch(index) {
1196 case -16: 1203 case -16:
1197 { 1204 {
1198 1205
1199 mediaPlayerState->toggleFullscreen(); 1206 mediaPlayerState->toggleFullscreen();
1200 bool b=mediaPlayerState->fullscreen(); 1207 bool b=mediaPlayerState->fullscreen();
1201 pmView->setItemChecked( index,b); 1208 pmView->setItemChecked( index,b);
1202 Config cfg( "OpiePlayer" ); 1209 Config cfg( "OpiePlayer" );
1203 cfg.writeEntry("FullScreen", b); 1210 cfg.writeEntry("FullScreen", b);
1204 1211
1205 } 1212 }
1206 break; 1213 break;
1207 }; 1214 };
1208} 1215}
1209 1216
1210void PlayListWidget::populateSkinsMenu() { 1217void PlayListWidget::populateSkinsMenu() {
1211 int item=0; 1218 int item=0;
1212 defaultSkinIndex=0; 1219 defaultSkinIndex=0;
1213 QString skinName; 1220 QString skinName;
1214 Config cfg( "OpiePlayer" ); 1221 Config cfg( "OpiePlayer" );
1215 cfg.setGroup("Options"); 1222 cfg.setGroup("Options");
1216 QString skin = cfg.readEntry("Skin","default"); 1223 QString skin = cfg.readEntry("Skin","default");
1217 1224
1218 QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); 1225 QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins");
1219 skinsDir.setFilter( QDir::Dirs); 1226 skinsDir.setFilter( QDir::Dirs);
1220 skinsDir.setSorting(QDir::Name); 1227 skinsDir.setSorting(QDir::Name);
1221 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1228 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1222 QFileInfoListIterator it( *skinslist ); 1229 QFileInfoListIterator it( *skinslist );
1223 QFileInfo *fi; 1230 QFileInfo *fi;
1224 while ( (fi=it.current()) ) { 1231 while ( (fi=it.current()) ) {
1225 skinName = fi->fileName(); 1232 skinName = fi->fileName();
1226 qDebug( fi->fileName()); 1233 qDebug( fi->fileName());
1227 if( skinName != "." && skinName != ".." && skinName !="CVS") 1234 if( skinName != "." && skinName != ".." && skinName !="CVS")
1228 item = skinsMenu->insertItem( fi->fileName()); 1235 item = skinsMenu->insertItem( fi->fileName());
1229 if( skinName == "default") 1236 if( skinName == "default")
1230 defaultSkinIndex = item; 1237 defaultSkinIndex = item;
1231 if( skinName == skin) 1238 if( skinName == skin)
1232 skinsMenu->setItemChecked( item, TRUE); 1239 skinsMenu->setItemChecked( item, TRUE);
1233 1240
1234 ++it; 1241 ++it;
1235 } 1242 }
1236} 1243}
1237 1244
1238void PlayListWidget::skinsMenuActivated(int item) { 1245void PlayListWidget::skinsMenuActivated(int item) {
1239 for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { 1246 for(uint i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) {
1240 skinsMenu->setItemChecked( i, FALSE); 1247 skinsMenu->setItemChecked( i, FALSE);
1241 } 1248 }
1242 skinsMenu->setItemChecked( item, TRUE); 1249 skinsMenu->setItemChecked( item, TRUE);
1243 1250
1244 Config cfg( "OpiePlayer" ); 1251 Config cfg( "OpiePlayer" );
1245 cfg.setGroup("Options"); 1252 cfg.setGroup("Options");
1246 cfg.writeEntry("Skin", skinsMenu->text( item)); 1253 cfg.writeEntry("Skin", skinsMenu->text( item));
1247} 1254}
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
@@ -286,193 +286,193 @@ void VideoWidget::paintButton( QPainter *p, int i ) {
286 } 286 }
287} 287}
288 288
289void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 289void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
290 for ( int i = 0; i < numVButtons; i++ ) { 290 for ( int i = 0; i < numVButtons; i++ ) {
291 if ( event->state() == QMouseEvent::LeftButton ) { 291 if ( event->state() == QMouseEvent::LeftButton ) {
292 // The test to see if the mouse click is inside the button or not 292 // The test to see if the mouse click is inside the button or not
293 int x = event->pos().x() - xoff; 293 int x = event->pos().x() - xoff;
294 int y = event->pos().y() - yoff; 294 int y = event->pos().y() - yoff;
295 295
296 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 296 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
297 && y < imgButtonMask->height() 297 && y < imgButtonMask->height()
298 && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 298 && imgButtonMask->pixelIndex( x, y ) == i + 1 );
299 299
300 if ( isOnButton && !videoButtons[i].isHeld ) { 300 if ( isOnButton && !videoButtons[i].isHeld ) {
301 videoButtons[i].isHeld = TRUE; 301 videoButtons[i].isHeld = TRUE;
302 toggleButton(i); 302 toggleButton(i);
303 303
304 switch (i) { 304 switch (i) {
305 case VideoVolUp: 305 case VideoVolUp:
306 emit moreClicked(); 306 emit moreClicked();
307 return; 307 return;
308 case VideoVolDown: 308 case VideoVolDown:
309 emit lessClicked(); 309 emit lessClicked();
310 return; 310 return;
311 } 311 }
312 } else if ( !isOnButton && videoButtons[i].isHeld ) { 312 } else if ( !isOnButton && videoButtons[i].isHeld ) {
313 videoButtons[i].isHeld = FALSE; 313 videoButtons[i].isHeld = FALSE;
314 toggleButton(i); 314 toggleButton(i);
315 } 315 }
316 } else { 316 } else {
317 317
318 if ( videoButtons[i].isHeld ) { 318 if ( videoButtons[i].isHeld ) {
319 videoButtons[i].isHeld = FALSE; 319 videoButtons[i].isHeld = FALSE;
320 if ( !videoButtons[i].isToggle ) { 320 if ( !videoButtons[i].isToggle ) {
321 setToggleButton( i, FALSE ); 321 setToggleButton( i, FALSE );
322 } 322 }
323 323
324 switch(i) { 324 switch(i) {
325 325
326 case VideoPlay: { 326 case VideoPlay: {
327 if( mediaPlayerState->isPaused ) { 327 if( mediaPlayerState->isPaused ) {
328 setToggleButton( i, FALSE ); 328 setToggleButton( i, FALSE );
329 mediaPlayerState->setPaused( FALSE ); 329 mediaPlayerState->setPaused( FALSE );
330 return; 330 return;
331 } else if( !mediaPlayerState->isPaused ) { 331 } else if( !mediaPlayerState->isPaused ) {
332 setToggleButton( i, TRUE ); 332 setToggleButton( i, TRUE );
333 mediaPlayerState->setPaused( TRUE ); 333 mediaPlayerState->setPaused( TRUE );
334 return; 334 return;
335 } else { 335 } else {
336 return; 336 return;
337 } 337 }
338 } 338 }
339 339
340 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; 340 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return;
341 case VideoNext: mediaPlayerState->setNext(); return; 341 case VideoNext: mediaPlayerState->setNext(); return;
342 case VideoPrevious: mediaPlayerState->setPrev(); return; 342 case VideoPrevious: mediaPlayerState->setPrev(); return;
343 case VideoVolUp: emit moreReleased(); return; 343 case VideoVolUp: emit moreReleased(); return;
344 case VideoVolDown: emit lessReleased(); return; 344 case VideoVolDown: emit lessReleased(); return;
345 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 345 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
346 } 346 }
347 } 347 }
348 } 348 }
349 } 349 }
350} 350}
351 351
352void VideoWidget::mousePressEvent( QMouseEvent *event ) { 352void VideoWidget::mousePressEvent( QMouseEvent *event ) {
353 mouseMoveEvent( event ); 353 mouseMoveEvent( event );
354} 354}
355 355
356void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 356void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
357 if ( mediaPlayerState->fullscreen() ) { 357 if ( mediaPlayerState->fullscreen() ) {
358 mediaPlayerState->setFullscreen( FALSE ); 358 mediaPlayerState->setFullscreen( FALSE );
359 makeVisible(); 359 makeVisible();
360 } 360 }
361 mouseMoveEvent( event ); 361 mouseMoveEvent( event );
362} 362}
363 363
364void VideoWidget::showEvent( QShowEvent* ) { 364void VideoWidget::showEvent( QShowEvent* ) {
365 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 365 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
366 mouseMoveEvent( &event ); 366 mouseMoveEvent( &event );
367} 367}
368 368
369 369
370 void VideoWidget::backToNormal() { 370 void VideoWidget::backToNormal() {
371 mediaPlayerState->setFullscreen( FALSE ); 371 mediaPlayerState->setFullscreen( FALSE );
372 makeVisible(); 372 makeVisible();
373 } 373 }
374 374
375void VideoWidget::makeVisible() { 375void VideoWidget::makeVisible() {
376 if ( mediaPlayerState->fullscreen() ) { 376 if ( mediaPlayerState->fullscreen() ) {
377 setBackgroundMode( QWidget::NoBackground ); 377 setBackgroundMode( QWidget::NoBackground );
378 showFullScreen(); 378 showFullScreen();
379 resize( qApp->desktop()->size() ); 379 resize( qApp->desktop()->size() );
380 slider->hide(); 380 slider->hide();
381 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 381 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
382 382 qApp->processEvents();
383 } else { 383 } else {
384 showNormal(); 384 showNormal();
385 showMaximized(); 385 showMaximized();
386 setBackgroundPixmap( *pixBg ); 386 setBackgroundPixmap( *pixBg );
387 if ( mediaPlayerState->streaming() ) { 387 if ( mediaPlayerState->streaming() ) {
388 slider->hide(); 388 slider->hide();
389 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 389 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
390 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 390 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
391 } else { 391 } else {
392 slider->show(); 392 slider->show();
393 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 393 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
394 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 394 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
395 } 395 }
396 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 396 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
397 qApp->processEvents(); 397 qApp->processEvents();
398 } 398 }
399} 399}
400 400
401 401
402void VideoWidget::paintEvent( QPaintEvent * pe) { 402void VideoWidget::paintEvent( QPaintEvent * pe) {
403 QPainter p( this ); 403 QPainter p( this );
404 404
405 if ( mediaPlayerState->fullscreen() ) { 405 if ( mediaPlayerState->fullscreen() ) {
406 // Clear the background 406 // Clear the background
407 p.setBrush( QBrush( Qt::black ) ); 407 p.setBrush( QBrush( Qt::black ) );
408 } else { 408 } else {
409 if ( !pe->erased() ) { 409 if ( !pe->erased() ) {
410 // Combine with background and double buffer 410 // Combine with background and double buffer
411 QPixmap pix( pe->rect().size() ); 411 QPixmap pix( pe->rect().size() );
412 QPainter p( &pix ); 412 QPainter p( &pix );
413 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 413 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
414 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 414 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
415 for ( int i = 0; i < numVButtons; i++ ) { 415 for ( int i = 0; i < numVButtons; i++ ) {
416 paintButton( &p, i ); 416 paintButton( &p, i );
417 } 417 }
418 QPainter p2( this ); 418 QPainter p2( this );
419 p2.drawPixmap( pe->rect().topLeft(), pix ); 419 p2.drawPixmap( pe->rect().topLeft(), pix );
420 } else { 420 } else {
421 QPainter p( this ); 421 QPainter p( this );
422 for ( int i = 0; i < numVButtons; i++ ) 422 for ( int i = 0; i < numVButtons; i++ )
423 paintButton( &p, i ); 423 paintButton( &p, i );
424 } 424 }
425 slider->repaint( TRUE ); 425 slider->repaint( TRUE );
426 } 426 }
427} 427}
428 428
429 429
430void VideoWidget::closeEvent( QCloseEvent* ) { 430void VideoWidget::closeEvent( QCloseEvent* ) {
431 mediaPlayerState->setList(); 431 mediaPlayerState->setList();
432} 432}
433 433
434 434
435 435
436void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 436void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
437 switch ( e->key() ) { 437 switch ( e->key() ) {
438////////////////////////////// Zaurus keys 438////////////////////////////// Zaurus keys
439 case Key_Home: 439 case Key_Home:
440 break; 440 break;
441 case Key_F9: //activity 441 case Key_F9: //activity
442 break; 442 break;
443 case Key_F10: //contacts 443 case Key_F10: //contacts
444// hide(); 444// hide();
445 break; 445 break;
446 case Key_F11: //menu 446 case Key_F11: //menu
447 break; 447 break;
448 case Key_F12: //home 448 case Key_F12: //home
449 break; 449 break;
450 case Key_F13: //mail 450 case Key_F13: //mail
451 break; 451 break;
452 case Key_Space: { 452 case Key_Space: {
453 if(mediaPlayerState->playing()) { 453 if(mediaPlayerState->playing()) {
454 mediaPlayerState->setPlaying(FALSE); 454 mediaPlayerState->setPlaying(FALSE);
455 } else { 455 } else {
456 mediaPlayerState->setPlaying(TRUE); 456 mediaPlayerState->setPlaying(TRUE);
457 } 457 }
458 } 458 }
459 break; 459 break;
460 case Key_Down: 460 case Key_Down:
461// toggleButton(6); 461// toggleButton(6);
462 emit lessClicked(); 462 emit lessClicked();
463 emit lessReleased(); 463 emit lessReleased();
464// toggleButton(6); 464// toggleButton(6);
465 break; 465 break;
466 case Key_Up: 466 case Key_Up:
467// toggleButton(5); 467// toggleButton(5);
468 emit moreClicked(); 468 emit moreClicked();
469 emit moreReleased(); 469 emit moreReleased();
470// toggleButton(5); 470// toggleButton(5);
471 break; 471 break;
472 case Key_Right: 472 case Key_Right:
473 mediaPlayerState->setNext(); 473 mediaPlayerState->setNext();
474 break; 474 break;
475 case Key_Left: 475 case Key_Left:
476 mediaPlayerState->setPrev(); 476 mediaPlayerState->setPrev();
477 break; 477 break;
478 case Key_Escape: 478 case Key_Escape: