summaryrefslogtreecommitdiff
authorchicken <chicken>2003-11-17 19:28:21 (UTC)
committer chicken <chicken>2003-11-17 19:28:21 (UTC)
commit56f2b27abab0cbae7548b43be4509965b37e3a92 (patch) (unidiff)
tree210dc84c5dbb1a93aaa5ae358a38a3de3510f493
parent8515000ba00ec666ee5e68fdd3c2786186093b93 (diff)
downloadopie-56f2b27abab0cbae7548b43be4509965b37e3a92.zip
opie-56f2b27abab0cbae7548b43be4509965b37e3a92.tar.gz
opie-56f2b27abab0cbae7548b43be4509965b37e3a92.tar.bz2
merge branch with head
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,369 +1,369 @@
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           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
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 34
35#include <qtextstream.h> 35#include <qtextstream.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38 38
39#include <qgfx_qws.h> 39#include <qgfx_qws.h>
40#include <qdirectpainter_qws.h> 40#include <qdirectpainter_qws.h>
41 41
42#include <assert.h> 42#include <assert.h>
43 43
44#include "xinevideowidget.h" 44#include "xinevideowidget.h"
45#include "frame.h" 45#include "frame.h"
46#include "lib.h" 46#include "lib.h"
47 47
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 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); 53 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * );
54 int null_is_showing_video( const xine_vo_driver_t* self ); 54 int null_is_showing_video( const xine_vo_driver_t* self );
55 void null_set_show_video( const xine_vo_driver_t* self, int show ); 55 void null_set_show_video( const xine_vo_driver_t* self, int show );
56 int null_is_fullscreen( const xine_vo_driver_t* self ); 56 int null_is_fullscreen( const xine_vo_driver_t* self );
57 void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); 57 void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
58 int null_is_scaling( const xine_vo_driver_t* self ); 58 int null_is_scaling( const xine_vo_driver_t* self );
59 void null_set_scaling( const xine_vo_driver_t* self, int scale ); 59 void null_set_scaling( const xine_vo_driver_t* self, int scale );
60 void null_set_gui_width( const xine_vo_driver_t* self, int width ); 60 void null_set_gui_width( const xine_vo_driver_t* self, int width );
61 void null_set_gui_height( const xine_vo_driver_t* self, int height ); 61 void null_set_gui_height( const xine_vo_driver_t* self, int height );
62 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 62 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
63 void null_set_videoGamma( const xine_vo_driver_t* self , int value ); 63 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
64 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 64 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
65 65
66 void null_preload_decoders( xine_stream_t *stream ); 66 void null_preload_decoders( xine_stream_t *stream );
67} 67}
68 68
69using namespace XINE; 69using namespace XINE;
70 70
71Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) 71Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
72{ 72{
73 m_initialized = false; 73 m_initialized = false;
74 m_duringInitialization = false; 74 m_duringInitialization = false;
75 m_video = false; 75 m_video = false;
76 m_wid = widget; 76 m_wid = widget;
77 printf("Lib"); 77 printf("Lib");
78 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 78 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
79 // get the configuration 79 // get the configuration
80 80
81 // not really OO, should be an extra class, later 81 // not really OO, should be an extra class, later
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 }
99 99
100 if ( initMode == InitializeImmediately ) { 100 if ( initMode == InitializeImmediately ) {
101 initialize(); 101 initialize();
102 m_initialized = true; 102 m_initialized = true;
103 } 103 }
104 else 104 else
105 start(); 105 start();
106} 106}
107 107
108void Lib::run() 108void Lib::run()
109{ 109{
110 qDebug( "Lib::run() started" ); 110 qDebug( "Lib::run() started" );
111 initialize(); 111 initialize();
112 m_initialized = true; 112 m_initialized = true;
113 qDebug( "Lib::run() finished" ); 113 qDebug( "Lib::run() finished" );
114} 114}
115 115
116void Lib::initialize() 116void Lib::initialize()
117{ 117{
118 m_duringInitialization = true; 118 m_duringInitialization = true;
119 m_xine = xine_new( ); 119 m_xine = xine_new( );
120 120
121 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 121 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
122 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 122 xine_config_load( m_xine, QFile::encodeName( configPath ) );
123 123
124 xine_init( m_xine ); 124 xine_init( m_xine );
125 125
126 // allocate oss for sound 126 // allocate oss for sound
127 // and fb for framebuffer 127 // and fb for framebuffer
128 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 128 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
129 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 129 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
130 130
131 131
132//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 132//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
133 133
134 134
135// null_display_handler( m_videoOutput, xine_display_frame, this ); 135// null_display_handler( m_videoOutput, xine_display_frame, this );
136 136
137 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 137 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
138 138
139 if (m_wid != 0 ) { 139 if (m_wid != 0 ) {
140 printf( "!0\n" ); 140 printf( "!0\n" );
141 setWidget( m_wid ); 141 setWidget( m_wid );
142 } 142 }
143 143
144 m_queue = xine_event_new_queue (m_stream); 144 m_queue = xine_event_new_queue (m_stream);
145 145
146 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 146 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
147 147
148 ::null_preload_decoders( m_stream ); 148 ::null_preload_decoders( m_stream );
149 149
150 m_duringInitialization = false; 150 m_duringInitialization = false;
151} 151}
152 152
153Lib::~Lib() { 153Lib::~Lib() {
154 assert( isRunning() == false ); 154 assert( isRunning() == false );
155 assert( m_initialized ); 155 assert( m_initialized );
156 156
157// free( m_config ); 157// free( m_config );
158 158
159 xine_close( m_stream ); 159 xine_close( m_stream );
160 160
161 xine_event_dispose_queue( m_queue ); 161 xine_event_dispose_queue( m_queue );
162 162
163 xine_dispose( m_stream ); 163 xine_dispose( m_stream );
164 164
165 xine_exit( m_xine ); 165 xine_exit( m_xine );
166 /* FIXME either free or delete but valgrind bitches against both */ 166 /* FIXME either free or delete but valgrind bitches against both */
167 //free( m_videoOutput ); 167 //free( m_videoOutput );
168 //delete m_audioOutput; 168 //delete m_audioOutput;
169} 169}
170 170
171void Lib::resize ( const QSize &s ) { 171void Lib::resize ( const QSize &s ) {
172 assert( m_initialized || m_duringInitialization ); 172 assert( m_initialized || m_duringInitialization );
173 173
174 if ( s. width ( ) && s. height ( ) ) { 174 if ( s. width ( ) && s. height ( ) ) {
175 ::null_set_gui_width( m_videoOutput, s. width() ); 175 ::null_set_gui_width( m_videoOutput, s. width() );
176 ::null_set_gui_height( m_videoOutput, s. height() ); 176 ::null_set_gui_height( m_videoOutput, s. height() );
177 } 177 }
178} 178}
179 179
180int Lib::majorVersion() { 180int Lib::majorVersion() {
181 int major, minor, sub; 181 int major, minor, sub;
182 xine_get_version ( &major, &minor, &sub ); 182 xine_get_version ( &major, &minor, &sub );
183 return major; 183 return major;
184} 184}
185 185
186int Lib::minorVersion() { 186int Lib::minorVersion() {
187 int major, minor, sub; 187 int major, minor, sub;
188 xine_get_version ( &major, &minor, &sub ); 188 xine_get_version ( &major, &minor, &sub );
189 return minor; 189 return minor;
190} 190}
191 191
192int Lib::subVersion() { 192int Lib::subVersion() {
193 int major, minor, sub; 193 int major, minor, sub;
194 xine_get_version ( &major, &minor, &sub ); 194 xine_get_version ( &major, &minor, &sub );
195 return sub; 195 return sub;
196} 196}
197 197
198int Lib::play( const QString& fileName, int startPos, int start_time ) { 198int Lib::play( const QString& fileName, int startPos, int start_time ) {
199 assert( m_initialized ); 199 assert( m_initialized );
200 // FIXME actually a hack imho. Should not be needed to dispose the whole stream 200 // FIXME actually a hack imho. Should not be needed to dispose the whole stream
201 // but without we get wrong media length reads from libxine for the second media 201 // but without we get wrong media length reads from libxine for the second media
202 //xine_dispose ( m_stream ); 202 //xine_dispose ( m_stream );
203 203
204 QString str = fileName.stripWhiteSpace(); 204 QString str = fileName.stripWhiteSpace();
205 205
206 //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 206 //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
207 //m_queue = xine_event_new_queue (m_stream); 207 //m_queue = xine_event_new_queue (m_stream);
208 //xine_event_create_listener_thread (m_queue, xine_event_handler, this); 208 //xine_event_create_listener_thread (m_queue, xine_event_handler, this);
209 209
210 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { 210 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
211 return 0; 211 return 0;
212 } 212 }
213 return xine_play( m_stream, startPos, start_time); 213 return xine_play( m_stream, startPos, start_time);
214} 214}
215 215
216void Lib::stop() { 216void Lib::stop() {
217 assert( m_initialized ); 217 assert( m_initialized );
218 218
219 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 219 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
220 xine_stop( m_stream ); 220 xine_stop( m_stream );
221} 221}
222 222
223void Lib::pause( bool toggle ) { 223void Lib::pause( bool toggle ) {
224 assert( m_initialized ); 224 assert( m_initialized );
225 225
226 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); 226 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
227} 227}
228 228
229int Lib::speed() const { 229int Lib::speed() const {
230 assert( m_initialized ); 230 assert( m_initialized );
231 231
232 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 232 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
233} 233}
234 234
235void Lib::setSpeed( int speed ) { 235void Lib::setSpeed( int speed ) {
236 assert( m_initialized ); 236 assert( m_initialized );
237 237
238 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 238 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
239} 239}
240 240
241int Lib::status() const { 241int Lib::status() const {
242 assert( m_initialized ); 242 assert( m_initialized );
243 243
244 return xine_get_status( m_stream ); 244 return xine_get_status( m_stream );
245} 245}
246 246
247int Lib::currentPosition() const { 247int Lib::currentPosition() const {
248 assert( m_initialized ); 248 assert( m_initialized );
249 249
250 int pos, time, length; 250 int pos, time, length;
251 xine_get_pos_length( m_stream, &pos, &time, &length ); 251 xine_get_pos_length( m_stream, &pos, &time, &length );
252 return pos; 252 return pos;
253} 253}
254 254
255int Lib::currentTime() const { 255int Lib::currentTime() const {
256 assert( m_initialized ); 256 assert( m_initialized );
257 257
258 int pos, time, length; 258 int pos, time, length;
259 xine_get_pos_length( m_stream, &pos, &time, &length ); 259 xine_get_pos_length( m_stream, &pos, &time, &length );
260 if ( time > 0 ) { 260 if ( time > 0 ) {
261 return time/1000; 261 return time/1000;
262 } else { 262 } else {
263 return 0; 263 return 0;
264 } 264 }
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*/
282 usleep(100000); 282 usleep(100000);
283 iTestLoop++; 283 iTestLoop++;
284 } 284 }
285 while ( iTestLoop < 10 ); /* if after 1s, we still don't have any 285 while ( iTestLoop < 10 ); /* if after 1s, we still don't have any
286valid stream, then return -1 (this value could be used to make the stream 286valid stream, then return -1 (this value could be used to make the stream
287unseekable, but it should never occur!! Mr. Murphy ? :) ) */ 287unseekable, but it should never occur!! Mr. Murphy ? :) ) */
288 288
289 return -1; 289 return -1;
290} 290}
291 291
292bool Lib::isSeekable() const { 292bool Lib::isSeekable() const {
293 assert( m_initialized ); 293 assert( m_initialized );
294 294
295 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); 295 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
296} 296}
297 297
298void Lib::seekTo( int time ) { 298void Lib::seekTo( int time ) {
299 assert( m_initialized ); 299 assert( m_initialized );
300 300
301 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( 301 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
302 // since its now milliseconds we need *1000 302 // since its now milliseconds we need *1000
303 xine_play( m_stream, 0, time*1000 ); 303 xine_play( m_stream, 0, time*1000 );
304} 304}
305 305
306 306
307Frame Lib::currentFrame() const { 307Frame Lib::currentFrame() const {
308 assert( m_initialized ); 308 assert( m_initialized );
309 309
310 Frame frame; 310 Frame frame;
311 return frame; 311 return frame;
312}; 312};
313 313
314QString Lib::metaInfo( int number) const { 314QString Lib::metaInfo( int number) const {
315 assert( m_initialized ); 315 assert( m_initialized );
316 316
317 return xine_get_meta_info( m_stream, number ); 317 return xine_get_meta_info( m_stream, number );
318} 318}
319 319
320int Lib::error() const { 320int Lib::error() const {
321 assert( m_initialized ); 321 assert( m_initialized );
322 322
323 return xine_get_error( m_stream ); 323 return xine_get_error( m_stream );
324}; 324};
325 325
326void Lib::ensureInitialized() 326void Lib::ensureInitialized()
327{ 327{
328 if ( m_initialized ) 328 if ( m_initialized )
329 return; 329 return;
330 330
331 qDebug( "waiting for initialization thread to finish" ); 331 qDebug( "waiting for initialization thread to finish" );
332 wait(); 332 wait();
333 qDebug( "initialization thread finished!" ); 333 qDebug( "initialization thread finished!" );
334} 334}
335 335
336void Lib::setWidget( XineVideoWidget *widget ) 336void Lib::setWidget( XineVideoWidget *widget )
337{ 337{
338 m_wid = widget; 338 m_wid = widget;
339 resize ( m_wid-> size ( ) ); 339 resize ( m_wid-> size ( ) );
340 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 340 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
341 m_wid->repaint(); 341 m_wid->repaint();
342} 342}
343 343
344void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) 344void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
345{ 345{
346 assert( sendType == ThreadUtil::Channel::OneWay ); 346 assert( sendType == ThreadUtil::Channel::OneWay );
347 handleXineEvent( msg->type() ); 347 handleXineEvent( msg->type() );
348 delete msg; 348 delete msg;
349} 349}
350 350
351void Lib::handleXineEvent( const xine_event_t* t ) { 351void Lib::handleXineEvent( const xine_event_t* t ) {
352 send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); 352 send( new ThreadUtil::ChannelMessage( t->type ), OneWay );
353} 353}
354 354
355void Lib::handleXineEvent( int type ) { 355void Lib::handleXineEvent( int type ) {
356 assert( m_initialized ); 356 assert( m_initialized );
357 357
358 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { 358 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
359 emit stopped(); 359 emit stopped();
360 } 360 }
361} 361}
362 362
363 363
364void Lib::setShowVideo( bool video ) { 364void Lib::setShowVideo( bool video ) {
365 assert( m_initialized ); 365 assert( m_initialized );
366 366
367 m_video = video; 367 m_video = video;
368 ::null_set_show_video( m_videoOutput, video ); 368 ::null_set_show_video( m_videoOutput, video );
369} 369}
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
@@ -190,193 +190,192 @@ void MediaPlayer::stopChangingVolume() {
190 drawnOnScreenDisplay = FALSE; 190 drawnOnScreenDisplay = FALSE;
191 onScreenDisplayVolume = 0; 191 onScreenDisplayVolume = 0;
192 int w=0; 192 int w=0;
193 int h=0; 193 int h=0;
194 if( !xineControl()->hasVideo() ) { 194 if( !xineControl()->hasVideo() ) {
195 w = audioUI()->width(); 195 w = audioUI()->width();
196 h = audioUI()->height(); 196 h = audioUI()->height();
197 audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 197 audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
198 } else { 198 } else {
199 w = videoUI()->width(); 199 w = videoUI()->width();
200 h = videoUI()->height(); 200 h = videoUI()->height();
201 videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 201 videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
202 } 202 }
203} 203}
204 204
205 205
206void MediaPlayer::timerEvent( QTimerEvent * ) { 206void MediaPlayer::timerEvent( QTimerEvent * ) {
207 if ( volumeDirection == +1 ) { 207 if ( volumeDirection == +1 ) {
208 volControl->incVol( 2 ); 208 volControl->incVol( 2 );
209 } else if ( volumeDirection == -1 ) { 209 } else if ( volumeDirection == -1 ) {
210 volControl->decVol( 2 ); 210 volControl->decVol( 2 );
211 } 211 }
212 212
213 213
214 // TODO FIXME 214 // TODO FIXME
215 // huh?? 215 // huh??
216 unsigned int v= 0; 216 unsigned int v= 0;
217 v = volControl->volume(); 217 v = volControl->volume();
218 v = v / 10; 218 v = v / 10;
219 219
220 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 220 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
221 return; 221 return;
222 } 222 }
223 223
224 int w=0; int h=0; 224 int w=0; int h=0;
225 if( !xineControl()->hasVideo() ) { 225 if( !xineControl()->hasVideo() ) {
226 w = audioUI()->width(); 226 w = audioUI()->width();
227 h = audioUI()->height(); 227 h = audioUI()->height();
228 228
229 if ( drawnOnScreenDisplay ) { 229 if ( drawnOnScreenDisplay ) {
230 if ( onScreenDisplayVolume > v ) { 230 if ( onScreenDisplayVolume > v ) {
231 audioUI()->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 231 audioUI()->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
232 } 232 }
233 } 233 }
234 drawnOnScreenDisplay = TRUE; 234 drawnOnScreenDisplay = TRUE;
235 onScreenDisplayVolume = v; 235 onScreenDisplayVolume = v;
236 QPainter p( audioUI() ); 236 QPainter p( audioUI() );
237 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 237 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
238 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 238 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
239 239
240 QFont f; 240 QFont f;
241 f.setPixelSize( 20 ); 241 f.setPixelSize( 20 );
242 f.setBold( TRUE ); 242 f.setBold( TRUE );
243 p.setFont( f ); 243 p.setFont( f );
244 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 244 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
245 245
246 for ( unsigned int i = 0; i < 10; i++ ) { 246 for ( unsigned int i = 0; i < 10; i++ ) {
247 if ( v > i ) { 247 if ( v > i ) {
248 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 248 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
249 } else { 249 } else {
250 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 250 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
251 } 251 }
252 } 252 }
253 } else { 253 } else {
254 w = videoUI()->width(); 254 w = videoUI()->width();
255 h = videoUI()->height(); 255 h = videoUI()->height();
256 256
257 if ( drawnOnScreenDisplay ) { 257 if ( drawnOnScreenDisplay ) {
258 if ( onScreenDisplayVolume > v ) { 258 if ( onScreenDisplayVolume > v ) {
259 videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 259 videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
260 } 260 }
261 } 261 }
262 drawnOnScreenDisplay = TRUE; 262 drawnOnScreenDisplay = TRUE;
263 onScreenDisplayVolume = v; 263 onScreenDisplayVolume = v;
264 QPainter p( videoUI() ); 264 QPainter p( videoUI() );
265 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 265 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
266 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 266 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
267 267
268 QFont f; 268 QFont f;
269 f.setPixelSize( 20 ); 269 f.setPixelSize( 20 );
270 f.setBold( TRUE ); 270 f.setBold( TRUE );
271 p.setFont( f ); 271 p.setFont( f );
272 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); 272 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
273 273
274 for ( unsigned int i = 0; i < 10; i++ ) { 274 for ( unsigned int i = 0; i < 10; i++ ) {
275 if ( v > i ) { 275 if ( v > i ) {
276 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 276 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
277 } else { 277 } else {
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
295 ioctl( fd, FBIOBLANK, 1 ); 294 ioctl( fd, FBIOBLANK, 1 );
296 if(fl !=-1) { 295 if(fl !=-1) {
297 ioctl( fl, 2 ); 296 ioctl( fl, 2 );
298 ::close(fl); 297 ::close(fl);
299 } 298 }
300#else 299#else
301 ioctl( fd, FBIOBLANK, 3 ); 300 ioctl( fd, FBIOBLANK, 3 );
302#endif 301#endif
303 isBlanked = TRUE; 302 isBlanked = TRUE;
304 } else { 303 } else {
305 qDebug("do unblanking"); 304 qDebug("do unblanking");
306 ioctl( fd, FBIOBLANK, 0); 305 ioctl( fd, FBIOBLANK, 0);
307#ifdef QT_QWS_SL5XXX 306#ifdef QT_QWS_SL5XXX
308 if(fl != -1) { 307 if(fl != -1) {
309 ioctl( fl, 1); 308 ioctl( fl, 1);
310 ::close(fl); 309 ::close(fl);
311 } 310 }
312#endif 311#endif
313 isBlanked = FALSE; 312 isBlanked = FALSE;
314 } 313 }
315 close( fd ); 314 close( fd );
316 } else { 315 } else {
317 qDebug("<< /dev/fb0 could not be opened >>"); 316 qDebug("<< /dev/fb0 could not be opened >>");
318 } 317 }
319} 318}
320 319
321void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 320void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
322 switch ( e->key() ) { 321 switch ( e->key() ) {
323////////////////////////////// Zaurus keys 322////////////////////////////// Zaurus keys
324 case Key_Home: 323 case Key_Home:
325 break; 324 break;
326 case Key_F9: //activity 325 case Key_F9: //activity
327 break; 326 break;
328 case Key_F10: //contacts 327 case Key_F10: //contacts
329 break; 328 break;
330 case Key_F11: //menu 329 case Key_F11: //menu
331 break; 330 break;
332 case Key_F12: //home 331 case Key_F12: //home
333 qDebug("Blank here"); 332 qDebug("Blank here");
334// mediaPlayerState->toggleBlank(); 333// mediaPlayerState->toggleBlank();
335 break; 334 break;
336 case Key_F13: //mail 335 case Key_F13: //mail
337 qDebug("Blank here"); 336 qDebug("Blank here");
338 // mediaPlayerState->toggleBlank(); 337 // mediaPlayerState->toggleBlank();
339 break; 338 break;
340 } 339 }
341} 340}
342 341
343void MediaPlayer::cleanUp() {// this happens on closing 342void MediaPlayer::cleanUp() {// this happens on closing
344 Config cfg( "OpiePlayer" ); 343 Config cfg( "OpiePlayer" );
345 mediaPlayerState.writeConfig( cfg ); 344 mediaPlayerState.writeConfig( cfg );
346 playList.writeDefaultPlaylist( ); 345 playList.writeDefaultPlaylist( );
347 346
348// QPEApplication::grabKeyboard(); 347// QPEApplication::grabKeyboard();
349// QPEApplication::ungrabKeyboard(); 348// QPEApplication::ungrabKeyboard();
350} 349}
351 350
352void MediaPlayer::recreateAudioAndVideoWidgets() const 351void MediaPlayer::recreateAudioAndVideoWidgets() const
353{ 352{
354 delete m_skinLoader; 353 delete m_skinLoader;
355 354
356 delete m_xineControl; 355 delete m_xineControl;
357 delete m_audioUI; 356 delete m_audioUI;
358 delete m_videoUI; 357 delete m_videoUI;
359 m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); 358 m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
360 m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); 359 m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
361 360
362 connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 361 connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
363 connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 362 connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
364 connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 363 connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
365 connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 364 connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
366 365
367 connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 366 connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
368 connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 367 connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
369 connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 368 connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
370 connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 369 connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
371 370
372 if ( !xine ) 371 if ( !xine )
373 xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); 372 xine = new XINE::Lib( XINE::Lib::InitializeImmediately );
374 373
375 m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); 374 m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState );
376 375
377 xine = 0; 376 xine = 0;
378} 377}
379 378
380AudioWidget *MediaPlayer::audioUI() const 379AudioWidget *MediaPlayer::audioUI() const
381{ 380{
382 if ( !m_audioUI ) 381 if ( !m_audioUI )
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
@@ -1,126 +1,124 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This program is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
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 ) ),
39 this, SLOT( setPlaying( bool ) ) ); 37 this, SLOT( setPlaying( bool ) ) );
40 38
41 setBackgroundMode( NoBackground ); 39 setBackgroundMode( NoBackground );
42} 40}
43 41
44MediaWidget::~MediaWidget() 42MediaWidget::~MediaWidget()
45{ 43{
46} 44}
47 45
48void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
49 const Skin &skin ) 47 const Skin &skin )
50{ 48{
51 buttonMask = skin.buttonMask( skinInfo, buttonCount ); 49 buttonMask = skin.buttonMask( skinInfo, buttonCount );
52 50
53 buttons.clear(); 51 buttons.clear();
54 buttons.reserve( buttonCount ); 52 buttons.reserve( buttonCount );
55 53
56 for ( uint i = 0; i < buttonCount; ++i ) { 54 for ( uint i = 0; i < buttonCount; ++i ) {
57 Button button = setupButton( skinInfo[ i ], skin ); 55 Button button = setupButton( skinInfo[ i ], skin );
58 buttons.push_back( button ); 56 buttons.push_back( button );
59 } 57 }
60} 58}
61 59
62MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
63{ 61{
64 Button button; 62 Button button;
65 button.command = buttonInfo.command; 63 button.command = buttonInfo.command;
66 button.type = buttonInfo.type; 64 button.type = buttonInfo.type;
67 button.mask = skin.buttonMaskImage( buttonInfo.fileName ); 65 button.mask = skin.buttonMaskImage( buttonInfo.fileName );
68 66
69 return button; 67 return button;
70} 68}
71 69
72void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) 70void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo )
73{ 71{
74 Skin skin( guiInfo.fileNameInfix ); 72 Skin skin( guiInfo.fileNameInfix );
75 skin.setCachable( false ); 73 skin.setCachable( false );
76 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); 74 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin );
77} 75}
78 76
79void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) 77void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin )
80{ 78{
81 backgroundPixmap = skin.backgroundPixmap(); 79 backgroundPixmap = skin.backgroundPixmap();
82 buttonUpImage = skin.buttonUpImage(); 80 buttonUpImage = skin.buttonUpImage();
83 buttonDownImage = skin.buttonDownImage(); 81 buttonDownImage = skin.buttonDownImage();
84 82
85 setupButtons( skinInfo, buttonCount, skin ); 83 setupButtons( skinInfo, buttonCount, skin );
86} 84}
87 85
88void MediaWidget::closeEvent( QCloseEvent * ) 86void MediaWidget::closeEvent( QCloseEvent * )
89{ 87{
90 mediaPlayerState.setList(); 88 mediaPlayerState.setList();
91} 89}
92 90
93void MediaWidget::paintEvent( QPaintEvent *pe ) 91void MediaWidget::paintEvent( QPaintEvent *pe )
94{ 92{
95 QPainter p( this ); 93 QPainter p( this );
96 94
97 if ( mediaPlayerState.isFullscreen() ) { 95 if ( mediaPlayerState.isFullscreen() ) {
98 // Clear the background 96 // Clear the background
99 p.setBrush( QBrush( Qt::black ) ); 97 p.setBrush( QBrush( Qt::black ) );
100 return; 98 return;
101 } 99 }
102 100
103 QPixmap buffer( size() ); 101 QPixmap buffer( size() );
104 QPainter bufferedPainter( &buffer ); 102 QPainter bufferedPainter( &buffer );
105 bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) ); 103 bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) );
106 paintAllButtons( bufferedPainter ); 104 paintAllButtons( bufferedPainter );
107 p.drawPixmap( 0, 0, buffer ); 105 p.drawPixmap( 0, 0, buffer );
108} 106}
109 107
110void MediaWidget::resizeEvent( QResizeEvent *e ) 108void MediaWidget::resizeEvent( QResizeEvent *e )
111{ 109{
112 QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); 110 QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask );
113 QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); 111 QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask );
114 112
115 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { 113 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
116 Button &button = *it; 114 Button &button = *it;
117 115
118 if ( button.mask.isNull() ) 116 if ( button.mask.isNull() )
119 continue; 117 continue;
120 button.pixUp = addMaskToPixmap( pixUp, button.mask ); 118 button.pixUp = addMaskToPixmap( pixUp, button.mask );
121 button.pixDown = addMaskToPixmap( pixDn, button.mask ); 119 button.pixDown = addMaskToPixmap( pixDn, button.mask );
122 } 120 }
123 121
124 QWidget::resizeEvent( e ); 122 QWidget::resizeEvent( e );
125} 123}
126 124
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,48 +1,41 @@
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 \
12 frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \ 10 frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \
13 playlistwidgetgui.cpp\ 11 playlistwidgetgui.cpp\
14 alphablend.c yuv2rgb.c yuv2rgb_arm2.c yuv2rgb_arm4l.S \ 12 alphablend.c yuv2rgb.c yuv2rgb_arm2.c yuv2rgb_arm4l.S \
15 threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.cpp \ 13 threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.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 \
37 ../../../i18n/ja/opieplayer2.ts \ 30 ../../../i18n/ja/opieplayer2.ts \
38 ../../../i18n/ko/opieplayer2.ts \ 31 ../../../i18n/ko/opieplayer2.ts \
39 ../../../i18n/no/opieplayer2.ts \ 32 ../../../i18n/no/opieplayer2.ts \
40 ../../../i18n/pl/opieplayer2.ts \ 33 ../../../i18n/pl/opieplayer2.ts \
41 ../../../i18n/pt/opieplayer2.ts \ 34 ../../../i18n/pt/opieplayer2.ts \
42 ../../../i18n/pt_BR/opieplayer2.ts \ 35 ../../../i18n/pt_BR/opieplayer2.ts \
43 ../../../i18n/sl/opieplayer2.ts \ 36 ../../../i18n/sl/opieplayer2.ts \
44 ../../../i18n/zh_CN/opieplayer2.ts \ 37 ../../../i18n/zh_CN/opieplayer2.ts \
45 ../../../i18n/zh_TW/opieplayer2.ts 38 ../../../i18n/zh_TW/opieplayer2.ts
46 39
47 40
48include ( $(OPIEDIR)/include.pro ) 41include ( $(OPIEDIR)/include.pro )
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
@@ -1,664 +1,673 @@
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,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
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           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = 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 <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() ) );
74 pmPlayList->insertSeparator(-1); 79 pmPlayList->insertSeparator(-1);
75 (void)new MenuItem( pmPlayList, tr( "Add File" ), 80 (void)new MenuItem( pmPlayList, tr( "Add File" ),
76 this,SLOT( openFile() ) ); 81 this,SLOT( openFile() ) );
77 (void)new MenuItem( pmPlayList, tr("Add URL"), 82 (void)new MenuItem( pmPlayList, tr("Add URL"),
78 this,SLOT( openURL() ) ); 83 this,SLOT( openURL() ) );
79 pmPlayList->insertSeparator(-1); 84 pmPlayList->insertSeparator(-1);
80 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 85 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
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() ) );
102 QVBox *stretch2 = new QVBox( vbox1 ); 107 QVBox *stretch2 = new QVBox( vbox1 );
103 108
104 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 109 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
105 SLOT( deletePlaylist() ) ); 110 SLOT( deletePlaylist() ) );
106 connect( pmView, SIGNAL( activated( int ) ), 111 connect( pmView, SIGNAL( activated( int ) ),
107 this, SLOT( pmViewActivated( int ) ) ); 112 this, SLOT( pmViewActivated( int ) ) );
108 connect( skinsMenu, SIGNAL( activated( int ) ) , 113 connect( skinsMenu, SIGNAL( activated( int ) ) ,
109 this, SLOT( skinsMenuActivated( int ) ) ); 114 this, SLOT( skinsMenuActivated( int ) ) );
110 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 115 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
111 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 116 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
112 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 117 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
113 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 118 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
114 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 119 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
115 this,SLOT( playIt( QListViewItem *) ) ); 120 this,SLOT( playIt( QListViewItem *) ) );
116 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 121 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
117 this, SLOT( addToSelection( QListViewItem *) ) ); 122 this, SLOT( addToSelection( QListViewItem *) ) );
118 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 123 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
119 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 124 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
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&)) );
146 154
147 155
148 cfg.setGroup("PlayList"); 156 cfg.setGroup("PlayList");
149 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 157 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
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";
173 QString currentString = config.readEntry( "CurrentPlaylist", filename); 182 QString currentString = config.readEntry( "CurrentPlaylist", filename);
174 if( currentString == filename) { 183 if( currentString == filename) {
175 Om3u *m3uList; 184 Om3u *m3uList;
176 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 185 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
177 if( d->selectedFiles->first() ) { 186 if( d->selectedFiles->first() ) {
178 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
179 do { 188 do {
180 // qDebug(d->selectedFiles->current()->file()); 189 // qDebug(d->selectedFiles->current()->file());
181 m3uList->add( d->selectedFiles->current()->file() ); 190 m3uList->add( d->selectedFiles->current()->file() );
182 } 191 }
183 while ( d->selectedFiles->next() ); 192 while ( d->selectedFiles->next() );
184 193
185 m3uList->write(); 194 m3uList->write();
186 m3uList->close(); 195 m3uList->close();
187 delete m3uList; 196 delete m3uList;
188 197
189 } 198 }
190 } 199 }
191} 200}
192 201
193void PlayListWidget::addToSelection( const DocLnk& lnk ) { 202void PlayListWidget::addToSelection( const DocLnk& lnk ) {
194 d->setDocumentUsed = FALSE; 203 d->setDocumentUsed = FALSE;
195 if( QFileInfo( lnk.file() ).exists() || 204 if( QFileInfo( lnk.file() ).exists() ||
196 lnk.file().left(4) == "http" ) { 205 lnk.file().left(4) == "http" ) {
197 d->selectedFiles->addToSelection( lnk ); 206 d->selectedFiles->addToSelection( lnk );
198 } 207 }
199// writeCurrentM3u(); 208// writeCurrentM3u();
200} 209}
201 210
202 211
203void PlayListWidget::clearList() { 212void PlayListWidget::clearList() {
204 while ( first() ) { 213 while ( first() ) {
205 d->selectedFiles->removeSelected(); 214 d->selectedFiles->removeSelected();
206 } 215 }
207 Config cfg( "OpiePlayer" ); 216 Config cfg( "OpiePlayer" );
208 cfg.setGroup("PlayList"); 217 cfg.setGroup("PlayList");
209 cfg.writeEntry("CurrentPlaylist","default"); 218 cfg.writeEntry("CurrentPlaylist","default");
210 setCaption("OpiePlayer"); 219 setCaption("OpiePlayer");
211} 220}
212 221
213void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 222void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
214 switch (mouse) { 223 switch (mouse) {
215 case LeftButton: 224 case LeftButton:
216 break; 225 break;
217 case RightButton: 226 case RightButton:
218 { 227 {
219 QPopupMenu m; 228 QPopupMenu m;
220 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 229 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
221 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 230 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
222 m.exec( QCursor::pos() ); 231 m.exec( QCursor::pos() );
223 } 232 }
224 break; 233 break;
225 } 234 }
226} 235}
227 236
228 237
229void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 238void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
230 switch (mouse) { 239 switch (mouse) {
231 case LeftButton: 240 case LeftButton:
232 break; 241 break;
233 case RightButton: 242 case RightButton:
234 { 243 {
235 QPopupMenu m; 244 QPopupMenu m;
236 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 245 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
237 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 246 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
238 m.exec( QCursor::pos() ); 247 m.exec( QCursor::pos() );
239 } 248 }
240 break; 249 break;
241 } 250 }
242} 251}
243 252
244 253
245void PlayListWidget::addAllToList() { 254void PlayListWidget::addAllToList() {
246 255
247 256
248 audioView->populateView(); 257 audioView->populateView();
249 258
250 QListViewItemIterator audioIt( audioView ); 259 QListViewItemIterator audioIt( audioView );
251 DocLnk lnk; 260 DocLnk lnk;
252 QString filename; 261 QString filename;
253 // iterate through all items of the listview 262 // iterate through all items of the listview
254 for ( ; audioIt.current(); ++audioIt ) { 263 for ( ; audioIt.current(); ++audioIt ) {
255 filename = audioIt.current()->text(3); 264 filename = audioIt.current()->text(3);
256 lnk.setName( QFileInfo(filename).baseName() ); //sets name 265 lnk.setName( QFileInfo(filename).baseName() ); //sets name
257 lnk.setFile( filename ); //sets file name 266 lnk.setFile( filename ); //sets file name
258 d->selectedFiles->addToSelection( lnk); 267 d->selectedFiles->addToSelection( lnk);
259 } 268 }
260 269
261 videoView->populateView(); 270 videoView->populateView();
262 271
263 QListViewItemIterator videoIt( videoView ); 272 QListViewItemIterator videoIt( videoView );
264 for ( ; videoIt.current(); ++videoIt ) { 273 for ( ; videoIt.current(); ++videoIt ) {
265 filename = videoIt.current()->text(3); 274 filename = videoIt.current()->text(3);
266 lnk.setName( QFileInfo(filename).baseName() ); //sets name 275 lnk.setName( QFileInfo(filename).baseName() ); //sets name
267 lnk.setFile( filename ); //sets file name 276 lnk.setFile( filename ); //sets file name
268 d->selectedFiles->addToSelection( lnk); 277 d->selectedFiles->addToSelection( lnk);
269 } 278 }
270 279
271 tabWidget->setCurrentPage(0); 280 tabWidget->setCurrentPage(0);
272 281
273 writeCurrentM3u(); 282 writeCurrentM3u();
274 d->selectedFiles->first(); 283 d->selectedFiles->first();
275} 284}
276 285
277 286
278void PlayListWidget::addAllMusicToList() { 287void PlayListWidget::addAllMusicToList() {
279 288
280 audioView->populateView(); 289 audioView->populateView();
281 290
282 QListViewItemIterator audioIt( audioView ); 291 QListViewItemIterator audioIt( audioView );
283 DocLnk lnk; 292 DocLnk lnk;
284 QString filename; 293 QString filename;
285 // iterate through all items of the listview 294 // iterate through all items of the listview
286 for ( ; audioIt.current(); ++audioIt ) { 295 for ( ; audioIt.current(); ++audioIt ) {
287 filename = audioIt.current()->text(3); 296 filename = audioIt.current()->text(3);
288 lnk.setName( QFileInfo(filename).baseName() ); //sets name 297 lnk.setName( QFileInfo(filename).baseName() ); //sets name
289 lnk.setFile( filename ); //sets file name 298 lnk.setFile( filename ); //sets file name
290 d->selectedFiles->addToSelection( lnk); 299 d->selectedFiles->addToSelection( lnk);
291 } 300 }
292 301
293 tabWidget->setCurrentPage(0); 302 tabWidget->setCurrentPage(0);
294 writeCurrentM3u(); 303 writeCurrentM3u();
295 d->selectedFiles->first(); 304 d->selectedFiles->first();
296} 305}
297 306
298 307
299void PlayListWidget::addAllVideoToList() { 308void PlayListWidget::addAllVideoToList() {
300 309
301 videoView->populateView(); 310 videoView->populateView();
302 311
303 QListViewItemIterator videoIt( videoView ); 312 QListViewItemIterator videoIt( videoView );
304 DocLnk lnk; 313 DocLnk lnk;
305 QString filename; 314 QString filename;
306 for ( ; videoIt.current(); ++videoIt ) { 315 for ( ; videoIt.current(); ++videoIt ) {
307 filename = videoIt.current()->text(3); 316 filename = videoIt.current()->text(3);
308 lnk.setName( QFileInfo(filename).baseName() ); //sets name 317 lnk.setName( QFileInfo(filename).baseName() ); //sets name
309 lnk.setFile( filename ); //sets file name 318 lnk.setFile( filename ); //sets file name
310 d->selectedFiles->addToSelection( lnk); 319 d->selectedFiles->addToSelection( lnk);
311 } 320 }
312 tabWidget->setCurrentPage(0); 321 tabWidget->setCurrentPage(0);
313 writeCurrentM3u(); 322 writeCurrentM3u();
314 d->selectedFiles->first(); 323 d->selectedFiles->first();
315} 324}
316 325
317 326
318void PlayListWidget::setDocument( const QString& fileref ) { 327void PlayListWidget::setDocument( const QString& fileref ) {
319 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 328 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
320 fromSetDocument = TRUE; 329 fromSetDocument = TRUE;
321 QFileInfo fileInfo(fileref); 330 QFileInfo fileInfo(fileref);
322 331
323 if ( !fileInfo.exists() ) { 332 if ( !fileInfo.exists() ) {
324 QMessageBox::warning( this, tr( "Invalid File" ), 333 QMessageBox::warning( this, tr( "Invalid File" ),
325 tr( "There was a problem in getting the file." ) ); 334 tr( "There was a problem in getting the file." ) );
326 return; 335 return;
327 } 336 }
328 337
329 clearList(); 338 clearList();
330 QString extension = fileInfo.extension(false); 339 QString extension = fileInfo.extension(false);
331 340
332 if( extension.find( "m3u", 0, false) != -1 341 if( extension.find( "m3u", 0, false) != -1
333 || extension.find( "pls", 0, false) != -1 ) { 342 || extension.find( "pls", 0, false) != -1 ) {
334 readListFromFile( fileref ); 343 readListFromFile( fileref );
335 } else { 344 } else {
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
354 363
355const DocLnk *PlayListWidget::current() const { // this is fugly 364const DocLnk *PlayListWidget::current() const { // this is fugly
356 assert( currentTab() == CurrentPlayList ); 365 assert( currentTab() == CurrentPlayList );
357 366
358 const DocLnk *lnk = d->selectedFiles->current(); 367 const DocLnk *lnk = d->selectedFiles->current();
359 if ( !lnk ) { 368 if ( !lnk ) {
360 d->selectedFiles->first(); 369 d->selectedFiles->first();
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}
409 418
410 419
411bool PlayListWidget::first() { 420bool PlayListWidget::first() {
412 return d->selectedFiles->first(); 421 return d->selectedFiles->first();
413} 422}
414 423
415 424
416bool PlayListWidget::last() { 425bool PlayListWidget::last() {
417 return d->selectedFiles->last(); 426 return d->selectedFiles->last();
418} 427}
419 428
420 429
421 void PlayListWidget::saveList() { 430 void PlayListWidget::saveList() {
422 writem3u(); 431 writem3u();
423 } 432 }
424 433
425 434
426void PlayListWidget::loadList( const DocLnk & lnk) { 435void PlayListWidget::loadList( const DocLnk & lnk) {
427 QString name = lnk.name(); 436 QString name = lnk.name();
428 437
429 if( name.length()>0) { 438 if( name.length()>0) {
430 setCaption("OpiePlayer: "+name); 439 setCaption("OpiePlayer: "+name);
431 clearList(); 440 clearList();
432 readListFromFile(lnk.file()); 441 readListFromFile(lnk.file());
433 tabWidget->setCurrentPage(0); 442 tabWidget->setCurrentPage(0);
434 } 443 }
435} 444}
436 445
437void PlayListWidget::addSelected() { 446void PlayListWidget::addSelected() {
438 assert( inFileListMode() ); 447 assert( inFileListMode() );
439 448
440 QListViewItemIterator it( currentFileListView ); 449 QListViewItemIterator it( currentFileListView );
441 for ( ; it.current(); ++it ) 450 for ( ; it.current(); ++it )
442 if ( it.current()->isSelected() ) { 451 if ( it.current()->isSelected() ) {
443 QString filename = it.current()->text(3); 452 QString filename = it.current()->text(3);
444 453
445 DocLnk lnk; 454 DocLnk lnk;
446 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 455 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
447 lnk.setFile( filename ); //sets file name 456 lnk.setFile( filename ); //sets file name
448 457
449 d->selectedFiles->addToSelection( lnk ); 458 d->selectedFiles->addToSelection( lnk );
450 } 459 }
451 460
452 currentFileListView->clearSelection(); 461 currentFileListView->clearSelection();
453 462
454 writeCurrentM3u(); 463 writeCurrentM3u();
455} 464}
456 465
457 466
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) {
476 if ( currentTab() == CurrentPlayList ) 485 if ( currentTab() == CurrentPlayList )
477 return; 486 return;
478 DocLnk lnk; 487 DocLnk lnk;
479 QString filename; 488 QString filename;
480 489
481 filename=it->text(3); 490 filename=it->text(3);
482 lnk.setName( QFileInfo(filename).baseName() ); //sets name 491 lnk.setName( QFileInfo(filename).baseName() ); //sets name
483 lnk.setFile( filename ); //sets file name 492 lnk.setFile( filename ); //sets file name
484 d->selectedFiles->addToSelection( lnk); 493 d->selectedFiles->addToSelection( lnk);
485 494
486 writeCurrentM3u(); 495 writeCurrentM3u();
487// tabWidget->setCurrentPage(0); 496// tabWidget->setCurrentPage(0);
488 497
489 } 498 }
490} 499}
491 500
492 501
493void PlayListWidget::tabChanged(QWidget *) { 502void PlayListWidget::tabChanged(QWidget *) {
494 503
495 d->tbPlay->setEnabled( true ); 504 d->tbPlay->setEnabled( true );
496 505
497 disconnect( audioView, SIGNAL( itemsSelected( bool ) ), 506 disconnect( audioView, SIGNAL( itemsSelected( bool ) ),
498 d->tbPlay, SLOT( setEnabled( bool ) ) ); 507 d->tbPlay, SLOT( setEnabled( bool ) ) );
499 disconnect( videoView, SIGNAL( itemsSelected( bool ) ), 508 disconnect( videoView, SIGNAL( itemsSelected( bool ) ),
500 d->tbPlay, SLOT( setEnabled( bool ) ) ); 509 d->tbPlay, SLOT( setEnabled( bool ) ) );
501 510
502 currentFileListView = 0; 511 currentFileListView = 0;
503 512
504 switch ( currentTab() ) { 513 switch ( currentTab() ) {
505 case CurrentPlayList: 514 case CurrentPlayList:
506 { 515 {
507 if( !tbDeletePlaylist->isHidden() ) { 516 if( !tbDeletePlaylist->isHidden() ) {
508 tbDeletePlaylist->hide(); 517 tbDeletePlaylist->hide();
509 } 518 }
510 d->tbRemoveFromList->setEnabled(TRUE); 519 d->tbRemoveFromList->setEnabled(TRUE);
511 d->tbAddToList->setEnabled(FALSE); 520 d->tbAddToList->setEnabled(FALSE);
512 521
513 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); 522 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
514 } 523 }
515 break; 524 break;
516 case AudioFiles: 525 case AudioFiles:
517 { 526 {
518 audioView->populateView(); 527 audioView->populateView();
519 528
520 if( !tbDeletePlaylist->isHidden() ) { 529 if( !tbDeletePlaylist->isHidden() ) {
521 tbDeletePlaylist->hide(); 530 tbDeletePlaylist->hide();
522 } 531 }
523 d->tbRemoveFromList->setEnabled(FALSE); 532 d->tbRemoveFromList->setEnabled(FALSE);
524 d->tbAddToList->setEnabled(TRUE); 533 d->tbAddToList->setEnabled(TRUE);
525 534
526 connect( audioView, SIGNAL( itemsSelected( bool ) ), 535 connect( audioView, SIGNAL( itemsSelected( bool ) ),
527 d->tbPlay, SLOT( setEnabled( bool ) ) ); 536 d->tbPlay, SLOT( setEnabled( bool ) ) );
528 537
529 d->tbPlay->setEnabled( audioView->hasSelection() ); 538 d->tbPlay->setEnabled( audioView->hasSelection() );
530 539
531 currentFileListView = audioView; 540 currentFileListView = audioView;
532 } 541 }
533 break; 542 break;
534 case VideoFiles: 543 case VideoFiles:
535 { 544 {
536 videoView->populateView(); 545 videoView->populateView();
537 if( !tbDeletePlaylist->isHidden() ) { 546 if( !tbDeletePlaylist->isHidden() ) {
538 tbDeletePlaylist->hide(); 547 tbDeletePlaylist->hide();
539 } 548 }
540 d->tbRemoveFromList->setEnabled(FALSE); 549 d->tbRemoveFromList->setEnabled(FALSE);
541 d->tbAddToList->setEnabled(TRUE); 550 d->tbAddToList->setEnabled(TRUE);
542 551
543 connect( videoView, SIGNAL( itemsSelected( bool ) ), 552 connect( videoView, SIGNAL( itemsSelected( bool ) ),
544 d->tbPlay, SLOT( setEnabled( bool ) ) ); 553 d->tbPlay, SLOT( setEnabled( bool ) ) );
545 554
546 d->tbPlay->setEnabled( videoView->hasSelection() ); 555 d->tbPlay->setEnabled( videoView->hasSelection() );
547 556
548 currentFileListView = videoView; 557 currentFileListView = videoView;
549 } 558 }
550 break; 559 break;
551 case PlayLists: 560 case PlayLists:
552 { 561 {
553 if( tbDeletePlaylist->isHidden() ) { 562 if( tbDeletePlaylist->isHidden() ) {
554 tbDeletePlaylist->show(); 563 tbDeletePlaylist->show();
555 } 564 }
556 playLists->reread(); 565 playLists->reread();
557 d->tbAddToList->setEnabled(FALSE); 566 d->tbAddToList->setEnabled(FALSE);
558 567
559 d->tbPlay->setEnabled( false ); 568 d->tbPlay->setEnabled( false );
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,
577 QFile().remove(playLists->selectedDocument().file()); 586 QFile().remove(playLists->selectedDocument().file());
578 QFile().remove(playLists->selectedDocument().linkFile()); 587 QFile().remove(playLists->selectedDocument().linkFile());
579 playLists->reread(); 588 playLists->reread();
580 break; 589 break;
581 case 1: // Cancel 590 case 1: // Cancel
582 break; 591 break;
583 }; 592 };
584} 593}
585 594
586 595
587void PlayListWidget::playSelected() { 596void PlayListWidget::playSelected() {
588 btnPlay( TRUE); 597 btnPlay( TRUE);
589} 598}
590 599
591bool PlayListWidget::inFileListMode() const 600bool PlayListWidget::inFileListMode() const
592{ 601{
593 TabType tab = currentTab(); 602 TabType tab = currentTab();
594 return tab == AudioFiles || tab == VideoFiles; 603 return tab == AudioFiles || tab == VideoFiles;
595} 604}
596 605
597void PlayListWidget::openURL() { 606void PlayListWidget::openURL() {
598 // http://66.28.164.33:2080 607 // http://66.28.164.33:2080
599 // http://somafm.com/star0242.m3u 608 // http://somafm.com/star0242.m3u
600 QString filename, name; 609 QString filename, name;
601 InputDialog *fileDlg; 610 InputDialog *fileDlg;
602 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); 611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
603 fileDlg->exec(); 612 fileDlg->exec();
604 if( fileDlg->result() == 1 ) { 613 if( fileDlg->result() == 1 ) {
605 filename = fileDlg->text(); 614 filename = fileDlg->text();
606 qDebug( "Selected filename is " + filename ); 615 qDebug( "Selected filename is " + filename );
607 // Om3u *m3uList; 616 // Om3u *m3uList;
608 DocLnk lnk; 617 DocLnk lnk;
609 Config cfg( "OpiePlayer" ); 618 Config cfg( "OpiePlayer" );
610 cfg.setGroup("PlayList"); 619 cfg.setGroup("PlayList");
611 620
612 if(filename.left(4) == "http") { 621 if(filename.left(4) == "http") {
613 QString m3uFile, m3uFilePath; 622 QString m3uFile, m3uFilePath;
614 if(filename.find(":",8,TRUE) != -1) { //found a port 623 if(filename.find(":",8,TRUE) != -1) { //found a port
615 m3uFile = filename.left( filename.find( ":",8,TRUE)); 624 m3uFile = filename.left( filename.find( ":",8,TRUE));
616 m3uFile = m3uFile.right( 7); 625 m3uFile = m3uFile.right( 7);
617 } else if(filename.left(4) == "http"){ 626 } else if(filename.left(4) == "http"){
618 m3uFile=filename; 627 m3uFile=filename;
619 m3uFile = m3uFile.right( m3uFile.length() - 7); 628 m3uFile = m3uFile.right( m3uFile.length() - 7);
620 } else{ 629 } else{
621 m3uFile=filename; 630 m3uFile=filename;
622 } 631 }
623 632
624 lnk.setName( filename ); //sets name 633 lnk.setName( filename ); //sets name
625 lnk.setFile( filename ); //sets file name 634 lnk.setFile( filename ); //sets file name
626 635
627// lnk.setIcon("opieplayer2/musicfile"); 636// lnk.setIcon("opieplayer2/musicfile");
628 637
629 d->selectedFiles->addToSelection( lnk ); 638 d->selectedFiles->addToSelection( lnk );
630 writeCurrentM3u(); 639 writeCurrentM3u();
631 d->selectedFiles->setSelectedItem( lnk.name()); 640 d->selectedFiles->setSelectedItem( lnk.name());
632 } 641 }
633 else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { 642 else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
634 readListFromFile( filename ); 643 readListFromFile( filename );
635 } else { 644 } else {
636 lnk.setName( QFileInfo(filename).baseName() ); //sets name 645 lnk.setName( QFileInfo(filename).baseName() ); //sets name
637 lnk.setFile( filename ); //sets file name 646 lnk.setFile( filename ); //sets file name
638 d->selectedFiles->addToSelection( lnk); 647 d->selectedFiles->addToSelection( lnk);
639 writeCurrentM3u(); 648 writeCurrentM3u();
640 d->selectedFiles->setSelectedItem( lnk.name()); 649 d->selectedFiles->setSelectedItem( lnk.name());
641 } 650 }
642 } 651 }
643 652
644 653
645 delete fileDlg; 654 delete fileDlg;
646} 655}
647 656
648 657
649void PlayListWidget::openFile() { 658void PlayListWidget::openFile() {
650 659
651 QString filename, name; 660 QString filename, name;
652 661
653 Config cfg( "OpiePlayer" ); 662 Config cfg( "OpiePlayer" );
654 cfg.setGroup("Dialog"); 663 cfg.setGroup("Dialog");
655 MimeTypes types; 664 MimeTypes types;
656 QStringList audio, video, all; 665 QStringList audio, video, all;
657 audio << "audio/*"; 666 audio << "audio/*";
658 audio << "playlist/plain"; 667 audio << "playlist/plain";
659 audio << "application/ogg"; 668 audio << "application/ogg";
660 audio << "audio/x-mpegurl"; 669 audio << "audio/x-mpegurl";
661 670
662 video << "video/*"; 671 video << "video/*";
663 video << "playlist/plain"; 672 video << "playlist/plain";
664 673
@@ -816,219 +825,219 @@ void PlayListWidget::writem3u() {
816 825
817 if( d->selectedFiles->first()) { //ramble through playlist view 826 if( d->selectedFiles->first()) { //ramble through playlist view
818 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); 827 m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate);
819 828
820 do { 829 do {
821 m3uList->add( d->selectedFiles->current()->file()); 830 m3uList->add( d->selectedFiles->current()->file());
822 } 831 }
823 while ( d->selectedFiles->next() ); 832 while ( d->selectedFiles->next() );
824 // qDebug( list ); 833 // qDebug( list );
825 m3uList->write(); 834 m3uList->write();
826 m3uList->close(); 835 m3uList->close();
827 delete m3uList; 836 delete m3uList;
828 837
829 //delete fileDlg; 838 //delete fileDlg;
830 839
831 DocLnk lnk; 840 DocLnk lnk;
832 lnk.setFile( filename); 841 lnk.setFile( filename);
833 lnk.setIcon("opieplayer2/playlist2"); 842 lnk.setIcon("opieplayer2/playlist2");
834 lnk.setName( name); //sets file name 843 lnk.setName( name); //sets file name
835 844
836 // qDebug(filename); 845 // qDebug(filename);
837 Config config( "OpiePlayer" ); 846 Config config( "OpiePlayer" );
838 config.setGroup( "PlayList" ); 847 config.setGroup( "PlayList" );
839 848
840 config.writeEntry("CurrentPlaylist",filename); 849 config.writeEntry("CurrentPlaylist",filename);
841 currentPlayList=filename; 850 currentPlayList=filename;
842 851
843 if(!lnk.writeLink()) { 852 if(!lnk.writeLink()) {
844 qDebug("Writing doclink did not work"); 853 qDebug("Writing doclink did not work");
845 } 854 }
846 855
847 setCaption(tr("OpiePlayer: ") + name); 856 setCaption(tr("OpiePlayer: ") + name);
848 } 857 }
849 } 858 }
850} 859}
851 860
852void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 861void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
853 switch ( e->key() ) { 862 switch ( e->key() ) {
854 ////////////////////////////// Zaurus keys 863 ////////////////////////////// Zaurus keys
855 case Key_F9: //activity 864 case Key_F9: //activity
856 // if(audioUI->isHidden()) 865 // if(audioUI->isHidden())
857 // audioUI->showMaximized(); 866 // audioUI->showMaximized();
858 break; 867 break;
859 case Key_F10: //contacts 868 case Key_F10: //contacts
860 // if( videoUI->isHidden()) 869 // if( videoUI->isHidden())
861 // videoUI->showMaximized(); 870 // videoUI->showMaximized();
862 break; 871 break;
863 case Key_F11: //menu 872 case Key_F11: //menu
864 break; 873 break;
865 case Key_F12: //home 874 case Key_F12: //home
866 // doBlank(); 875 // doBlank();
867 break; 876 break;
868 case Key_F13: //mail 877 case Key_F13: //mail
869 // doUnblank(); 878 // doUnblank();
870 break; 879 break;
871 case Key_Q: //add to playlist 880 case Key_Q: //add to playlist
872 addSelected(); 881 addSelected();
873 break; 882 break;
874 case Key_R: //remove from playlist 883 case Key_R: //remove from playlist
875 removeSelected(); 884 removeSelected();
876 break; 885 break;
877 // case Key_P: //play 886 // case Key_P: //play
878 // qDebug("Play"); 887 // qDebug("Play");
879 // playSelected(); 888 // playSelected();
880 // break; 889 // break;
881 case Key_Space: 890 case Key_Space:
882 // playSelected(); puh 891 // playSelected(); puh
883 break; 892 break;
884 case Key_1: 893 case Key_1:
885 tabWidget->setCurrentPage( 0 ); 894 tabWidget->setCurrentPage( 0 );
886 break; 895 break;
887 case Key_2: 896 case Key_2:
888 tabWidget->setCurrentPage( 1 ); 897 tabWidget->setCurrentPage( 1 );
889 break; 898 break;
890 case Key_3: 899 case Key_3:
891 tabWidget->setCurrentPage( 2 ); 900 tabWidget->setCurrentPage( 2 );
892 break; 901 break;
893 case Key_4: 902 case Key_4:
894 tabWidget->setCurrentPage( 3 ); 903 tabWidget->setCurrentPage( 3 );
895 break; 904 break;
896 case Key_Down: 905 case Key_Down:
897 if ( !d->selectedFiles->next() ) 906 if ( !d->selectedFiles->next() )
898 d->selectedFiles->first(); 907 d->selectedFiles->first();
899 break; 908 break;
900 case Key_Up: 909 case Key_Up:
901 if ( !d->selectedFiles->prev() ) 910 if ( !d->selectedFiles->prev() )
902 // d->selectedFiles->last(); 911 // d->selectedFiles->last();
903 break; 912 break;
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
922void PlayListWidget::populateSkinsMenu() { 931void PlayListWidget::populateSkinsMenu() {
923 int item = 0; 932 int item = 0;
924 defaultSkinIndex = 0; 933 defaultSkinIndex = 0;
925 QString skinName; 934 QString skinName;
926 Config cfg( "OpiePlayer" ); 935 Config cfg( "OpiePlayer" );
927 cfg.setGroup("Options" ); 936 cfg.setGroup("Options" );
928 QString skin = cfg.readEntry( "Skin", "default" ); 937 QString skin = cfg.readEntry( "Skin", "default" );
929 938
930 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 939 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
931 skinsDir.setFilter( QDir::Dirs ); 940 skinsDir.setFilter( QDir::Dirs );
932 skinsDir.setSorting(QDir::Name ); 941 skinsDir.setSorting(QDir::Name );
933 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 942 const QFileInfoList *skinslist = skinsDir.entryInfoList();
934 QFileInfoListIterator it( *skinslist ); 943 QFileInfoListIterator it( *skinslist );
935 QFileInfo *fi; 944 QFileInfo *fi;
936 while ( ( fi = it.current() ) ) { 945 while ( ( fi = it.current() ) ) {
937 skinName = fi->fileName(); 946 skinName = fi->fileName();
938// qDebug( fi->fileName() ); 947// qDebug( fi->fileName() );
939 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 948 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
940 item = skinsMenu->insertItem( fi->fileName() ) ; 949 item = skinsMenu->insertItem( fi->fileName() ) ;
941 } 950 }
942 if( skinName == "default" ) { 951 if( skinName == "default" ) {
943 defaultSkinIndex = item; 952 defaultSkinIndex = item;
944 } 953 }
945 if( skinName == skin ) { 954 if( skinName == skin ) {
946 skinsMenu->setItemChecked( item, TRUE ); 955 skinsMenu->setItemChecked( item, TRUE );
947 } 956 }
948 ++it; 957 ++it;
949 } 958 }
950} 959}
951 960
952void PlayListWidget::skinsMenuActivated( int item ) { 961void PlayListWidget::skinsMenuActivated( int item ) {
953 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 962 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
954 skinsMenu->setItemChecked( i, FALSE ); 963 skinsMenu->setItemChecked( i, FALSE );
955 } 964 }
956 skinsMenu->setItemChecked( item, TRUE ); 965 skinsMenu->setItemChecked( item, TRUE );
957 966
958 { 967 {
959 Config cfg( "OpiePlayer" ); 968 Config cfg( "OpiePlayer" );
960 cfg.setGroup("Options"); 969 cfg.setGroup("Options");
961 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 970 cfg.writeEntry("Skin", skinsMenu->text( item ) );
962 } 971 }
963 972
964 emit skinSelected(); 973 emit skinSelected();
965} 974}
966 975
967PlayListWidget::TabType PlayListWidget::currentTab() const 976PlayListWidget::TabType PlayListWidget::currentTab() const
968{ 977{
969 static const TabType indexToTabType[ TabTypeCount ] = 978 static const TabType indexToTabType[ TabTypeCount ] =
970 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 979 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
971 980
972 int index = tabWidget->currentPageIndex(); 981 int index = tabWidget->currentPageIndex();
973 assert( index < TabTypeCount && index >= 0 ); 982 assert( index < TabTypeCount && index >= 0 );
974 983
975 return indexToTabType[ index ]; 984 return indexToTabType[ index ];
976} 985}
977 986
978PlayListWidget::Entry PlayListWidget::currentEntry() const 987PlayListWidget::Entry PlayListWidget::currentEntry() const
979{ 988{
980 if ( currentTab() == CurrentPlayList ) { 989 if ( currentTab() == CurrentPlayList ) {
981 const DocLnk *lnk = current(); 990 const DocLnk *lnk = current();
982 return Entry( lnk->name(), lnk->file() ); 991 return Entry( lnk->name(), lnk->file() );
983 } 992 }
984 993
985 return Entry( currentFileListPathName() ); 994 return Entry( currentFileListPathName() );
986} 995}
987 996
988QString PlayListWidget::currentFileListPathName() const { 997QString PlayListWidget::currentFileListPathName() const {
989 return currentFileListView->currentItem()->text( 3 ); 998 return currentFileListView->currentItem()->text( 3 );
990} 999}
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;
1018 stream >> file; 1027 stream >> file;
1019 setDocument( (const QString &) file); 1028 setDocument( (const QString &) file);
1020 } else if ( msg == "add(QString)" ) { //add to playlist 1029 } else if ( msg == "add(QString)" ) { //add to playlist
1021 QString file; 1030 QString file;
1022 stream >> file; 1031 stream >> file;
1023 QFileInfo fileInfo(file); 1032 QFileInfo fileInfo(file);
1024 DocLnk lnk; 1033 DocLnk lnk;
1025 lnk.setName( fileInfo.baseName() ); //sets name 1034 lnk.setName( fileInfo.baseName() ); //sets name
1026 lnk.setFile( file ); //sets file name 1035 lnk.setFile( file ); //sets file name
1027 addToSelection( lnk ); 1036 addToSelection( lnk );
1028 } else if ( msg == "rem(QString)" ) { //remove from playlist 1037 } else if ( msg == "rem(QString)" ) { //remove from playlist
1029 QString file; 1038 QString file;
1030 stream >> file; 1039 stream >> file;
1031 1040
1032 } 1041 }
1033 1042
1034} 1043}
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
@@ -1,138 +1,143 @@
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,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
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           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = 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#ifndef PLAY_LIST_WIDGET_H 34#ifndef PLAY_LIST_WIDGET_H
35#define PLAY_LIST_WIDGET_H 35#define PLAY_LIST_WIDGET_H
36 36
37 37
38#include <qpushbutton.h> 38#include <qpushbutton.h>
39#include <qpopupmenu.h> 39#include <qpopupmenu.h>
40#include <qpe/qcopenvelope_qws.h> 40#include <qpe/qcopenvelope_qws.h>
41 41
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
58 { 60 {
59 Entry( const QString &_name, const QString &_fileName ) 61 Entry( const QString &_name, const QString &_fileName )
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;
77 80
78public slots: 81public slots:
79 bool first(); 82 bool first();
80 bool last(); 83 bool last();
81 bool next(); 84 bool next();
82 bool prev(); 85 bool prev();
83 void writeDefaultPlaylist( ); 86 void writeDefaultPlaylist( );
84 QString currentFileListPathName() const; 87 QString currentFileListPathName() const;
85protected: 88protected:
86 QCopChannel * channel; 89 QCopChannel * channel;
87 void keyReleaseEvent( QKeyEvent *e); 90 void keyReleaseEvent( QKeyEvent *e);
88 91
89signals: 92signals:
90 void skinSelected(); 93 void skinSelected();
91 94
92private: 95private:
93 int defaultSkinIndex; 96 int defaultSkinIndex;
94/* void readm3u(const QString &); */ 97/* void readm3u(const QString &); */
95/* void readPls(const QString &); */ 98/* void readPls(const QString &); */
96 void readListFromFile(const QString &); 99 void readListFromFile(const QString &);
97 void initializeStates(); 100 void initializeStates();
98 101
99 bool inFileListMode() const; 102 bool inFileListMode() const;
100 103
101private slots: 104private slots:
102 void qcopReceive(const QCString&, const QByteArray&); 105 void qcopReceive(const QCString&, const QByteArray&);
103 void populateSkinsMenu(); 106 void populateSkinsMenu();
104 void skinsMenuActivated(int); 107 void skinsMenuActivated(int);
105 void pmViewActivated(int); 108 void pmViewActivated(int);
106 void writem3u(); 109 void writem3u();
107 void writeCurrentM3u(); 110 void writeCurrentM3u();
108 void openFile(); 111 void openFile();
109 void openURL(); 112 void openURL();
110 void setDocument( const QString& fileref ); 113 void setDocument( const QString& fileref );
111 void addToSelection( const DocLnk& ); // Add a media file to the playlist 114 void addToSelection( const DocLnk& ); // Add a media file to the playlist
112 void addToSelection( QListViewItem* ); // Add a media file to the playlist 115 void addToSelection( QListViewItem* ); // Add a media file to the playlist
113 void clearList(); 116 void clearList();
114 void addAllToList(); 117 void addAllToList();
115 void addAllMusicToList(); 118 void addAllMusicToList();
116 void addAllVideoToList(); 119 void addAllVideoToList();
117 void saveList(); // Save the playlist 120 void saveList(); // Save the playlist
118 void loadList( const DocLnk &); // Load a playlist 121 void loadList( const DocLnk &); // Load a playlist
119 void playIt( QListViewItem *); 122 void playIt( QListViewItem *);
120 void btnPlay(bool); 123 void btnPlay(bool);
121 void deletePlaylist(); 124 void deletePlaylist();
122 void addSelected(); 125 void addSelected();
123 void removeSelected(); 126 void removeSelected();
124 void tabChanged(QWidget*); 127 void tabChanged(QWidget*);
125 void viewPressed( int, QListViewItem *, const QPoint&, int); 128 void viewPressed( int, QListViewItem *, const QPoint&, int);
126 void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 129 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
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
@@ -1,194 +1,194 @@
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 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
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           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = 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 34
35#include <qtoolbar.h> 35#include <qtoolbar.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37 37
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qmenubar.h> 39#include <qmenubar.h>
40 40
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
59 QToolBar *toolbar = new QToolBar( this ); 59 QToolBar *toolbar = new QToolBar( this );
60 toolbar->setHorizontalStretchable( TRUE ); 60 toolbar->setHorizontalStretchable( TRUE );
61 61
62 // Create Menubar 62 // Create Menubar
63 QMenuBar *menu = new QMenuBar( toolbar ); 63 QMenuBar *menu = new QMenuBar( toolbar );
64 menu->setMargin( 0 ); 64 menu->setMargin( 0 );
65 65
66 bar = new QToolBar( this ); 66 bar = new QToolBar( this );
67 bar->setLabel( tr( "Play Operations" ) ); 67 bar->setLabel( tr( "Play Operations" ) );
68 68
69 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); 69 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" );
70 tbDeletePlaylist->setFlat( TRUE ); 70 tbDeletePlaylist->setFlat( TRUE );
71 tbDeletePlaylist->setFixedSize( 20, 20 ); 71 tbDeletePlaylist->setFixedSize( 20, 20 );
72 72
73 tbDeletePlaylist->hide(); 73 tbDeletePlaylist->hide();
74 74
75 pmPlayList = new QPopupMenu( this ); 75 pmPlayList = new QPopupMenu( this );
76 menu->insertItem( tr( "File" ), pmPlayList ); 76 menu->insertItem( tr( "File" ), pmPlayList );
77 77
78 pmView = new QPopupMenu( this ); 78 pmView = new QPopupMenu( this );
79 menu->insertItem( tr( "View" ), pmView ); 79 menu->insertItem( tr( "View" ), pmView );
80 pmView->isCheckable(); 80 pmView->isCheckable();
81 81
82 skinsMenu = new QPopupMenu( this ); 82 skinsMenu = new QPopupMenu( this );
83 pmView->insertItem( tr( "Skins" ), skinsMenu ); 83 pmView->insertItem( tr( "Skins" ), skinsMenu );
84 skinsMenu->isCheckable(); 84 skinsMenu->isCheckable();
85 85
86 gammaMenu = new QPopupMenu( this ); 86 gammaMenu = new QPopupMenu( this );
87 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); 87 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu );
88 88
89 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); 89 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
90 gammaSlider->setRange( -40, 40 ); 90 gammaSlider->setRange( -40, 40 );
91 gammaSlider->setTickmarks( QSlider::Left ); 91 gammaSlider->setTickmarks( QSlider::Left );
92 gammaSlider->setTickInterval( 20 ); 92 gammaSlider->setTickInterval( 20 );
93 gammaSlider->setFocusPolicy( QWidget::StrongFocus ); 93 gammaSlider->setFocusPolicy( QWidget::StrongFocus );
94 gammaSlider->setValue( 0 ); 94 gammaSlider->setValue( 0 );
95 gammaSlider->setMinimumHeight( 50 ); 95 gammaSlider->setMinimumHeight( 50 );
96 96
97 gammaLCD = new QLCDNumber( 3, gammaMenu ); 97 gammaLCD = new QLCDNumber( 3, gammaMenu );
98 gammaLCD-> setFrameShape ( QFrame::NoFrame ); 98 gammaLCD-> setFrameShape ( QFrame::NoFrame );
99 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); 99 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
100 100
101 gammaMenu->insertItem( gammaSlider ); 101 gammaMenu->insertItem( gammaSlider );
102 gammaMenu->insertItem( gammaLCD ); 102 gammaMenu->insertItem( gammaLCD );
103 103
104 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); 104 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) );
105 105
106 vbox5 = new QVBox( this ); 106 vbox5 = new QVBox( this );
107 QVBox *vbox4 = new QVBox( vbox5 ); 107 QVBox *vbox4 = new QVBox( vbox5 );
108 QHBox *hbox6 = new QHBox( vbox4 ); 108 QHBox *hbox6 = new QHBox( vbox4 );
109 109
110 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 110 tabWidget = new QTabWidget( hbox6, "tabWidget" );
111 111
112 playListTab = new QWidget( tabWidget, "PlayListTab" ); 112 playListTab = new QWidget( tabWidget, "PlayListTab" );
113 tabWidget->insertTab( playListTab, "Playlist"); 113 tabWidget->insertTab( playListTab, "Playlist");
114 114
115 QGridLayout *Playout = new QGridLayout( playListTab ); 115 QGridLayout *Playout = new QGridLayout( playListTab );
116 Playout->setSpacing( 2); 116 Playout->setSpacing( 2);
117 Playout->setMargin( 2); 117 Playout->setMargin( 2);
118 118
119 // Add the playlist area 119 // Add the playlist area
120 QVBox *vbox3 = new QVBox( playListTab ); 120 QVBox *vbox3 = new QVBox( playListTab );
121 d->playListFrame = vbox3; 121 d->playListFrame = vbox3;
122 122
123 QHBox *hbox2 = new QHBox( vbox3 ); 123 QHBox *hbox2 = new QHBox( vbox3 );
124 d->selectedFiles = new PlayListSelection( hbox2 ); 124 d->selectedFiles = new PlayListSelection( hbox2 );
125 125
126 vbox1 = new QVBox( hbox2 ); 126 vbox1 = new QVBox( hbox2 );
127 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 127 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
128 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 128 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
129 129
130 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 130 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
131 131
132 QWidget *aTab; 132 QWidget *aTab;
133 aTab = new QWidget( tabWidget, "aTab" ); 133 aTab = new QWidget( tabWidget, "aTab" );
134 134
135 QGridLayout *Alayout = new QGridLayout( aTab ); 135 QGridLayout *Alayout = new QGridLayout( aTab );
136 Alayout->setSpacing( 2 ); 136 Alayout->setSpacing( 2 );
137 Alayout->setMargin( 2 ); 137 Alayout->setMargin( 2 );
138 // no m3u's here please 138 // no m3u's here please
139 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" ); 139 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" );
140 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 140 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
141 tabWidget->insertTab( aTab, tr( "Audio" ) ); 141 tabWidget->insertTab( aTab, tr( "Audio" ) );
142 142
143 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 143 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
144 144
145 QWidget *vTab; 145 QWidget *vTab;
146 vTab = new QWidget( tabWidget, "vTab" ); 146 vTab = new QWidget( tabWidget, "vTab" );
147 147
148 QGridLayout *Vlayout = new QGridLayout( vTab ); 148 QGridLayout *Vlayout = new QGridLayout( vTab );
149 Vlayout->setSpacing( 2 ); 149 Vlayout->setSpacing( 2 );
150 Vlayout->setMargin( 2 ); 150 Vlayout->setMargin( 2 );
151 videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" ); 151 videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" );
152 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 152 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
153 153
154 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); 154 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
155 155
156 tabWidget->insertTab( vTab, tr( "Video" ) ); 156 tabWidget->insertTab( vTab, tr( "Video" ) );
157 157
158 //playlists list 158 //playlists list
159 QWidget *LTab; 159 QWidget *LTab;
160 LTab = new QWidget( tabWidget, "LTab" ); 160 LTab = new QWidget( tabWidget, "LTab" );
161 QGridLayout *Llayout = new QGridLayout( LTab ); 161 QGridLayout *Llayout = new QGridLayout( LTab );
162 Llayout->setSpacing( 2 ); 162 Llayout->setSpacing( 2 );
163 Llayout->setMargin( 2 ); 163 Llayout->setMargin( 2 );
164 164
165 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); 165 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
166 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 166 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
167 167
168 tabWidget->insertTab( LTab, tr( "Lists" ) ); 168 tabWidget->insertTab( LTab, tr( "Lists" ) );
169 169
170 setCentralWidget( vbox5 ); 170 setCentralWidget( vbox5 );
171} 171}
172 172
173 173
174 174
175PlayListWidgetGui::~PlayListWidgetGui() { 175PlayListWidgetGui::~PlayListWidgetGui() {
176} 176}
177 177
178void PlayListWidgetGui::setView( char view ) { 178void PlayListWidgetGui::setView( char view ) {
179 if ( view == 'l' ) 179 if ( view == 'l' )
180 showMaximized(); 180 showMaximized();
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
@@ -1,129 +1,129 @@
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 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
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           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = 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#ifndef PLAY_LIST_WIDGET_GUI_H 34#ifndef PLAY_LIST_WIDGET_GUI_H
35#define PLAY_LIST_WIDGET_GUI_H 35#define PLAY_LIST_WIDGET_GUI_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39 39
40#include <qtabwidget.h> 40#include <qtabwidget.h>
41#include <qpe/fileselector.h> 41#include <qpe/fileselector.h>
42#include <qaction.h> 42#include <qaction.h>
43#include <qtoolbutton.h> 43#include <qtoolbutton.h>
44#include <qslider.h> 44#include <qslider.h>
45#include <qlcdnumber.h> 45#include <qlcdnumber.h>
46 46
47class PlayListWidgetPrivate; 47class PlayListWidgetPrivate;
48class PlayListSelection; 48class PlayListSelection;
49class MediaPlayerState; 49class MediaPlayerState;
50class PlayListFileView; 50class PlayListFileView;
51 51
52class Config; 52class Config;
53class QToolBar; 53class QToolBar;
54class QListViewItem; 54class QListViewItem;
55class QListView; 55class QListView;
56class QPoint; 56class QPoint;
57class QAction; 57class QAction;
58class QLabel; 58class QLabel;
59 59
60class PlayListWidgetPrivate { 60class PlayListWidgetPrivate {
61public: 61public:
62 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 62 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
63 QFrame *playListFrame; 63 QFrame *playListFrame;
64 PlayListSelection *selectedFiles; 64 PlayListSelection *selectedFiles;
65 bool setDocumentUsed; 65 bool setDocumentUsed;
66}; 66};
67 67
68 68
69class ToolButton : public QToolButton { 69class ToolButton : public QToolButton {
70 Q_OBJECT 70 Q_OBJECT
71public: 71public:
72 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 72 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
73 : QToolButton( parent, name ) { 73 : QToolButton( parent, name ) {
74 setTextLabel( name ); 74 setTextLabel( name );
75 setPixmap( Resource::loadPixmap( icon ) ); 75 setPixmap( Resource::loadPixmap( icon ) );
76 setAutoRaise( TRUE ); 76 setAutoRaise( TRUE );
77 setFocusPolicy( QWidget::NoFocus ); 77 setFocusPolicy( QWidget::NoFocus );
78 setToggleButton( t ); 78 setToggleButton( t );
79 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 79 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
80 } 80 }
81}; 81};
82 82
83class MenuItem : public QAction { 83class MenuItem : public QAction {
84 84
85public: 85public:
86 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 86 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
87 : QAction( text, QString::null, 0, 0 ) { 87 : QAction( text, QString::null, 0, 0 ) {
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 ;
105 QPopupMenu *gammaMenu; 105 QPopupMenu *gammaMenu;
106 QSlider *gammaSlider; 106 QSlider *gammaSlider;
107 QLCDNumber *gammaLCD; 107 QLCDNumber *gammaLCD;
108 bool fromSetDocument; 108 bool fromSetDocument;
109 bool insanityBool; 109 bool insanityBool;
110 QString setDocFileRef; 110 QString setDocFileRef;
111 // retrieve the current playlist entry (media file link) 111 // retrieve the current playlist entry (media file link)
112 QPushButton *tbDeletePlaylist; 112 QPushButton *tbDeletePlaylist;
113 int selected; 113 int selected;
114 QPopupMenu *pmPlayList; 114 QPopupMenu *pmPlayList;
115 FileSelector* playLists; 115 FileSelector* playLists;
116 QPopupMenu *skinsMenu; 116 QPopupMenu *skinsMenu;
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