-rw-r--r-- | noncore/multimedia/opieplayer2/config.in | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/main.cpp | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opie-mediaplayer2.control | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opieplayer2.pro | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 69 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.h | 4 |
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,33 +1,33 @@ | |||
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 | ||
@@ -58,65 +58,65 @@ extern "C" { | |||
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 | ||
69 | using namespace XINE; | 69 | using namespace XINE; |
70 | 70 | ||
71 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | 71 | Lib::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 | ||
108 | void Lib::run() | 108 | void 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 | ||
116 | void Lib::initialize() | 116 | void 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 ) ); |
@@ -241,65 +241,65 @@ void Lib::setSpeed( int speed ) { | |||
241 | int Lib::status() const { | 241 | int 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 | ||
247 | int Lib::currentPosition() const { | 247 | int 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 | ||
255 | int Lib::currentTime() const { | 255 | int 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 | ||
267 | int Lib::length() const { | 267 | int 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 |
286 | valid stream, then return -1 (this value could be used to make the stream | 286 | valid stream, then return -1 (this value could be used to make the stream |
287 | unseekable, but it should never occur!! Mr. Murphy ? :) ) */ | 287 | unseekable, but it should never occur!! Mr. Murphy ? :) ) */ |
288 | 288 | ||
289 | return -1; | 289 | return -1; |
290 | } | 290 | } |
291 | 291 | ||
292 | bool Lib::isSeekable() const { | 292 | bool 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 | ||
298 | void Lib::seekTo( int time ) { | 298 | void 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 | ||
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 | |||
11 | OPIE_EXPORT_APP( OApplicationFactory<PlayListWidget> ) | ||
12 | |||
13 | #if 0 | ||
7 | int main(int argc, char **argv) { | 14 | int 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 | |||
@@ -254,65 +254,64 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
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 | ||
285 | void MediaPlayer::blank( bool b ) { | 285 | void 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 | } |
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,62 +1,60 @@ | |||
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 | |||
31 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 29 | MediaWidget::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 | ||
44 | MediaWidget::~MediaWidget() | 42 | MediaWidget::~MediaWidget() |
45 | { | 43 | { |
46 | } | 44 | } |
47 | 45 | ||
48 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 46 | void 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 | ||
62 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) | 60 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) |
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 @@ | |||
1 | Package: opie-mediaplayer2 | 1 | Package: opie-mediaplayer2 |
2 | Files: 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 | 2 | Files: 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 |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org> | 5 | Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, libopie1, zlib1g, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs | 7 | Depends: task-opie-minimal, libopie1, zlib1g, libstdc++2.10-glibc2.2, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs |
8 | Description: The Opie media player II | 8 | Description: 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. |
11 | Version: $QPE_VERSION$EXTRAVERSION | 11 | Version: $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 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \ | 2 | HEADERS = 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 |
9 | SOURCES = main.cpp \ | 7 | SOURCES = 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 |
17 | TARGET = opieplayer2 | 15 | TARGET = opieplayer2 |
18 | INCLUDEPATH += $(OPIEDIR)/include | 16 | INCLUDEPATH += $(OPIEDIR)/include |
19 | DEPENDPATH += $(OPIEDIR)/include | 17 | DEPENDPATH += $(OPIEDIR)/include |
20 | LIBS += -lqpe -lpthread -lopie -lxine -lstdc++ | 18 | LIBS += -lqpe -lpthread -lopie -lxine -lstdc++ |
21 | MOC_DIR = qpeobj | 19 | MOC_DIR = qpeobj |
22 | OBJECTS_DIR = qpeobj | 20 | OBJECTS_DIR = qpeobj |
23 | 21 | ||
24 | #INCLUDEPATH += $(OPIEDIR)/include | ||
25 | #DEPENDPATH += $(OPIEDIR)/include | ||
26 | |||
27 | |||
28 | |||
29 | TRANSLATIONS = ../../../i18n/de/opieplayer2.ts \ | 22 | TRANSLATIONS = ../../../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 | ||
48 | include ( $(OPIEDIR)/include.pro ) | 41 | include ( $(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 | |||
@@ -10,187 +10,196 @@ | |||
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 | ||
50 | PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 51 | PlayListWidget::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 | ||
156 | PlayListWidget::~PlayListWidget() { | 164 | PlayListWidget::~PlayListWidget() { |
157 | delete d; | 165 | delete d; |
166 | delete m_mp; | ||
158 | } | 167 | } |
159 | 168 | ||
160 | 169 | ||
161 | void PlayListWidget::initializeStates() { | 170 | void 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 | ||
168 | void PlayListWidget::writeDefaultPlaylist() { | 177 | void 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 | ||
193 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 202 | void 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" ) { |
@@ -312,121 +321,121 @@ void PlayListWidget::addAllVideoToList() { | |||
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 | ||
318 | void PlayListWidget::setDocument( const QString& fileref ) { | 327 | void 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 | ||
350 | void PlayListWidget::useSelectedDocument() { | 359 | void PlayListWidget::useSelectedDocument() { |
351 | d->setDocumentUsed = FALSE; | 360 | d->setDocumentUsed = FALSE; |
352 | } | 361 | } |
353 | 362 | ||
354 | 363 | ||
355 | const DocLnk *PlayListWidget::current() const { // this is fugly | 364 | const 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 | ||
368 | bool PlayListWidget::prev() { | 377 | bool 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 | ||
394 | bool PlayListWidget::next() { | 403 | bool 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 | ||
411 | bool PlayListWidget::first() { | 420 | bool PlayListWidget::first() { |
412 | return d->selectedFiles->first(); | 421 | return d->selectedFiles->first(); |
413 | } | 422 | } |
414 | 423 | ||
415 | 424 | ||
416 | bool PlayListWidget::last() { | 425 | bool 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 | ||
426 | void PlayListWidget::loadList( const DocLnk & lnk) { | 435 | void 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()); |
@@ -434,66 +443,66 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
434 | } | 443 | } |
435 | } | 444 | } |
436 | 445 | ||
437 | void PlayListWidget::addSelected() { | 446 | void 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 | ||
458 | void PlayListWidget::removeSelected() { | 467 | void PlayListWidget::removeSelected() { |
459 | d->selectedFiles->removeSelected( ); | 468 | d->selectedFiles->removeSelected( ); |
460 | writeCurrentM3u(); | 469 | writeCurrentM3u(); |
461 | } | 470 | } |
462 | 471 | ||
463 | 472 | ||
464 | void PlayListWidget::playIt( QListViewItem *it) { | 473 | void 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 | ||
472 | void PlayListWidget::addToSelection( QListViewItem *it) { | 481 | void 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 | ||
493 | void PlayListWidget::tabChanged(QWidget *) { | 502 | void 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 ) ), |
@@ -536,65 +545,65 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
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 | ||
566 | void PlayListWidget::btnPlay(bool b) { | 575 | void 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 | ||
572 | void PlayListWidget::deletePlaylist() { | 581 | void 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 | ||
587 | void PlayListWidget::playSelected() { | 596 | void PlayListWidget::playSelected() { |
588 | btnPlay( TRUE); | 597 | btnPlay( TRUE); |
589 | } | 598 | } |
590 | 599 | ||
591 | bool PlayListWidget::inFileListMode() const | 600 | bool 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 | ||
597 | void PlayListWidget::openURL() { | 606 | void 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; |
@@ -880,66 +889,66 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | |||
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 | ||
907 | void PlayListWidget::pmViewActivated(int index) { | 916 | void 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 | ||
922 | void PlayListWidget::populateSkinsMenu() { | 931 | void 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 ) { |
@@ -967,68 +976,68 @@ void PlayListWidget::skinsMenuActivated( int item ) { | |||
967 | PlayListWidget::TabType PlayListWidget::currentTab() const | 976 | PlayListWidget::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 | ||
978 | PlayListWidget::Entry PlayListWidget::currentEntry() const | 987 | PlayListWidget::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 | ||
988 | QString PlayListWidget::currentFileListPathName() const { | 997 | QString PlayListWidget::currentFileListPathName() const { |
989 | return currentFileListView->currentItem()->text( 3 ); | 998 | return currentFileListView->currentItem()->text( 3 ); |
990 | } | 999 | } |
991 | 1000 | ||
992 | 1001 | ||
993 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { | 1002 | void 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 | |||
@@ -18,83 +18,86 @@ | |||
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 | ||
44 | class Config; | 44 | class Config; |
45 | class QListViewItem; | 45 | class QListViewItem; |
46 | class QListView; | 46 | class QListView; |
47 | class QPoint; | 47 | class QPoint; |
48 | class QAction; | 48 | class QAction; |
49 | class QLabel; | 49 | class QLabel; |
50 | class MediaPlayerState; | ||
51 | class MediaPlayer; | ||
50 | 52 | ||
51 | class PlayListWidget : public PlayListWidgetGui { | 53 | class PlayListWidget : public PlayListWidgetGui { |
52 | Q_OBJECT | 54 | Q_OBJECT |
53 | public: | 55 | public: |
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 | ||
78 | public slots: | 81 | public 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; |
85 | protected: | 88 | protected: |
86 | QCopChannel * channel; | 89 | QCopChannel * channel; |
87 | void keyReleaseEvent( QKeyEvent *e); | 90 | void keyReleaseEvent( QKeyEvent *e); |
88 | 91 | ||
89 | signals: | 92 | signals: |
90 | void skinSelected(); | 93 | void skinSelected(); |
91 | 94 | ||
92 | private: | 95 | private: |
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 | ||
@@ -103,36 +106,38 @@ private slots: | |||
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 | ||
129 | private: | 132 | private: |
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 | |||
@@ -17,66 +17,66 @@ | |||
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 | ||
49 | PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name ) | 49 | PlayListWidgetGui::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 ); |
@@ -157,38 +157,38 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg | |||
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 | ||
175 | PlayListWidgetGui::~PlayListWidgetGui() { | 175 | PlayListWidgetGui::~PlayListWidgetGui() { |
176 | } | 176 | } |
177 | 177 | ||
178 | void PlayListWidgetGui::setView( char view ) { | 178 | void 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 | ||
186 | void PlayListWidgetGui::setActiveWindow() { | 186 | void 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 | |||
@@ -64,66 +64,66 @@ public: | |||
64 | PlayListSelection *selectedFiles; | 64 | PlayListSelection *selectedFiles; |
65 | bool setDocumentUsed; | 65 | bool setDocumentUsed; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | 68 | ||
69 | class ToolButton : public QToolButton { | 69 | class ToolButton : public QToolButton { |
70 | Q_OBJECT | 70 | Q_OBJECT |
71 | public: | 71 | public: |
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 | ||
83 | class MenuItem : public QAction { | 83 | class MenuItem : public QAction { |
84 | 84 | ||
85 | public: | 85 | public: |
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 | ||
93 | class PlayListWidgetGui : public QMainWindow { | 93 | class PlayListWidgetGui : public QMainWindow { |
94 | Q_OBJECT | 94 | Q_OBJECT |
95 | public: | 95 | public: |
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 | ||
99 | protected: | 99 | protected: |
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 | ||